Exemplo n.º 1
0
  private AttributeType<?> toBasicType(QName qName) {

    if (Constants.XSD_STRING.equals(qName)) {
      return BasicTypes.STRING_TYPE;
    }
    if (Constants.XSD_DATETIME.equals(qName) || Constants.XSD_DATE.equals(qName)) {
      return BasicTypes.DATE_TYPE;
    }
    if (Constants.XSD_BOOLEAN.equals(qName)) {
      return BasicTypes.BOOLEAN_TYPE;
    }
    if (Constants.XSD_DOUBLE.equals(qName)) {
      return BasicTypes.DOUBLE_TYPE;
    }
    if (Constants.XSD_FLOAT.equals(qName)) {
      return BasicTypes.FLOAT_TYPE;
    }
    if (Constants.XSD_INT.equals(qName)) {
      return BasicTypes.INTEGER_TYPE;
    }
    if (Constants.XSD_LONG.equals(qName)) {
      return BasicTypes.LONG_TYPE;
    }
    if (Constants.XSD_SHORT.equals(qName)) {
      return BasicTypes.SHORT_TYPE;
    }

    // these types are unbounded and unsafe to map to any BasicTypes number values.
    // Potentially the catalog should support a BigInteger type for these types to map to
    if (Constants.XSD_INTEGER.equals(qName)
        || Constants.XSD_POSITIVEINTEGER.equals(qName)
        || Constants.XSD_NEGATIVEINTEGER.equals(qName)
        || Constants.XSD_NONPOSITIVEINTEGER.equals(qName)
        || Constants.XSD_NONNEGATIVEINTEGER.equals(qName)) {
      return BasicTypes.STRING_TYPE;
    }
    return null;
  }
Exemplo n.º 2
0
  private void processSimpleType(XmlSchemaElement xmlSchemaElement) {
    QName qName = xmlSchemaElement.getSchemaTypeName();
    String name = xmlSchemaElement.getName();
    AttributeType<?> attributeType = toBasicType(qName);

    if (attributeType != null) {
      boolean multiValued = xmlSchemaElement.getMaxOccurs() > 1 ? true : false;
      descriptors.add(
          new FeatureAttributeDescriptor(
              propertyPrefix + name,
              name,
              isQueryable(name) /* indexed */,
              true /* stored */,
              false /* tokenized */,
              multiValued,
              attributeType));
    }
    if (Constants.XSD_STRING.equals(qName)) {
      textualProperties.add(propertyPrefix + name);
    }

    properties.add(propertyPrefix + name);
  }