super.buildOperation(builder);
QueryOperation qo = new QueryOperation();
qo.setName(name);
SQLQueryHandler sqlqh = new SQLQueryHandler();
Result result;
if (isCollection) {
result = new CollectionResult();
}
else {
result = new Result();
}
SimpleXMLFormat sxf = null;
if (isSimpleXMLFormat() || getReturnType() == null) {
sxf = new SimpleXMLFormat();
if (simpleXMLFormatTag != null && simpleXMLFormatTag.length() > 0) {
sxf.setSimpleXMLFormatTag(simpleXMLFormatTag);
}
result.setType(SXF_QNAME);
}
if (xmlTag != null && xmlTag.length() > 0) {
if (sxf == null) {
sxf = new SimpleXMLFormat();
result.setType(SXF_QNAME);
}
sxf.setXMLTag(xmlTag);
}
if (sxf != null) {
result.setSimpleXMLFormat(sxf);
// check to see if the O-X project needs descriptor for SimpleXMLFormat
if (builder.oxProject.getDescriptorForAlias(DEFAULT_SIMPLE_XML_FORMAT_TAG) == null) {
SimpleXMLFormatProject sxfProject = new SimpleXMLFormatProject();
builder.oxProject.addDescriptor(sxfProject.buildXRRowSetModelDescriptor());
}
}
if (binaryAttachment) {
Attachment attachment = new Attachment();
attachment.setMimeType(DEFAULT_ATTACHMENT_MIMETYPE);
result.setAttachment(attachment);
}
if (returnType != null && returnType.length() > 0) {
result.setType(qNameFromString("{" +builder.getTargetNamespace() + "}" +
returnType, builder.schema));
}
else {
result.setType(SXF_QNAME);
result.setSimpleXMLFormat( sxf == null ? new SimpleXMLFormat() : sxf);
}
qo.setResult(result);
sqlqh.setSqlString(convertJDBCParameterBindingMarkers(sql, bindings));
if (!bindings.isEmpty()) {
for (BindingModel param : bindings) {
Parameter p = new Parameter();
p.setName(param.name);
p.setType(qNameFromString(param.type, builder.schema));