use of org.apache.cxf.binding.corba.wsdl.Anonwstring in project cxf by apache.
the class StringVisitor method visitAnonBoundedString.
private void visitAnonBoundedString() {
// xmlschema:bounded anon string
XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, true);
simpleType.setName(stringScopedName.toString());
XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
restriction.setBaseTypeName(Constants.XSD_STRING);
XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet();
maxLengthFacet.setValue(boundNode.toString());
restriction.getFacets().add(maxLengthFacet);
simpleType.setContent(restriction);
setSchemaType(simpleType);
CorbaType anon = null;
if (stringNode.getType() == IDLTokenTypes.LITERAL_string) {
// corba:anonstring
Anonstring anonstring = new Anonstring();
anonstring.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
anonstring.setBound(Long.parseLong(boundNode.toString()));
anonstring.setType(simpleType.getQName());
anon = anonstring;
} else if (stringNode.getType() == IDLTokenTypes.LITERAL_wstring) {
// corba:anonwstring
Anonwstring anonwstring = new Anonwstring();
anonwstring.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
anonwstring.setBound(Long.parseLong(boundNode.toString()));
anonwstring.setType(simpleType.getQName());
anon = anonwstring;
} else {
// should never get here
throw new RuntimeException("StringVisitor attempted to visit an invalid node");
}
// add corba:anonstring
typeMap.getStructOrExceptionOrUnion().add(anon);
setCorbaType(anon);
}
use of org.apache.cxf.binding.corba.wsdl.Anonwstring in project cxf by apache.
the class StringVisitor method visitBoundedString.
private void visitBoundedString() {
// xmlschema:bounded string
XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(schema, true);
simpleType.setName(stringScopedName.toString());
XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
restriction.setBaseTypeName(Constants.XSD_STRING);
XmlSchemaMaxLengthFacet maxLengthFacet = new XmlSchemaMaxLengthFacet();
maxLengthFacet.setValue(boundNode.toString());
restriction.getFacets().add(maxLengthFacet);
simpleType.setContent(restriction);
setSchemaType(simpleType);
Scope anonstringScopedName = new Scope(getScope(), "_Anon1_" + stringScopedName.tail());
String anonstringName = anonstringScopedName.toString();
CorbaType anon = null;
if (stringNode.getType() == IDLTokenTypes.LITERAL_string) {
// corba:anonstring
Anonstring anonstring = new Anonstring();
anonstring.setQName(new QName(typeMap.getTargetNamespace(), anonstringName));
anonstring.setBound(Long.parseLong(boundNode.toString()));
anonstring.setType(simpleType.getQName());
anon = anonstring;
} else if (stringNode.getType() == IDLTokenTypes.LITERAL_wstring) {
// corba:anonwstring
Anonwstring anonwstring = new Anonwstring();
anonwstring.setQName(new QName(typeMap.getTargetNamespace(), anonstringName));
anonwstring.setBound(Long.valueOf(boundNode.toString()));
anonwstring.setType(simpleType.getQName());
anon = anonwstring;
} else {
// should never get here
throw new RuntimeException("StringVisitor attempted to visit an invalid node");
}
// add corba:anonstring
typeMap.getStructOrExceptionOrUnion().add(anon);
// corba:alias
Alias alias = new Alias();
alias.setQName(new QName(typeMap.getTargetNamespace(), stringScopedName.toString()));
alias.setBasetype(anon.getQName());
alias.setType(simpleType.getQName());
alias.setRepositoryID(stringScopedName.toIDLRepositoryID());
// add corba:alias
setCorbaType(alias);
}
use of org.apache.cxf.binding.corba.wsdl.Anonwstring in project cxf by apache.
the class CorbaUtils method getAnonTypeCode.
private static TypeCode getAnonTypeCode(ORB orb, QName type, Object obj, CorbaTypeMap typeMap, Stack<QName> seenTypes) {
TypeCode tc = null;
if (obj instanceof Anonarray) {
Anonarray anonArrayType = (Anonarray) obj;
tc = orb.create_array_tc((int) anonArrayType.getBound(), getTypeCode(orb, anonArrayType.getElemtype(), typeMap, seenTypes));
} else if (obj instanceof Anonfixed) {
Anonfixed anonFixedType = (Anonfixed) obj;
tc = orb.create_fixed_tc((short) anonFixedType.getDigits(), (short) anonFixedType.getScale());
} else if (obj instanceof Anonsequence) {
Anonsequence anonSeqType = (Anonsequence) obj;
tc = orb.create_sequence_tc((int) anonSeqType.getBound(), getTypeCode(orb, anonSeqType.getElemtype(), typeMap, seenTypes));
} else if (obj instanceof Anonstring) {
Anonstring anonStringType = (Anonstring) obj;
tc = orb.create_string_tc((int) anonStringType.getBound());
} else if (obj instanceof Anonwstring) {
Anonwstring anonWStringType = (Anonwstring) obj;
tc = orb.create_wstring_tc((int) anonWStringType.getBound());
}
return tc;
}
Aggregations