コード例 #1
0
ファイル: BaseResolver.java プロジェクト: NCIP/c3pr
  /**
   * Search role based on nci id.
   *
   * @param assignedIdentifier the assigned identifier
   * @param role the role
   * @return the list
   * @return
   */
  protected List<Object> searchRoleBasedOnNciId(
      String assignedIdentifier, gov.nih.nci.coppa.po.Correlation role) {
    List<Object> remoteRoleList = new ArrayList<Object>();
    IdentifiedPerson identifiedPersonWithExactCtepIdMatch = null;
    if (assignedIdentifier != null) {
      // get Identified Organization using the Identifier provided
      IdentifiedPerson identifiedPersonToSearch =
          CoppaObjectFactory.getCoppaIdentfiedPersonSearchCriteriaOnCTEPId(assignedIdentifier);
      List<IdentifiedPerson> identifiedPersonsList =
          personOrganizationResolverUtils.getIdentifiedPerson(identifiedPersonToSearch);
      if (identifiedPersonsList.size() == 0) {
        return remoteRoleList;
      }

      // The identifiedPerson search by CTEP code is a like match & not exact match and returns more
      // than one result.
      // So Iterate thru the IdentifiedPersons fetched and isolate the one whose extension exactly
      // matches the search criteria.
      for (IdentifiedPerson identifiedPerson : identifiedPersonsList) {
        if (identifiedPerson != null
            && identifiedPerson
                .getAssignedId()
                .getRoot()
                .equalsIgnoreCase(PersonOrganizationResolverUtils.CTEP_PERSON)) {
          if (identifiedPerson
              .getAssignedId()
              .getExtension()
              .equalsIgnoreCase(assignedIdentifier)) {
            identifiedPersonWithExactCtepIdMatch = identifiedPerson;
            break;
          }
        }
      }
    }
    String personIiExtension = null;
    Person person = null;
    String correlationNodeXmlPayload = null;
    List<CorrelationNode> correlationNodeList = null;
    // Get the Role corresponding to every Identified Person fetched. Because the identifiedPerson
    // search by CTEP code is a
    // like match not exact match and can return more than one result.
    if (identifiedPersonWithExactCtepIdMatch != null) {
      personIiExtension = identifiedPersonWithExactCtepIdMatch.getPlayerIdentifier().getExtension();
      if (personIiExtension == null) {
        return remoteRoleList;
      }
      person = CoppaObjectFactory.getCoppaPersonForExtension(personIiExtension);
      correlationNodeXmlPayload = CoppaObjectFactory.getCorrelationNodePayload(role, person, null);

      correlationNodeList = getCorrelationNodesFromPayloadXml(correlationNodeXmlPayload);
      remoteRoleList.addAll(
          getRemoteRolesFromCorrelationNodesList(correlationNodeList, null, assignedIdentifier));
    }
    return remoteRoleList;
  }
コード例 #2
0
ファイル: BaseResolver.java プロジェクト: NCIP/c3pr
  /**
   * Search role based on name.
   *
   * @param firstName the first name
   * @param middleName the middle name
   * @param lastName the last name
   * @param role (instance of HealthCareProvide or ClinicalResearchStaff)
   * @return the list
   * @return
   */
  protected List<Object> searchRoleBasedOnName(
      String firstName, String middleName, String lastName, gov.nih.nci.coppa.po.Correlation role) {
    if (isDataValid(firstName, middleName, lastName)) {
      Person person = CoppaObjectFactory.getCoppaPerson(firstName, middleName, lastName);
      String correlationNodeXmlPayload =
          CoppaObjectFactory.getCorrelationNodePayload(role, person, null);

      List<CorrelationNode> correlationNodeList =
          getCorrelationNodesFromPayloadXml(correlationNodeXmlPayload);
      List<Object> remoteRoleList =
          getRemoteRolesFromCorrelationNodesList(correlationNodeList, null, null);
      return remoteRoleList;
    }
    return new ArrayList<Object>();
  }
コード例 #3
0
ファイル: BaseResolver.java プロジェクト: NCIP/c3pr
  /**
   * Search role based on organization.
   *
   * @param organizationNciIdentifier the organization nci identifier
   * @param role the role
   * @return the list
   * @return
   */
  protected List<Object> searchRoleBasedOnOrganization(
      String organizationNciIdentifier, gov.nih.nci.coppa.po.Correlation role) {
    // Get IdentifiedOrganization by ctepId
    IdentifiedOrganization identifiedOrganizationSearchCriteria =
        CoppaObjectFactory.getCoppaIdentfiedOrganizationSearchCriteriaOnCTEPId(
            organizationNciIdentifier);
    String payload =
        CoppaObjectFactory.getCoppaIdentfiedOrganization(identifiedOrganizationSearchCriteria);
    String results = null;
    try {
      results = personOrganizationResolverUtils.broadcastIdentifiedOrganizationSearch(payload);
    } catch (C3PRCodedException e) {
      log.error(e.getMessage());
    }

    // Assuming here that the ctepCode search yields exactly one organization
    List<String> resultObjects = XMLUtils.getObjectsFromCoppaResponse(results);
    if (resultObjects.size() == 0) {
      return new ArrayList<Object>();
    }
    if (resultObjects.size() > 1) {
      log.error(
          "searchStaffBasedOnOrganization: The ctep code matches more than one organization. The current implementation uses only the first match as it"
              + "assumes the ctep code search to always yield one exact match.");
    }

    IdentifiedOrganization coppaIdOrganization =
        CoppaObjectFactory.getCoppaIdentfiedOrganization(resultObjects.get(0));
    II organizationIdentifier = coppaIdOrganization.getPlayerIdentifier();
    Organization organization =
        CoppaObjectFactory.getCoppaOrganizationFromII(organizationIdentifier);
    String correlationNodeXmlPayload =
        CoppaObjectFactory.getCorrelationNodePayload(role, null, organization);

    List<CorrelationNode> correlationNodeList =
        personOrganizationResolverUtils.getCorrelationNodesFromPayloadXml(
            correlationNodeXmlPayload);
    List<Object> remoteStaffList =
        getRemoteRolesFromCorrelationNodesList(correlationNodeList, coppaIdOrganization, null);

    return remoteStaffList;
  }
コード例 #4
0
ファイル: BaseResolver.java プロジェクト: NCIP/c3pr
 /**
  * Gets the correlation nodes from payload xml.
  *
  * @param correlationNodeXmlPayload the correlation node xml payload
  * @return the correlation nodes from payload xml
  */
 public List<CorrelationNode> getCorrelationNodesFromPayloadXml(String correlationNodeXmlPayload) {
   String correlationNodeArrayXml = "";
   try {
     correlationNodeArrayXml =
         personOrganizationResolverUtils.broadcastSearchCorrelationsWithEntities(
             correlationNodeXmlPayload, true, true);
   } catch (Exception e) {
     log.error(e.getStackTrace());
   }
   List<String> correlationNodes = XMLUtils.getObjectsFromCoppaResponse(correlationNodeArrayXml);
   List<CorrelationNode> correlationNodeList = new ArrayList<CorrelationNode>();
   // creating a list of correlationNodes
   for (String correlationNode : correlationNodes) {
     correlationNodeList.add(CoppaObjectFactory.getCorrelationNodeObjectFromXml(correlationNode));
   }
   return correlationNodeList;
 }