コード例 #1
0
ファイル: TopPanelModel.java プロジェクト: URMC/i2b2
  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;
  }