View Javadoc
1   package org.andromda.cartridges.xmlschema.metafacades;
2   
3   import org.andromda.cartridges.xmlschema.XmlSchemaProfile;
4   
5   /**
6    * MetafacadeLogic implementation for org.andromda.cartridges.xmlschema.metafacades.XSDAttribute.
7    *
8    * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute
9    */
10  public class XSDAttributeLogicImpl
11          extends XSDAttributeLogic
12  {
13      private static final long serialVersionUID = 34L;
14      // ---------------- constructor -------------------------------
15  
16      /**
17       * @param metaObject
18       * @param context
19       */
20      public XSDAttributeLogicImpl(Object metaObject, String context)
21      {
22          super(metaObject, context);
23      }
24  
25      /**
26       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttributeLogic#handleGetMaxOccurs()
27       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#getMaxOccurs()
28       */
29      protected String handleGetMaxOccurs()
30      {
31          String maxOccurs = null;
32          boolean isMany = this.isMany();
33          if (isMany)
34          {
35              maxOccurs = "unbounded";
36          }
37          else
38          {
39              maxOccurs = "1";
40          }
41          return maxOccurs;
42      }
43  
44      /**
45       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttributeLogic#handleGetMinOccurs()
46       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#getMinOccurs()
47       */
48      protected String handleGetMinOccurs()
49      {
50          String minOccurs = null;
51          boolean isRequired = this.isRequired();
52          if (isRequired)
53          {
54              minOccurs = "1";
55          }
56          else
57          {
58              minOccurs = "0";
59          }
60          return minOccurs;
61      }
62  
63      /**
64       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttributeLogic#handleIsXsdAttribute()
65       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isXsdAttribute()
66       */
67      protected boolean handleIsXsdAttribute()
68      {
69          return this.hasStereotype(XmlSchemaProfile.STEREOTYPE_XML_ATTRIBUTE);
70      }
71  
72      /**
73       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isXsdElement()
74       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttributeLogic#handleIsXsdElement()
75       */
76      protected boolean handleIsXsdElement()
77      {
78          return !this.isXsdAttribute();
79      }
80  
81      /**
82       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttributeLogic#handleIsOwnerSchemaType()
83       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isOwnerSchemaType()
84       */
85      protected boolean handleIsOwnerSchemaType()
86      {
87          final Object owner = this.getOwner();
88          return owner instanceof XSDComplexType || owner instanceof XSDEnumerationType;
89      }
90  
91  }