예제 #1
0
  /**
   * This method is used to get ApplicationType for the form RRSF424
   *
   * @return ApplicationType corresponding to the proposal type code.
   */
  private ApplicationType getApplicationType() {
    ApplicationType applicationType = ApplicationType.Factory.newInstance();
    Map<String, String> submissionInfo = s2sUtilService.getSubmissionType(pdDoc);
    if (pdDoc.getDevelopmentProposal().getProposalTypeCode() != null
        && Integer.parseInt(pdDoc.getDevelopmentProposal().getProposalTypeCode())
            < PROPOSAL_TYPE_CODE_6) {
      // Check <6 to ensure that if proposalType='TASk ORDER", it must not
      // set. THis is because enum ApplicationType has no
      // entry for TASK ORDER
      ApplicationTypeCodeDataType.Enum applicationTypeCodeDataType =
          ApplicationTypeCodeDataType.Enum.forInt(
              Integer.parseInt(pdDoc.getDevelopmentProposal().getProposalTypeCode()));
      applicationType.setApplicationTypeCode(applicationTypeCodeDataType);
      if (Integer.parseInt(pdDoc.getDevelopmentProposal().getProposalTypeCode())
          == ApplicationTypeCodeDataType.INT_REVISION) {
        String revisionCode = null;
        if (submissionInfo.get(S2SConstants.KEY_REVISION_CODE) != null) {
          revisionCode = submissionInfo.get(S2SConstants.KEY_REVISION_CODE);
          RevisionTypeCodeDataType.Enum revisionCodeApplication =
              RevisionTypeCodeDataType.Enum.forString(revisionCode);
          applicationType.setRevisionCode(revisionCodeApplication);
        }
        String revisionCodeOtherDesc = null;
        if (submissionInfo.get(S2SConstants.KEY_REVISION_OTHER_DESCRIPTION) != null) {
          revisionCodeOtherDesc = submissionInfo.get(S2SConstants.KEY_REVISION_OTHER_DESCRIPTION);
          applicationType.setRevisionCodeOtherExplanation(revisionCodeOtherDesc);
        }
      }
    }
    YesNoDataType.Enum answer = null;
    String answerdetails = getAnswer(ANSWER_128);
    if (answerdetails != null && !answerdetails.equals(NOT_ANSWERED)) {
      answer =
          answerdetails.equals(S2SConstants.PROPOSAL_YNQ_ANSWER_Y)
              ? YesNoDataType.Y_YES
              : YesNoDataType.N_NO;
      applicationType.setIsOtherAgencySubmission(answer);
    } else {
      applicationType.setIsOtherAgencySubmission(null);
    }

    if (answer != null && answer.equals(YesNoDataType.Y_YES)) {
      String answerExplanation = getAnswer(ANSWER_111);
      if (answerExplanation != null) {
        Collection<ArgValueLookup> argDescription =
            KcServiceLocator.getService(ArgValueLookupService.class).findAllArgValueLookups();
        if (argDescription != null) {
          for (ArgValueLookup argValue : argDescription) {
            if (argValue.getValue().equals(answerExplanation)) {
              String description = argValue.getDescription();
              String submissionExplanation = description.substring(5);
              if (submissionExplanation.length() > ANSWER_EXPLANATION_MAX_LENGTH) {
                applicationType.setOtherAgencySubmissionExplanation(
                    submissionExplanation.substring(0, ANSWER_EXPLANATION_MAX_LENGTH));
              } else {
                applicationType.setOtherAgencySubmissionExplanation(submissionExplanation);
              }
            }
          }
        }
      }
    }
    return applicationType;
  }
예제 #2
0
  protected MessageHeaderType getMessageHeader() {
    MessageHeaderType messageHeader = new MessageHeaderType();

    messageHeader.setI2B2VersionCompatible(
        new BigDecimal(Messages.getString("QueryData.i2b2VersionCompatible"))); // $NON-NLS-1$

    ApplicationType appType = new ApplicationType();
    appType.setApplicationName(
        Messages.getString("QueryData.SendingApplicationName")); // $NON-NLS-1$
    appType.setApplicationVersion(
        Messages.getString("QueryData.SendingApplicationVersion")); // $NON-NLS-1$
    messageHeader.setSendingApplication(appType);

    messageHeader.setAcceptAcknowledgementType(new String("messageId"));

    MessageTypeType messageTypeType = new MessageTypeType();
    messageTypeType.setEventType(Messages.getString("QueryData.EventType"));
    messageTypeType.setMessageCode(Messages.getString("QueryData.MessageCode"));
    messageHeader.setMessageType(messageTypeType);

    FacilityType facility = new FacilityType();
    facility.setFacilityName(Messages.getString("QueryData.SendingFacilityName")); // $NON-NLS-1$
    messageHeader.setSendingFacility(facility);

    ApplicationType appType2 = new ApplicationType();
    appType2.setApplicationVersion(
        Messages.getString("QueryData.ReceivingApplicationVersion")); // $NON-NLS-1$
    appType2.setApplicationName(
        Messages.getString("QueryData.ReceivingApplicationName")); // $NON-NLS-1$
    messageHeader.setReceivingApplication(appType2);

    FacilityType facility2 = new FacilityType();
    facility2.setFacilityName(Messages.getString("QueryData.ReceivingFacilityName")); // $NON-NLS-1$
    messageHeader.setReceivingFacility(facility2);

    Date currentDate = new Date();
    DTOFactory factory = new DTOFactory();
    messageHeader.setDatetimeOfMessage(factory.getXMLGregorianCalendar(currentDate.getTime()));

    SecurityType secType = new SecurityType();
    secType.setDomain(UserInfoBean.getInstance().getUserDomain());
    secType.setUsername(UserInfoBean.getInstance().getUserName());
    PasswordType ptype = new PasswordType();
    ptype.setIsToken(UserInfoBean.getInstance().getUserPasswordIsToken());
    ptype.setTokenMsTimeout(UserInfoBean.getInstance().getUserPasswordTimeout());
    ptype.setValue(UserInfoBean.getInstance().getUserPassword());

    secType.setPassword(ptype);
    messageHeader.setSecurity(secType);

    MessageControlIdType mcIdType = new MessageControlIdType();
    mcIdType.setInstanceNum(0);
    mcIdType.setMessageNum(generateMessageId());
    messageHeader.setMessageControlId(mcIdType);

    ProcessingIdType proc = new ProcessingIdType();
    proc.setProcessingId(Messages.getString("QueryData.ProcessingId")); // $NON-NLS-1$
    proc.setProcessingMode(Messages.getString("QueryData.ProcessingMode")); // $NON-NLS-1$
    messageHeader.setProcessingId(proc);

    messageHeader.setAcceptAcknowledgementType(
        Messages.getString("QueryData.AcceptAcknowledgementType")); // $NON-NLS-1$
    messageHeader.setApplicationAcknowledgementType(
        Messages.getString("QueryData.ApplicationAcknowledgementType")); // $NON-NLS-1$
    messageHeader.setCountryCode(Messages.getString("QueryData.CountryCode")); // $NON-NLS-1$
    messageHeader.setProjectId(UserInfoBean.getInstance().getProjectId());
    return messageHeader;
  }