use of org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsKey in project carbon-business-process by wso2.
the class AnalyticsPublisherExtensionOperation method fillDataArray.
private void fillDataArray(Object[] dataArray, List<AnalyticsKey> payloadAnalyticsKeyList, int startIndex, ExtensionContext context, Element element) throws FaultException {
for (int i = 0; i < payloadAnalyticsKeyList.size(); i++) {
AnalyticsKey analyticsKey = payloadAnalyticsKeyList.get(i);
if (analyticsKey.getExpression() != null) {
String expression = evaluateXPathExpression(context, analyticsKey.getExpression(), element);
convertDataType(dataArray, (i + startIndex), analyticsKey, expression);
} else if (analyticsKey.getVariable() != null && analyticsKey.getPart() == null) {
if (analyticsKey.getQuery() == null) {
String variable = context.readVariable(analyticsKey.getVariable()).getTextContent();
convertDataType(dataArray, (i + startIndex), analyticsKey, variable);
/* simple types should be specified for here */
} else {
String errMsg = "This functionality is currently not supported";
log.error(errMsg);
handleException(errMsg);
}
} else if (analyticsKey.getVariable() != null && analyticsKey.getPart() != null) {
NodeList childNodes = context.readVariable(analyticsKey.getVariable()).getChildNodes();
String result = null;
String part = analyticsKey.getPart();
for (int j = 0; j < childNodes.getLength(); j++) {
Node item = childNodes.item(j);
if (item != null && item.getNodeType() == Node.ELEMENT_NODE && item.getLocalName().equals(part)) {
/* remove the payload part */
result = DOMUtils.domToString(DOMUtils.getFirstChildElement(item));
}
}
convertDataType(dataArray, (i + startIndex), analyticsKey, result);
dataArray[i + startIndex] = result;
}
}
}
Aggregations