in mixins/om-mixins/src/main/java/org/apache/axiom/soap/impl/common/builder/SOAP12BuilderHelper.java [48:242]
public AxiomElementType<? extends AxiomElement> handleEvent(
OMElement parent, int elementLevel, String namespaceURI, String localName)
throws SOAPProcessingException {
AxiomElementType<? extends AxiomElement> elementType = null;
if (elementLevel == 4) {
if (localName.equals(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) {
if (codePresent) {
throw new SOAPProcessingException("Multiple Code element encountered");
} else {
elementType = AxiomNodeFactory::createSOAP12FaultCode;
codePresent = true;
codeprocessing = true;
}
} else if (localName.equals(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {
if (!codeprocessing && !subCodeProcessing) {
if (codePresent) {
if (reasonPresent) {
throw new SOAPProcessingException(
"Multiple Reason Element encountered");
} else {
elementType = AxiomNodeFactory::createSOAP12FaultReason;
reasonPresent = true;
reasonProcessing = true;
}
} else {
throw new SOAPProcessingException(
"Wrong element order encountred at " + localName);
}
} else {
if (codeprocessing) {
throw new SOAPProcessingException("Code doesn't have a value");
} else {
throw new SOAPProcessingException("A subcode doesn't have a Value");
}
}
} else if (localName.equals(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME)) {
if (!reasonProcessing) {
if (reasonPresent && !rolePresent && !detailPresent) {
if (nodePresent) {
throw new SOAPProcessingException("Multiple Node element encountered");
} else {
elementType = AxiomNodeFactory::createSOAP12FaultNode;
nodePresent = true;
}
} else {
throw new SOAPProcessingException(
"wrong element order encountered at " + localName);
}
} else {
throw new SOAPProcessingException("Reason element Should have a text");
}
} else if (localName.equals(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME)) {
if (!reasonProcessing) {
if (reasonPresent && !detailPresent) {
if (rolePresent) {
throw new SOAPProcessingException("Multiple Role element encountered");
} else {
elementType = AxiomNodeFactory::createSOAP12FaultRole;
rolePresent = true;
}
} else {
throw new SOAPProcessingException(
"Wrong element order encountered at " + localName);
}
} else {
throw new SOAPProcessingException("Reason element should have a text");
}
} else if (localName.equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
if (!reasonProcessing) {
if (reasonPresent) {
if (detailPresent) {
throw new SOAPProcessingException(
"Multiple detail element encountered");
} else {
elementType = AxiomNodeFactory::createSOAP12FaultDetail;
detailPresent = true;
}
} else {
throw new SOAPProcessingException(
"wrong element order encountered at " + localName);
}
} else {
throw new SOAPProcessingException("Reason element should have a text");
}
} else {
throw new SOAPProcessingException(
localName + " unsupported element in SOAPFault element");
}
} else if (elementLevel == 5) {
if (parent.getLocalName().equals(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME)) {
if (localName.equals(SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) {
if (!valuePresent) {
elementType = AxiomNodeFactory::createSOAP12FaultValue;
valuePresent = true;
codeprocessing = false;
} else {
throw new SOAPProcessingException(
"Multiple value Encountered in code element");
}
} else if (localName.equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
if (!subcodePresent) {
if (valuePresent) {
elementType = AxiomNodeFactory::createSOAP12FaultSubCode;
subcodePresent = true;
subCodeProcessing = true;
} else {
throw new SOAPProcessingException(
"Value should present before the subcode");
}
} else {
throw new SOAPProcessingException(
"multiple subcode Encountered in code element");
}
} else {
throw new SOAPProcessingException(
localName + " is not supported inside the code element");
}
} else if (parent.getLocalName().equals(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME)) {
if (localName.equals(SOAP12Constants.SOAP_FAULT_TEXT_LOCAL_NAME)) {
elementType = AxiomNodeFactory::createSOAP12FaultText;
reasonProcessing = false;
} else {
throw new SOAPProcessingException(
localName + " is not supported inside the reason");
}
} else if (parent.getLocalName().equals(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME)) {
elementType = AxiomNodeFactory::createNSAwareElement;
processingDetailElements = true;
detailElementNames = new Vector<String>();
detailElementNames.add(localName);
} else {
throw new SOAPProcessingException(
parent.getLocalName() + " should not have child element");
}
} else if (elementLevel > 5) {
if (parent.getLocalName().equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
if (localName.equals(SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME)) {
if (subcodeValuePresent) {
throw new SOAPProcessingException("multiple subCode value encountered");
} else {
elementType = AxiomNodeFactory::createSOAP12FaultValue;
subcodeValuePresent = true;
subSubcodePresent = false;
subCodeProcessing = false;
}
} else if (localName.equals(SOAP12Constants.SOAP_FAULT_SUB_CODE_LOCAL_NAME)) {
if (subcodeValuePresent) {
if (!subSubcodePresent) {
elementType = AxiomNodeFactory::createSOAP12FaultSubCode;
subcodeValuePresent = false;
subSubcodePresent = true;
subCodeProcessing = true;
} else {
throw new SOAPProcessingException("multiple subcode encountered");
}
} else {
throw new SOAPProcessingException(
"Value should present before the subcode");
}
} else {
throw new SOAPProcessingException(
localName + " is not supported inside the subCode element");
}
} else if (processingDetailElements) {
int detailElementLevel = 0;
boolean localNameExist = false;
for (int i = 0; i < detailElementNames.size(); i++) {
if (parent.getLocalName().equals(detailElementNames.get(i))) {
localNameExist = true;
detailElementLevel = i + 1;
}
}
if (localNameExist) {
detailElementNames.setSize(detailElementLevel);
elementType = AxiomNodeFactory::createNSAwareElement;
detailElementNames.add(localName);
}
} else {
throw new SOAPProcessingException(
parent.getLocalName()
+ " should not have child at element level "
+ elementLevel);
}
}
return elementType;
}