Package org.activiti.designer.util.editor

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


  @Override
  protected void extractChildren() {

    final String poolId = getModelObject().getId();

    final Bpmn2MemoryModel rootModel = findRootModel();

    processChildren(poolId, rootModel);

  }
View Full Code Here


    extractProcess(this, model.getBpmnModel().getMainProcess());
    extractPools(model.getBpmnModel().getPools());
  }

  private Bpmn2MemoryModel buildModel(final IFile modelFile) {
    final Bpmn2MemoryModel result = new Bpmn2MemoryModel(null, modelFile);

    String filePath = modelFile.getLocationURI().getPath();
    File bpmnFile = new File(filePath);
    try {
      if (bpmnFile.exists()) {
        final FileInputStream fileStream = new FileInputStream(bpmnFile);
        final XMLInputFactory xif = XMLInputFactory.newInstance();
        final InputStreamReader in = new InputStreamReader(fileStream, "UTF-8");
        final XMLStreamReader xtr = xif.createXMLStreamReader(in);
        BpmnXMLConverter converter = new BpmnXMLConverter();
        BpmnModel bpmnModel = converter.convertToBpmnModel(xtr);
        result.setBpmnModel(bpmnModel);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

  protected AbstractDiagramTreeNode(final Object parent, final T modelObject, final String name) {
    super(parent, modelObject, name);
  }

  protected final Bpmn2MemoryModel findRootModel() {
    Bpmn2MemoryModel result = null;

    if (hasRootModel()) {
      result = getRootModel();
    } else if (getParent() instanceof AbstractDiagramTreeNode) {
      result = ((AbstractDiagramTreeNode< ? >) getParent()).findRootModel();
View Full Code Here

    final Pool parentPool = findParentPool();
    if (parentPool != null) {
      final String poolId = parentPool.getId();

      final Bpmn2MemoryModel bpmn2MemoryModel = findRootModel();

      result = bpmn2MemoryModel.getBpmnModel().getProcess(poolId);

    } else {
      throw new IllegalArgumentException("findParentPool was called on a lane that has no pool as a parent");
    }
    return result;
View Full Code Here

    for (final PictogramElement pictogramElement : context.getPictogramElements()) {
      if(getBusinessObjectForPictogramElement(pictogramElement) == null) continue;
      final Object boObject = getBusinessObjectForPictogramElement(pictogramElement);
      if(boObject instanceof Pool == true) {
        final Pool pool = (Pool) boObject;
        Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
        Process process = model.getBpmnModel().getProcess(pool.getId());
        model.getBpmnModel().getProcesses().remove(process);
        model.getBpmnModel().getPools().remove(pool);
        IRemoveContext rc = new RemoveContext(pictogramElement);
        IFeatureProvider featureProvider = getFeatureProvider();
        IRemoveFeature removeFeature = featureProvider.getRemoveFeature(rc);
        if (removeFeature != null) {
          removeFeature.remove(rc);
View Full Code Here

     
     
    } else if (bo instanceof Pool) {
     
      if(context.getProperty("org.activiti.designer.lane.create") == null) {
        Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
        Pool pool = (Pool) bo;
        Process process = model.getBpmnModel().getProcess(pool.getId());
        if (process != null) {
          int deltaLaneHeight = deltaHeight / process.getLanes().size();
          List<Lane> sortedLanes = sortLanesByHorizontalOrder(process.getLanes());
          int yShift = 0;
          for (Lane lane : sortedLanes) {
View Full Code Here

    // get the activity itself to determine its boundary events
    final Activity activity = (Activity) getBusinessObjectForPictogramElement(shape);
    ILocation shapeLocationAfterMove = Graphiti.getLayoutService().getLocationRelativeToDiagram(shape);
    moveActivityChilds(activity, shapeLocationAfterMove);
   
    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
   
    if (context.getSourceContainer() != context.getTargetContainer()) {
      if (context.getSourceContainer() instanceof Diagram == false) {
        Object containerBo = getFeatureProvider().getBusinessObjectForPictogramElement(context.getSourceContainer());
        if (containerBo instanceof SubProcess) {
          SubProcess subProcess = (SubProcess) containerBo;
          subProcess.removeFlowElement(activity.getId());
          for (SequenceFlow flow : activity.getOutgoingFlows()) {
            subProcess.removeFlowElement(flow.getId());
          }
          for (BoundaryEvent event : activity.getBoundaryEvents()) {
            subProcess.removeFlowElement(event.getId());
          }
        } else if (containerBo instanceof Lane) {
          Lane lane = (Lane) containerBo;
          lane.getFlowReferences().remove(activity.getId());
          lane.getParentProcess().removeFlowElement(activity.getId());
          for (SequenceFlow flow : activity.getOutgoingFlows()) {
            lane.getParentProcess().removeFlowElement(flow.getId());
          }
          for (BoundaryEvent event : activity.getBoundaryEvents()) {
            lane.getParentProcess().removeFlowElement(event.getId());
          }
        }
      } else {
        if (model.getBpmnModel().getMainProcess() != null) {
          model.getBpmnModel().getMainProcess().removeFlowElement(activity.getId());
          for (SequenceFlow flow : activity.getOutgoingFlows()) {
            model.getBpmnModel().getMainProcess().removeFlowElement(flow.getId());
          }
          for (BoundaryEvent event : activity.getBoundaryEvents()) {
            model.getBpmnModel().getMainProcess().removeFlowElement(event.getId());
          }
        }
      }
     
      if (context.getTargetContainer() instanceof Diagram == false) {
        Object containerBo = getFeatureProvider().getBusinessObjectForPictogramElement(context.getTargetContainer());
        if (containerBo instanceof SubProcess) {
          SubProcess subProcess = (SubProcess) containerBo;
          subProcess.addFlowElement(activity);
          for (SequenceFlow flow : activity.getOutgoingFlows()) {
            subProcess.addFlowElement(flow);
          }
          for (BoundaryEvent event : activity.getBoundaryEvents()) {
            subProcess.addFlowElement(event);
          }
        } else if (containerBo instanceof Lane) {
          Lane lane = (Lane) containerBo;
          lane.getFlowReferences().add(activity.getId());
          lane.getParentProcess().addFlowElement(activity);
          for (SequenceFlow flow : activity.getOutgoingFlows()) {
            lane.getParentProcess().addFlowElement(flow);
          }
          for (BoundaryEvent event : activity.getBoundaryEvents()) {
            lane.getParentProcess().addFlowElement(event);
          }
        }
      } else {
        if (model.getBpmnModel().getMainProcess() == null) {
          model.addMainProcess();
        }
        model.getBpmnModel().getMainProcess().addFlowElement(activity);
        for (SequenceFlow flow : activity.getOutgoingFlows()) {
          model.getBpmnModel().getMainProcess().addFlowElement(flow);
        }
        for (BoundaryEvent event : activity.getBoundaryEvents()) {
          model.getBpmnModel().getMainProcess().addFlowElement(event);
        }
      }
    }
  }
View Full Code Here

      }
    }
  }

  private FlowElement getFlowElement(FlowElement flowElement) {
    Bpmn2MemoryModel model = ModelHandler.getModel(EcoreUtil.getURI(getDiagram()));
    for (Process process : model.getBpmnModel().getProcesses()) {
      FlowElement processElement = getFlowElementInProcess(flowElement, process.getFlowElements());
      if(processElement != null) return processElement;
    }
    return null;
  }
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.