예제 #1
0
  @Override
  public IHICData updateFormValuesWithDBData(IHICData incomingDO) {
    HashMap<String, Object> map = incomingDO.getDataObjectDetails();

    WorkflowComponent.log(0, "[INSIDE FUNCTION - updateFormValuesWithDBData]");
    String patientId = getPatientIdFromFormValues(incomingDO);
    WorkflowComponent.log(
        0, "[INSIDE FUNCTION - updateFormValuesWithDBData]; patientId=" + patientId);
    if (patientId != null) {
      String scheduleId = getScheduleIdFromFormValues(incomingDO);
      WorkflowComponent.log(
          0, "[INSIDE FUNCTION - updateFormValuesWithDBData]; scheduleId=" + scheduleId);

      HashMap<String, Object> ret =
          DataObjectListUtil.getPatientDOFormValuesFromDB(
              patientId,
              scheduleId,
              (String) map.get(CoreConstants.DATAOBJECT_WORKFLOW_PATTERN),
              (String) map.get(CoreConstants.DATAOBJECT_WORKFLOW_PATTERN_NODE));
      if (ret != null) {
        Hashtable<String, Object> formValues =
            incomingDO.getData().getFormPattern().getFormValues();

        Iterator<String> keyIter = ret.keySet().iterator();
        while (keyIter.hasNext()) {
          String key = keyIter.next();
          if (!formValues.containsKey(key)) formValues.put(key, ret.get(key));
          WorkflowComponent.log(
              0,
              "[INSIDE FUNCTION - updateFormValuesWithDBData]\t[key]"
                  + key
                  + "\t[value]"
                  + ret.get(key));
        }
      }
    }
    return incomingDO;
  }
예제 #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();
    }
  }
예제 #3
0
 @Override
 public void removeDataObjectFromNode(String workflowId, String nodeId, IHICData dataObject) {
   WorkflowComponent.log(0, "[DataObjectManagerDB][removeDataObjectFromNode]");
   updateDataObjectStatusInDBQueue(workflowId, nodeId, dataObject);
 }