private Object[] getXSDSimpleTypeDefinitionChildren_ATOMIC(XSDSimpleTypeDefinition parent) {
    ArrayList<Object> list = new ArrayList<Object>();
    // add Base Type if not a pre-defined type
    if (parent != null
        && parent.getSchema() != null
        && parent.getSchema().getSchemaForSchema() != null) {
      if (!parent.getSchema().getSchemaForSchema().getTypeDefinitions().contains(parent)) {
        list.add(parent.getBaseTypeDefinition());
      }
    }

    if (!Util.isBuildInType(parent)) {
      list.addAll(parent.getFacetContents());
    }

    return list.toArray(new Object[list.size()]);
  }
Ejemplo n.º 2
0
  protected void processTypeFacets(
      XSDSimpleTypeDefinition type, Node typeNode, XSDTypeDefinition baseType)
      throws RepositoryException {
    if (baseType == null) {
      baseType = type.getBaseType();
    }
    if (baseType == type) {
      // The base type is the anytype ...
      baseType =
          type.getSchema()
              .getSchemaForSchema()
              .resolveSimpleTypeDefinition("http://www.w3.org/2001/XMLSchema", "anyType");
    }
    if (baseType != null) {
      typeNode.setProperty(XsdLexicon.BASE_TYPE_NAME, baseType.getName());
      typeNode.setProperty(XsdLexicon.BASE_TYPE_NAMESPACE, baseType.getTargetNamespace());
      setReference(
          typeNode,
          XsdLexicon.BASE_TYPE_REFERENCE,
          TYPE_DEFINITIONS,
          baseType.getTargetNamespace(),
          baseType.getName());
    }

    processFacet(
        type.getEffectiveMaxLengthFacet(), typeNode, XsdLexicon.MAX_LENGTH, PropertyType.LONG);
    processFacet(type.getMaxLengthFacet(), typeNode, XsdLexicon.MAX_LENGTH, PropertyType.LONG);
    processFacet(
        type.getEffectiveMinLengthFacet(), typeNode, XsdLexicon.MIN_LENGTH, PropertyType.LONG);
    processFacet(type.getMinLengthFacet(), typeNode, XsdLexicon.MIN_LENGTH, PropertyType.LONG);
    processFacet(
        type.getEffectiveMaxFacet(), typeNode, XsdLexicon.MAX_VALUE_EXCLUSIVE, PropertyType.LONG);
    processFacet(
        type.getMaxExclusiveFacet(), typeNode, XsdLexicon.MAX_VALUE_EXCLUSIVE, PropertyType.LONG);
    processFacet(
        type.getEffectiveMinFacet(), typeNode, XsdLexicon.MIN_VALUE_EXCLUSIVE, PropertyType.LONG);
    processFacet(
        type.getMinExclusiveFacet(), typeNode, XsdLexicon.MIN_VALUE_EXCLUSIVE, PropertyType.LONG);
    processFacet(
        type.getMaxInclusiveFacet(), typeNode, XsdLexicon.MAX_VALUE_INCLUSIVE, PropertyType.LONG);
    processFacet(
        type.getMinInclusiveFacet(), typeNode, XsdLexicon.MIN_VALUE_INCLUSIVE, PropertyType.LONG);
    processFacet(
        type.getEffectiveTotalDigitsFacet(), typeNode, XsdLexicon.TOTAL_DIGITS, PropertyType.LONG);
    processFacet(type.getTotalDigitsFacet(), typeNode, XsdLexicon.TOTAL_DIGITS, PropertyType.LONG);
    processFacet(
        type.getEffectiveFractionDigitsFacet(),
        typeNode,
        XsdLexicon.FRACTION_DIGITS,
        PropertyType.LONG);
    processFacet(
        type.getFractionDigitsFacet(), typeNode, XsdLexicon.FRACTION_DIGITS, PropertyType.LONG);

    processFacet(
        type.getEffectiveWhiteSpaceFacet(), typeNode, XsdLexicon.WHITESPACE, PropertyType.STRING);
    processFacet(type.getWhiteSpaceFacet(), typeNode, XsdLexicon.WHITESPACE, PropertyType.STRING);

    processFacet(
        type.getEffectivePatternFacet(), typeNode, XsdLexicon.PATTERN, PropertyType.STRING);
    @SuppressWarnings("unchecked")
    List<XSDPatternFacet> patternFacets = type.getPatternFacets();
    processFacetsList(patternFacets, typeNode, XsdLexicon.PATTERN);

    processFacet(
        type.getEffectiveEnumerationFacet(),
        typeNode,
        XsdLexicon.ENUMERATED_VALUES,
        PropertyType.STRING);
    @SuppressWarnings("unchecked")
    List<XSDEnumerationFacet> enumFacets = type.getEnumerationFacets();
    processFacetsList(enumFacets, typeNode, XsdLexicon.ENUMERATED_VALUES);

    @SuppressWarnings("unchecked")
    List<XSDSimpleFinal> finalFacets2 = type.getFinal();
    processEnumerators(finalFacets2, typeNode, XsdLexicon.FINAL);

    processAnnotation(type.getAnnotation(), typeNode);
  }