List<MessageDefinition> messageSetDefinitions = new ArrayList<MessageDefinition>();
Set<Map.Entry<String, EdifactModel>> modelSet = mappingModels.entrySet();
StringBuilder rootClassesListFileBuilder = new StringBuilder();
for(Map.Entry<String, EdifactModel> model : modelSet) {
Description description = model.getValue().getDescription();
if(description.equals(EDIUtils.MODEL_SET_DEFINITIONS_DESCRIPTION_LOOKUP_NAME)) {
// Already done (above). Skip it...
continue;
}
if(messages == null || messages.contains(description.getName())) {
EJC ejc = new EJC();
ejc.include(commonsPackageName);
ejc.addEDIMessageAnnotation(true);
if(definitionsClassModel != null) {
String messagePackageName = packageName + "." + description.getName();
ClassModel classModel = ejc.compile(model.getValue().getEdimap(), messagePackageName, destDir.getAbsolutePath(), definitionsClassModel.getClassesByNode());
// If this is an interchange, get rid of the edi mapping model config and the
// Factory class for the message folder...
if(interchangeProperties != null) {
MessageDefinition messageDef = new MessageDefinition(description.getName(), "/" + messagePackageName.replace('.', '/') + "/" + EJC.BINDINGCONFIG_XML);
messageSetDefinitions.add(messageDef);
deleteFile(messagePackageName, EJC.EDIMAPPINGCONFIG_XML);
deleteFile(messagePackageName, EDIUtils.encodeClassName(description.getName()) + "Factory.java");
JClass beanClass = classModel.getRootBeanConfig().getBeanClass();
rootClassesListFileBuilder.append(beanClass.getPackageName()).append(".").append(beanClass.getClassName()).append("\n");
}
} else {