예제 #1
0
  /**
   * To associate existing participant to the report and to create new SCG.
   *
   * @param request : request
   * @param reportQueueId : reportQueueId
   * @param participantIdToAssociate : participantIdToAssociate
   * @throws NumberFormatException : NumberFormatException
   * @throws BizLogicException : BizLogicException
   */
  private void createNewSCG(
      HttpServletRequest request, String reportQueueId, String participantIdToAssociate)
      throws NumberFormatException, BizLogicException {

    ReportLoaderQueue reportLoaderQueue = null;
    reportLoaderQueue = Utility.getReportQueueObject(reportQueueId);

    // Changing the status of the report in the queue to NEW
    reportLoaderQueue.setStatus(CaTIESConstants.NEW);

    // Create new SCG
    reportLoaderQueue.setSpecimenCollectionGroup(null);

    // removing all participants from CATISSUE_REPORT_PARTICIP_REL other
    // than the selected participant
    final Collection participantColl = reportLoaderQueue.getParticipantCollection();
    final Iterator iter = participantColl.iterator();
    final Set tempColl = new HashSet();
    while (iter.hasNext()) {
      final Participant participant = (Participant) iter.next();
      if (participant.getId().toString().equals(participantIdToAssociate.trim())) {
        tempColl.add(participant);
      }
    }
    reportLoaderQueue.setParticipantCollection(tempColl);

    // Updating the report queue obj
    this.updateReportLoaderQueue(reportLoaderQueue, request);
  }
예제 #2
0
  /**
   * Associate the existing SCG to the report.
   *
   * @param request : request
   * @param reportQueueId : reportQueueId
   * @param participantIdToAssociate : participantIdToAssociate
   * @param specimenCollGrpId : specimenCollGrpId
   * @throws DAOException : DAOException
   * @throws BizLogicException : BizLogicException
   * @throws UserNotAuthorizedException : UserNotAuthorizedException
   */
  private void associateSCGWithReport(
      HttpServletRequest request,
      String reportQueueId,
      String participantIdToAssociate,
      String specimenCollGrpId)
      throws DAOException, BizLogicException, UserNotAuthorizedException {
    Long cprId = null;
    ReportLoaderQueue reportLoaderQueue = null;
    reportLoaderQueue = Utility.getReportQueueObject(reportQueueId);

    // Changing the status of the report in the queue to NEW
    reportLoaderQueue.setStatus(CaTIESConstants.NEW);

    // Associating the SCG
    if (specimenCollGrpId != null && !specimenCollGrpId.equals("")) {
      SpecimenCollectionGroup scg = null;
      final IFactory factory = AbstractFactoryConfig.getInstance().getBizLogicFactory();
      final ReportLoaderQueueBizLogic reportLoaderQueueBizLogic =
          (ReportLoaderQueueBizLogic) factory.getBizLogic(ReportLoaderQueue.class.getName());
      final Object object =
          reportLoaderQueueBizLogic.retrieve(
              SpecimenCollectionGroup.class.getName(), new Long(specimenCollGrpId));
      if (object != null) {
        scg = (SpecimenCollectionGroup) object;
      }
      cprId = scg.getCollectionProtocolRegistration().getId();
      reportLoaderQueue.setSpecimenCollectionGroup(scg);
    }

    // Retrieving participantID if it is null
    if (participantIdToAssociate == null || participantIdToAssociate.equals("")) {
      final DefaultBizLogic defaultBizLogic = new DefaultBizLogic();
      final Long partID =
          (Long)
              defaultBizLogic.retrieveAttribute(
                  CollectionProtocolRegistration.class.getName(),
                  cprId,
                  Constants.COLUMN_NAME_PARTICIPANT_ID);
      participantIdToAssociate = partID.toString();
    }

    // removing all participants from CATISSUE_REPORT_PARTICIP_REL other
    // than the selected participant
    final Collection participantColl = reportLoaderQueue.getParticipantCollection();
    final Iterator iter = participantColl.iterator();
    final Set tempColl = new HashSet();
    Participant participant = null;
    while (iter.hasNext()) {
      participant = (Participant) iter.next();
      if (participant.getId().toString().equals(participantIdToAssociate.trim())) {
        tempColl.add(participant);
      }
    }
    reportLoaderQueue.setParticipantCollection(tempColl);

    // Updating the report queue obj
    this.updateReportLoaderQueue(reportLoaderQueue, request);
  }
