Package org.activiti.engine

Examples of org.activiti.engine.RepositoryService


            @FormParam("namespace") String namespace,
            @FormParam("parent") String parent,
            @FormParam("svg_xml") String svgXml,
            @FormParam("type") String type, @FormParam("views") String views)
            throws Exception {
        RepositoryService repositoryService = processEngine
                .getRepositoryService();
        Model model = repositoryService.getModel(id);
        model.setName(name);
        // model.setMetaInfo(root.toString());
        System.out.println("jsonXml : " + jsonXml);
        repositoryService.saveModel(model);
        repositoryService.addModelEditorSource(model.getId(),
                jsonXml.getBytes("utf-8"));

        Map map = new HashMap();

        return map;
View Full Code Here


    }

    @RequestMapping("modeler-open")
    public String open(@RequestParam(value = "id", required = false) String id)
            throws Exception {
        RepositoryService repositoryService = processEngine
                .getRepositoryService();
        Model model = repositoryService.getModel(id);

        if (model == null) {
            model = repositoryService.newModel();
            repositoryService.saveModel(model);
            id = model.getId();
        }

        return "redirect:/widgets/modeler/editor.html?id=" + id;
    }
View Full Code Here

        return "redirect:/modeler/modeler-list.do";
    }

    @RequestMapping("modeler-deploy")
    public String deploy(@RequestParam("id") String id) throws Exception {
        RepositoryService repositoryService = processEngine
                .getRepositoryService();
        Model modelData = repositoryService.getModel(id);
        JsonNode modelNode = (JsonNode) new ObjectMapper()
                .readTree(repositoryService.getModelEditorSource(modelData
                        .getId()));
        byte[] bpmnBytes = null;

        BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
        bpmnBytes = new BpmnXMLConverter().convertToXML(model);

        String processName = modelData.getName() + ".bpmn20.xml";
        Deployment deployment = repositoryService.createDeployment()
                .name(modelData.getName())
                .addString(processName, new String(bpmnBytes, "UTF-8"))
                .deploy();
        modelData.setDeploymentId(deployment.getId());
        repositoryService.saveModel(modelData);

        List<ProcessDefinition> processDefinitions = repositoryService
                .createProcessDefinitionQuery()
                .deploymentId(deployment.getId()).list();

        for (ProcessDefinition processDefinition : processDefinitions) {
            processEngine.getManagementService().executeCommand(
View Full Code Here

    /**
     * 流程定义.
     */
    public Page findProcessDefinitions(Page page) {
        RepositoryService repositoryService = processEngine
                .getRepositoryService();
        long count = repositoryService.createProcessDefinitionQuery().count();
        List<ProcessDefinition> processDefinitions = repositoryService
                .createProcessDefinitionQuery().listPage((int) page.getStart(),
                        page.getPageSize());
        page.setResult(processDefinitions);
        page.setTotalCount(count);

View Full Code Here

    /**
     * 部署.
     */
    public Page findDeployments(Page page) {
        RepositoryService repositoryService = processEngine
                .getRepositoryService();
        long count = repositoryService.createDeploymentQuery().count();
        List<Deployment> deployments = repositoryService
                .createDeploymentQuery().listPage((int) page.getStart(),
                        page.getPageSize());
        page.setResult(deployments);
        page.setTotalCount(count);

View Full Code Here

  @Rule
  public ActivitiRule activitiRule = new ActivitiRule();

  @Test
  public void startProcess() throws Exception {
    RepositoryService repositoryService = activitiRule.getRepositoryService();
    repositoryService.createDeployment().addInputStream("DymaticForm.bpmn20.xml", new FileInputStream(filename)).deploy();
   
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("DymaticForm").latestVersion().singleResult();
    FormService formService = activitiRule.getFormService();
    StartFormData startFormData = formService.getStartFormData(processDefinition.getId());
    assertNull(startFormData.getFormKey());
   
    Map<String, String> formProperties = new HashMap<String, String>();
View Full Code Here

        out().println("-------------");
    }

    protected void printDetails(String pid) {
        ProcessEngine pe = this.getProcessEngine();
        RepositoryService repo = pe.getRepositoryService();
        RuntimeService rt = pe.getRuntimeService();
        HistoryService hs = pe.getHistoryService();

        ProcessInstance pi = rt.createProcessInstanceQuery().processInstanceId(pid).singleResult();
        HistoricProcessInstance hpi = hs.createHistoricProcessInstanceQuery().processInstanceId(pid)
            .singleResult();
        if (pi == null && hpi == null) {
            // both null means. no process with that id.
            out().printf("No process details found with process id %s \n", pid);
            return;
        }

        String pdId = null;
        if (pi != null) {
            pdId = pi.getProcessDefinitionId();
        } else if (hpi != null) {
            pdId = hpi.getProcessDefinitionId();
        }

        ProcessDefinition pd = repo.createProcessDefinitionQuery().processDefinitionId(pdId).singleResult();
        Deployment depInfo = repo.createDeploymentQuery().deploymentId(pd.getDeploymentId()).singleResult();
        // print
        if (isVerbose()) {
            out().println("======== Deployment Details");
            printDeploymentInfo(depInfo);
View Full Code Here

        if (engine == null) {
            out().println("Process Engine NOT Found!");
            return null;
        }

        RepositoryService repo = engine.getRepositoryService();

        if (this.deploymentIDs != null && this.deploymentIDs.length > 0) {
            for (String deploymentID : this.deploymentIDs) {
                repo.deleteDeployment(deploymentID, this.cascade);
                out().printf("Undeployed %s \n", deploymentID);
            }
            return null;
        }

        if (!undeployAll) {
            out().println("Activiti Deployment IDs required or use the command with -a or --all " +
                "option for all undeployments");
            return null;
        } else {
            out().println("Undeploying all Activiti deployments...");
            List<Deployment> depList = repo.createDeploymentQuery().orderByDeploymenTime().asc().list();
            for (Deployment dep : depList) {
                String deploymentID = dep.getId();
                repo.deleteDeployment(deploymentID, this.cascade);
                out().printf("Undeployed %s \n", deploymentID);
            }
        }

        return null;
View Full Code Here

            // set all to true;
            this.active = this.definitions = this.history = this.deployments = true;
        }

        if (this.deployments) {
            RepositoryService repo = pe.getRepositoryService();
            printDeployments(out(), repo);
        }

        if (this.definitions) {
            RepositoryService repo = pe.getRepositoryService();
            printProcessDefinitions(out(), repo);
        }

        if (this.history) {
            HistoryService his = pe.getHistoryService();
View Full Code Here

  @Rule
  public ActivitiRule activitiRule = new ActivitiRule();

  @Test
  public void startProcess() throws Exception {
    RepositoryService repositoryService = activitiRule.getRepositoryService();
    repositoryService.createDeployment().addInputStream("TimeBoundaryIntermediateEvent.bpmn20.xml",
        new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("TimeBoundaryIntermediateEvent", variableMap);
View Full Code Here

TOP

Related Classes of org.activiti.engine.RepositoryService

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.