Esempio n. 1
0
 public void getComboData(
     String dataPatternId,
     String formPatternId,
     Window rootFormValue,
     String paramList,
     Combobox comboObj) {
   UiLibraryCompositeCommand command = new UiLibraryCompositeCommand();
   command.setMethodName(method);
   command.setRouter(router);
   command.setClassname(classname);
   command.setComponentId(componentId);
   command.setDataPatternId(dataPatternId);
   command.setFormPatternId(formPatternId);
   command.setFormValues(formValues);
   command.setRootFormValue(rootFormValue);
   command.setParamList(paramList);
   command.setSession(null);
   command.setComboSelectedValue(null);
   command.setValidListRequest(false);
   command.setPagingId("");
   command.execute();
   IHICData hicData = command.getHICData();
   List listValue = null;
   IData dataUnit = hicData.getData();
   listValue = dataUnit.getQueryData().getListData();
   String[][] allValues = dataUnit.getQueryData().iterateListData(listValue);
   uiLibraryUtil.showComboData(allValues, comboObj);
 }
  public void appendToDataObjectMetaData(
      String workflowId, String nodeId, IHICData dataObject, Dataobject doDb)
      throws WorkflowComponentException {
    // Store DataObject Metadata
    Hashtable<String, Object> hash = dataObject.getData().getFormPattern().getFormValues();
    Enumeration<String> hashKeys = hash.keys();

    while (hashKeys.hasMoreElements()) {
      String key = hashKeys.nextElement();
      /*if(hash.get(key) instanceof ArrayList)
      {
      	ArrayList toolValues=(ArrayList)hash.get(key);
      	for(int i=0;i<toolValues.size();i++)
      	{
      		String value = toolValues.get(i).toString();
      		DataObjectMetaDataImpl.addDataObjectMetadataWithExistingCheck(doDb, key, value);
      	}

      }
      else
      {*/
      Object value = hash.get(key);
      DataObjectMetaDataImpl.addDataObjectMetadataWithExistingCheck(doDb, key, value);
      /*}*/
    }
  }
