本文整理汇总了Java中org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction类的典型用法代码示例。如果您正苦于以下问题:Java XmlSchemaSimpleTypeRestriction类的具体用法?Java XmlSchemaSimpleTypeRestriction怎么用?Java XmlSchemaSimpleTypeRestriction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaSimpleTypeRestriction类属于org.apache.ws.commons.schema包,在下文中一共展示了XmlSchemaSimpleTypeRestriction类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: walkSimpleTypeRestriction
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
protected void walkSimpleTypeRestriction(XmlSchema xmlSchema, XmlSchemaSimpleTypeRestriction obj) {
walkAnnotated(xmlSchema, obj);
QName qname = obj.getBaseTypeName();
if ((qname != null) && (deep)) {
walkByTypeName(xmlSchema, qname);
} else {
XmlSchemaSimpleType type = obj.getBaseType();
if (type != null) {
walkSimpleType(xmlSchema, type);
}
}
XmlSchemaObjectCollection facets = obj.getFacets();
for (int i = 0; i < facets.getCount(); i++) {
XmlSchemaFacet facet = (XmlSchemaFacet) facets.getItem(i);
walkFacet(xmlSchema, facet);
}
}
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:19,代码来源:XmlSchemaWalker.java
示例2: createAlphaXmlSchemaSimpleType
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* Create a simple type for an alphanumeric type.
* <p>
* COBOL alphanumeric fields are fixed length so we create a facet to
* enforce that constraint. A pattern derived from the picture clause can
* also be used as a facet. If the item has children conditions, we add
* enumeration facets
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @param xsdTypeName the XML schema built-in type name to use as a
* restriction
* @return an XML schema simple type
*/
protected XmlSchemaSimpleType createAlphaXmlSchemaSimpleType(
final XsdDataItem xsdDataItem, final String xsdTypeName) {
XmlSchemaSimpleTypeRestriction restriction = createRestriction(xsdTypeName);
if (xsdDataItem.getLength() > -1) {
restriction.getFacets().add(
createMaxLengthFacet(xsdDataItem.getLength()));
}
if (xsdDataItem.getPattern() != null) {
restriction.getFacets().add(
createPatternFacet(xsdDataItem.getPattern()));
}
addEnumerationFacets(xsdDataItem, restriction);
return createXmlSchemaSimpleType(restriction);
}
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:29,代码来源:XsdEmitter.java
示例3: createAlphaXmlSchemaSimpleType
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* Create a simple type for an alphanumeric type.
* <p/>
* COBOL alphanumeric fields are fixed length so we create a facet to
* enforce that constraint. A pattern derived from the picture clause can
* also be used as a facet. If the item has children conditions, we add
* enumeration facets
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @param xsdTypeName the XML schema built-in type name to use as a
* restriction
* @return an XML schema simple type
*/
protected XmlSchemaSimpleType createAlphaXmlSchemaSimpleType(
final XsdDataItem xsdDataItem, final String xsdTypeName) {
XmlSchemaSimpleTypeRestriction restriction = createRestriction(xsdTypeName);
if (xsdDataItem.getLength() > -1) {
restriction.getFacets().add(
createMaxLengthFacet(xsdDataItem.getLength()));
}
if (xsdDataItem.getPattern() != null) {
restriction.getFacets().add(
createPatternFacet(xsdDataItem.getPattern()));
}
addEnumerationFacets(xsdDataItem, restriction);
return createXmlSchemaSimpleType(restriction);
}
开发者ID:legsem,项目名称:legstar-core2,代码行数:29,代码来源:XsdEmitter.java
示例4: getSimpleTypeName
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
private static final QName getSimpleTypeName(final XmlSchemaSimpleType simpleType) {
final QName typeName = simpleType.getQName();
if (null == typeName) {
// The type is anonymous.
final XmlSchemaSimpleTypeContent content = simpleType.getContent();
if (content instanceof XmlSchemaSimpleTypeRestriction) {
final XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
return restriction.getBaseTypeName();
} else if (content instanceof XmlSchemaSimpleTypeList) {
final XmlSchemaSimpleTypeList list = (XmlSchemaSimpleTypeList) content;
return list.getItemTypeName();
} else {
throw new AssertionError(content);
}
} else {
return typeName;
}
}
开发者ID:inbloom,项目名称:secure-data-service,代码行数:19,代码来源:Xsd2UmlConvert.java
示例5: walkSimpleType
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
protected void walkSimpleType(XmlSchema xmlSchema, XmlSchemaSimpleType obj) {
walkAnnotated(xmlSchema, obj);
XmlSchemaSimpleTypeContent simpleTypeContent = obj.getContent();
if (simpleTypeContent != null) {
if (simpleTypeContent instanceof XmlSchemaSimpleTypeRestriction) {
walkSimpleTypeRestriction(xmlSchema, (XmlSchemaSimpleTypeRestriction)simpleTypeContent);
} else if (simpleTypeContent instanceof XmlSchemaSimpleTypeList) {
walkSimpleTypeList(xmlSchema, (XmlSchemaSimpleTypeList)simpleTypeContent);
} else if (simpleTypeContent instanceof XmlSchemaSimpleTypeUnion) {
walkSimpleTypeUnion(xmlSchema, (XmlSchemaSimpleTypeUnion)simpleTypeContent);
}
}
}
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:14,代码来源:XmlSchemaWalker.java
示例6: createXmlSchemaSimpleType
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* Create an XML schema simple type from a restriction.
*
* @param restriction the XML schema restriction
* @return the XML schema simple type
*/
protected XmlSchemaSimpleType createXmlSchemaSimpleType(
final XmlSchemaSimpleTypeRestriction restriction) {
XmlSchemaSimpleType xmlSchemaSimpleType = new XmlSchemaSimpleType(
getXsd());
xmlSchemaSimpleType.setContent(restriction);
return xmlSchemaSimpleType;
}
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:14,代码来源:XsdEmitter.java
示例7: createRestriction
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* Create an XML schema restriction.
*
* @param xsdTypeName the XML schema built-in type name to use as a
* restriction
* @return an XML schema restriction
*/
protected XmlSchemaSimpleTypeRestriction createRestriction(
final String xsdTypeName) {
XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
restriction.setBaseTypeName(new QName(
XMLConstants.W3C_XML_SCHEMA_NS_URI, xsdTypeName));
return restriction;
}
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:15,代码来源:XsdEmitter.java
示例8: createXmlSchemaSimpleType
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* Create an XML schema simple type from a restriction.
*
* @param restriction the XML schema restriction
* @return the XML schema simple type
*/
protected XmlSchemaSimpleType createXmlSchemaSimpleType(
final XmlSchemaSimpleTypeRestriction restriction) {
XmlSchemaSimpleType xmlSchemaSimpleType = new XmlSchemaSimpleType(
getXsd(), false);
xmlSchemaSimpleType.setContent(restriction);
return xmlSchemaSimpleType;
}
开发者ID:legsem,项目名称:legstar-core2,代码行数:14,代码来源:XsdEmitter.java
示例9: writeSchema
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
@Override
public void writeSchema(XmlSchema root) {
if (serializedWhenUnknown) {
XmlSchemaSimpleType simple = new XmlSchemaSimpleType(root, true);
simple.setName("serializedJavaObject");
XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
simple.setContent(restriction);
restriction.setBaseTypeName(XmlSchemaConstants.BASE64BINARY_QNAME);
}
}
开发者ID:claudemamo,项目名称:jruby-cxf,代码行数:11,代码来源:ObjectType.java
示例10: getSimpleContentTypeName
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
private QName getSimpleContentTypeName(XmlSchemaSimpleType schemaSimpleType) {
QName simpleContentTypeName = null;
if (schemaSimpleType.getContent() != null
&& schemaSimpleType.getContent() instanceof XmlSchemaSimpleTypeRestriction) {
XmlSchemaSimpleTypeRestriction simpleContent = (XmlSchemaSimpleTypeRestriction) schemaSimpleType
.getContent();
simpleContentTypeName = simpleContent.getBaseTypeName();
} else {
throw new RuntimeException("Unsupported simple content model: "
+ schemaSimpleType.getContent().getClass().getCanonicalName());
}
return simpleContentTypeName;
}
开发者ID:inbloom,项目名称:secure-data-service,代码行数:14,代码来源:XsdToNeutralSchemaRepo.java
示例11: decorateText
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
public String decorateText(String text, Object element) {
String decoratedText = text;
if (element != null) {
if (element instanceof XmlSchemaObject) {
XmlSchemaObject xso = (XmlSchemaObject) element;
XmlSchemaType type = null;
String value = null;
if (element instanceof XmlSchemaElement) {
type = SchemaMeta.getType(xso, ((XmlSchemaElement) element).getSchemaTypeName());
} else if (element instanceof XmlSchemaAttribute) {
XmlSchemaAttribute attr = (XmlSchemaAttribute) element;
type = SchemaMeta.getType(xso, attr.getSchemaTypeName());
value = attr.getDefaultValue();
value = value == null ? attr.getFixedValue() : "default:" + value;
} else if (element instanceof XmlSchemaSimpleContentExtension) {
type = SchemaMeta.getType(xso, ((XmlSchemaSimpleContentExtension) element).getBaseTypeName());
} else if (element instanceof XmlSchemaSimpleTypeRestriction) {
type = SchemaMeta.getType(xso, ((XmlSchemaSimpleTypeRestriction) element).getBaseTypeName());
} else if (element instanceof XmlSchemaEnumerationFacet) {
XmlSchemaEnumerationFacet enumerationFacet = (XmlSchemaEnumerationFacet) element;
decoratedText += " [" + enumerationFacet.getValue() + "]";
}
if (value != null) {
decoratedText += " {" + value + "}";
}
if (type != null && type instanceof XmlSchemaSimpleType) {
decoratedText += " [" + SchemaMeta.getPrefix(type) + ":" + type.getName() + "]";
}
int size = SchemaMeta.getReferencedDatabaseObjects(xso).size();
if (size > 1 || size >= 0 && element instanceof XmlSchemaComplexType && ((XmlSchemaComplexType) element).getName() != null) {
decoratedText += " (" + size + ")";
}
String prefix = SchemaMeta.getPrefix(xso);
if (prefix != null) {
decoratedText = prefix + ":" + decoratedText;
}
}
}
return decoratedText;
}
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:47,代码来源:SchemaViewLabelDecorator.java
示例12: walk
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
protected void walk(XmlSchema xmlSchema, XmlSchemaObject obj) {
if (obj instanceof XmlSchema) {
walk((XmlSchema) obj);
} else if (obj instanceof XmlSchemaElement) {
walkElement(xmlSchema, (XmlSchemaElement) obj);
} else if (obj instanceof XmlSchemaSimpleType) {
walkSimpleType(xmlSchema, (XmlSchemaSimpleType) obj);
} else if (obj instanceof XmlSchemaSimpleTypeRestriction) {
walkSimpleTypeRestriction(xmlSchema, (XmlSchemaSimpleTypeRestriction) obj);
} else if (obj instanceof XmlSchemaSimpleTypeList) {
walkSimpleTypeList(xmlSchema, (XmlSchemaSimpleTypeList) obj);
} else if (obj instanceof XmlSchemaSimpleTypeUnion) {
walkSimpleTypeUnion(xmlSchema, (XmlSchemaSimpleTypeUnion) obj);
} else if (obj instanceof XmlSchemaComplexType) {
walkComplexType(xmlSchema, (XmlSchemaComplexType) obj);
} else if (obj instanceof XmlSchemaGroupRef) {
walkGroupRef(xmlSchema, (XmlSchemaGroupRef) obj);
} else if (obj instanceof XmlSchemaIdentityConstraint) {
walkIdentityConstraint(xmlSchema, (XmlSchemaIdentityConstraint) obj);
} else if (obj instanceof XmlSchemaImport) {
walkImport(xmlSchema, (XmlSchemaImport) obj);
} else if (obj instanceof XmlSchemaInclude) {
walkInclude(xmlSchema, (XmlSchemaInclude) obj);
} else if (obj instanceof XmlSchemaAll) {
walkAll(xmlSchema, (XmlSchemaAll) obj);
} else if (obj instanceof XmlSchemaAnnotation) {
walkAnnotation(xmlSchema, (XmlSchemaAnnotation) obj);
} else if (obj instanceof XmlSchemaDocumentation) {
walkDocumentation(xmlSchema, (XmlSchemaDocumentation) obj);
} else if (obj instanceof XmlSchemaAppInfo) {
walkAppInfo(xmlSchema, (XmlSchemaAppInfo) obj);
} else if (obj instanceof XmlSchemaChoice) {
walkChoice(xmlSchema, (XmlSchemaChoice) obj);
} else if (obj instanceof XmlSchemaSequence) {
walkSequence(xmlSchema, (XmlSchemaSequence) obj);
} else if (obj instanceof XmlSchemaAny) {
walkAny(xmlSchema, (XmlSchemaAny) obj);
} else if (obj instanceof XmlSchemaSimpleContent) {
walkSimpleContent(xmlSchema, (XmlSchemaSimpleContent) obj);
} else if (obj instanceof XmlSchemaSimpleContentRestriction) {
walkSimpleContentRestriction(xmlSchema, (XmlSchemaSimpleContentRestriction) obj);
} else if (obj instanceof XmlSchemaFacet) {
walkFacet(xmlSchema, (XmlSchemaFacet) obj);
} else if (obj instanceof XmlSchemaXPath) {
walkField(xmlSchema, (XmlSchemaXPath) obj);
} else if (obj instanceof XmlSchemaAttributeGroupRef) {
walkAttributeGroupRef(xmlSchema, (XmlSchemaAttributeGroupRef) obj);
} else if (obj instanceof XmlSchemaSimpleContentExtension) {
walkSimpleContentExtension(xmlSchema, (XmlSchemaSimpleContentExtension) obj);
} else if (obj instanceof XmlSchemaAnyAttribute) {
walkAnyAttribute(xmlSchema, (XmlSchemaAnyAttribute) obj);
} else if (obj instanceof XmlSchemaComplexContent) {
walkComplexContent(xmlSchema, (XmlSchemaComplexContent) obj);
} else if (obj instanceof XmlSchemaComplexContentExtension) {
walkComplexContentExtension(xmlSchema, (XmlSchemaComplexContentExtension) obj);
} else if (obj instanceof XmlSchemaComplexContentRestriction) {
walkComplexContentRestriction(xmlSchema, (XmlSchemaComplexContentRestriction) obj);
} else if (obj instanceof XmlSchemaGroup) {
walkGroup(xmlSchema, (XmlSchemaGroup) obj);
} else if (obj instanceof XmlSchemaAttributeGroup) {
walkAttributeGroup(xmlSchema, (XmlSchemaAttributeGroup) obj);
} else if (obj instanceof XmlSchemaAttribute) {
walkAttribute(xmlSchema, (XmlSchemaAttribute) obj);
} else if (obj instanceof XmlSchemaRedefine) {
walkRedefine(xmlSchema, (XmlSchemaRedefine) obj);
}
}
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:68,代码来源:XmlSchemaWalker.java
示例13: createNumericXmlSchemaSimpleType
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* Create a simple type for an numeric type.
* <p>
* Numeric elements might have totaDigits, fractionDigits, minInclusive or
* maxInclusive facets.
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @param xsdTypeName the XML schema built-in type name to use as a
* restriction
* @return an XML schema simple type
*/
protected XmlSchemaSimpleType createNumericXmlSchemaSimpleType(
final XsdDataItem xsdDataItem, final String xsdTypeName) {
XmlSchemaSimpleTypeRestriction restriction = createRestriction(xsdTypeName);
/*
* COBOL native binary are special because even though they have a
* totalDigits attribute, it is not used enforce a restriction.
*/
if (xsdDataItem.getCobolType() != CobolType.NATIVE_BINARY_ITEM
&& xsdDataItem.getTotalDigits() > -1) {
/*
* Due to a bug in JAXB (see JAXB issue 715), unsignedLong may end
* up being mapped to BigInteger instead of Long when totalDigits is
* used instead of maxInclusive. So for now, we keep maxInclusive.
*/
if (xsdDataItem.getXsdType() == XsdType.ULONG) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < xsdDataItem.getTotalDigits(); i++) {
sb.append("9");
}
restriction.getFacets().add(
createMaxInclusiveFacet(sb.toString()));
} else {
restriction.getFacets().add(
createTotalDigitsFacet(xsdDataItem.getTotalDigits()));
}
}
/* fractionDigits is a fixed facet for most numerics so be careful */
if (xsdDataItem.getFractionDigits() > 0) {
restriction.getFacets().add(
createFractionDigitsFacet(xsdDataItem.getFractionDigits()));
}
/*
* For xsd:decimal and xsd:integer, we further constrain if the numeric
* needs to be positive (unsigned).
*/
if ((xsdDataItem.getXsdType() == XsdType.INTEGER || xsdDataItem
.getXsdType() == XsdType.DECIMAL) && !xsdDataItem.isSigned()) {
restriction.getFacets().add(createMinInclusiveFacet("0"));
}
addEnumerationFacets(xsdDataItem, restriction);
return createXmlSchemaSimpleType(restriction);
}
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:59,代码来源:XsdEmitter.java
示例14: addEnumerationFacets
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* If simple type has conditions attached to it, emit enumeration facets.
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @param restriction the current set of constraints
*/
protected void addEnumerationFacets(final XsdDataItem xsdDataItem,
final XmlSchemaSimpleTypeRestriction restriction) {
if (getModel().mapConditionsToFacets()) {
boolean hasValueThru = false;
for (XsdDataItem child : xsdDataItem.getChildren()) {
if (child.getDataEntryType() == DataEntryType.CONDITION) {
for (String conditionValue : child.getConditionLiterals()) {
restriction.getFacets().add(
createEnumerationFacet(ValueUtil
.resolveFigurative(conditionValue,
xsdDataItem
.getMaxStorageLength(),
getModel().quoteIsQuote())));
}
for (Range conditionRange : child.getConditionRanges()) {
if (hasValueThru) {
_log.warn(xsdDataItem.getCobolName()
+ " has several VALUE THRU statements."
+ " Cannot translate to XSD."
+ " Only the first one will be converted."
+ " Ignoring: " + conditionRange.toString());
break;
}
restriction.getFacets().add(
createMinInclusiveFacet(ValueUtil
.resolveFigurative(conditionRange
.getFrom(), xsdDataItem
.getMaxStorageLength(),
getModel().quoteIsQuote())));
restriction.getFacets().add(
createMaxInclusiveFacet(ValueUtil
.resolveFigurative(conditionRange
.getTo(), xsdDataItem
.getMaxStorageLength(),
getModel().quoteIsQuote())));
hasValueThru = true;
}
}
}
}
}
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:49,代码来源:XsdEmitter.java
示例15: createNumericXmlSchemaSimpleType
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* Create a simple type for an numeric type.
* <p/>
* Numeric elements might have totaDigits, fractionDigits, minInclusive or
* maxInclusive facets.
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @param xsdTypeName the XML schema built-in type name to use as a
* restriction
* @return an XML schema simple type
*/
protected XmlSchemaSimpleType createNumericXmlSchemaSimpleType(
final XsdDataItem xsdDataItem, final String xsdTypeName) {
XmlSchemaSimpleTypeRestriction restriction = createRestriction(xsdTypeName);
/*
* COBOL native binary are special because even though they have a
* totalDigits attribute, it is not used enforce a restriction.
*/
if (xsdDataItem.getCobolType() != CobolTypes.NATIVE_BINARY_ITEM
&& xsdDataItem.getTotalDigits() > -1) {
/*
* Due to a bug in JAXB (see JAXB issue 715), unsignedLong may end
* up being mapped to BigInteger instead of Long when totalDigits is
* used instead of maxInclusive. So for now, we keep maxInclusive.
*/
if (xsdDataItem.getXsdType() == XsdType.ULONG) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < xsdDataItem.getTotalDigits(); i++) {
sb.append("9");
}
restriction.getFacets().add(
createMaxInclusiveFacet(sb.toString()));
} else {
restriction.getFacets().add(
createTotalDigitsFacet(xsdDataItem.getTotalDigits()));
}
}
/* fractionDigits is a fixed facet for most numerics so be careful */
if (xsdDataItem.getFractionDigits() > 0) {
restriction.getFacets().add(
createFractionDigitsFacet(xsdDataItem.getFractionDigits()));
}
/*
* For xsd:decimal and xsd:integer, we further constrain if the numeric
* needs to be positive (unsigned).
*/
if ((xsdDataItem.getXsdType() == XsdType.INTEGER || xsdDataItem
.getXsdType() == XsdType.DECIMAL) && !xsdDataItem.isSigned()) {
restriction.getFacets().add(createMinInclusiveFacet("0"));
}
addEnumerationFacets(xsdDataItem, restriction);
return createXmlSchemaSimpleType(restriction);
}
开发者ID:legsem,项目名称:legstar-core2,代码行数:59,代码来源:XsdEmitter.java
示例16: addEnumerationFacets
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* If simple type has conditions attached to it, emit enumeration facets.
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @param restriction the current set of constraints
*/
protected void addEnumerationFacets(final XsdDataItem xsdDataItem,
final XmlSchemaSimpleTypeRestriction restriction) {
if (getConfig().mapConditionsToFacets()) {
boolean hasValueThru = false;
for (XsdDataItem child : xsdDataItem.getChildren()) {
if (child.getDataEntryType() == DataEntryType.CONDITION) {
for (String conditionValue : child.getConditionLiterals()) {
restriction.getFacets().add(
createEnumerationFacet(ValueUtil
.resolveFigurative(conditionValue,
xsdDataItem
.getMaxStorageLength(),
getConfig().quoteIsQuote())));
}
for (Range conditionRange : child.getConditionRanges()) {
if (hasValueThru) {
_log.warn(xsdDataItem.getCobolName()
+ " has several VALUE THRU statements."
+ " Cannot translate to XSD."
+ " Only the first one will be converted."
+ " Ignoring: " + conditionRange.toString());
break;
}
restriction.getFacets().add(
createMinInclusiveFacet(ValueUtil
.resolveFigurative(conditionRange
.getFrom(), xsdDataItem
.getMaxStorageLength(),
getConfig().quoteIsQuote())));
restriction.getFacets().add(
createMaxInclusiveFacet(ValueUtil
.resolveFigurative(conditionRange
.getTo(), xsdDataItem
.getMaxStorageLength(),
getConfig().quoteIsQuote())));
hasValueThru = true;
}
}
}
}
}
开发者ID:legsem,项目名称:legstar-core2,代码行数:49,代码来源:XsdEmitter.java
示例17: getProps
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
/**
* Retrieve the properties of a primitive type.
*
* @param xsdSimpleType the XML schema primitive type
* @param cobolAnnotations the associated COBOL annotations
* @return a set of properties
*/
private Map < String, Object > getProps(XmlSchemaSimpleType xsdSimpleType,
final CobolAnnotations cobolAnnotations) {
XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) xsdSimpleType
.getContent();
if (restriction != null && restriction.getBaseTypeName() != null) {
QName xsdTypeName = restriction.getBaseTypeName();
List < XmlSchemaFacet > facets = restriction.getFacets();
if (xsdTypeName.equals(Constants.XSD_STRING)) {
return getCobolAlphanumType(facets);
} else if (xsdTypeName.equals(Constants.XSD_HEXBIN)) {
return getCobolOctetStreamType(facets);
} else if (xsdTypeName.equals(Constants.XSD_INT)) {
return getCobolDecimalType(cobolAnnotations, Integer.class);
} else if (xsdTypeName.equals(Constants.XSD_LONG)) {
return getCobolDecimalType(cobolAnnotations, Long.class);
} else if (xsdTypeName.equals(Constants.XSD_SHORT)) {
return getCobolDecimalType(cobolAnnotations, Short.class);
} else if (xsdTypeName.equals(Constants.XSD_DECIMAL)) {
return getCobolDecimalType(cobolAnnotations, BigDecimal.class);
} else if (xsdTypeName.equals(Constants.XSD_FLOAT)) {
return getCobolDecimalType(cobolAnnotations, Float.class);
} else if (xsdTypeName.equals(Constants.XSD_DOUBLE)) {
return getCobolDecimalType(cobolAnnotations, Double.class);
} else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDINT)) {
return getCobolDecimalType(cobolAnnotations, Long.class);
} else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDSHORT)) {
return getCobolDecimalType(cobolAnnotations, Integer.class);
} else if (xsdTypeName.equals(Constants.XSD_UNSIGNEDLONG)) {
return getCobolDecimalType(cobolAnnotations, BigInteger.class);
} else if (xsdTypeName.equals(Constants.XSD_INTEGER)) {
return getCobolDecimalType(cobolAnnotations, BigInteger.class);
} else {
throw new Xsd2ConverterException("Unsupported xsd type "
+ xsdTypeName);
}
} else {
throw new Xsd2ConverterException("Simple type without restriction "
+ xsdSimpleType.getQName());
}
}
开发者ID:legsem,项目名称:legstar-core2,代码行数:50,代码来源:Xsd2CobolTypesModelBuilder.java
示例18: createXmlTypeInfo
import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; //导入依赖的package包/类
public static XmlTypeInfo createXmlTypeInfo(QName qname, XmlSchemaType type) {
if (qname == null) throw new NullPointerException("qname is null");
if (type == null) throw new NullPointerException("type is null");
XmlTypeInfo typeInfo = new XmlTypeInfo();
typeInfo.qname = qname;
typeInfo.anonymous = qname.getLocalPart().indexOf('>') >= 0;
if (type instanceof XmlSchemaSimpleType) {
XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) type;
XmlSchemaSimpleTypeContent content = simpleType.getContent();
if (content instanceof XmlSchemaSimpleTypeList) {
XmlSchemaSimpleTypeList list = (XmlSchemaSimpleTypeList) content;
typeInfo.simpleBaseType = list.getItemType().getQName();
// this is a list
typeInfo.listType = true;
} else if (content instanceof XmlSchemaSimpleTypeRestriction) {
XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) content;
typeInfo.simpleBaseType = restriction.getBaseTypeName();
// is this an enumeration?
for (Iterator iterator = restriction.getFacets().getIterator(); iterator.hasNext(); ) {
if (iterator.next() instanceof XmlSchemaEnumerationFacet) {
typeInfo.enumType = true;
break;
}
}
}
} else if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
// SOAP array component type
typeInfo.arrayComponentType = extractSoapArrayComponentType(complexType);
// process attributes (skip soap arrays which have non-mappable attributes)
if (!isSoapArray(complexType)) {
XmlSchemaObjectCollection attributes = complexType.getAttributes();
for (Iterator iterator = attributes.getIterator(); iterator.hasNext(); ) {
Object item = iterator.next();
if (item instanceof XmlSchemaAttribute) {
XmlSchemaAttribute attribute = (XmlSchemaAttribute) item;
Object old = typeInfo.attributes.put(attribute.getQName().getLocalPart(), attribute.getSchemaTypeName());
if (old != null) {
throw new IllegalArgumentException("Complain to your expert group member, spec does not support attributes with the same local name and differing namespaces: original: " + old + ", duplicate local name: " + attribute);
}
}
}
}
} else {
log.warn("Unknown schema type class " + typeInfo.getClass().getName());
}
return typeInfo;
}
开发者ID:apache,项目名称:tomee,代码行数:57,代码来源:CommonsSchemaInfoBuilder.java
注:本文中的org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论