public JSONObject setXPathMapping(String source, String target, int index) { MappingElement sourceElement = this.inputSchema.getMappingElement(source); JSONObject targetElement = this.elementCache.get(target); String xpath = sourceElement.getXPath(); String type = sourceElement.getType(); // setXPathMapping(xpath, targetElement, index); setXPathMapping(xpath, type, targetElement, index); saveMappings(); return targetElement; }
public JSONObject setConditionXPath(String target, String value) { JSONObject targetElement = this.elementCache.get(target); MappingElement sourceElement = this.inputSchema.getMappingElement(value); String xpath = sourceElement.getXPath(); String type = sourceElement.getType(); if (targetElement.has("condition")) { log.debug("Set condition xpath for " + target + " to " + xpath); targetElement.getJSONObject("condition").put("xpath", xpath); targetElement.getJSONObject("condition").put("type", type); targetElement.getJSONObject("condition").remove("value"); saveMappings(); } return targetElement; }
public JSONObject setConditionClauseXPath(String id, String path, String source) { JSONObject result = new JSONObject(); JSONObject targetElement = this.elementCache.get(id); if (targetElement.has("condition")) { MappingElement sourceElement = this.inputSchema.getMappingElement(source); String value = sourceElement.getXPath(); String type = sourceElement.getType(); JSONObject condition = targetElement.getJSONObject("condition"); this.setConditionClauseKey(condition, path, "xpath", value); this.setConditionClauseKey(condition, path, "type", type); this.removeConditionClauseKey(condition, path, "value"); result = condition; saveMappings(); } return result; }