|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| package org.apache.hivemind.schema.impl; |
|
16 |
| |
|
17 |
| import java.util.ArrayList; |
|
18 |
| import java.util.Collections; |
|
19 |
| import java.util.Iterator; |
|
20 |
| import java.util.List; |
|
21 |
| |
|
22 |
| import org.apache.hivemind.schema.AttributeModel; |
|
23 |
| import org.apache.hivemind.schema.ElementModel; |
|
24 |
| import org.apache.hivemind.schema.Rule; |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| public class ElementModelImpl extends SchemaImpl implements ElementModel |
|
32 |
| { |
|
33 |
| private String _elementName; |
|
34 |
| |
|
35 |
| private List _attributeModels; |
|
36 |
| |
|
37 |
| private List _shareableAttributeModels; |
|
38 |
| |
|
39 |
| private String _keyAttribute; |
|
40 |
| |
|
41 |
| private List _rules; |
|
42 |
| |
|
43 |
| private List _shareableRules; |
|
44 |
| |
|
45 |
| private String _contentTranslator; |
|
46 |
| |
|
47 |
10553
| public String getElementName()
|
|
48 |
| { |
|
49 |
10553
| return _elementName;
|
|
50 |
| } |
|
51 |
| |
|
52 |
3999
| public void setElementName(String string)
|
|
53 |
| { |
|
54 |
3999
| _elementName = string;
|
|
55 |
| } |
|
56 |
| |
|
57 |
5030
| public void addAttributeModel(AttributeModel attributeModel)
|
|
58 |
| { |
|
59 |
5030
| if (_attributeModels == null)
|
|
60 |
2093
| _attributeModels = new ArrayList();
|
|
61 |
| |
|
62 |
5030
| _attributeModels.add(attributeModel);
|
|
63 |
5030
| _shareableAttributeModels = null;
|
|
64 |
| } |
|
65 |
| |
|
66 |
11065
| public List getAttributeModels()
|
|
67 |
| { |
|
68 |
11065
| if (_shareableAttributeModels == null)
|
|
69 |
3584
| _shareableAttributeModels = _attributeModels == null ? Collections.EMPTY_LIST
|
|
70 |
| : Collections.unmodifiableList(_attributeModels); |
|
71 |
| |
|
72 |
11065
| return _shareableAttributeModels;
|
|
73 |
| } |
|
74 |
| |
|
75 |
127
| public AttributeModel getAttributeModel(String name)
|
|
76 |
| { |
|
77 |
127
| if (_attributeModels == null)
|
|
78 |
1
| return null;
|
|
79 |
| |
|
80 |
126
| for (Iterator i = _attributeModels.iterator(); i.hasNext();)
|
|
81 |
| { |
|
82 |
126
| AttributeModel am = (AttributeModel) i.next();
|
|
83 |
| |
|
84 |
126
| if (am.getName().equals(name))
|
|
85 |
126
| return am;
|
|
86 |
| } |
|
87 |
| |
|
88 |
0
| return null;
|
|
89 |
| } |
|
90 |
| |
|
91 |
3995
| public void setKeyAttribute(String keyAttribute)
|
|
92 |
| { |
|
93 |
3995
| _keyAttribute = keyAttribute;
|
|
94 |
| } |
|
95 |
| |
|
96 |
13864
| public String getKeyAttribute()
|
|
97 |
| { |
|
98 |
13864
| return _keyAttribute;
|
|
99 |
| } |
|
100 |
| |
|
101 |
14689
| public void addRule(Rule rule)
|
|
102 |
| { |
|
103 |
14689
| if (_rules == null)
|
|
104 |
3987
| _rules = new ArrayList();
|
|
105 |
| |
|
106 |
14689
| _rules.add(rule);
|
|
107 |
14689
| _shareableRules = null;
|
|
108 |
| } |
|
109 |
| |
|
110 |
7623
| public List getRules()
|
|
111 |
| { |
|
112 |
7623
| if (_shareableRules == null)
|
|
113 |
956
| _shareableRules = _rules == null ? Collections.EMPTY_LIST : Collections
|
|
114 |
| .unmodifiableList(_rules); |
|
115 |
| |
|
116 |
7623
| return _shareableRules;
|
|
117 |
| } |
|
118 |
| |
|
119 |
16
| public String getContentTranslator()
|
|
120 |
| { |
|
121 |
16
| return _contentTranslator;
|
|
122 |
| } |
|
123 |
| |
|
124 |
3995
| public void setContentTranslator(String string)
|
|
125 |
| { |
|
126 |
3995
| _contentTranslator = string;
|
|
127 |
| } |
|
128 |
| |
|
129 |
| } |