Exemplo n.º 1
0
 private WorkflowInstance safeGetWorkflowInstanceById(String workflowInstId) {
   try {
     return instRep.getWorkflowInstanceById(workflowInstId);
   } catch (Exception e) {
     return null;
   }
 }
Exemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see org.apache.oodt.cas.workflow.engine.WorkflowEngine#getWorkflowInstanceMetadata(java.lang.String)
   */
  public Metadata getWorkflowInstanceMetadata(String workflowInstId) {
    // okay, try and look up that worker thread in our hash map
    IterativeWorkflowProcessorThread worker =
        (IterativeWorkflowProcessorThread) workerMap.get(workflowInstId);
    if (worker == null) {
      // try and get the metadata
      // from the workflow instance repository (as it was persisted)
      try {
        WorkflowInstance inst = instRep.getWorkflowInstanceById(workflowInstId);
        return inst.getSharedContext();
      } catch (InstanceRepositoryException e) {
        LOG.log(
            Level.FINEST,
            "WorkflowEngine: Attempt to get metadata "
                + "for workflow instance id: "
                + workflowInstId
                + ", however, this engine is "
                + "not tracking its execution and the id: ["
                + workflowInstId
                + "] "
                + "was never persisted to "
                + "the instance repository");
        e.printStackTrace();
        return new Metadata();
      }
    }

    return worker.getWorkflowInstance().getSharedContext();
  }
Exemplo n.º 3
0
  private synchronized void persistWorkflowInstance(WorkflowInstance wInst) throws EngineException {

    try {
      if (wInst.getId() == null || (wInst.getId() != null && wInst.getId().equals(""))) {
        // we have to persist it by adding it
        // rather than updating it
        instRep.addWorkflowInstance(wInst);

      } else {
        // persist by update
        instRep.updateWorkflowInstance(wInst);
      }
    } catch (InstanceRepositoryException e) {
      e.printStackTrace();
      throw new EngineException(e.getMessage());
    }
  }