Refine search
public void simpleType(XSSimpleType simpleType) { if (simpleType.getName() != null) { typeNames.add(new QName(simpleType.getTargetNamespace(), simpleType .getName())); if (simpleType.isRestriction()) { final XSType baseType = simpleType.asRestriction() .getBaseType(); if (baseType != null) { baseType.visit(this); } } if (simpleType.isList()) { final XSSimpleType itemType = simpleType.asList().getItemType(); if (itemType != null) { itemType.visit(this); } } // simpleType.getSimpleBaseType() } }
String typeName = xs.getName(); String namespace = xs.getTargetNamespace(); if (xs.getFacet("enumeration") != null) { typeName = elementName != null ? elementName + "Type" : generateAnonymousName(); if (xs.isRestriction() && xs.getFacet("enumeration") != null) { createEnum(typeName, namespace, xs.asRestriction()); } else { xs = xs.getBaseType().asSimpleType(); if (xs != null) { baseTypeName = xs.getName(); simpleTypes.put(typeName, xs != null ? xs.getName() : "string");
@Override public QName simpleType(final XSSimpleType type) { if (type.getName() == null) { return new QName(type.getTargetNamespace(), "anonymousSimpleType"); } else { return new QName(type.getTargetNamespace(), type.getName()); } }
private String findBaseConversion(XSSimpleType owner) { // find the base simple type mapping. for( XSSimpleType st=owner; st!=null; st = st.getSimpleBaseType() ) { if( !WellKnownNamespace.XML_SCHEMA.equals(st.getTargetNamespace()) ) continue; // user-defined type String name = st.getName().intern(); for( String s : knownBases ) if(name.equalsIgnoreCase(s)) return s; } return null; }
public void listSimpleType( XSListSimpleType type ) { XSSimpleType itemType = type.getItemType(); if(itemType.isLocal()) { println("<list>"); indent++; simpleType(itemType); indent--; println("</list>"); } else { // global type println(MessageFormat.format("<list itemType=\"'{'{0}'}'{1}\" />", itemType.getTargetNamespace(), itemType.getName())); } }
private OntClass convertRestriction(String mainURI, XSSimpleType simple, String URI) { XSRestrictionSimpleType restriction = simple.asRestriction(); if (baseType.isRestriction()) { baseFacets.initFacets(baseType.asRestriction()); Resource onDatatype = null; if (baseType.getTargetNamespace().equals(XSDDatatype.XSD)) { onDatatype = XSDUtil.getXSDResource(baseType.getName()); } else if (baseFacets.enumeration != null) { onDatatype = ontology.createResource(baseURI);
public CElement simpleType(XSSimpleType type) { CElement c = allow(type,type.getName()); if(c!=null) return c; if(getGlobalBinding().isSimpleTypeSubstitution() && type.isGlobal()) { return new CClassInfo(model,selector.getClassScope(), deriveName(type), type.getLocator(), getName(type), null, type, null ); } return never(); }
public SimpleTypeDefinition createSimpleTypeDefinition(XSSimpleType simpleType, PrismContext prismContext, XSAnnotation annotation) throws SchemaException { QName typeName = new QName(simpleType.getTargetNamespace(), simpleType.getName()); XSType baseType = simpleType.getBaseType(); QName baseTypeName = baseType != null ? new QName(baseType.getTargetNamespace(), baseType.getName()) : null; SimpleTypeDefinition.DerivationMethod derivationMethod; switch (simpleType.getDerivationMethod()) { case XSSimpleType.EXTENSION: derivationMethod = EXTENSION; break; case XSSimpleType.RESTRICTION: derivationMethod = RESTRICTION; break; case XSSimpleType.SUBSTITUTION: derivationMethod = SUBSTITUTION; break; default: derivationMethod = null; // TODO are combinations allowed? e.g. EXTENSION+SUBSTITUTION? } return new SimpleTypeDefinitionImpl(typeName, baseTypeName, derivationMethod, prismContext); }
private BigInteger readFacet(String facetName,int offset) { XSFacet me = initiatingType.getFacet(facetName); if(me==null) return null; BigInteger bi = DatatypeConverter.parseInteger(me.getValue().value); if(offset!=0) bi = bi.add(BigInteger.valueOf(offset)); return bi; }
private void write(Struct st, XSAttributeDecl decl, boolean goingup) { if (decl.getType().isRestriction() && (decl.getType().getName() == null || !basicTypes .contains(decl.getType().getName()))) { String typeName = processSimpleType(decl.getType(), decl.getName()); st.addField(decl.getName(), typeName, goingup, false, decl.getFixedValue(), xsdMapping); } else if (decl.getType().isList()) { st.addField(decl.getName(), decl.getType().asList().getItemType() .getName(), goingup, true, null, xsdMapping); } else { st.addField(decl.getName(), decl.getType().getName(), goingup, false, decl.getFixedValue(), xsdMapping); } }
if (notAnnotated(fieldVar, ANNOTATION_SIZE) && isSizeAnnotationApplicable(fieldType)) { try { if ((facet = simpleType.getFacet(FACET_LENGTH)) != null) { int length = Integer.parseInt(facet.getValue().value); a.put(fieldVar.annotate(ANNOTATION_SIZE).param("min", length).param("max", length), FacetType.length); } else { Integer minLength = (facet = simpleType.getFacet(FACET_MINLENGTH)) != null ? Integer.parseInt(facet.getValue().value) : null; Integer maxLength = (facet = simpleType.getFacet(FACET_MAXLENGTH)) != null ? Integer.parseInt(facet.getValue().value) : null; String msg = "'" + facet.getName() + "' in '" + simpleType.getName() + "' cannot be parsed."; throw new RuntimeException(new SAXParseException(msg, facet.getLocator(), nfe)); if ((facet = simpleType.getFacet(FACET_MAXINCLUSIVE)) != null && isNumberOrCharSequence(fieldType, false)) { String maxIncValue = facet.getValue().value; if (notAnnotatedAndNotDefaultBoundary(fieldVar, ANNOTATION_DECIMALMAX, maxIncValue)) { if ((facet = simpleType.getFacet(FACET_MININCLUSIVE)) != null && isNumberOrCharSequence(fieldType, false)) { String minIncValue = facet.getValue().value; if (notAnnotatedAndNotDefaultBoundary(fieldVar, ANNOTATION_DECIMALMIN, minIncValue)) { if ((facet = simpleType.getFacet(FACET_MAXEXCLUSIVE)) != null && isNumberOrCharSequence(fieldType, false)) { String maxExcValue = facet.getValue().value; if (!jsr303) { // ~ if jsr349 if ((facet = simpleType.getFacet(FACET_MINEXCLUSIVE)) != null && isNumberOrCharSequence(fieldType, false)) { String minExcValue = facet.getValue().value; if (!jsr303) { // ~ if jsr349 if ((facet = simpleType.getFacet(FACET_TOTALDIGITS)) != null && isNumberOrCharSequence(fieldType, true)) {
public Iterator<XSFacet> simpleType(XSSimpleType type) { // TODO: it's not clear if "facets" mean all inherited facets or just declared facets XSRestrictionSimpleType r = type.asRestriction(); if(r!=null) return r.iterateDeclaredFacets(); else return empty(); }
public void processType(XSSimpleType simpleType, JFieldVar field, String propertyName, String className) { if (!hasAnnotation(field, Size.class) && isSizeAnnotationApplicable(field)) { Integer maxLength = simpleType.getFacet("maxLength") == null ? null : Utils.parseInt(simpleType.getFacet( "maxLength").getValue().value); Integer minLength = simpleType.getFacet("minLength") == null ? null : Utils.parseInt(simpleType.getFacet( "minLength").getValue().value); Integer length = simpleType.getFacet("length") == null ? null : Utils.parseInt(simpleType.getFacet( "length").getValue().value); Integer maxLength = simpleType.getFacet("maxLength") == null ? null : Utils.parseInt(simpleType.getFacet( "maxLength").getValue().value); if (maxLength != null) { XSFacet maxInclusive = simpleType.getFacet("maxInclusive"); if (maxInclusive != null && Utils.isNumber(field) && isValidValue(maxInclusive) && !hasAnnotation(field, DecimalMax.class)) { XSFacet minInclusive = simpleType.getFacet("minInclusive"); if (minInclusive != null && Utils.isNumber(field) && isValidValue(minInclusive) && !hasAnnotation(field, DecimalMin.class)) { XSFacet maxExclusive = simpleType.getFacet("maxExclusive"); if (maxExclusive != null && Utils.isNumber(field) && isValidValue(maxExclusive) && !hasAnnotation(field, DecimalMax.class)) { XSFacet minExclusive = simpleType.getFacet("minExclusive"); if (minExclusive != null && Utils.isNumber(field) && isValidValue(minExclusive) && !hasAnnotation(field, DecimalMin.class)) { if (simpleType.getFacet("totalDigits") != null && Utils.isNumber(field)) {
private void write(Struct st, XSAttGroupDecl attGroup, boolean goingup) { Iterator<? extends XSAttributeUse> it; Iterator<? extends XSAttGroupDecl> itg; XSAttributeUse att; XSAttributeDecl decl; itg = attGroup.getAttGroups().iterator(); while (itg.hasNext()) { write(st, itg.next(), goingup); } it = attGroup.getDeclaredAttributeUses().iterator(); while (it.hasNext()) { att = it.next(); decl = att.getDecl(); if (decl.getType().getName() == null) { if (decl.getType().isRestriction()) { String typeName = processSimpleType(decl.getType(), decl.getName()); st.addField(decl.getName(), typeName, (goingup && att.isRequired()), false, decl.getFixedValue(), xsdMapping); } } else { write(st, decl, att.isRequired()); } } }
private <T> Collection<? extends DisplayableValue<T>> parseEnumAllowedValues(QName typeName, ComplexTypeDefinition ctd, XSType xsType) { if (xsType.isSimpleType()) { if (xsType.asSimpleType().isRestriction()) { XSRestrictionSimpleType restriction = xsType.asSimpleType().asRestriction(); List<XSFacet> enumerations = restriction.getDeclaredFacets(XSFacet.FACET_ENUMERATION); List<DisplayableValueImpl<T>> enumValues = new ArrayList<>(
if ((facet = simpleType.getFacet(FACET_LENGTH)) != null) { int length = Integer.valueOf(facet.getValue().value); a.put(fieldVar.annotate(sizeAnn).param("min", length).param("max", length), FacetType.length); } else { Integer minLength = (facet = simpleType.getFacet(FACET_MINLENGTH)) != null ? Integer.valueOf(facet.getValue().value) : null; Integer maxLength = (facet = simpleType.getFacet(FACET_MAXLENGTH)) != null ? Integer.valueOf(facet.getValue().value) : null; if ((facet = simpleType.getFacet(FACET_MAXINCLUSIVE)) != null && isNumberOrCharSequence(fieldType, false)) { String maxIncValue = facet.getValue().value; if (notAnnotatedAndNotDefaultBoundary(fieldVar, decimalMaxAnn, maxIncValue)) { if ((facet = simpleType.getFacet(FACET_MININCLUSIVE)) != null && isNumberOrCharSequence(fieldType, false)) { String minIncValue = facet.getValue().value; if (notAnnotatedAndNotDefaultBoundary(fieldVar, decimalMinAnn, minIncValue)) { if ((facet = simpleType.getFacet(FACET_MAXEXCLUSIVE)) != null && isNumberOrCharSequence(fieldType, false)) { String maxExcValue = facet.getValue().value; if (!jsr303) { // ~ if jsr349 if ((facet = simpleType.getFacet(FACET_MINEXCLUSIVE)) != null && isNumberOrCharSequence(fieldType, false)) { String minExcValue = facet.getValue().value; if (!jsr303) // ~ if jsr349 if ((facet = simpleType.getFacet(FACET_TOTALDIGITS)) != null && isNumberOrCharSequence(fieldType, true)) { Integer digits = Integer.valueOf(facet.getValue().value); if (digits != null) { XSFacet fractionDigits = simpleType.getFacet(FACET_FRACTIONDIGITS); int fractionDigs = fractionDigits == null ? 0 : Integer.valueOf(fractionDigits.getValue().value); if (notAnnotated(fieldVar, digitsAnn))
public void simpleType(XSSimpleType simpleType) { if (shouldWalk && visited.add(simpleType.getBaseType())) simpleType.getBaseType().visit(this); }
public void unionSimpleType(XSUnionSimpleType type) { if(check(type)) { for( int i=0; i<type.getMemberSize(); i++ ) type.getMember(i).visit((XSSimpleTypeVisitor)this); } }
public List<XSFacet> getFacets( String name ) { List<XSFacet> f = getDeclaredFacets(name); if(!f.isEmpty()) return f; // none was found on this datatype. check the base type. return getSimpleBaseType().getFacets(name); }