Package org.activiti.designer.util.editor

Examples of org.activiti.designer.util.editor.Bpmn2MemoryModel


      ((SequenceFlow) bo).getExecutionListeners().set(index, listener);
    } else if(bo instanceof Process) {
      ((Process) bo).getExecutionListeners().set(index, listener);
    } else if(bo instanceof Pool) {
      Pool pool = ((Pool) bo);
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(diagram));
      model.getBpmnModel().getProcess(pool.getId()).getExecutionListeners().set(index, listener);
    }
  }
View Full Code Here


      ((SequenceFlow) bo).getExecutionListeners().remove(listener);
    } else if(bo instanceof Process) {
      ((Process) bo).getExecutionListeners().remove(listener);
    } else if(bo instanceof Pool) {
      Pool pool = ((Pool) bo);
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(diagram));
      model.getBpmnModel().getProcess(pool.getId()).getExecutionListeners().remove(listener);
    }
  }
View Full Code Here

      }
    }
  };

  protected void updateParentLane(String oldElementId, String newElementId) {
    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
    for (Process process : model.getBpmnModel().getProcesses()) {
      for (Lane lane : process.getLanes()) {
        if (lane.getFlowReferences().contains(oldElementId)) {
          lane.getFlowReferences().remove(oldElementId);
          lane.getFlowReferences().add(newElementId);
          return;
View Full Code Here

    namespaceText.removeFocusListener(listener);
    documentationText.removeFocusListener(listener);
    candidateStarterUsersText.removeFocusListener(listener);
    candidateStarterGroupsText.removeFocusListener(listener);
   
    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
    Process process = null;
    if(getSelectedPictogramElement() instanceof Diagram) {
      if (model.getBpmnModel().getPools().size() > 0) {
        process = model.getBpmnModel().getProcess(model.getBpmnModel().getPools().get(0).getId());
        setEnabled(false);
      } else {
        process = model.getBpmnModel().getMainProcess();
        setEnabled(true);
      }
   
    } else {
      Pool pool = ((Pool) getBusinessObject(getSelectedPictogramElement()));
      process = model.getBpmnModel().getProcess(pool.getId());
      setEnabled(true);
    }
   
    if(StringUtils.isNotEmpty(model.getBpmnModel().getTargetNamespace())) {
      namespaceText.setText(model.getBpmnModel().getTargetNamespace());
    } else {
      namespaceText.setText("http://www.activiti.org/test");
    }
   
    if (process != null) {
View Full Code Here

    connection.setEnd(targetAnchor);
   
    sourceAnchor.getOutgoingConnections().add(connection);
    targetAnchor.getIncomingConnections().add(connection);
   
    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
   
    BaseElement sourceElement = model.getFlowElement(association.getSourceRef());
    if (sourceElement == null) {
      sourceElement = model.getArtifact(association.getSourceRef());
    }
    BaseElement targetElement = model.getFlowElement(association.getTargetRef());
    if (targetElement == null) {
      targetElement = model.getArtifact(association.getTargetRef());
    }

    final GraphicsAlgorithm sourceGraphics = getPictogramElement(sourceElement).getGraphicsAlgorithm();
    GraphicsAlgorithm targetGraphics = getPictogramElement(targetElement).getGraphicsAlgorithm();
   
View Full Code Here

    addGraphicalContent(context, baseElement);
  }
 
  protected void addBaseElementToContainer(ContainerShape targetContainer, BaseElement baseElement) {
    if (targetContainer instanceof Diagram) {
      final Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
      if (model.getBpmnModel().getMainProcess() == null) {
        model.addMainProcess();
      }
      addFlowNodeOrArtifact(baseElement, model.getBpmnModel().getMainProcess());
    }
    else {
      // find the parent object
      final Object parent = getBusinessObjectForPictogramElement(targetContainer);
     
View Full Code Here

    try {
      final IFile dataFile = adei.getDataFile();
      final String diagramFileString = dataFile.getLocationURI().getPath();

      boolean saveImage = PreferencesUtil.getBooleanPreference(Preferences.SAVE_IMAGE);
      Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagramTypeProvider().getDiagram()));

      // add sequence flow bend-points to the model
      final IFeatureProvider featureProvider = getDiagramTypeProvider().getFeatureProvider();
      new GraphitiToBpmnDI(model, featureProvider).processGraphitiElements();

      BpmnXMLConverter converter = new BpmnXMLConverter();
      byte[] xmlBytes = converter.convertToXML(model.getBpmnModel());

      File objectsFile = new File(diagramFileString);
      FileOutputStream fos = new FileOutputStream(objectsFile);
      fos.write(xmlBytes);
      fos.close();
View Full Code Here

    super.setInput(input);

    final ActivitiDiagramEditorInput adei = (ActivitiDiagramEditorInput) input;
    final IFile dataFile = adei.getDataFile();

    final Bpmn2MemoryModel model = new Bpmn2MemoryModel(getDiagramTypeProvider().getFeatureProvider(), dataFile);
    ModelHandler.addModel(EcoreUtil.getURI(getDiagramTypeProvider().getDiagram()), model);

    String filePath = dataFile.getLocationURI().getPath();
    File bpmnFile = new File(filePath);
    try {
      if (bpmnFile.exists() == false) {
        model.setBpmnModel(new BpmnModel());
        model.addMainProcess();
        bpmnFile.createNewFile();
        dataFile.refreshLocal(IResource.DEPTH_INFINITE, null);
      } else {
        FileInputStream fileStream = new FileInputStream(bpmnFile);
        XMLInputFactory xif = XMLInputFactory.newInstance();
        InputStreamReader in = new InputStreamReader(fileStream, "UTF-8");
        XMLStreamReader xtr = xif.createXMLStreamReader(in);
        BpmnXMLConverter bpmnConverter = new BpmnXMLConverter();
        bpmnConverter.setUserTaskFormTypes(PreferencesUtil.getStringArray(Preferences.ALFRESCO_FORMTYPES_USERTASK));
        bpmnConverter.setStartEventFormTypes(PreferencesUtil.getStringArray(Preferences.ALFRESCO_FORMTYPES_STARTEVENT));
        BpmnModel bpmnModel = bpmnConverter.convertToBpmnModel(xtr);
        model.setBpmnModel(bpmnModel);
       
        if (bpmnModel.getLocationMap().size() == 0) {
          BpmnAutoLayout layout = new BpmnAutoLayout(bpmnModel);
          layout.execute();
        }
View Full Code Here

    saveMessages();
  }
 
  private void saveMessages() {
    if(diagram == null) return;
    final Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(diagram));
    if (model == null) {
      return;
    }
   
    TransactionalEditingDomain editingDomain = diagramEditor.getEditingDomain();
    ActivitiUiUtil.runModelChange(new Runnable() {
      public void run() {
        List<Message> newMessageList = new ArrayList<Message>();
        for (TableItem item : getItems()) {
          String id = item.getText(0);
          String name = item.getText(1);
          if(StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(name)) {
           
            Message newMessage = new Message();
            newMessage.setId(id);
            newMessage.setName(name);
            newMessageList.add(newMessage);
          }
        }
        model.getBpmnModel().setMessages(newMessageList);
      }
    }, editingDomain, "Model Update");
  }
View Full Code Here

    saveSignals();
  }
 
  private void saveSignals() {
    if(diagram == null) return;
    final Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(diagram));
    if (model == null) {
      return;
    }
   
    TransactionalEditingDomain editingDomain = diagramEditor.getEditingDomain();
    ActivitiUiUtil.runModelChange(new Runnable() {
      public void run() {
        List<Signal> newSignalList = new ArrayList<Signal>();
        for (TableItem item : getItems()) {
          String id = item.getText(0);
          String name = item.getText(1);
          if(StringUtils.isNotEmpty(id) && StringUtils.isNotEmpty(name)) {
           
            Signal newSignal = new Signal();
            newSignal.setId(id);
            newSignal.setName(name);
            newSignalList.add(newSignal);
          }
        }
        model.getBpmnModel().setSignals(newSignalList);
      }
    }, editingDomain, "Model Update");
  }
View Full Code Here

TOP

Related Classes of org.activiti.designer.util.editor.Bpmn2MemoryModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.