Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
  /**
   * 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;
  }