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
14
15 public XSDAttributeLogicImpl(Object metaObject, String context)
16 {
17 super(metaObject, context);
18 }
19
20 /***
21 * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#getMaxOccurs()
22 */
23 protected java.lang.String handleGetMaxOccurs()
24 {
25 String maxOccurs = null;
26 boolean isMany = this.isMany();
27 if (isMany)
28 {
29 maxOccurs = "unbounded";
30 }
31 else
32 {
33 maxOccurs = "1";
34 }
35 return maxOccurs;
36 }
37
38 /***
39 * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#getMinOccurs()
40 */
41 protected java.lang.String handleGetMinOccurs()
42 {
43 String minOccurs = null;
44 boolean isRequired = this.isRequired();
45 if (isRequired)
46 {
47 minOccurs = "1";
48 }
49 else
50 {
51 minOccurs = "0";
52 }
53 return minOccurs;
54 }
55
56 /***
57 * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isXsdAttribute()
58 */
59 protected boolean handleIsXsdAttribute()
60 {
61 return this.hasStereotype(XmlSchemaProfile.STEREOTYPE_XML_ATTRIBUTE);
62 }
63
64 /***
65 * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isXsdElement()
66 */
67 protected boolean handleIsXsdElement()
68 {
69 return !this.isXsdAttribute();
70 }
71
72 /***
73 * @see org.andromda.cartridges.xmlschema.metafacades.XSDAttribute#isOwnerSchemaType()
74 */
75 protected boolean handleIsOwnerSchemaType()
76 {
77 final Object owner = this.getOwner();
78 return owner instanceof XSDComplexType || owner instanceof XSDEnumerationType;
79 }
80
81 }