Search in sources :

Example 1 with XMLBindJson

use of com.axelor.data.xml.XMLBindJson in project axelor-open-suite by axelor.

the class AppLoaderExportServiceImpl method createJsonModelInput.

protected XMLInput createJsonModelInput(AppDataLoader dataLoader, boolean relationalInput) {
    XMLInput xmlInput = createXmlInput(dataLoader);
    Map<String, Object> jsonFieldMap = MetaStore.findJsonFields(dataLoader.getModelName());
    fixTargetName(jsonFieldMap);
    String nodeName = getBindNodeName(xmlInput.getRoot());
    XMLBindJson xmlBindJson = new XMLBindJson();
    xmlBindJson.setNode(nodeName);
    xmlBindJson.setJsonModel(dataLoader.getModelName());
    if (!CollectionUtils.isEmpty(dataLoader.getSearchJsonFieldSet())) {
        xmlBindJson.setSearch(getJsonSearchFields(dataLoader, jsonFieldMap));
        xmlBindJson.setUpdate(true);
    }
    if (relationalInput) {
        xmlBindJson.setCreate(false);
    }
    xmlBindJson.setBindings(geJsonFieldBinding(jsonFieldMap, dataLoader, relationalInput));
    List<XMLBind> rootBindings = new ArrayList<XMLBind>();
    rootBindings.add(xmlBindJson);
    xmlInput.setBindings(rootBindings);
    return xmlInput;
}
Also used : XMLBindJson(com.axelor.data.xml.XMLBindJson) ArrayList(java.util.ArrayList) XMLInput(com.axelor.data.xml.XMLInput) XMLBind(com.axelor.data.xml.XMLBind)

Aggregations

XMLBind (com.axelor.data.xml.XMLBind)1 XMLBindJson (com.axelor.data.xml.XMLBindJson)1 XMLInput (com.axelor.data.xml.XMLInput)1 ArrayList (java.util.ArrayList)1