public void deleteXMLWorkflowFromWorkflowNodeInfo(int workflowID) {
    String workQuery = WorkflowSqlCommands.Find_Workflownodeinfo_Based_On_WorkflowID;
    ArrayList<NameQueryParameter> listParam = new ArrayList<NameQueryParameter>();
    NameQueryParameter work = new NameQueryParameter(WorkflowSqlCommands.workflowid, workflowID);
    listParam.add(work);
    try {
      List list =
          (List)
              ConnectionDatabase.GetInstanceOfDatabaseComponent()
                  .executeHSQLQueryWithNameParameter(workQuery, listParam);
      if (list != null && list.size() > 0) {
        for (Iterator fieldRow = list.iterator(); fieldRow.hasNext(); ) {
          Workflownodeinfo node = (Workflownodeinfo) fieldRow.next();
          Nodeinfo nodeObject = new Nodeinfo();
          nodeObject = node.getNodeinfo();
          NodeEventImpl nei = new NodeEventImpl();
          nei.deleteNodeEventBasedOnWorkflowNodeId(node.getId());
          NodeInfoImpl nii = new NodeInfoImpl();
          ConnectionDatabase.GetInstanceOfDatabaseComponent().deleteObject(node);
          ConnectionDatabase.GetInstanceOfDatabaseComponent().deleteObject(nodeObject);
          // nii.deleteNodeInfoBasedOnNodeId(node.getNodeinfo());

        }
      }

    } catch (DBComponentException e) {
      e.printStackTrace();
    }
    /*catch(WorkflowComponentException wce)
    {
    	wce.printStackTrace();
    }*/
  }
  @Override
  public Workflownodeinfo addWorkFlowNodeInfo(
      int workflowId, int nodeId, String status, boolean isStartNode)
      throws WorkflowComponentException {

    Workflownodeinfo workflownodeinfo = new Workflownodeinfo();

    IWorkFlow workflow = new WorkFlowImpl();
    Workflowinfo workflowinfo = workflow.getWorkFlowBasedOnId(workflowId);
    if (workflowinfo != null) workflownodeinfo.setWorkflowinfo(workflowinfo);

    INodeInfo nodeInfo = new NodeInfoImpl();
    Nodeinfo nodeObject = nodeInfo.getNodeBasedOnId(nodeId);
    if (nodeObject != null) workflownodeinfo.setNodeinfo(nodeObject);
    workflownodeinfo.setIsStartNode(isStartNode);
    workflownodeinfo.setStatus(status);
    Object obj = null;

    try {
      obj = ConnectionDatabase.GetInstanceOfDatabaseComponent().saveObject(workflownodeinfo);
    } catch (DBComponentException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    if (obj != null) {
      workflownodeinfo = (Workflownodeinfo) obj;
    }
    return workflownodeinfo;
  }
  /**
   * 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();
    }
  }