XSDVariety variety = typeDefinition.getVariety(); int varietyType = variety.getValue(); target = typeDefinition.getBaseTypeDefinition(); target = typeDefinition.getItemTypeDefinition(); List memberTypes = typeDefinition.getMemberTypeDefinitions(); if (memberTypes != null && memberTypes.size() > 0)
/** * This tests whether the specified simple type definition, * <code>s</code>, can accomodate the given constraining facet, * <code>f</code>, based on its existing facet children. */ protected boolean canAccomodateFacet(XSDSimpleTypeDefinition s, XSDConstrainingFacet f) { return (f instanceof XSDRepeatableFacet) || (f instanceof XSDLengthFacet && s.getLengthFacet() == null && s.getMinLengthFacet() == null && s.getMaxLengthFacet() == null) || (f instanceof XSDMinLengthFacet && s.getMinLengthFacet() == null && s.getLengthFacet() == null) || (f instanceof XSDMaxLengthFacet && s.getMaxLengthFacet() == null && s.getLengthFacet() == null) || (f instanceof XSDWhiteSpaceFacet && s.getWhiteSpaceFacet() == null) || (f instanceof XSDMinInclusiveFacet && s.getMinFacet() == null) || (f instanceof XSDMinExclusiveFacet && s.getMinFacet() == null) || (f instanceof XSDMaxInclusiveFacet && s.getMaxFacet() == null) || (f instanceof XSDMaxExclusiveFacet && s.getMaxFacet() == null) || (f instanceof XSDTotalDigitsFacet && s.getTotalDigitsFacet() == null) || (f instanceof XSDFractionDigitsFacet && s.getFractionDigitsFacet() == null); } }
public java.lang.Object[] getElements(java.lang.Object inputElement) { java.util.List list = new ArrayList(); if (inputElement instanceof XSDSimpleTypeDefinition) { XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) inputElement; return st.getEnumerationFacets().toArray(); } return list.toArray(); }
protected AttributeType createType( XSDSimpleTypeDefinition xsdType, int depth ) { if (types.containsKey(xsdType)) { return (AttributeType) types.get(xsdType); } //import? if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) { return (AttributeType) findType(xsdType); } //first build super type AttributeType superType = null; XSDTypeDefinition baseType = xsdType.getBaseType(); if ((baseType != null) && !baseType.equals(xsdType)) { if (baseType.getName() != null) { //ignore unamed types //superType = createType((XSDSimpleTypeDefinition)baseType); superType = createType(baseType, depth+1); assert superType != null; } } //TODO: actually derive valus from type AttributeType gtType = factory.createAttributeType( name(xsdType), Object.class, false, false, Collections.EMPTY_LIST, superType, null ); types.put(xsdType, gtType); return gtType; }
public boolean isFocusAllowed() { XSDSimpleTypeDefinition xsdSimpleTypeDefinition = (XSDSimpleTypeDefinition) target; if (XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace())) { return false; } if (xsdSimpleTypeDefinition.getName() == null) { return false; } return true; }
if (type.getVariety() == XSDVariety.LIST_LITERAL) { final XSDSimpleTypeDefinition itemType = type.getItemTypeDefinition(); List parsed = new ArrayList(); } else if (type.getVariety() == XSDVariety.UNION_LITERAL) { for (Iterator f = type.getFacets().iterator(); f.hasNext(); ) { XSDFacet facet = (XSDFacet) f.next();
if (type.getVariety() == XSDVariety.LIST_LITERAL) { if (type.getLengthFacet() != null) { XSDLengthFacet length = type.getLengthFacet(); if (type.getMaxLengthFacet() != null) { XSDMaxLengthFacet length = type.getMaxLengthFacet(); if (type.getMinLengthFacet() != null) { XSDMinLengthFacet length = type.getMinLengthFacet(); if (!type.getEnumerationFacets().isEmpty()) { for (Iterator e = type.getEnumerationFacets().iterator(); e.hasNext();) { XSDEnumerationFacet enumeration = (XSDEnumerationFacet) e.next(); final XSDSimpleTypeDefinition itemType = type.getItemTypeDefinition(); List parsed = new ArrayList(); } else if (type.getVariety() == XSDVariety.UNION_LITERAL) { for (Iterator f = type.getFacets().iterator(); f.hasNext();) { XSDFacet facet = (XSDFacet) f.next(); facets.add(facet);
(xsdSimpleTypeDefinition.getName() == null ? xsdSimpleTypeDefinition.getAliasName() : xsdSimpleTypeDefinition.getName()); XSDSimpleTypeDefinition baseTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition(); if (baseTypeDefinition != null && XSDVariety.ATOMIC_LITERAL == xsdSimpleTypeDefinition.getVariety()) if (baseTypeDefinition.getName() != null && !xsdSimpleTypeDefinition.getContents().contains(baseTypeDefinition) && !XSDConstants.isAnySimpleType(baseTypeDefinition)) result.append(baseTypeDefinition.getQName(xsdSimpleTypeDefinition)); XSDSimpleTypeDefinition itemTypeDefinition = xsdSimpleTypeDefinition.getItemTypeDefinition(); if (itemTypeDefinition != null) if (itemTypeDefinition.getName() != null) result.append(itemTypeDefinition.getQName()); List<XSDSimpleTypeDefinition> memberTypeDefinitions = xsdSimpleTypeDefinition.getMemberTypeDefinitions(); if (!memberTypeDefinitions.isEmpty()) for (XSDSimpleTypeDefinition memberTypeDefinition : memberTypeDefinitions) if (memberTypeDefinition.getName() != null) result.append(memberTypeDefinition.getQName());
else if (XSDConstants.isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTargetNamespace())) String name = xsdSimpleTypeDefinition.getName(); if (name != null) EDataType result = (EDataType)getBuiltInEClassifier(xsdSimpleTypeDefinition.getTargetNamespace(), "anyType".equals(name) ? "anySimpleType" : name); if (result != null) else if (xsdSimpleTypeDefinition.getContainer() == null) String name= xsdSimpleTypeDefinition.getName(); EDataType eDataType = (EDataType)extendedMetaData.getType(xsdSimpleTypeDefinition.getTargetNamespace(), name); if (eDataType != null) extendedMetaData.setName(eDataType, xsdSimpleTypeDefinition.getAliasName()); XSDSimpleTypeDefinition baseTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition(); if (baseTypeDefinition != null) extendedMetaData.setName(eDataType, xsdSimpleTypeDefinition.getAliasName()); if (baseTypeDefinition.getVariety() != xsdSimpleTypeDefinition.getVariety()) if (xsdSimpleTypeDefinition.getVariety() == XSDVariety.LIST_LITERAL) EDataType itemEDataType = getEDataType(xsdSimpleTypeDefinition.getItemTypeDefinition()); extendedMetaData.setItemType(eDataType, itemEDataType); eDataType.setInstanceTypeName("java.util.List");
if (theBaseTypeDefinition != null && theBaseTypeDefinition.getContainer() != null) if (!((XSDConcreteComponentImpl)theBaseTypeDefinition).analyze() && !XSDConstants.isURType(theBaseTypeDefinition) && theBaseTypeDefinition.isCircular()) newVariety = theBaseTypeDefinition.getVariety(); newPrimitiveTypeDefinition = theBaseTypeDefinition.getPrimitiveTypeDefinition(); newBounded = theBaseTypeDefinition.getBoundedFacet().isValue(); newCardinality = theBaseTypeDefinition.getCardinalityFacet().getValue(); newNumeric = theBaseTypeDefinition.getNumericFacet().isValue(); newOrdered = theBaseTypeDefinition.getOrderedFacet().getValue(); newValidFacets = theBaseTypeDefinition.getValidFacets(); if (XSDVariety.LIST_LITERAL == theBaseTypeDefinition.getVariety()) XSDSimpleTypeDefinition newItemTypeDefinition = theBaseTypeDefinition.getItemTypeDefinition(); if (newItemTypeDefinition != getItemTypeDefinition()) else if (XSDVariety.UNION_LITERAL == theBaseTypeDefinition.getVariety()) List<XSDSimpleTypeDefinition> newMemberTypeDefinitions = theBaseTypeDefinition.getMemberTypeDefinitions(); List<XSDSimpleTypeDefinition> remainingMemberTypeDefinitions = new ArrayList<XSDSimpleTypeDefinition>(getMemberTypeDefinitions()); remainingMemberTypeDefinitions.removeAll(newMemberTypeDefinitions); if (theItemTypeDefinition != null && theItemTypeDefinition.getContainer() != null) if (!((XSDConcreteComponentImpl)theItemTypeDefinition).analyze() && !XSDConstants.isURType(theItemTypeDefinition) && theItemTypeDefinition.isCircular()) if (theMemberTypeDefinition.getContainer() != null)
String maxValue = maxLengthText.getText().trim(); XSDLengthFacet lengthFacet = xsdSimpleTypeDefinition.getLengthFacet(); XSDMinLengthFacet minLengthFacet = xsdSimpleTypeDefinition.getMinLengthFacet(); XSDMaxLengthFacet maxLengthFacet = xsdSimpleTypeDefinition.getMaxLengthFacet(); XSDMinInclusiveFacet minInclusiveFacet = xsdSimpleTypeDefinition.getMinInclusiveFacet(); XSDMinExclusiveFacet minExclusiveFacet = xsdSimpleTypeDefinition.getMinExclusiveFacet(); XSDMaxInclusiveFacet maxInclusiveFacet = xsdSimpleTypeDefinition.getMaxInclusiveFacet(); XSDMaxExclusiveFacet maxExclusiveFacet = xsdSimpleTypeDefinition.getMaxExclusiveFacet(); if (XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001.equals(xsdSimpleTypeDefinition.getTargetNamespace()) && (doUpdateMax || doUpdateMin)) anonymousSimpleType.setBaseTypeDefinition(xsdSimpleTypeDefinition);
if (attributeTypeDefinition.getVariety() == XSDVariety.LIST_LITERAL) XSDLengthFacet xsdLengthFacet = attributeTypeDefinition.getEffectiveLengthFacet(); if (isRequired) XSDMinLengthFacet xsdMinLengthFacet = attributeTypeDefinition.getEffectiveMinLengthFacet(); if (xsdMinLengthFacet != null) XSDMaxLengthFacet xsdMaxLengthFacet = attributeTypeDefinition.getEffectiveMaxLengthFacet(); if (xsdMaxLengthFacet != null) attributeTypeDefinition.getVariety() == XSDVariety.LIST_LITERAL && xsdComponent instanceof XSDAttributeUse && "true".equals(getEcoreAttribute(xsdComponent, "many")); if (isMany) EDataType eDataType = getEDataType(attributeTypeDefinition.getItemTypeDefinition()); XSDLengthFacet xsdLengthFacet = attributeTypeDefinition.getEffectiveLengthFacet(); int lowerBound = isRequired ? 1 : 0; int upperBound = -1; XSDMinLengthFacet xsdMinLengthFacet = attributeTypeDefinition.getEffectiveMinLengthFacet(); if (xsdMinLengthFacet != null) XSDMaxLengthFacet xsdMaxLengthFacet = attributeTypeDefinition.getEffectiveMaxLengthFacet(); if (xsdMaxLengthFacet != null)
if (theBaseTypeDefinition != null && (forceResolve || theBaseTypeDefinition.getContainer() == null)) theBaseTypeDefinition = resolveSimpleTypeDefinition(theBaseTypeDefinition.getTargetNamespace(), theBaseTypeDefinition.getName()); if (theBaseTypeDefinition == null || !theBaseTypeDefinition.isSetVariety() || theBaseTypeDefinition.getVariety() != getVariety()) if (forceResolve || theItemTypeDefinition.getContainer() == null) resolveSimpleTypeDefinition(theItemTypeDefinition.getTargetNamespace(), theItemTypeDefinition.getName()); if (forceResolve || newItemTypeDefinition.getContainer() != null && newItemTypeDefinition != theItemTypeDefinition) if (forceResolve || theMemberTypeDefinition.getContainer() == null) resolveSimpleTypeDefinition(theMemberTypeDefinition.getTargetNamespace(), theMemberTypeDefinition.getName()); if (forceResolve || newMemberTypeDefinition.getContainer() != null && newMemberTypeDefinition != theMemberTypeDefinition)
XSDTypeDefinition baseType = simpleType.getBaseTypeDefinition(); Element derivedBy = domHelper.getDerivedByElement(simpleType.getElement()); if (derivedBy != null && derivedBy instanceof IDOMNode) XSDSimpleTypeDefinition itemType = simpleType.getItemTypeDefinition(); if (itemType != null) String ns = itemType.getTargetNamespace(); if (ns == null) ns = ""; if (ns.equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) Node listNode = domHelper.getChildNode(simpleType.getElement(), XSDConstants.LIST_ELEMENT_TAG); if (listNode != null && listNode instanceof Element) listElement.setAttribute(XSDConstants.ITEMTYPE_ATTRIBUTE, getNewQName(itemType, itemType.getName(), newPrefix)); List memberTypes = simpleType.getMemberTypeDefinitions(); if (memberTypes.size() > 0) Node unionNode = domHelper.getChildNode(simpleType.getElement(), XSDConstants.UNION_ELEMENT_TAG); if (unionNode != null && unionNode instanceof Element) String ns = st.getTargetNamespace(); if (ns == null) ns = ""; if (ns.equals(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001)) sb.append(getNewQName(st, st.getName(), newPrefix));
public static boolean isLocalReferenceType(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) { while (xsdSimpleTypeDefinition != null) { if (XSDConstants.isAnySimpleType(xsdSimpleTypeDefinition)) { return false; } String name = xsdSimpleTypeDefinition.getName(); if (XSDConstants.isSchemaForSchemaNamespace(xsdSimpleTypeDefinition.getTargetNamespace()) && ("IDREF".equals(name) || "IDREFS".equals(name))) { return true; } xsdSimpleTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition(); } return false; }
for (XSDFacet xsdFacet : xsdSimpleTypeDefinition.getFacetContents()) XSDSimpleTypeDefinition baseTypeDefinition = xsdSimpleTypeDefinition.getBaseTypeDefinition(); if (baseTypeDefinition != null) for (XSDConstrainingFacet xsdConstrainingFacet : baseTypeDefinition.getFacets()) if (xsdFixedFacet.isFixed() && !baseTypeDefinition.equalValues(getEffectiveValue(), xsdFixedFacet.getEffectiveValue())) theElement, XSDConstants.VALUE_ATTRIBUTE, new Object [] { getLexicalValue(), xsdFixedFacet.getLexicalValue(), getFacetName(), baseTypeDefinition.getURI() }); xsdDiagnostic.getComponents().add(xsdFixedFacet);
switch (xsdSimpleTypeDefinition.getVariety().getValue()) result = baseName + (XSDConstants.isURType(xsdSimpleTypeDefinition.getBaseTypeDefinition()) ? "_._item" : "_._base"); break; (XSDConstants.isURType(xsdSimpleTypeDefinition.getBaseTypeDefinition()) ? "_._member" + "_._" + xsdSimpleTypeDefinition.getMemberTypeDefinitions().indexOf(this) : "_._base"); break;
else if (theBaseTypeDefinition.getContainer() == null) createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "_UI_UnresolvedTypeDefinition_message", theBaseTypeDefinition.getURI()); if (theBaseTypeDefinition.getFinal().contains(XSDSimpleFinal.RESTRICTION_LITERAL)) createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cos-st-restricts.1.2", theBaseTypeDefinition.getURI()); createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cos-st-retricts.0.0", theBaseTypeDefinition.getURI()); if (theBaseTypeDefinition.getFinal().contains(XSDSimpleFinal.RESTRICTION_LITERAL)) createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cos-st-restricts.1.2", theBaseTypeDefinition.getURI()); else if (theItemTypeDefinition.getContainer() == null) (XSDDiagnosticSeverity.ERROR_LITERAL, "_UI_UnresolvedTypeDefinition_message", theItemTypeDefinition.getURI()); else if (XSDVariety.ATOMIC_LITERAL != theItemTypeDefinition.getVariety() && XSDVariety.UNION_LITERAL != theItemTypeDefinition.getVariety()) else if (theItemTypeDefinition.getFinal().contains(XSDSimpleFinal.LIST_LITERAL)) createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cos-st-restricts.2.0", theBaseTypeDefinition.getURI()); createDiagnostic(XSDDiagnosticSeverity.ERROR_LITERAL, "cos-st-retricts.0.1", theItemTypeDefinition.getURI()); if (theBaseTypeDefinition.getFinal().contains(XSDSimpleFinal.RESTRICTION_LITERAL))
public void refreshStringLength() XSDMinLengthFacet minLengthFacet = xsdSimpleTypeDefinition.getMinLengthFacet(); XSDMaxLengthFacet maxLengthFacet = xsdSimpleTypeDefinition.getMaxLengthFacet(); XSDLengthFacet lengthFacet = xsdSimpleTypeDefinition.getLengthFacet();
if (baseType instanceof XSDSimpleTypeDefinition) XSDVariety variety = simpleType.getVariety(); if (variety.getValue() == XSDVariety.ATOMIC) simpleType.setBaseTypeDefinition((XSDSimpleTypeDefinition) baseType); simpleType.getMemberTypeDefinitions().add(baseType); simpleType.setItemTypeDefinition((XSDSimpleTypeDefinition) baseType);