use of com.axelor.data.xml.XMLInput in project axelor-open-suite by axelor.
the class AppLoaderExportServiceImpl method createMetaModelInput.
protected XMLInput createMetaModelInput(AppDataLoader dataLoader, boolean relationalInput) throws ClassNotFoundException {
XMLInput xmlInput = createXmlInput(dataLoader);
Mapper modelMapper = Mapper.of(Class.forName(dataLoader.getMetaModel().getFullName()));
String nodeName = getBindNodeName(xmlInput.getRoot());
XMLBind xmlBind = new XMLBind();
xmlBind.setTypeName(dataLoader.getMetaModel().getFullName());
xmlBind.setNode(nodeName);
if (!CollectionUtils.isEmpty(dataLoader.getSearchMetaFieldSet())) {
xmlBind.setSearch(getMetaSearchFields(modelMapper, dataLoader));
xmlBind.setUpdate(true);
}
if (relationalInput) {
xmlBind.setCreate(false);
}
xmlBind.setBindings(getMetaFieldBinding(modelMapper, dataLoader, relationalInput));
List<XMLBind> rootBindings = new ArrayList<XMLBind>();
rootBindings.add(xmlBind);
xmlInput.setBindings(rootBindings);
return xmlInput;
}
use of com.axelor.data.xml.XMLInput 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;
}
use of com.axelor.data.xml.XMLInput in project axelor-open-suite by axelor.
the class AppLoaderExportServiceImpl method createXmlInput.
protected XMLInput createXmlInput(AppDataLoader dataLoader) {
XMLInput xmlInput = new XMLInput();
String modelName = dataLoader.getModelName();
xmlInput.setFileName(modelName + ".xml");
String dasherizeModel = Inflector.getInstance().dasherize(modelName);
xmlInput.setRoot(dasherizeModel + "s");
return xmlInput;
}
Aggregations