View Javadoc
1   package org.andromda.cartridges.xmlschema.metafacades;
2   
3   /**
4    * MetafacadeLogic implementation for org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEnd.
5    *
6    * @see org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEnd
7    */
8   public class XSDAssociationEndLogicImpl
9           extends XSDAssociationEndLogic
10  {
11      private static final long serialVersionUID = 34L;
12      // ---------------- constructor -------------------------------
13  
14      /**
15       * @param metaObject
16       * @param context
17       */
18      public XSDAssociationEndLogicImpl(Object metaObject, String context)
19      {
20          super(metaObject, context);
21      }
22  
23      /**
24       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEndLogic#handleGetMaxOccurs()
25       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEnd#getMaxOccurs()
26       */
27      protected String handleGetMaxOccurs()
28      {
29          String maxOccurs = null;
30          boolean isMany = this.isMany();
31          if (isMany)
32          {
33              maxOccurs = "unbounded";
34          }
35          else
36          {
37              maxOccurs = "1";
38          }
39          return maxOccurs;
40      }
41  
42      /**
43       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEndLogic#handleGetMinOccurs()
44       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEnd#getMinOccurs()
45       */
46      protected String handleGetMinOccurs()
47      {
48          String minOccurs = null;
49          boolean isRequired = this.isRequired();
50          if (isRequired)
51          {
52              minOccurs = "1";
53          }
54          else
55          {
56              minOccurs = "0";
57          }
58          return minOccurs;
59      }
60  
61      /**
62       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEndLogic#handleIsOwnerSchemaType()
63       * @see org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEnd#isOwnerSchemaType()
64       */
65      protected boolean handleIsOwnerSchemaType()
66      {
67          final Object owner = this.getType();
68          return owner instanceof XSDComplexType || owner instanceof XSDEnumerationType;
69      }
70  
71  }