Gridarta Editor
ArchetypeTypeParser.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.model.archetypetype;
21 
22 import java.util.Collection;
23 import java.util.HashSet;
24 import java.util.LinkedHashSet;
29 import nu.xom.Attribute;
30 import nu.xom.Element;
31 import nu.xom.Elements;
32 import org.apache.log4j.Category;
33 import org.apache.log4j.Logger;
34 import org.jetbrains.annotations.NotNull;
35 import org.jetbrains.annotations.Nullable;
36 
43 public class ArchetypeTypeParser {
44 
48  private static final int @NotNull [] EMPTY_INT_ARRAY = new int[0];
49 
53  @NotNull
54  private static final Category LOG = Logger.getLogger(ArchetypeTypeParser.class);
55 
59  @NotNull
61 
67  this.archetypeAttributeParser = archetypeAttributeParser;
68  }
69 
81  @NotNull
82  public ArchetypeType loadAttributeList(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType parentArchetypeType, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final IgnorelistsDefinition ignorelistsDefinition, final boolean isDefaultType) {
83  final String typeName = parseTypeName(typeElement, isDefaultType);
84  if (LOG.isDebugEnabled()) {
85  LOG.debug("loadAttributeList: " + typeName);
86  }
87  final int typeNo = parseTypeNo(typeElement, isDefaultType, typeName, errorViewCollector);
88  final Attribute typeElementAttribute = typeElement.getAttribute(Constants.XML_TYPE_DISPLAY);
89  final String display = typeElementAttribute == null ? "" : typeElementAttribute.getValue();
90  final boolean map = parseMap(typeElement);
91  final int[] inv = parseInv(typeElement, typeName, errorViewCollector);
92  final boolean allowsAllInv = parseAllowsAllInv(typeElement);
93  final Collection<String> ignoreTable = new HashSet<>();
94  final ArchetypeAttributesDefinition typeAttributes = isDefaultType ? new ArchetypeAttributesDefinition() : parseTypeAttributes(typeElement, typeName, errorViewCollector, ignoreTable, ignorelistsDefinition);
95 
96  final Collection<String> importTypes = new LinkedHashSet<>();
97  for (final Element importTypeElement : new ElementsIterable(typeElement.getChildElements(Constants.XML_ELEMENT_IMPORT_TYPE))) {
98  final String importType = parseImportType(importTypeElement, typeName, errorViewCollector);
99  if (importType != null && !importTypes.add(importType)) {
100  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has duplicate import for '" + importType + "'.");
101  }
102  }
103 
104  final String defaultSectionName = typeNo == -1 ? ArchetypeAttributeSection.GENERAL_SECTION : ArchetypeAttributeSection.SPECIAL_SECTION;
105  final ArchetypeAttributeSection attributeSection = new ArchetypeAttributeSection(defaultSectionName);
106  final ArchetypeType newArchetypeType = new ArchetypeType(typeName, typeNo, display, map, inv, allowsAllInv, parseDescription(typeElement), parseUse(typeElement), typeAttributes);
107  final Iterable<ArchetypeAttributeSection> attributeList = addAttributeList(typeElement, attributeSection, errorViewCollector, typeName, archetypeTypeSet);
108  if (LOG.isDebugEnabled()) {
109  LOG.debug("loadAttributeList: adding default section " + attributeSection);
110  }
111  newArchetypeType.addAttributeSection(attributeSection);
112  for (final ArchetypeAttributeSection archetypeAttributeSection : attributeList) {
113  if (LOG.isDebugEnabled()) {
114  LOG.debug("loadAttributeList: adding section " + archetypeAttributeSection);
115  }
116  newArchetypeType.addAttributeSection(archetypeAttributeSection);
117  }
118  if (parentArchetypeType != null) {
119  if (LOG.isDebugEnabled()) {
120  LOG.debug("loadAttributeList: importing attributes from parent archetype type " + parentArchetypeType.getTypeName());
121  }
122  final Collection<String> autoIgnoreTable = new HashSet<>();
123  for (final ArchetypeAttributeSection archetypeAttributeSection : attributeList) {
124  for (final ArchetypeAttribute attribute : archetypeAttributeSection) {
125  if (LOG.isDebugEnabled()) {
126  LOG.debug("loadAttributeList: auto-ignore: " + attribute.getArchetypeAttributeName() + " [parent]");
127  }
128  autoIgnoreTable.add(attribute.getArchetypeAttributeName());
129  }
130  }
131  for (final ArchetypeAttribute attribute : attributeSection) {
132  if (LOG.isDebugEnabled()) {
133  LOG.debug("loadAttributeList: auto-ignore: " + attribute.getArchetypeAttributeName() + " [this]");
134  }
135  autoIgnoreTable.add(attribute.getArchetypeAttributeName());
136  }
137 
138  if (parentArchetypeType.hasAttribute()) {
139  for (final String importType : importTypes) {
140  if (LOG.isDebugEnabled()) {
141  LOG.debug("loadAttributeList: importing attributes from " + importType);
142  }
143  addImportList(importType, newArchetypeType, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable);
144  }
145  }
146 
147  if (LOG.isDebugEnabled()) {
148  LOG.debug("loadAttributeList: importing default attributes from " + parentArchetypeType.getTypeName());
149  }
150  addDefaultList(parentArchetypeType, newArchetypeType, autoIgnoreTable, ignoreTable);
151  }
152 
153  return newArchetypeType;
154  }
155 
164  private static void addDefaultList(@NotNull final Iterable<ArchetypeAttributeSection> archetypeType, @NotNull final ArchetypeType newArchetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Collection<String> ignoreTable) {
165  for (final ArchetypeAttributeSection archetypeAttributeSection : archetypeType) {
166  for (final ArchetypeAttribute archetypeAttribute : archetypeAttributeSection) {
167  // add all attributes from the default_type which are not in the ignoreTable
168  final String archetypeAttributeName = archetypeAttribute.getArchetypeAttributeName();
169  if (ignoreTable.contains(archetypeAttributeName)) {
170  if (LOG.isDebugEnabled()) {
171  LOG.debug("addDefaultList: skipping " + archetypeAttributeName + " because of ignoreTable");
172  }
173  continue;
174  }
175  if (autoIgnoreTable.contains(archetypeAttributeName)) {
176  if (LOG.isDebugEnabled()) {
177  LOG.debug("addDefaultList: skipping " + archetypeAttributeName + " because of autoIgnoreTable");
178  }
179  continue;
180  }
181  if (LOG.isDebugEnabled()) {
182  LOG.debug("addDefaultList: adding " + archetypeAttributeName + " to section " + archetypeAttributeSection);
183  }
184  newArchetypeType.addArchetypeAttribute(archetypeAttributeSection.getSectionName(), archetypeAttribute);
185  }
186  }
187  }
188 
199  private static void addImportList(@NotNull final String importName, @NotNull final ArchetypeType newArchetypeType, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Collection<String> autoIgnoreTable) {
200  final ArchetypeType importType = archetypeTypeSet.getArchetypeType(importName);
201  if (importType == null) {
202  if (LOG.isDebugEnabled()) {
203  LOG.debug("addImportList: skipping " + importName + " because it does not exist");
204  }
205  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, typeName + ": import type \"" + importName + "\" not found!");
206  return;
207  }
208 
209  for (final ArchetypeAttributeSection archetypeAttributeSection : importType) {
210  final String sectionName = archetypeAttributeSection.getSectionName();
211  if (sectionName.equals(ArchetypeAttributeSection.GENERAL_SECTION)) {
212  if (LOG.isDebugEnabled()) {
213  LOG.debug("addImportList: skipping section " + sectionName + " because it is the general section");
214  }
215  continue;
216  }
217 
218  for (final ArchetypeAttribute archetypeAttribute : archetypeAttributeSection) {
219  final String attributeName = archetypeAttribute.getArchetypeAttributeName();
220  if (autoIgnoreTable.contains(attributeName)) {
221  if (LOG.isDebugEnabled()) {
222  LOG.debug("addImportList: skipping " + attributeName + " because of autoIgnoreTable");
223  }
224  continue;
225  }
226 
227  if (LOG.isDebugEnabled()) {
228  LOG.debug("addImportList: adding " + archetypeAttribute + " to section " + sectionName);
229  }
230  newArchetypeType.addArchetypeAttribute(sectionName, archetypeAttribute);
231  if (LOG.isDebugEnabled()) {
232  LOG.debug("addImportList: auto-ignore: " + attributeName + " [import]");
233  }
234  autoIgnoreTable.add(attributeName);
235  }
236  }
237  }
238 
249  @Nullable
250  private static String parseImportType(@NotNull final Element importTypeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) {
251  final Attribute nameAttribute = importTypeElement.getAttribute(Constants.XML_IMPORT_TYPE_NAME);
252  if (nameAttribute == null) {
253  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has " + Constants.XML_ELEMENT_IMPORT_TYPE + " element without '" + Constants.XML_IMPORT_TYPE_NAME + "'.");
254  return null;
255  }
256 
257  final String name = nameAttribute.getValue();
258  if (name.isEmpty()) {
259  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has " + Constants.XML_ELEMENT_IMPORT_TYPE + " element with empty '" + Constants.XML_IMPORT_TYPE_NAME + "'.");
260  return null;
261  }
262 
263  return name;
264  }
265 
273  @NotNull
274  private static String parseTypeName(@NotNull final Element typeElement, final boolean isDefaultType) {
275  return isDefaultType ? "default" : typeElement.getAttribute(Constants.XML_TYPE_NAME).getValue();
276  }
277 
286  private static int parseTypeNo(@NotNull final Element typeElement, final boolean isDefaultType, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) {
287  if (isDefaultType) {
288  return -1;
289  }
290 
291  final String number = typeElement.getAttribute(Constants.XML_TYPE_NUMBER).getValue();
292  try {
293  return Integer.parseInt(number);
294  } catch (final NumberFormatException ignored) {
295  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid type number '" + number + "'.");
296  return -1;
297  }
298  }
299 
305  private static boolean parseMap(@NotNull final Element typeElement) {
306  final Attribute attribute = typeElement.getAttribute(Constants.XML_TYPE_MAP);
307  return attribute != null && attribute.getValue().equals("yes");
308  }
309 
318  private static int @Nullable [] parseInv(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) {
319  final Attribute attribute = typeElement.getAttribute(Constants.XML_TYPE_INV);
320  if (attribute == null) {
321  return null;
322  }
323 
324  final String inv = attribute.getValue();
325  if (inv.isEmpty()) {
326  return EMPTY_INT_ARRAY;
327  }
328  if (inv.equals("*")) {
329  return null;
330  }
331 
332  final String[] types = StringUtils.PATTERN_COMMA.split(inv, -1);
333  final int[] result = new int[types.length];
334  for (int i = 0; i < types.length; i++) {
335  try {
336  result[i] = Integer.parseInt(types[i]);
337  } catch (final NumberFormatException ignored) {
338  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid inv specification '" + types[i] + "'.");
339  result[i] = -1;
340  }
341  }
342  return result;
343  }
344 
350  private static boolean parseAllowsAllInv(@NotNull final Element typeElement) {
351  final Attribute attribute = typeElement.getAttribute(Constants.XML_TYPE_ALLOWS_ALL_INV);
352  return attribute != null && attribute.getValue().equals("yes");
353  }
354 
365  @NotNull
366  private static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) {
367  final ArchetypeAttributesDefinition typeAttributes = parseRequiredAttribute(typeElement, typeName, errorViewCollector);
368 
369  final Elements ignoreElements = typeElement.getChildElements(Constants.XML_ELEMENT_IGNORE);
370  if (ignoreElements.size() > 0) {
371  final Element ignoreElement = ignoreElements.get(0);
372  parseAttributeAttributes(ignoreElement, typeName, errorViewCollector, ignoreTable);
373  parseIgnoreListAttribute(ignoreElement, typeName, errorViewCollector, ignoreTable, ignorelistsDefinition);
374  }
375 
376  return typeAttributes;
377  }
378 
386  @NotNull
387  private static ArchetypeAttributesDefinition parseRequiredAttribute(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) {
389  final Elements requiredElements = typeElement.getChildElements(Constants.XML_ELEMENT_REQUIRED);
390  if (requiredElements.size() > 0) {
391  for (final Element attributeElement : new ElementsIterable(requiredElements.get(0).getChildElements(Constants.XML_ELEMENT_ATTRIBUTE))) {
392  final Attribute archAttribute = attributeElement.getAttribute(Constants.XML_ATTRIBUTE_ARCH);
393  if (archAttribute == null) {
394  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, Constants.XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + Constants.XML_ELEMENT_ATTRIBUTE + " missing '" + Constants.XML_ATTRIBUTE_ARCH + "'.");
395  continue;
396  }
397  final String attributeValue = archAttribute.getValue();
398  if (attributeValue.isEmpty()) {
399  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, Constants.XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + Constants.XML_ELEMENT_ATTRIBUTE + " empty '" + Constants.XML_ATTRIBUTE_ARCH + "'.");
400  continue;
401  }
402 
403  final Attribute valueAttribute = attributeElement.getAttribute(Constants.XML_ATTRIBUTE_VALUE);
404  if (valueAttribute == null) {
405  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, Constants.XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + Constants.XML_ELEMENT_ATTRIBUTE + " missing '" + Constants.XML_ATTRIBUTE_VALUE + "'.");
406  continue;
407  }
408  final String value = valueAttribute.getValue();
409  if (value.isEmpty()) {
410  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, Constants.XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + Constants.XML_ELEMENT_ATTRIBUTE + " empty '" + Constants.XML_ATTRIBUTE_VALUE + "'.");
411  continue;
412  }
413 
414  attributes.add(new ArchetypeAttributeDefinition(attributeValue, value));
415  }
416  }
417  return attributes;
418  }
419 
427  private static void parseAttributeAttributes(@NotNull final Element ignoreElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection<String> ignoreTable) {
428  for (final Element attributeElement : new ElementsIterable(ignoreElement.getChildElements(Constants.XML_ELEMENT_ATTRIBUTE))) {
429  final Attribute archAttribute = attributeElement.getAttribute(Constants.XML_ATTRIBUTE_ARCH);
430  if (archAttribute == null) {
431  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, Constants.XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + Constants.XML_ELEMENT_ATTRIBUTE + " missing '" + Constants.XML_ATTRIBUTE_ARCH + "'.");
432  continue;
433  }
434 
435  final String attributeValue = archAttribute.getValue();
436  if (attributeValue.isEmpty()) {
437  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, Constants.XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + Constants.XML_ELEMENT_ATTRIBUTE + " empty '" + Constants.XML_ATTRIBUTE_ARCH + "'.");
438  continue;
439  }
440 
441  ignoreTable.add(attributeValue);
442  }
443  }
444 
453  private static void parseIgnoreListAttribute(@NotNull final Element ignoreElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) {
454  for (final Element ignoreListElement : new ElementsIterable(ignoreElement.getChildElements(Constants.XML_ELEMENT_IGNORE_LIST))) {
455  final Attribute nameAttribute = ignoreListElement.getAttribute(Constants.XML_IGNORE_LIST_NAME);
456  if (nameAttribute == null) {
457  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, Constants.XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + Constants.XML_ELEMENT_IGNORE_LIST + " missing '" + Constants.XML_IGNORE_LIST_NAME + "'.");
458  continue;
459  }
460 
461  final String name = nameAttribute.getValue();
462  final Iterable<String> ignoreList = ignorelistsDefinition.get(name);
463  if (ignoreList == null) {
464  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, Constants.XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + Constants.XML_ELEMENT_IGNORE_LIST + " with " + Constants.XML_IGNORE_LIST_NAME + " \"" + name + "\" is undefined.");
465  continue;
466  }
467 
468  for (final String ignoreItem : ignoreList) {
469  ignoreTable.add(ignoreItem);
470  }
471  }
472  }
473 
479  @Nullable
480  private static String parseDescription(@NotNull final Element root) {
481  final Elements elements = root.getChildElements(Constants.XML_DESCRIPTION);
482  return elements.size() == 0 ? null : elements.get(0).getValue().trim();
483  }
484 
490  @Nullable
491  private static String parseUse(@NotNull final Element root) {
492  final Elements elements = root.getChildElements(Constants.XML_USE);
493  return elements.size() == 0 ? null : elements.get(0).getValue().trim();
494  }
495 
508  @NotNull
509  private Iterable<ArchetypeAttributeSection> addAttributeList(@NotNull final Element typeElement, @NotNull final ArchetypeAttributeSection defaultAttributeSection, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet) {
511  for (final Element childElement : new ElementsIterable(typeElement.getChildElements())) {
512  final String childName = childElement.getLocalName();
513 
514  if (childName.equals(Constants.XML_ELEMENT_ATTRIBUTE)) {
515  parseAttribute(childElement, errorViewCollector, typeName, archetypeTypeSet, sections, defaultAttributeSection.getSectionName());
516  } else if (childName.equals(Constants.XML_ELEMENT_SECTION) && childElement.getChildElements().size() > 0) {
517  final Attribute nameAttribute = childElement.getAttribute(Constants.XML_SECTION_NAME);
518  if (nameAttribute == null) {
519  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " contains a " + Constants.XML_ELEMENT_SECTION + " missing '" + Constants.XML_SECTION_NAME + "'.");
520  continue;
521  }
522 
523  final String sectionName = nameAttribute.getValue();
524  if (sectionName.isEmpty()) {
525  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " contains a " + Constants.XML_ELEMENT_SECTION + " with empty '" + Constants.XML_SECTION_NAME + "'.");
526  continue;
527  }
528 
529  for (final Element element : new ElementsIterable(childElement.getChildElements(Constants.XML_ELEMENT_ATTRIBUTE))) {
530  parseAttribute(element, errorViewCollector, typeName, archetypeTypeSet, sections, sectionName);
531  }
532  }
533  }
534  return sections;
535  }
536 
547  private void parseAttribute(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeAttributeSections sections, @NotNull final String sectionName) {
548  final ArchetypeAttribute archetypeAttribute = parseAttribute(attributeElement, errorViewCollector, typeName, archetypeTypeSet);
549  if (archetypeAttribute == null) {
550  return;
551  }
552 
553  final String effectiveSectionName = archetypeAttribute instanceof ArchetypeAttributeText ? archetypeAttribute.getAttributeName() : sectionName; // text attributes get their own section
554  sections.addArchetypeAttribute(effectiveSectionName, archetypeAttribute);
555  }
556 
568  @Nullable
569  private ArchetypeAttribute parseAttribute(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet) {
570  try {
571  return archetypeAttributeParser.load(attributeElement, errorViewCollector, archetypeTypeSet, typeName);
572  } catch (final MissingAttributeException ex) {
573  errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": " + ex.getMessage());
574  return null;
575  }
576  }
577 
578 }
net.sf.gridarta.model.archetypetype.Constants.XML_DESCRIPTION
static final String XML_DESCRIPTION
Definition: Constants.java:358
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseTypeName
static String parseTypeName(@NotNull final Element typeElement, final boolean isDefaultType)
Definition: ArchetypeTypeParser.java:274
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseImportType
static String parseImportType(@NotNull final Element importTypeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector)
Definition: ArchetypeTypeParser.java:250
net.sf.gridarta.model.archetypetype.Constants.XML_ELEMENT_ATTRIBUTE
static final String XML_ELEMENT_ATTRIBUTE
Definition: Constants.java:236
net.sf.gridarta
net.sf.gridarta.model.archetypetype.Constants.XML_ELEMENT_IMPORT_TYPE
static final String XML_ELEMENT_IMPORT_TYPE
Definition: Constants.java:224
net.sf.gridarta.model.archetypetype.ArchetypeAttributeParser.load
ArchetypeAttribute load(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final String typeName)
Definition: ArchetypeAttributeParser.java:76
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseTypeAttributes
static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection< String > ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition)
Definition: ArchetypeTypeParser.java:366
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser
Definition: ArchetypeTypeParser.java:43
net.sf.gridarta.model.archetypetype.MissingAttributeException
Definition: MissingAttributeException.java:28
net.sf.gridarta.model.archetypetype.Constants.XML_ELEMENT_IGNORE
static final String XML_ELEMENT_IGNORE
Definition: Constants.java:218
net.sf
net.sf.gridarta.model.archetypetype.Constants.XML_IGNORE_LIST_NAME
static final String XML_IGNORE_LIST_NAME
Definition: Constants.java:340
net.sf.gridarta.model.archetypetype.ArchetypeAttributeSections
Definition: ArchetypeAttributeSections.java:32
net.sf.gridarta.model.archetypetype.Constants.XML_TYPE_DISPLAY
static final String XML_TYPE_DISPLAY
Definition: Constants.java:188
net.sf.gridarta.model.archetypetype.IgnorelistsDefinition
Definition: IgnorelistsDefinition.java:34
net.sf.gridarta.model.archetypetype.Constants.XML_IMPORT_TYPE_NAME
static final String XML_IMPORT_TYPE_NAME
Definition: Constants.java:346
net.sf.gridarta.model.archetypetype.ArchetypeAttributeSection.SPECIAL_SECTION
static final String SPECIAL_SECTION
Definition: ArchetypeAttributeSection.java:42
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.LOG
static final Category LOG
Definition: ArchetypeTypeParser.java:54
net.sf.gridarta.model.archetypetype.ArchetypeTypeSet
Definition: ArchetypeTypeSet.java:40
net.sf.gridarta.model.archetypetype.ArchetypeAttributeSection.GENERAL_SECTION
static final String GENERAL_SECTION
Definition: ArchetypeAttributeSection.java:37
net.sf.gridarta.model.archetypetype.Constants.XML_TYPE_INV
static final String XML_TYPE_INV
Definition: Constants.java:174
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseAttribute
ArchetypeAttribute parseAttribute(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet)
Definition: ArchetypeTypeParser.java:569
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.ArchetypeTypeParser
ArchetypeTypeParser(@NotNull final ArchetypeAttributeParser archetypeAttributeParser)
Definition: ArchetypeTypeParser.java:66
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseAttribute
void parseAttribute(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeAttributeSections sections, @NotNull final String sectionName)
Definition: ArchetypeTypeParser.java:547
net
net.sf.gridarta.model.errorview
Definition: ErrorView.java:20
net.sf.gridarta.model.archetypetype.Constants.XML_TYPE_ALLOWS_ALL_INV
static final String XML_TYPE_ALLOWS_ALL_INV
Definition: Constants.java:181
net.sf.gridarta.model.errorview.ErrorViewCollector
Definition: ErrorViewCollector.java:31
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseRequiredAttribute
static ArchetypeAttributesDefinition parseRequiredAttribute(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector)
Definition: ArchetypeTypeParser.java:387
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseMap
static boolean parseMap(@NotNull final Element typeElement)
Definition: ArchetypeTypeParser.java:305
net.sf.gridarta.model.errorview.ErrorViewCategory
Definition: ErrorViewCategory.java:28
net.sf.gridarta.model.archetypetype.Constants.XML_ELEMENT_SECTION
static final String XML_ELEMENT_SECTION
Definition: Constants.java:230
net.sf.gridarta.model.archetypetype.ArchetypeAttribute
Definition: ArchetypeAttribute.java:28
net.sf.gridarta.utils.xml.ElementsIterable
Definition: ElementsIterable.java:30
net.sf.gridarta.model.archetypetype.ArchetypeAttributesDefinition
Definition: ArchetypeAttributesDefinition.java:34
net.sf.gridarta.model.errorview.ErrorViewCategory.TYPES_ENTRY_INVALID
TYPES_ENTRY_INVALID
Definition: ErrorViewCategory.java:92
net.sf.gridarta.model.archetypetype.Constants.XML_ATTRIBUTE_ARCH
static final String XML_ATTRIBUTE_ARCH
Definition: Constants.java:243
net.sf.gridarta.model.archetypetype.ArchetypeAttribute.getAttributeName
String getAttributeName()
Definition: ArchetypeAttribute.java:86
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.EMPTY_INT_ARRAY
static final int[] EMPTY_INT_ARRAY
Definition: ArchetypeTypeParser.java:48
net.sf.gridarta.model.archetypetype.ArchetypeType.addAttributeSection
void addAttributeSection(@NotNull final ArchetypeAttributeSection newArchetypeAttributeSection)
Definition: ArchetypeType.java:128
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.archetypeAttributeParser
final ArchetypeAttributeParser archetypeAttributeParser
Definition: ArchetypeTypeParser.java:60
net.sf.gridarta.utils.StringUtils
Definition: StringUtils.java:31
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.addAttributeList
Iterable< ArchetypeAttributeSection > addAttributeList(@NotNull final Element typeElement, @NotNull final ArchetypeAttributeSection defaultAttributeSection, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet)
Definition: ArchetypeTypeParser.java:509
net.sf.gridarta.model.archetypetype.ArchetypeAttributeSection
Definition: ArchetypeAttributeSection.java:32
net.sf.gridarta.model.archetypetype.ArchetypeAttributesDefinition.add
void add(@NotNull final ArchetypeAttributeDefinition archetypeAttribute)
Definition: ArchetypeAttributesDefinition.java:46
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseInv
static int[] parseInv(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector)
Definition: ArchetypeTypeParser.java:318
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.addDefaultList
static void addDefaultList(@NotNull final Iterable< ArchetypeAttributeSection > archetypeType, @NotNull final ArchetypeType newArchetypeType, @NotNull final Collection< String > autoIgnoreTable, @NotNull final Collection< String > ignoreTable)
Definition: ArchetypeTypeParser.java:164
net.sf.gridarta.utils.StringUtils.PATTERN_COMMA
static final Pattern PATTERN_COMMA
Definition: StringUtils.java:97
net.sf.gridarta.model
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseIgnoreListAttribute
static void parseIgnoreListAttribute(@NotNull final Element ignoreElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection< String > ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition)
Definition: ArchetypeTypeParser.java:453
net.sf.gridarta.model.archetypetype.Constants.XML_SECTION_NAME
static final String XML_SECTION_NAME
Definition: Constants.java:352
net.sf.gridarta.model.archetypetype.Constants.XML_TYPE_NAME
static final String XML_TYPE_NAME
Definition: Constants.java:153
net.sf.gridarta.model.archetypetype.ArchetypeAttributeParser
Definition: ArchetypeAttributeParser.java:35
net.sf.gridarta.model.archetypetype.Constants
Definition: Constants.java:28
net.sf.gridarta.model.archetypetype.Constants.XML_TYPE_MAP
static final String XML_TYPE_MAP
Definition: Constants.java:167
net.sf.gridarta.utils.xml
Definition: ElementsIterable.java:20
net.sf.gridarta.model.archetypetype.Constants.XML_TYPE_NUMBER
static final String XML_TYPE_NUMBER
Definition: Constants.java:160
net.sf.gridarta.model.archetypetype.Constants.XML_ATTRIBUTE_VALUE
static final String XML_ATTRIBUTE_VALUE
Definition: Constants.java:257
net.sf.gridarta.model.archetypetype.ArchetypeType
Definition: ArchetypeType.java:35
net.sf.gridarta.model.archetypetype.Constants.XML_ELEMENT_REQUIRED
static final String XML_ELEMENT_REQUIRED
Definition: Constants.java:212
net.sf.gridarta.model.archetypetype.ArchetypeAttributeText
Definition: ArchetypeAttributeText.java:30
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseDescription
static String parseDescription(@NotNull final Element root)
Definition: ArchetypeTypeParser.java:480
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseAttributeAttributes
static void parseAttributeAttributes(@NotNull final Element ignoreElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection< String > ignoreTable)
Definition: ArchetypeTypeParser.java:427
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseUse
static String parseUse(@NotNull final Element root)
Definition: ArchetypeTypeParser.java:491
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.addImportList
static void addImportList(@NotNull final String importName, @NotNull final ArchetypeType newArchetypeType, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Collection< String > autoIgnoreTable)
Definition: ArchetypeTypeParser.java:199
net.sf.gridarta.model.archetypetype.Constants.XML_ELEMENT_IGNORE_LIST
static final String XML_ELEMENT_IGNORE_LIST
Definition: Constants.java:206
net.sf.gridarta.utils
Definition: ActionBuilderUtils.java:20
net.sf.gridarta.model.archetypetype.Constants.XML_USE
static final String XML_USE
Definition: Constants.java:364
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.loadAttributeList
ArchetypeType loadAttributeList(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType parentArchetypeType, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final IgnorelistsDefinition ignorelistsDefinition, final boolean isDefaultType)
Definition: ArchetypeTypeParser.java:82
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseAllowsAllInv
static boolean parseAllowsAllInv(@NotNull final Element typeElement)
Definition: ArchetypeTypeParser.java:350
net.sf.gridarta.model.archetypetype.ArchetypeAttributeDefinition
Definition: ArchetypeAttributeDefinition.java:30
net.sf.gridarta.model.archetypetype.ArchetypeTypeParser.parseTypeNo
static int parseTypeNo(@NotNull final Element typeElement, final boolean isDefaultType, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector)
Definition: ArchetypeTypeParser.java:286