예제 #1
0
  public Node getNode(String expression) throws CciDistPortalExceptionC {
    Node node = null;
    mXpath.reset();

    try {
      node = (Node) mXpath.evaluate(expression, mDocument, XPathConstants.NODE);
    } catch (XPathExpressionException e) {
      throw new CciDistPortalExceptionC(e);
    }
    return node;
  }
예제 #2
0
  /**
   * @param obj
   * @param expression
   * @return
   * @throws com.ccieurope.ccidistportal.exception.CciDistPortalExceptionC
   */
  public String getString(Object obj, String expression) throws CciDistPortalExceptionC {
    String value;
    mXpath.reset();

    try {
      value = mXpath.evaluate(expression, obj, XPathConstants.STRING).toString();
    } catch (XPathExpressionException e) {
      throw new CciDistPortalExceptionC(e);
    }

    return value;
  }
예제 #3
0
  @Override
  public Map<String, Boolean> checkStudyCharacteristic(String protocolMetaData) {
    Map<String, Boolean> studyCharacteristicMap = Maps.newHashMap();

    String isAchStudyXpath =
        "boolean(count(/protocol/site-responsible[text()='ach-achri'])>0 or count(/protocol/study-sites/site[@site-id=\"2\" or @site-id=\"1\"])>0)";

    String isAchStudyWithDrugXpath =
        "boolean((count(/protocol/site-responsible[text()='ach-achri'])>0 or count(/protocol/study-sites/site[@site-id=\"2\" or @site-id=\"1\"])>0) and count(/protocol/drugs/drug)>0)";

    String isInvestigatorStudyPath =
        "boolean(count(/protocol/study-type[text()='investigator-initiated'])>0)";

    String isIndustryOrCoorpStudyPath =
        "boolean(count(/protocol/study-type[text()='cooperative-group'])>0 or count(/protocol/study-type[text()='industry-sponsored'])>0)";

    String isUamsStudyPath = "boolean(count(/protocol/site-responsible[text()='uams'])>0)";

    try {
      boolean isAchStudy = false;
      boolean isAchStudyWithDrug = false;

      boolean isInvestigatorStudy = false;
      boolean isIndustryOrCoorpStudy = false;

      boolean isUAMSStudy = false;

      Document assertXml = xmlProcessor.loadXmlStringToDOM(protocolMetaData);

      XPath xpathInstance = xmlProcessor.getXPathInstance();

      isAchStudy =
          (Boolean) (xpathInstance.evaluate(isAchStudyXpath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isAchStudy", isAchStudy);

      xpathInstance.reset();

      isAchStudyWithDrug =
          (Boolean)
              (xpathInstance.evaluate(isAchStudyWithDrugXpath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isAchStudyWithDrug", isAchStudyWithDrug);

      xpathInstance.reset();

      isInvestigatorStudy =
          (Boolean)
              (xpathInstance.evaluate(isInvestigatorStudyPath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isInvestigatorStudy", isInvestigatorStudy);

      xpathInstance.reset();

      isIndustryOrCoorpStudy =
          (Boolean)
              (xpathInstance.evaluate(
                  isIndustryOrCoorpStudyPath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isIndustryOrCoorpStudy", isIndustryOrCoorpStudy);

      xpathInstance.reset();

      isUAMSStudy =
          (Boolean) (xpathInstance.evaluate(isUamsStudyPath, assertXml, XPathConstants.BOOLEAN));

      studyCharacteristicMap.put("isUAMSStudy", isUAMSStudy);

    } catch (Exception e) {
      // don't care
    }

    return studyCharacteristicMap;
  }