private static ExpressionBean adaptExpression(Expression exp) { ExpressionBean expb = new ExpressionBean(exp.getId()); expb.setContent(exp.getTextContent()); //setDocumentation(expb, exp); return expb; }
@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()); }
public ActivityBean(String id){ super(id); dataInputAssociations = new ArrayList<IDataAssociationBean>(); dataOutputAssociations = new ArrayList<IDataAssociationBean>(); ioSpecification = new IOSpecificationBean(IdGenerator.createUniqueId()); dataInputs = new HashSet<IItemAwareElementBean>(); dataOutputs = new HashSet<IItemAwareElementBean>(); }
da.setTarget(itemAwareElements.get(dataAssociationTargets.get(da))); if(da.getTarget()!=null) da.setTargetItem(da.getTarget().getItemSubject()); da.addSource(iaeb); if(iaeb!=null) da.setSourceItem(iaeb.getItemSubject()); InputOutputBindingBean iobb = new InputOutputBindingBean(iobinding.getId()); if(iobinding.hasOperationRef()) { iobb.setOperation(findObjectInDefinitions(def, iobinding.getOperationRef(), OperationBean.class)); iobb.setInputData((IDataInputBean) itemAwareElements.get(iobinding.getInputDataRef())); iobb.setOutputData((IDataOutputBean) itemAwareElements.get(iobinding.getOutputDataRef()));
private static AssignmentBean adaptAssignement(Assignment a) { AssignmentBean ab = null; if(a!=null){ ab = new AssignmentBean(a.getId()); setDocumentationAndExtensions(ab, a); ab.setFrom(adaptExpression(a.getFrom())); ab.setTo(adaptExpression(a.getTo())); } return ab; }
private static DataObjectBean adaptDataObject(DataObject do1, DefinitionsBean defs) { DataObjectBean dob = new DataObjectBean(do1.getId()); setDocumentationAndExtensions(dob, do1); dob.setName(do1.getName()); if(do1.getItemSubjectRef()!=null) { dob.setItemSubject(defs.getItemDefinitionById(do1.getItemSubjectRef().getLocalPart())); } itemAwareElements.put(do1, dob); elements.put(dob.getId(), dob); return dob; }
private static void adaptDataInputs(WithDataInput wdi, WithDataInputBean wdib, DefinitionsBean defs){ if(wdi.hasDataInput()){ for(DataInput di : wdi.getDataInput()){ DataInputBean dib = new DataInputBean(di.getId()); setDocumentationAndExtensions(dib, di); dib.setName(di.getName()); dib.setCollection(di.isIsCollection()); adaptItemAwareElement(dib, di, defs); wdib.addDataInput(dib); itemAwareElements.put(di, dib); } } }
private static void adaptDataOutputs(WithDataOutput wdi, WithDataOutputBean wdib, DefinitionsBean defs){ if(wdi.hasDataOutput()){ for(DataOutput do_ : wdi.getDataOutput()){ DataOutputBean dob = new DataOutputBean(do_.getId()); setDocumentationAndExtensions(dob, do_); dob.setName(do_.getName()); dob.setCollection(do_.isIsCollection()); adaptItemAwareElement(dob, do_, defs); wdib.addDataOutput(dob); itemAwareElements.put(do_, dob); } } }
@Override public void bind(SequenceFlowEditorModel watchedModel, SequenceFlowBean modelToBind) { IExpressionBean exp = new ExpressionBean(); exp.setContent(watchedModel.getConditionnalExpression()); modelToBind.setExpression(exp); }
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 IOSpecificationBean adaptIOSpecifications(InputOutputSpecification iospec, DefinitionsBean defs){ IOSpecificationBean res = new IOSpecificationBean(); if(iospec!=null){ res.setId(iospec.getId()); setDocumentationAndExtensions(res, iospec); adaptDataInputs(iospec, res, defs); adaptDataOutputs(iospec, res, defs); } return res; }
@Override public void initializeWatchedModel(DataAssociationEditorModel watchedModel, DataAssociationBean modelToBind) { // 1 - load assignments if(modelToBind.getAssignements()!=null && !modelToBind.getAssignements().isEmpty()) { IAssignmentBean a = modelToBind.getAssignements().get(0); if(a.getFrom()!=null) { watchedModel.setFrom(a.getFrom().getContent()); } if(a.getTo()!=null) { watchedModel.setTo(a.getTo().getContent()); } } // 2 - load source or target item if(modelToBind.getSourceItem()!=null) { watchedModel.setItemDef(modelToBind.getSourceItem()); } else if (modelToBind.getTargetItem()!=null) { watchedModel.setItemDef(modelToBind.getTargetItem()); } }
private IDataOutputBean getDataOutput(IFlowNodeBean fn, String defaultId) { if(fn instanceof IActivityBean) { IActivityBean acti = (IActivityBean) fn; if(!acti.getIoSpecification().getDataOutputs().isEmpty()) { return acti.getIoSpecification().getDataOutputs().get(0); } } else if(fn instanceof ICatchEventBean) { ICatchEventBean event = (ICatchEventBean) fn; if(!event.getDataOutputs().isEmpty()) { return event.getDataOutputs().get(0); } } return new DataOutputBean(defaultId); }
private IDataInputBean getDataInput(IFlowNodeBean fn, String defaultId) { if(fn instanceof IActivityBean) { IActivityBean acti = (IActivityBean) fn; if(!acti.getIoSpecification().getDataInputs().isEmpty()) { return acti.getIoSpecification().getDataInputs().get(0); } } else if(fn instanceof IThrowEventBean) { IThrowEventBean event = (IThrowEventBean) fn; if(!event.getDataInputs().isEmpty()) { return event.getDataInputs().get(0); } } return new DataInputBean(defaultId); }
public void bindSyntaxModel(IModelElement diagramElementSyntaxModel, IEditorModel editorModel, IDiagramElement diagramElement) { SequenceFlowBean bean = (SequenceFlowBean) diagramElementSyntaxModel; SequenceFlowEditorModel eModel = (SequenceFlowEditorModel) editorModel; bean.setName(eModel.getName()); bean.setDocumentation(eModel.getDocumentation()); if (eModel.getConditionnalExpression()!=null){ ExpressionBean exp = new ExpressionBean(IdGenerator.createUniqueId()); exp.setContent(eModel.getConditionnalExpression()); bean.setExpression(exp); } //set target and source IBPMNEdge sequenceFlowEdge = (IBPMNEdge) diagramElement; IBPMNShape source = (IBPMNShape) sequenceFlowEdge.getSource(); IBPMNShape target = (IBPMNShape) sequenceFlowEdge.getTarget(); if (source!=null){ if (source.getModelElement() instanceof IFlowElementBean) bean.setSourceNode((IFlowElementBean) source.getModelElement()); } if (target!=null){ if (target.getModelElement() instanceof IFlowElementBean) bean.setTargetNode((IFlowElementBean) target.getModelElement()); } }
private void addDefaultAsssignmentExpressions(IDataAssociationBean dab) { if(dab.getAssignements().isEmpty()) return; IAssignmentBean a = dab.getAssignements().get(0); if(a.getFrom()==null || a.getFrom().getContent()==null || a.getFrom().getContent().isEmpty()) { IExpressionBean fromExp = new ExpressionBean(); String fromExpContent = "$"+dab.getSources().get(0).getId(); fromExp.setContent(fromExpContent); a.setFrom(fromExp); } if(a.getTo()==null || a.getTo().getContent()==null || a.getTo().getContent().isEmpty()) { IExpressionBean toExp = new ExpressionBean(); String toExpContent = "$"+dab.getTarget().getId(); toExp.setContent(toExpContent); a.setTo(toExp); } }
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); } } }
public ProcessBean(String id){ super(id); isClosed = false; type = ProcessTypes.NONE; sequenceFlows = new ArrayList<ISequenceFlowBean>(); startEvents = new ArrayList<IStartEventBean>(); endEvents = new ArrayList<IEndEventBean>(); tasks = new ArrayList<ITaskBean>(); gateways = new ArrayList<IGatewayBean>(); intermediateCatchEvents = new ArrayList<IIntermediateCatchEventBean>(); intermediateThrowEvents = new ArrayList<IIntermediateThrowEventBean>(); dataObjects = new ArrayList<IDataObjectBean>(); subprocesses = new ArrayList<ISubProcessBean>(); callActivities = new ArrayList<ICallActivityBean>(); artifacts = new ArrayList<IArtifactBean>(); iOBindings = new ArrayList<IInputOutputBinding>(); supportedInterfaces = new ArrayList<IInterfaceBean>(); ioSpecification = new IOSpecificationBean(IdGenerator.createUniqueId()); lanes = new ArrayList<ILaneBean>(); }
ExpressionBean exp = new ExpressionBean(createUniqueId()); exp.setContent("Mistakes Exists"); sf3.setExpression(exp); process.addSequenceFlow(sf3); sf4.setSourceNode(gateway); sf4.setTargetNode(task4); ExpressionBean exp2 = new ExpressionBean(createUniqueId()); exp2.setContent("No Mistakes"); sf4.setExpression(exp2); process.addSequenceFlow(sf4);
sf3.setSourceNode(gateway); sf3.setTargetNode(task3); ExpressionBean exp = new ExpressionBean(createUniqueId()); exp.setContent("Real Alert"); sf3.setExpression(exp); process.addSequenceFlow(sf3); sf4.setSourceNode(gateway); sf4.setTargetNode(task4); ExpressionBean exp2 = new ExpressionBean(createUniqueId()); exp2.setContent("Unimportant Alert"); sf4.setExpression(exp2); process.addSequenceFlow(sf4);