1 package org.andromda.cartridges.xmlschema.metafacades;
2
3 import org.andromda.cartridges.xmlschema.XmlSchemaProfile;
4
5
6
7
8
9
10 public class XSDAttributeLogicImpl
11 extends XSDAttributeLogic
12 {
13 private static final long serialVersionUID = 34L;
14
15
16
17
18
19
20 public XSDAttributeLogicImpl(Object metaObject, String context)
21 {
22 super(metaObject, context);
23 }
24
25
26
27
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
46
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
65
66
67 protected boolean handleIsXsdAttribute()
68 {
69 return this.hasStereotype(XmlSchemaProfile.STEREOTYPE_XML_ATTRIBUTE);
70 }
71
72
73
74
75
76 protected boolean handleIsXsdElement()
77 {
78 return !this.isXsdAttribute();
79 }
80
81
82
83
84
85 protected boolean handleIsOwnerSchemaType()
86 {
87 final Object owner = this.getOwner();
88 return owner instanceof XSDComplexType || owner instanceof XSDEnumerationType;
89 }
90
91 }