private static void addDataOutputAssociations(WithDataOutputAssociationBean wdob, WithDataOutputAssociation wdo){ if(wdo.getDataOutputAssociation()!=null){ for(DataOutputAssociation doa : wdo.getDataOutputAssociation()){ DataAssociationBean doab = new DataAssociationBean(doa.getId()); setDocumentationAndExtensions(doab, doa); if(doa.hasSourceRef()){ ensureIdIsSet(doab); dataAssociationSources.put(doab, doa.getSourceRef()); } if(doa.hasTargetRef()){ ensureIdIsSet(doab); dataAssociationTargets.put(doab, doa.getTargetRef()); } if(doa.getAssignment()!=null){ for(Assignment a : doa.getAssignment()){ doab.addAssignement(adaptAssignement(a)); } } wdob.addDataOutputAssociation(doab); } } }
private static void addDataInputAssociations(WithDataInputAssociationBean wdib, WithDataInputAssociation wdi){ if(wdi.getDataInputAssociation()!=null){ for(DataInputAssociation dia : wdi.getDataInputAssociation()){ DataAssociationBean diab = new DataAssociationBean(dia.getId()); setDocumentationAndExtensions(diab, dia); if(dia.hasSourceRef()){ ensureIdIsSet(diab); dataAssociationSources.put(diab, dia.getSourceRef()); } if(dia.hasTargetRef()){ ensureIdIsSet(diab); dataAssociationTargets.put(diab, dia.getTargetRef()); } if(dia.getAssignment()!=null){ for(Assignment a : dia.getAssignment()){ diab.addAssignement(adaptAssignement(a)); } } wdib.addDataInputAssociation(diab); } } }
@Override public void bind(DataAssociationEditorModel watchedModel, DataAssociationBean modelToBind) { // 1 - binding of 'to' and 'from' fields of the editor model //add an assignment with the 'to' and 'from' expressions modelToBind.getAssignements().clear(); IAssignmentBean a = new AssignmentBean(); modelToBind.addAssignement(a); IExpressionBean from = new ExpressionBean(); from.setContent(watchedModel.getFrom()); a.setFrom(from); IExpressionBean to = new ExpressionBean(); to.setContent(watchedModel.getTo()); a.setTo(to); // 2 - binding of 'itemDef' property of the editor model //set targetItem and sourceItem to the editor model value // the builder will use one of them depending if the data association // is a datainputassociation or a dataoutputassociation modelToBind.setTargetItem(watchedModel.getItemDef()); modelToBind.setSourceItem(watchedModel.getItemDef()); }