AggregateMediator mediator = new AggregateMediator();
processAuditStatus(mediator, elem);
OMElement corelateOn = elem.getFirstChildWithName(CORELATE_ON_Q);
if (corelateOn != null) {
OMAttribute corelateExpr = corelateOn.getAttribute(EXPRESSION_Q);
if (corelateExpr != null) {
try {
mediator.setCorrelateExpression(
SynapseXPathFactory.getSynapseXPath(corelateOn, EXPRESSION_Q));
} catch (JaxenException e) {
handleException("Unable to load the corelate XPATH expression", e);
}
}
}
OMElement completeCond = elem.getFirstChildWithName(COMPLETE_CONDITION_Q);
if (completeCond != null) {
OMAttribute completeTimeout = completeCond.getAttribute(TIMEOUT_Q);
if (completeTimeout != null) {
mediator.setCompletionTimeoutMillis(
Long.parseLong(completeTimeout.getAttributeValue()) * 1000);
}
OMElement messageCount = completeCond.getFirstChildWithName(MESSAGE_COUNT_Q);
if (messageCount != null) {
OMAttribute min = messageCount.getAttribute(MIN_Q);
if (min != null) {
mediator.setMinMessagesToComplete(Integer.parseInt(min.getAttributeValue()));
}
OMAttribute max = messageCount.getAttribute(MAX_Q);
if (max != null) {
mediator.setMaxMessagesToComplete(Integer.parseInt(max.getAttributeValue()));
}
}
}
OMElement onComplete = elem.getFirstChildWithName(ON_COMPLETE_Q);
if (onComplete != null) {
OMAttribute aggregateExpr = onComplete.getAttribute(EXPRESSION_Q);
if (aggregateExpr != null) {
try {
mediator.setAggregationExpression(
SynapseXPathFactory.getSynapseXPath(onComplete, EXPRESSION_Q));
} catch (JaxenException e) {
handleException("Unable to load the aggregating XPATH", e);
}
}
OMAttribute onCompleteSequence = onComplete.getAttribute(SEQUENCE_Q);
if (onCompleteSequence != null) {
mediator.setOnCompleteSequenceRef(onCompleteSequence.getAttributeValue());
} else if (onComplete.getFirstElement() != null) {
mediator.setOnCompleteSequence((new SequenceMediatorFactory())
.createAnonymousSequence(onComplete, properties));
} else {
SequenceMediator sequence = new SequenceMediator();