예제 #3
0
  /**
   * To overwrite the existing report.
   *
   * @param request : request
   * @param reportQueueId : reportQueueId
   * @throws BizLogicException : BizLogicException
   * @throws NumberFormatException : NumberFormatException
   * @throws BizLogicException : BizLogicException
   */
  protected void overwriteReport(HttpServletRequest request, String reportQueueId)
      throws NumberFormatException, BizLogicException {
    ReportLoaderQueue reportLoaderQueue = null;
    reportLoaderQueue = Utility.getReportQueueObject(reportQueueId);

    // Changing the status of the report in the queue to NEW
    reportLoaderQueue.setStatus(CaTIESConstants.OVERWRITE_REPORT);
    this.updateReportLoaderQueue(reportLoaderQueue, request);
  }
예제 #4
0
  /**
   * Ignore the new report and use the existing one.
   *
   * @param reportQueueId : reportQueueId
   * @throws DAOException : DAOException
   * @throws UserNotAuthorizedException : UserNotAuthorizedException
   * @throws BizLogicException : BizLogicException
   */
  protected void ignoreNewReport(String reportQueueId)
      throws DAOException, UserNotAuthorizedException, BizLogicException {
    // Long cprId = null;
    ReportLoaderQueue reportLoaderQueue = null;
    reportLoaderQueue = Utility.getReportQueueObject(reportQueueId);
    final IFactory factory = AbstractFactoryConfig.getInstance().getBizLogicFactory();
    final ReportLoaderQueueBizLogic reportLoaderQueueBizLogic =
        (ReportLoaderQueueBizLogic) factory.getBizLogic(ReportLoaderQueue.class.getName());

    // deleting the reportloaderQueue object
    reportLoaderQueueBizLogic.delete(reportLoaderQueue, 0);
  }
예제 #5
0
  /**
   * To create new participant and associate it to the report.
   *
   * @param request : request
   * @param reportQueueId : reportQueueId
   * @return String : String
   * @throws Exception : Exception
   */
  private String createNewParticipant(HttpServletRequest request, String reportQueueId)
      throws Exception {

    String errorMessage = null;
    ReportLoaderQueue reportLoaderQueue = null;
    reportLoaderQueue = Utility.getReportQueueObject(reportQueueId);

    final Participant participant = Utility.getParticipantFromReportLoaderQueue(reportQueueId);

    final IFactory factory = AbstractFactoryConfig.getInstance().getBizLogicFactory();
    final ParticipantBizLogic participantBizLogic =
        (ParticipantBizLogic) factory.getBizLogic(Participant.class.getName());
    try {
      participantBizLogic.insert(participant, this.getSessionData(request), 0);
    } catch (final Exception e) {
      this.logger.error(e.getMessage(), e);
      // System.out.println("Error Occurred !!!!!");
      errorMessage = ApplicationProperties.getValue("errors.caTies.conflict.genericmessage");
      // Setting the status to NEW
      // reportLoaderQueue.setParticipantCollection(null);
      // reportLoaderQueue.setStatus(CaTIESConstants.
      // PARTICIPANT_CREATION_ERROR);
      // updateReportLoaderQueue(reportLoaderQueue,request);
      return errorMessage;
    }

    final Collection participantColl = new HashSet();
    // Adding the new participant
    participantColl.add(participant);
    reportLoaderQueue.setParticipantCollection(participantColl);
    // The new SCG for this participant will be inserted by the
    // FileProcessorThread

    // Setting the status to NEW
    reportLoaderQueue.setStatus(CaTIESConstants.NEW);
    reportLoaderQueue.setSpecimenCollectionGroup(null);
    this.updateReportLoaderQueue(reportLoaderQueue, request);

    return errorMessage;
  }