public <E extends IModelElement> Set<E> getConnectedTo(Class<? extends E> typeToFilterOn,Class<? extends E> connectorType){ HashSet<E> result = new HashSet<E>(); Map<IDiagramElement,E> edges = this.getEdges(connectorType); for(IDiagramElement di:edges.keySet()){ IEdge edge = (IEdge) di; //check in source if (isAssignableTo(edge.getSource().getClass(), typeToFilterOn)){ result.add((E) edge.getSource().getModelElement()); } //check in target if (isAssignableTo(edge.getTarget().getClass(), typeToFilterOn)){ result.add((E) edge.getTarget().getModelElement()); } } return result; }
@Override public ParticipantBean getSyntaxModel() { ParticipantBean participant = (ParticipantBean) getMainDiagramElement().getModelElement(); //clean participants process first participant.getProcess().getLanes().clear(); participant.getProcess().clearFlowElements(); participant.getProcess().clearIOSpec(); //add all lanes (recursively) into participants process HashSet<LaneBean> lanes = (HashSet<LaneBean>) this.getAll(LaneBean.class, true); for(LaneBean lane:lanes){ participant.getProcess().addLane(lane); } //grab all sequence flows HashMap<IDiagramElement,SequenceFlowBean> sequenceFlows = (HashMap<IDiagramElement, SequenceFlowBean>) this.getEdges(SequenceFlowBean.class); for(IDiagramElement di:sequenceFlows.keySet()){ SequenceFlowBean s = sequenceFlows.get(di); s.setSourceNode((IFlowElementBean) ((IEdge)di).getSource().getModelElement()); s.setTargetNode((IFlowElementBean) ((IEdge)di).getTarget().getModelElement()); participant.getProcess().addSequenceFlow(s); } return participant; }
s.setTargetNode((IFlowElementBean) ((IEdge)di).getTarget().getModelElement()); if (edge.getTarget().getModelElement() instanceof IItemAwareElementBean && edge.getSource().getModelElement() instanceof WithDataOutputAssociationBean){ IItemAwareElementBean data = (IItemAwareElementBean) edge.getTarget().getModelElement(); IFlowNodeBean source = (IFlowNodeBean) edge.getSource().getModelElement(); && edge.getTarget().getModelElement() instanceof IFlowNodeBean){ IFlowNodeBean target = (IFlowNodeBean) edge.getTarget().getModelElement(); MessageFlowBean mf = messageFlows.get(di); mf.setSource((IInteractionNodeBean) ((IEdge)di).getSource().getModelElement()); mf.setTarget((IInteractionNodeBean) ((IEdge)di).getTarget().getModelElement()); collaboration.addMessageFlow(mf); AssociationBean assoc = associations.get(el); assoc.setSource((IBaseElementBean) edge.getSource().getModelElement()); assoc.setTarget((IBaseElementBean) edge.getTarget().getModelElement());
s.setTargetNode((IFlowElementBean) ((IEdge)di).getTarget().getModelElement());
IDiagramElementView targetElement = diagramView.getUIElementById(edge.getTarget().getModelElement().getId());