public static EsbDiagramEditor getDiagramEditor() { /* Always refers EsbDiagramEditor from EsbDeserializerRegistry unless it is NULL * This ensures that the operations are executed by deserializer performs against the EsbDiagramEditor * initialized in EsbDeserializerRegistry * */ EsbDiagramEditor diagramEditorRef = EsbDeserializerRegistry.getInstance().getDiagramEditor(); if (diagramEditorRef != null) { diagramEditor = diagramEditorRef; return diagramEditorRef; } return diagramEditor; }
/** * Execute deserializer * * @param mediatorFlow * @param nodeList * @param domain * @param mediator * @param reversed * @param commentMediatorList * @param lastMediator * @throws DeserializerException */ private void executeMediatorDeserializer( IGraphicalEditPart part, LinkedList<EsbNode> nodeList, TransactionalEditingDomain domain, AbstractMediator mediator, boolean reversed, LinkedList<CommentMediator> commentMediatorList, boolean lastMediator) throws DeserializerException { @SuppressWarnings("rawtypes") IEsbNodeDeserializer deserializer = EsbDeserializerRegistry.getInstance().getDeserializer(mediator); if (deserializer != null) { deserializer.setReversed(reversed); @SuppressWarnings("unchecked") EsbNode node = deserializer.createNode(part, mediator); if (node != null) { // If there is any comment mediator(XML comment) in the source, // we will add // that into previous output connector's comment mediator list. // So that comment mediators have been encapsulated inside // output connectors which will prevent editor representing // comment mediators graphically. if (node instanceof CommentMediator) { AbstractOutputConnectorEditPart abstractOutputConnectorEditPart = null; if (reversed) { ProxyServiceEditPart proxyEditPart = EditorUtils.getProxy(part); commentMediatorList.add((CommentMediator) node); boolean faultSequence = isMediationFlowInFaultSequence(part); if (lastMediator && !faultSequence) { if (proxyEditPart != null) { abstractOutputConnectorEditPart = EditorUtils.getProxyOutSequenceOutputConnector(proxyEditPart); } APIResourceEditPart apiEditPart = EditorUtils.getApiResourceFromEditPart(part); if (apiEditPart != null) { abstractOutputConnectorEditPart = EditorUtils.getProxyOutSequenceOutputConnector(apiEditPart); } for (CommentMediator commentMediator : commentMediatorList) { if (abstractOutputConnectorEditPart != null) { executeAddValueCommand( ((OutputConnector) ((Node) abstractOutputConnectorEditPart.getModel()).getElement()) .getCommentMediators(), commentMediator, reversed); } } } } else { abstractOutputConnectorEditPart = getPreviousOutputConnector(part, nodeList, reversed); if (abstractOutputConnectorEditPart != null) { executeAddValueCommand( ((OutputConnector) ((Node) abstractOutputConnectorEditPart.getModel()).getElement()) .getCommentMediators(), (CommentMediator) node, reversed); } } } else { nodeList.add(node); if (reversed) { for (CommentMediator commentMediator : commentMediatorList) { AbstractOutputConnectorEditPart abstractOutputConnectorEditPart = getPreviousOutputConnector(part, nodeList, reversed); if (abstractOutputConnectorEditPart != null) { executeAddValueCommand( ((OutputConnector) ((Node) abstractOutputConnectorEditPart.getModel()).getElement()) .getCommentMediators(), commentMediator, reversed); } } commentMediatorList.clear(); } } if (node instanceof SendMediator) { if (getRootCompartment() != null) { SendMediator sendMediator = (SendMediator) node; EndPoint endPoint = sendMediator.getNextNode(); // Extract the endPoint info from the sendMediator if (endPoint != null) { if (reversed) { nodeList.add(nodeList.size(), endPoint); } else { nodeList.add(endPoint); } } } } } } }