Add winery source code
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.common / src / main / java / org / eclipse / winery / common / propertydefinitionkv / WinerysPropertiesDefinition.java
1 /*******************************************************************************
2  * Copyright (c) 2013 University of Stuttgart.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * and the Apache License 2.0 which both accompany this distribution,
6  * and are available at http://www.eclipse.org/legal/epl-v10.html
7  * and http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Contributors:
10  *     Oliver Kopp - initial API and implementation
11  *******************************************************************************/
12 package org.eclipse.winery.common.propertydefinitionkv;
13
14 import javax.xml.bind.annotation.XmlAttribute;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17
18 import org.eclipse.winery.common.constants.Namespaces;
19
20 /**
21  * This is Winery's main extension element for a key/value based properties
22  * definition
23  */
24 @XmlRootElement(name = "PropertiesDefinition")
25 public class WinerysPropertiesDefinition {
26         
27         private String namespace;
28         private String elementName;
29         private PropertyDefinitionKVList propertyDefinitionKVList;
30         private Boolean isDerivedFromXSD = Boolean.FALSE;
31         
32         
33         @XmlAttribute(name = "namespace")
34         public String getNamespace() {
35                 return this.namespace;
36         }
37         
38         public void setNamespace(String namespace) {
39                 this.namespace = namespace;
40         }
41         
42         @XmlAttribute(name = "elementname")
43         public String getElementName() {
44                 return this.elementName;
45         }
46         
47         public void setElementName(String localName) {
48                 this.elementName = localName;
49         }
50         
51         @XmlElement(name = "properties")
52         public PropertyDefinitionKVList getPropertyDefinitionKVList() {
53                 return this.propertyDefinitionKVList;
54         }
55         
56         public void setPropertyDefinitionKVList(PropertyDefinitionKVList propertyDefinitionKVList) {
57                 this.propertyDefinitionKVList = propertyDefinitionKVList;
58         }
59         
60         /**
61          * @return null if not derived from XSD, "Boolean.TRUE" otherwise. This
62          *         leads JAXB to write the attribute only if derivedFromXSD is true
63          */
64         @XmlAttribute(name = "derivedFromXSD", namespace = Namespaces.TOSCA_WINERY_EXTENSIONS_NAMESPACE)
65         public Boolean getIsDerivedFromXSD() {
66                 if ((this.isDerivedFromXSD != null) && (this.isDerivedFromXSD)) {
67                         return Boolean.TRUE;
68                 } else {
69                         return null;
70                 }
71         }
72         
73         public void setIsDerivedFromXSD(Boolean isDerivedFromXSD) {
74                 this.isDerivedFromXSD = isDerivedFromXSD;
75         }
76         
77 }