/** * Set source and target of association. */ public Object postProcess(IContext context, Object object) { MBpmnModel dia = (MBpmnModel)context.getRootObject(); MAssociation asso = (MAssociation)object; MArtifact source = (MArtifact)dia.getAllAssociationSources().get(asso.getId()); MAssociationTarget target = (MAssociationTarget)dia.getAllAssociationTargets().get(asso.getId()); if(source==null) throw new RuntimeException("Could not find association source: "+asso.getId()); if(target==null) throw new RuntimeException("Could not find association target: "+asso.getId()); asso.setSource(source); asso.setTarget(target); source.addAssociation(asso); target.addAssociation(asso); return null; }
/** * Add artifacts. * @param artifacts The list of artifacts. * @param sources The sources result map (association id -> art). */ protected MArtifact addArtifacts(List artifacts, Map sources) { MArtifact ret = null; if(artifacts!=null) { for(int i=0; i<artifacts.size() && ret==null; i++) { MArtifact art = (MArtifact)artifacts.get(i); List assos = art.getAssociations(); if(assos!=null) { for(int j=0; j<assos.size(); j++) { MAssociation asso = (MAssociation)assos.get(j); sources.put(asso.getId(), art); } } } } return ret; }
/** * Set source and target of association. */ public Object postProcess(IContext context, Object object) { MBpmnModel dia = (MBpmnModel)context.getRootObject(); MAssociation asso = (MAssociation)object; MArtifact source = (MArtifact)dia.getAllAssociationSources().get(asso.getId()); MAssociationTarget target = (MAssociationTarget)dia.getAllAssociationTargets().get(asso.getId()); if(source==null) throw new RuntimeException("Could not find association source: "+source); if(target==null) throw new RuntimeException("Could not find association target: "+target); asso.setSource(source); asso.setTarget(target); source.addAssociation(asso); target.addAssociation(asso); return null; }