Esempio n. 1
0
 public void temporarilyCloseStudySiteToAccrualAndTreatment(Message message)
     throws RemoteException {
   List arguments = xmUtils.getArguments(message);
   List<Identifier> identifiers = xmUtils.getDomainObjectsFromList(Identifier.class, arguments);
   if (identifiers.size() == 0) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is atleast one identifier in the message.");
   }
   List<HealthcareSite> heaList =
       xmUtils.getDomainObjectsFromList(HealthcareSite.class, arguments);
   if (heaList.size() != 1) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is atleast one healtcare site defination in the message.");
   }
   WebRequest webRequest =
       SessionAndAuditHelper.setupHibernateSessionAndAudit(
           interceptor, "C3PR Admin", "Coordinating Center", new Date(), "Coordinating Center");
   try {
     // TODO fix it later
     //            studyRepository.temporarilyCloseStudySiteToAccrualAndTreatment(identifiers,
     // heaList.get(0).getPrimaryIdentifier());
   } catch (Exception e) {
     throw new RemoteException(e.getMessage());
   } finally {
     SessionAndAuditHelper.tearDownHibernateSession(interceptor, webRequest);
   }
 }
Esempio n. 2
0
 public void createStudyDefinition(Message message) throws RemoteException {
   List<Study> objects =
       xmUtils.getDomainObjectsFromList(Study.class, xmUtils.getArguments(message));
   if (objects.size() != 1) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is exactly one study defination in the message.");
   }
   WebRequest webRequest =
       SessionAndAuditHelper.setupHibernateSessionAndAudit(
           interceptor, "C3PR Admin", "Coordinating Center", new Date(), "Coordinating Center");
   try {
     Study study = objects.get(0);
     studyFactory.buildStudy(study);
     for (StudySite studySite : study.getStudySites()) {
       studySite.setHostedMode(false);
       // TODO fix it later
       //                studySite.setSiteStudyStatus(SiteStudyStatus.PENDING);
     }
     for (StudyCoordinatingCenter studyCoordinatingCenter : study.getStudyCoordinatingCenters()) {
       studyCoordinatingCenter.setHostedMode(false);
     }
     study.setCoordinatingCenterStudyStatus(CoordinatingCenterStudyStatus.PENDING);
     studyDao.save(study);
     studyRepository.createStudy(study.getIdentifiers());
   } catch (C3PRCodedException e) {
     throw new RemoteException("error building the study", e);
   } finally {
     SessionAndAuditHelper.tearDownHibernateSession(interceptor, webRequest);
   }
 }
Esempio n. 3
0
 public void activateStudySite(gov.nih.nci.cabig.ccts.domain.Message message)
     throws RemoteException {
   List arguments = xmUtils.getArguments(message);
   List<Identifier> identifiers = xmUtils.getDomainObjectsFromList(Identifier.class, arguments);
   if (identifiers.size() == 0) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is atleast one identifier in the message.");
   }
   List<StudySite> studySiteList = xmUtils.getDomainObjectsFromList(StudySite.class, arguments);
   if (studySiteList.size() != 1) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is atleast one study site defination in the message.");
   }
   WebRequest webRequest =
       SessionAndAuditHelper.setupHibernateSessionAndAudit(
           interceptor, "C3PR Admin", "Coordinating Center", new Date(), "Coordinating Center");
   try {
     StudySite studySite =
         studyRepository
             .getUniqueStudy(identifiers)
             .getStudySite(studySiteList.get(0).getHealthcareSite().getPrimaryIdentifier());
     studySite.setIrbApprovalDate(studySiteList.get(0).getIrbApprovalDate());
     // TODO fix it later
     //        	studySite.setStartDate(studySiteList.get(0).getStartDate());
     studySiteDao.save(studySite);
     // TODO fix it later
     //            studyRepository.activateStudySite(identifiers,
     // studySiteList.get(0).getHealthcareSite().getPrimaryIdentifier());
   } catch (Exception e) {
     throw new RemoteException(e.getMessage());
   } finally {
     SessionAndAuditHelper.tearDownHibernateSession(interceptor, webRequest);
   }
 }
Esempio n. 4
0
 public void temporarilyCloseStudyToAccrualAndTreatment(Message message) throws RemoteException {
   List<Identifier> objects =
       xmUtils.getDomainObjectsFromList(Identifier.class, xmUtils.getArguments(message));
   if (objects.size() == 0) {
     throw new RemoteException(
         "Illegal Argument(s). Make sure there is atleast one identifier in the message.");
   }
   WebRequest webRequest =
       SessionAndAuditHelper.setupHibernateSessionAndAudit(
           interceptor, "C3PR Admin", "Coordinating Center", new Date(), "Coordinating Center");
   try {
     studyRepository.temporarilyCloseStudyToAccrualAndTreatment(objects);
   } catch (Exception e) {
     throw new RemoteException(e.getMessage());
   } finally {
     SessionAndAuditHelper.tearDownHibernateSession(interceptor, webRequest);
   }
 }
Esempio n. 5
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. 6
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;
  }