Пример #1
0
  /**
   * Updating status of DO in Database in case of the error and update the status of pervious node
   * to waiting. This function is called from removeDataObjectFromNode. Here we are not removing
   * entry from DB since we would require meta data information about DO at each node in workflow.
   *
   * @param workflowId
   * @param nodeId
   * @param dataObject
   */
  private void updateDataObjectGivenStatusInDBQueue(
      String workflowId, String nodeId, IHICData dataObject, String status) {
    HashMap<String, Object> doDetails = dataObject.getDataObjectDetails();
    try {
      // This makes sure that the current call is pertaining to Workflow tool
      if (!isPatientPresentInFormValues(dataObject)) return;

      Hashtable<String, Object> metaData =
          HashUtil.removeNonRequiredKeysFromHashtable(
              ApplicationConstant.REQUIRED_KEYS_FOR_UNIQUE_DO,
              (Hashtable<String, Object>) doDetails.get(CoreConstants.DATAOBJECT_FORM_VALUES));
      DataObjectQueueImpl.setDataObjectExecutionStatus(
          workflowId,
          nodeId,
          StringUtil.getString(doDetails.get(CoreConstants.DATAOBJECT_USER_ID)),
          StringUtil.getString(doDetails.get(CoreConstants.DATAOBJECT_UNIQUE_ID)),
          status,
          metaData);
    } catch (WorkflowComponentException e) {
      e.printStackTrace();
    }
  }
Пример #2
0
  /**
   * Function for adding DO to Node Queue in database.
   *
   * @param workflowId
   * @param nodeId
   * @param dataObject
   */
  private void addDataObjectToDBQueue(String workflowId, String nodeId, IHICData dataObject) {
    try {
      // This makes sure that the current call is pertaining to Workflow tool
      if (!isPatientSchedulePresentInFormValues(dataObject)) return;

      // Disallow non-visual WF to store entry in DB
      Workflowinfo workflow = WorkFlowImpl.getWorkflowBasedOnWorkflowName(workflowId);
      Boolean isVisual = workflow.getIsVisual();
      if (isVisual == null) return;
      if (!isVisual.booleanValue()) return;

      /*// Update DO unique id to Patient ID which is unique for each patient
      updateDataObjectUniqueId(dataObject);*/

      // Get WorkflowNodeInfo for current nodeId
      Workflownodeinfo wfNodeInfo = WorkFlowNodeInfoImpl.getWorkFlowNodeInfo(workflowId, nodeId);

      /*
       * &&&&&&&&&&&&&&&&&&&&&& PRINTING &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
       */
      DataObjectListUtil.printDataObject(dataObject, "THIS IS WHAT HAS COME FOR SAVE", "*");
      WorkflowComponent.log(
          0,
          "[workflowId]"
              + workflowId
              + "\n[nodeId]"
              + nodeId
              + "\n[NODE_EXECUTION_STATUS]"
              + ((wfNodeInfo.getNodeinfo().getNodetype().indexOf("I") >= 0)
                  ? WorkflowConstant.NODE_EXECUTION_STATUS_WAITING
                  : WorkflowConstant.NODE_EXECUTION_STATUS_PROGRESS));
      /*
       * &&&&&&&&&&&&&&&&&&&&&& PRINTING &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
       */

      // Store DataObject
      HashMap<String, Object> doDetails = dataObject.getDataObjectDetails();

      // Create meta data based on which search is required
      Hashtable<String, Object> metaData =
          HashUtil.removeNonRequiredKeysFromHashtable(
              ApplicationConstant.REQUIRED_KEYS_FOR_UNIQUE_DO,
              (Hashtable<String, Object>) doDetails.get(CoreConstants.DATAOBJECT_FORM_VALUES));

      Dataobject doQueue =
          DataObjectQueueImpl.addDataObjectToDbQueueWithExistingCheck(
              StringUtil.getString(doDetails.get(CoreConstants.DATAOBJECT_FORM_PATTERN)),
              StringUtil.getString(doDetails.get(CoreConstants.DATAOBJECT_DATA_PATTERN)),
              StringUtil.getString(doDetails.get(CoreConstants.DATAOBJECT_STATUS)),
              wfNodeInfo,
              StringUtil.getString(doDetails.get(CoreConstants.DATAOBJECT_USER_PATTERN)),
              StringUtil.getString(doDetails.get(CoreConstants.DATAOBJECT_USER_ID)),
              StringUtil.getString(doDetails.get(CoreConstants.DATAOBJECT_UNIQUE_ID)),
              (wfNodeInfo.getNodeinfo().getNodetype().indexOf("I") >= 0)
                  ? WorkflowConstant.NODE_EXECUTION_STATUS_WAITING
                  : WorkflowConstant.NODE_EXECUTION_STATUS_PROGRESS,
              metaData);

      // Store DataObject Metadata
      appendToDataObjectMetaData(workflowId, nodeId, dataObject, doQueue);

    } catch (WorkflowComponentException e) {
      e.printStackTrace();
    }
  }