Examples of WorkflowSession


Examples of com.day.cq.workflow.WorkflowSession

        response.setContentType("application/json");
        response.setCharacterEncoding("UTF-8");

        final JSONObject json = new JSONObject();

        final WorkflowSession workflowSession = workflowService.getWorkflowSession(
                request.getResourceResolver().adaptTo(Session.class));

        try {
            final WorkflowModel[] workflowModels = workflowSession.getModels();

            for (final WorkflowModel workflowModel : workflowModels) {
                JSONObject jsonWorkflow = new JSONObject();
                try {
                    jsonWorkflow.put("label", workflowModel.getTitle());
View Full Code Here

Examples of com.day.cq.workflow.WorkflowSession

            log.debug("Processing batch [ {} ] with workflow model [ {} ]", this.getCurrentBatch(resource).getPath(),
                    workflowModel);
        }

        final Session session = resource.getResourceResolver().adaptTo(Session.class);
        final WorkflowSession workflowSession = workflowService.getWorkflowSession(session);
        final WorkflowModel model = workflowSession.getModel(workflowModel);

        final Map<String, String> workflowMap = new LinkedHashMap<String, String>();

        final Resource currentBatch = this.getCurrentBatch(resource);
        final ModifiableValueMap currentProperties = currentBatch.adaptTo(ModifiableValueMap.class);

        Resource batchToProcess;
        if (currentProperties.get(KEY_STARTED_AT, Date.class) == null) {
            currentProperties.put(KEY_STARTED_AT, Calendar.getInstance());
            batchToProcess = currentBatch;
            log.debug("Virgin batch [ {} ]; preparing to initiate WF.", currentBatch.getPath());
        } else {
            batchToProcess = this.advance(resource);
            log.debug("Completed batch [ {} ]; preparing to advance and initiate WF on next batch [ {} ].",
                    currentBatch.getPath(), batchToProcess);
        }

        if (batchToProcess != null) {
            for (final Resource child : batchToProcess.getChildren()) {
                final ModifiableValueMap properties = child.adaptTo(ModifiableValueMap.class);

                final String state = properties.get(KEY_STATE, "");
                final String payloadPath = properties.get(KEY_PATH, String.class);

                if (StringUtils.isBlank(state)
                        && StringUtils.isNotBlank(payloadPath)) {

                    // Don't try to restart already processed batch items

                    final Workflow workflow = workflowSession.startWorkflow(model,
                            workflowSession.newWorkflowData("JCR_PATH", payloadPath));
                    properties.put(KEY_WORKFLOW_ID, workflow.getId());
                    properties.put(KEY_STATE, workflow.getState());

                    workflowMap.put(child.getPath(), workflow.getId());
                }
View Full Code Here

Examples of com.day.cq.workflow.WorkflowSession

    private Map<String, String> getActiveWorkflows(ResourceResolver resourceResolver,
                                                   final Map<String, String> workflowMap)
            throws RepositoryException, PersistenceException {

        final Map<String, String> activeWorkflowMap = new LinkedHashMap<String, String>();
        final WorkflowSession workflowSession =
                workflowService.getWorkflowSession(resourceResolver.adaptTo(Session.class));

        boolean dirty = false;
        for (final Map.Entry<String, String> entry : workflowMap.entrySet()) {
            final String workflowId = entry.getValue();

            final Workflow workflow;
            try {
                workflow = workflowSession.getWorkflow(workflowId);
                if (workflow.isActive()) {
                    activeWorkflowMap.put(entry.getKey(), workflow.getId());
                }

                final Resource resource = resourceResolver.getResource(entry.getKey());
View Full Code Here

Examples of com.day.cq.workflow.WorkflowSession

    private int terminateActiveWorkflows(ResourceResolver resourceResolver,
                                         final Resource contentResource,
                                         final Map<String, String> workflowMap)
            throws RepositoryException, PersistenceException {

        final WorkflowSession workflowSession =
                workflowService.getWorkflowSession(resourceResolver.adaptTo(Session.class));

        boolean dirty = false;
        int count = 0;
        for (final Map.Entry<String, String> entry : workflowMap.entrySet()) {
            final String workflowId = entry.getValue();

            final Workflow workflow;
            try {
                workflow = workflowSession.getWorkflow(workflowId);
                if (workflow.isActive()) {

                    workflowSession.terminateWorkflow(workflow);

                    count++;

                    log.info("Terminated workflow [ {} ]", workflowId);
View Full Code Here

Examples of org.fireflow.engine.impl.WorkflowSession

        this.calendarService = calendarService;
        this.calendarService.setRuntimeContext(this);
    }

    public IWorkflowSession getWorkflowSession() {
        return new WorkflowSession(this);
    }
View Full Code Here

Examples of org.fireflow.engine.impl.WorkflowSession

    Activity activity = activityInstance.getActivity();
    IPersistenceService persistenceService = rtCtx.getPersistenceService();
    ICalendarService calService = rtCtx.getCalendarService();

    IProcessInstance processInstance = token.getProcessInstance();
    WorkflowSession workflowSession = (WorkflowSession) ((IWorkflowSessionAware) processInstance)
        .getCurrentWorkflowSession();

    if (workflowSession == null) {
      throw new EngineException(token.getProcessInstance(),
          activityInstance.getActivity(),
View Full Code Here

Examples of org.huihoo.workflow.runtime.WorkflowSession

   * @param event The session event
   */
  public void sessionDestroyed(HttpSessionEvent event)
  {
    HttpSession session=event.getSession();
    WorkflowSession workflowSession=(WorkflowSession)session.getAttribute(Constants.WORKFLOW_CLIENT_SESSION);
    if(workflowSession!=null)
    {
      session.removeAttribute(Constants.WORKFLOW_CLIENT_SESSION);
      workflowSession.invalidate();
    }
  }
View Full Code Here

Examples of org.huihoo.workflow.runtime.WorkflowSession

  public boolean accept(String sessionID, SerialWork workItem)
    throws WorkflowException, RemoteException
  {
    Context cotext=(Context)this.workflowService;
    SessionManager manager=cotext.getEngine().getSessionManager();
    WorkflowSession session=manager.findSession(sessionID);
   
    WorkflowProcess workflowProcess=workflowService.findWorkflowPackage(workItem.getPackageID()).getMainProcess();
    WorkflowCase workflowCase=workflowService.getCaseDatabase().findWorkflowCase(session,workflowProcess,workItem.getCaseID());
    WorkflowWork workflowWork=workflowService.getCaseDatabase().findWorkflowWork(session,workflowProcess,workflowCase,workItem.getUUID());   
    return getWrappedObject().accept(session,workflowWork);
View Full Code Here

Examples of org.huihoo.workflow.runtime.WorkflowSession

  public boolean dispatch(String sessionID, SerialWork workItem)
    throws WorkflowException, RemoteException
  {
    Context cotext=(Context)this.workflowService;
    SessionManager manager=cotext.getEngine().getSessionManager();
    WorkflowSession session=manager.findSession(sessionID);
    WorkflowProcess workflowProcess=workflowService.findWorkflowPackage(workItem.getPackageID()).getMainProcess();
    WorkflowCase workflowCase=workflowService.getCaseDatabase().findWorkflowCase(session,workflowProcess,workItem.getCaseID());
    WorkflowWork workflowWork=workflowService.getCaseDatabase().findWorkflowWork(session,workflowProcess,workflowCase,workItem.getUUID());   
    return getWrappedObject().dispatch(session,workflowWork);
  }
View Full Code Here

Examples of org.huihoo.workflow.runtime.WorkflowSession

  public boolean revert(String sessionID, SerialWork workItem)
    throws WorkflowException, RemoteException
  {
    Context cotext=(Context)this.workflowService;
    SessionManager manager=cotext.getEngine().getSessionManager();
    WorkflowSession session=manager.findSession(sessionID);
    WorkflowProcess workflowProcess=workflowService.findWorkflowPackage(workItem.getPackageID()).getMainProcess();
    WorkflowCase workflowCase=workflowService.getCaseDatabase().findWorkflowCase(session,workflowProcess,workItem.getCaseID());
    WorkflowWork workflowWork=workflowService.getCaseDatabase().findWorkflowWork(session,workflowProcess,workflowCase,workItem.getUUID());   
    return getWrappedObject().revert(session,workflowWork);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.