Esempio n. 3
0
  @EventSubscriber(topic = "executeRuleHICData")
  public IHICData executeRuleHICData(IHICData dataObject) throws Exception {
    this.hicData = dataObject;
    System.out.println("-----Inside ExecuteRuleHICData----hicData=" + hicData);
    List<String> resultList = new ArrayList<String>();
    try {
      String factInStrFormat = hicData.getData().getSqlQuery();
      hicData.setUniqueID(factInStrFormat);
      System.out.println("-------Inside Execute RULES---factInStrFormat" + factInStrFormat);
      Object[] facts = {hicData};
      System.out.println("------Facts Object-------- =" + facts);

      List<IRuleClass> ruleClassList = new ArrayList<IRuleClass>();
      ruleClassList = executeRules(facts); // Should be called every time a fact arrives
      System.out.println(
          "-------Inside Execute RULES- number of rules mathcing=--ruleClassList.size()="
              + ruleClassList.size());
      if (ruleClassList.size() > 0) {
        for (int i = 0; i < ruleClassList.size(); i++) {
          IRuleClass rule = ruleClassList.get(i);
          Consequence con = (Consequence) rule.getConsequenceList().get(0);
          resultList.add(con.getConsequenceString());
          hicData
              .getData()
              .getFormPattern()
              .getFormValues()
              .put("RulesComponent", con.getConsequenceString());
        }
      }
      for (int i = 0; i < resultList.size(); i++) {
        System.out.println("Inside executeRuleHICData consequence list");
        System.out.println(resultList.get(i));
        //	hicData.getData().setRawData(resultLis
      }
    } catch (ComponentException e) {
      e.printStackTrace();
      throw new Exception(e.getMessage());
    }
    System.out.println("-----Done with ExecuteRuleHICData----hicData=" + hicData);
    return hicData;
  }
  @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;
  }
  @Override
  public IHICData getMatchingDataObjectForUser(IHICData incomingDataObject, String nodeExecStatus) {
    /*String tempUniqueId = incomingDataObject.getUniqueID();

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

    // For UniqueId to be same across server restart, search should not be based on UniqueId
    List<Object[]> output =
        DataObjectQueueImpl.checkDataObjectForUser(incomingDataObject, nodeExecStatus, false);

    // Check for null if list of data object
    if (output != null) {
      boolean idSet = false;
      for (int i = 0; i < output.size(); i++) {
        Dataobject dObj = (Dataobject) output.get(i)[0];

        if (dObj != null) {
          // This check is added in case more than one dataoject is recieved for same node exection
          // status.
          // So a unqiue id check is added if the stored dataobject and incoming dataobject has same
          // unqiue id and then unqiue id set
          if (output.size() > 1) {
            incomingDataObject = UniqueIDUtil.updateUniqueId(incomingDataObject);
            String uniqueId = incomingDataObject.getUniqueID();
            if (uniqueId.equalsIgnoreCase(dObj.getUniqueid())) idSet = true;
          }
          // Update incoming data object
          incomingDataObject = NOLISRuntimeHandler.prepareHICData(incomingDataObject);
          incomingDataObject.getData().getFormPattern().setFormId(dObj.getFormpattern());
          incomingDataObject.getData().getDataPattern().setDataPatternId(dObj.getDatapattern());
          // TODO create User Pattern info also
          // incomingDataObject.getData().a
          incomingDataObject.getData().setStatus(dObj.getStatus());
          incomingDataObject.setUniqueID(dObj.getUniqueid());

          incomingDataObject
              .getData()
              .getWorkflowPattern()
              .setWorkflowPattern(dObj.getWorkflownodeinfo().getWorkflowinfo().getName());
          incomingDataObject
              .getData()
              .getWorkflowPattern()
              .setWorkflowNode(dObj.getWorkflownodeinfo().getNodeinfo().getNodename());

          // Fetch meta data for this data object
          /*List<Dataobjectmetadata> doMetadataList = DataObjectMetaDataImpl.getAllMetaDataForDataObject(dObj.getId());
          if (doMetadataList != null)
          {
          	// Create form values
          	Hashtable<String, Object> formValues = incomingDataObject.getData().getFormPattern().getFormValues();
          	if (formValues == null) formValues = new Hashtable<String, Object>();

          	ArrayList toolOutValues= new ArrayList();
          	for (int j = 0; j < doMetadataList.size(); j++)
          	{
          		Dataobjectmetadata metaData = doMetadataList.get(j);
          		if ((formValues.containsKey(WorkflowConstant.TOOL_OUTPUT_FILE))
          				&& (metaData.getDatakey().equals(WorkflowConstant.TOOL_OUTPUT_FILE)))
          		{
          			Object obj = formValues.get(WorkflowConstant.TOOL_OUTPUT_FILE);
          			if(obj instanceof ArrayList)
          			{
          				toolOutValues = (ArrayList)obj;

          				if (!toolOutValues.contains(metaData.getDatavalue()))
          					toolOutValues.add(metaData.getDatavalue());
          				formValues.put(WorkflowConstant.TOOL_OUTPUT_FILE,toolOutValues);
          			}
          			else
          			{
          				String toolValue = obj.toString();

          				if (!toolOutValues.contains(toolValue))
          					toolOutValues.add(toolValue);
          				if (!toolOutValues.contains(metaData.getDatavalue()))
          					toolOutValues.add(metaData.getDatavalue());
          				formValues.put(WorkflowConstant.TOOL_OUTPUT_FILE,toolOutValues);
          			}
          		}
          		else
          		{
          			// Add entries to Form Values; but do not over-write
          			if (!formValues.containsKey(metaData.getDatakey()))
          				formValues.put(metaData.getDatakey(), metaData.getDatavalue());
          		}
          	}

          	// Set Form Values
          	incomingDataObject.getData().getFormPattern().setFormValues(formValues);
          }*/

          // Sent back the first matching data according to input received.
          if (output.size() > 1 && i < output.size() && !idSet) {
            continue;
          } else break;
        }
      }
    }

    /*incomingDataObject.setUniqueID(tempUniqueId);*/

    return incomingDataObject;
  }