Exemplo n.º 1
0
 /**
  * Return the type definition for the primitive with name xsdName (note, this is not the
  * human-readable name, but the actual XSD type name.) Return null if a type with this name is not
  * in the list of all primitives
  *
  * @param xsdName
  * @return the simple type definition with the given xsdName
  */
 public static XSDSimpleTypeDefinition getPrimitive(String xsdName) {
   for (XSDSimpleTypeDefinition next : getAdvancedPrimitives()) {
     if (next.getName().equals(xsdName)) {
       return next;
     }
   }
   return null;
 }
Exemplo n.º 2
0
  protected void processSimpleTypeDefinition(XSDSimpleTypeDefinition type, Node node)
      throws RepositoryException {
    boolean isAnonymous = type.getName() == null;
    String nodeName = isAnonymous ? XsdLexicon.SIMPLE_TYPE : type.getName();
    // This is a normal simple type definition ...
    logger.debug("Simple type: '{0}' in ns '{1}' ", type.getName(), type.getTargetNamespace());

    Node typeNode = node.addNode(nodeName, XsdLexicon.SIMPLE_TYPE_DEFINITION);
    typeNode.setProperty(XsdLexicon.NAMESPACE, type.getTargetNamespace());
    if (!isAnonymous) {
      typeNode.setProperty(XsdLexicon.NC_NAME, type.getName());
      registerForSymbolSpace(
          TYPE_DEFINITIONS, type.getTargetNamespace(), type.getName(), typeNode.getIdentifier());
    }
    processTypeFacets(type, typeNode, type.getBaseType());
    processNonSchemaAttributes(type, typeNode);
  }
Exemplo n.º 3
0
  public static boolean needsNumeric(XSDSimpleTypeDefinition simpleType) {
    // check main first:
    if (ModelerCore.getWorkspaceDatatypeManager().isNumeric(simpleType)) return true;

    // above only checks against decimal:
    XSDSimpleTypeDefinition base = simpleType.getBaseTypeDefinition();

    if (base != null) {
      String basename = base.getName();
      for (int i = 0; i < NUMERIC_TYPES.length; i++) {
        String numericTypeName = NUMERIC_TYPES[i];
        if (numericTypeName.equalsIgnoreCase(basename)) {
          return true;
        } // endif
      } // endfor
    } // endif

    return false;
  }