20 package net.sf.gridarta.model.archetypetype;
28 import nu.xom.Attribute;
29 import nu.xom.Document;
30 import nu.xom.Element;
31 import nu.xom.Elements;
33 import org.apache.log4j.Category;
34 import org.apache.log4j.Logger;
35 import org.jetbrains.annotations.NotNull;
36 import org.jetbrains.annotations.Nullable;
75 final Element rootElement = document.getRootElement();
80 if (attributeOrderElements.size() > 0) {
86 parseTypes(archetypeTypeSet, element, errorViewCollector, defaultArchetypeType, ignorelistsDefinition);
89 if (
LOG.isInfoEnabled()) {
92 return archetypeTypeSet;
106 if (attributeBitmask !=
null) {
107 archetypeTypeSet.addBitmask(name, attributeBitmask);
127 parseBmentry(element, errorViewCollector, name, isNamed, attributeBitmask);
143 return attributeBitmask;
158 final String bitAttribute = tmpBitAttribute ==
null ?
"" : tmpBitAttribute.getValue();
161 final String valueAttribute = tmpValueAttribute ==
null ?
"" : tmpValueAttribute.getValue();
162 if (!bitAttribute.isEmpty() && !valueAttribute.isEmpty()) {
170 if (bitAttribute.isEmpty()) {
176 value = Integer.parseInt(valueAttribute);
177 }
catch (
final NumberFormatException ignored) {
184 bitValue = Integer.parseInt(bitAttribute);
185 }
catch (
final NumberFormatException ignored) {
189 if (bitValue < 0 || bitValue >= 32) {
193 if (!attributeBitmask.addBitName(bitValue, name)) {
197 value = 1 << bitValue;
200 attributeBitmask.addName(name, value);
203 final String encoding = tmpEncodingAttribute ==
null ?
"" : tmpEncodingAttribute.getValue();
205 if (encoding.isEmpty()) {
209 attributeBitmask.addNamedValue(encoding, value);
211 if (!encoding.isEmpty()) {
228 parseList(archetypeTypeSet, element, errorViewCollector);
245 archetypeTypeSet.addList(name, list);
260 value = Integer.valueOf(valueString);
261 }
catch (
final NumberFormatException ignore) {
266 list.add(value, name);
267 }
catch (
final IllegalArgumentException ex) {
285 return ignorelistsDefinition;
297 if (!value.isEmpty()) {
298 if (archetypeTypeSet.addAttributeOrder(value)) {
314 if (ignorelistsDefinition.containsKey(name)) {
320 if (archAttribute ==
null) {
324 ignorelistsDefinition.put(name, archAttribute.getValue());
325 }
catch (
final IllegalArgumentException ex) {
331 rejectAttributes(attributeElement,
Constants.
XML_ATTRIBUTE_TYPE,
Constants.
XML_ATTRIBUTE_ARCH_BEGIN,
Constants.
XML_ATTRIBUTE_ARCH_END,
Constants.
XML_ATTRIBUTE_EDITOR,
Constants.
XML_ATTRIBUTE_VALUE,
Constants.
XML_ATTRIBUTE_MIN,
Constants.
XML_ATTRIBUTE_MAX,
Constants.
XML_ATTRIBUTE_CHECK_MIN,
Constants.
XML_ATTRIBUTE_CHECK_MAX,
Constants.
XML_ATTRIBUTE_LENGTH,
Constants.
XML_ATTRIBUTE_TRUE,
Constants.
XML_ATTRIBUTE_FALSE,
Constants.
XML_ATTRIBUTE_MARKER);
364 archetypeTypeSet.addArchetypeType(
archetypeTypeParser.
loadAttributeList(typeElement, errorViewCollector, defaultArchetypeType, archetypeTypeSet, ignorelistsDefinition,
false));
375 for (
final String attribute : attributes) {
376 if (element.getAttribute(attribute) !=
null) {