Package pl.net.bluesoft.rnd.processtool.model

Examples of pl.net.bluesoft.rnd.processtool.model.ProcessInstance


    }

  public String internalInvoke(final TaskWatch watch) {
    ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
    ProcessInstanceDAO dao = ctx.getProcessInstanceDAO();
    ProcessInstance pi = dao.getProcessInstance(Long.parseLong(processInstanceId));
    if (pi.getInternalId() == null) {
        pi.setInternalId(context.getScopeInstance().getExecution().getProcessInstance().getId());
        dao.saveProcessInstance(pi);
    }

    final ProcessToolProcessStep stepInstance = ctx.getRegistry().getStep(stepName);
    if (stepInstance == null) {
View Full Code Here


    @Override
    public void execute(DelegateExecution execution) throws Exception {
        ProcessToolContext ptc = ProcessToolContext.Util.getThreadProcessToolContext();
        ProcessInstanceDAO dao = ptc.getProcessInstanceDAO();
        String processInstanceId = execution.getProcessInstanceId();
        ProcessInstance pi = dao.getProcessInstanceByInternalId(processInstanceId);

        String res;
        String stepName = (String) this.stepName.getValue(execution);
        Map params = new HashMap();
        if (this.params != null) {
            String xml = (String) this.params.getValue(execution);
            if (xml != null) {
                XStream xs = new XStream();
                xs.alias("map", java.util.Map.class);
                xs.registerConverter(new Converter() {
                    public boolean canConvert(Class clazz) {
                        return AbstractMap.class.isAssignableFrom(clazz);
                    }

                    public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
                        AbstractMap<String, String> map = (AbstractMap<String, String>) value;
                        for (Map.Entry<String, String> entry : map.entrySet()) {
                            writer.startNode(entry.getKey().toString());
                            writer.setValue(entry.getValue().toString());
                            writer.endNode();
                        }
                    }

                    public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
                        Map<String, String> map = new HashMap<String, String>();

                        while (reader.hasMoreChildren()) {
                            reader.moveDown();
                            map.put(reader.getNodeName(), reader.getValue());
                            reader.moveUp();
                        }
                        return map;
                    }
                });
                params = (Map) xs.fromXML(xml);
            }
        }

        try {
            ProcessToolProcessStep stepInstance = ptc.getRegistry().getStep(stepName);
            if (stepInstance == null) {
                throw new IllegalArgumentException("No step defined by name: " + stepName);
            }
            processAutowiredProperties(stepInstance, params);
            res = stepInstance.invoke(prepareStep(pi, execution), params);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        for (ProcessInstanceAttribute pia : pi.getProcessAttributes()) {
            if (pia instanceof BpmVariable) {
                BpmVariable bpmVar = (BpmVariable) pia;
                if (hasText(bpmVar.getBpmVariableName())) {
                    execution.setVariable(bpmVar.getBpmVariableName(), bpmVar.getBpmVariableValue());
                }
View Full Code Here

                withErrorHandling(getApplication(), new Runnable() {
                    public void run() {
                        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
                        ProcessDefinitionConfig cfg = (ProcessDefinitionConfig) l.getValue();
                        cfg = ctx.getProcessDefinitionDAO().getActiveConfigurationByKey(cfg.getBpmDefinitionKey());
                        ProcessInstance instance = session.createProcessInstance(cfg, null, ctx, null, null, "portlet", null);
                        getWindow().showNotification(getMessage("newProcess.started"), 2000);
                        getWindow().executeJavaScript("Liferay.trigger('processtool.bpm.newProcess', '" + instance.getInternalId() + "');");
                        getWindow().executeJavaScript("vaadin.forceSync();");

                        List<BpmTask> tasks = session.findUserTasks(instance, ctx);
                        if (!tasks.isEmpty()) {
                            BpmTask task = tasks.get(0);
                            if (activityMainPane != null) {
                                activityMainPane.displayProcessData(task, session);
                            }
                            else {
                                Window w = new Window(instance.getInternalId());
                                w.setContent(new ProcessDataPane(getApplication(), session, i18NSource, task, new WindowProcessDataDisplayContext(w)));
                                w.center();
                                getWindow().addWindow(w);
                                w.focus();
                            }
View Full Code Here

    withErrorHandling(getApplication(), new Runnable() {
      @Override
      public void run() {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        ProcessDefinitionConfig cfg = ctx.getProcessDefinitionDAO().getActiveConfigurationByKey(bpmDefinitionId);
        ProcessInstance instance = session.createProcessInstance(cfg, null, ctx, null, null, "portlet", null);
        VaadinUtility.informationNotification(activityMainPane.getApplication(), getMessage("newProcess.started"), 1000);
        getWindow().executeJavaScript("Liferay.trigger('processtool.bpm.newProcess', '" + instance.getInternalId() + "');");
        getWindow().executeJavaScript("vaadin.forceSync();");

        List<BpmTask> tasks = session.findUserTasks(instance, ctx);
        if (!tasks.isEmpty()) {
          BpmTask task = tasks.get(0);
          if (activityMainPane != null) {
            activityMainPane.displayProcessData(task, session);
          }
          else {
            Window w = new Window(instance.getInternalId());
            w.setContent(new ProcessDataPane(getApplication(), session, i18NSource, task, new WindowProcessDataDisplayContext(w)));
            w.center();
            getWindow().addWindow(w);
            w.focus();
          }
View Full Code Here

   * @return true jeżeli nastąpiło przełączenie
   */
  private boolean changeCurrentViewToActiveProcess()
  {
    /* Aktualny proces */
    ProcessInstance closedProcess = task.getProcessInstance();
   
    /* Proces główny względem wstrzymywanego procesu */
    ProcessInstance parentProcess = closedProcess.getParent();
   
    boolean isSubProcess = parentProcess != null ;
    boolean isParentProcess = !closedProcess.getChildren().isEmpty();
   
    /* Zamykany proces jest podprocesem, wybierz do otwoarcia jego rodzica */
    if(isSubProcess)
    {
      /* Przełącz się na proces głowny */
      if(parentProcess.isProcessRunning())
        return changeProcess(parentProcess);
    }
   
   
    /* Zamykany proces jest procesem glownym dla innych procesow */
 
View Full Code Here

  }

  @Override
    @WebMethod (exclude=true)
    public ProcessInstance getProcessData(@WebParam(name="internalId")final String internalId) throws AperteWsWrongArgumentException {
        ProcessInstance processInstance = withContext(new ReturningProcessToolContextCallback<ProcessInstance>() {
            @Override
            public ProcessInstance processWithContext(ProcessToolContext ctx) {
                return fetchHibernateData(getSession(ctx).getProcessData(internalId, ctx));
            }
        });
View Full Code Here

  @Override
    @WebMethod
    public boolean isProcessRunning(@WebParam(name="internalId")final String internalId) throws AperteWsWrongArgumentException {
   
    final ProcessInstance processData = getProcessData(internalId);
        return withContext(new ReturningProcessToolContextCallback<Boolean>() {
            @Override
            public Boolean processWithContext(ProcessToolContext ctx) {
                return getSession(ctx).isProcessRunning(processData.getInternalId(), ctx);
            }
        });
    }
View Full Code Here

 

  @Override
    @WebMethod
    public boolean isProcessOwnedByUser(@WebParam(name="internalId")final String internalId,@WebParam(name="userLogin") final String userLogin) throws AperteWsWrongArgumentException {
    final ProcessInstance processData = getProcessData(internalId);
      final UserData findUser = findUser(userLogin);
        return withContext(new ReturningProcessToolContextCallback<Boolean>() {
            @Override
            public Boolean processWithContext(ProcessToolContext ctx) {
             
View Full Code Here

  @Override
  @WebMethod
    public List<BpmTask> getTaskData(@WebParam(name="internalId")final String internalId,
                                                 @WebParam(name="taskName")final String taskName) throws AperteWsWrongArgumentException, AperteWsIllegalArgumentException {
   
    final ProcessInstance processData = getProcessData(internalId);
    
    AperteErrorCheckUtil.checkCorrectnessOfArgument(taskName, AperteIllegalArgumentCodes.TASK);
   
    List<BpmTask> bpmTasks = withContext(new ReturningProcessToolContextCallback<List<BpmTask>>() {
            @Override
            public List<BpmTask> processWithContext(ProcessToolContext ctx) {
                return fetchHibernateData(getSession(ctx).getTaskData(processData.getInternalId(), taskName, ctx));
            }
        });
   
    if(bpmTasks== null || bpmTasks.isEmpty()){
     
View Full Code Here

  @Override
  @WebMethod (exclude=true)
    public List<BpmTask> findUserTasks(@WebParam(name="processInstanceInternalId")final String internalId,
        @WebParam(name="userLogin")final String userLogin) throws AperteWsWrongArgumentException {
    final ProcessInstance processInstance = getProcessData(internalId);
    final UserData user = findUser(userLogin);
        return withContext(new ReturningProcessToolContextCallback<List<BpmTask>>() {
            @Override
            public List<BpmTask> processWithContext(ProcessToolContext ctx) {
                return fetchHibernateData(getSession(ctx, user).findUserTasks(processInstance, ctx));
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.processtool.model.ProcessInstance

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.