in bindings/servicemix-smpp/src/main/java/org/apache/servicemix/smpp/marshaler/DefaultSmppMarshaler.java [325:759]
private void applyOptionalParametersToRequest(MessageRequest request, NormalizedMessage message) {
List<OptionalParameter> optionalParameters = new ArrayList<OptionalParameter>();
//DEST_ADDR_SUBUNIT
Object destAddressSubunit = message.getProperty(DEST_ADDR_SUBUNIT);
if (destAddressSubunit != null) {
if (destAddressSubunit instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DEST_ADDR_SUBUNIT, (Byte) destAddressSubunit));
} else if (destAddressSubunit instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DEST_ADDR_SUBUNIT, Byte.valueOf((String) destAddressSubunit)));
}
}
//DEST_NETWORK_TYPE
Object destNetworkType = message.getProperty(DEST_NETWORK_TYPE);
if (destNetworkType != null) {
if (destNetworkType instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DEST_NETWORK_TYPE, (Byte) destNetworkType));
} else if (destNetworkType instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DEST_NETWORK_TYPE, Byte.valueOf((String) destNetworkType)));
}
}
//DEST_BEARER_TYPE
Object destBearerType = message.getProperty(DEST_BEARER_TYPE);
if (destBearerType != null) {
if (destBearerType instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DEST_BEARER_TYPE, (Byte) destBearerType));
} else if (destBearerType instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DEST_BEARER_TYPE, Byte.valueOf((String) destBearerType)));
}
}
//DEST_TELEMATICS_ID
Object destTelematicsId = message.getProperty(DEST_TELEMATICS_ID);
if (destTelematicsId != null) {
if (destTelematicsId instanceof Short) {
optionalParameters.add(new OptionalParameter.Short(Tag.DEST_TELEMATICS_ID, (Short) destTelematicsId));
} else if (destTelematicsId instanceof String) {
optionalParameters.add(new OptionalParameter.Short(Tag.DEST_TELEMATICS_ID, Short.valueOf((String) destTelematicsId)));
}
}
//SOURCE_ADDR_SUBUNIT
Object sourceAddrSubunit = message.getProperty(SOURCE_ADDR_SUBUNIT);
if (sourceAddrSubunit != null) {
if (sourceAddrSubunit instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SOURCE_ADDR_SUBUNIT, (Byte) sourceAddrSubunit));
} else if (sourceAddrSubunit instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SOURCE_ADDR_SUBUNIT, Byte.valueOf((String) sourceAddrSubunit)));
}
}
//SOURCE_NETWORK_TYPE
Object sourceNetworkType = message.getProperty(SOURCE_NETWORK_TYPE);
if (sourceNetworkType != null) {
if (sourceNetworkType instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SOURCE_NETWORK_TYPE, (Byte) sourceNetworkType));
} else if (sourceNetworkType instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SOURCE_NETWORK_TYPE, Byte.valueOf((String) sourceNetworkType)));
}
}
//SOURCE_BEARER_TYPE
Object sourceBearerType = message.getProperty(SOURCE_BEARER_TYPE);
if (sourceBearerType != null) {
if (sourceBearerType instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SOURCE_BEARER_TYPE, (Byte) sourceBearerType));
} else if (sourceBearerType instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SOURCE_BEARER_TYPE, Byte.valueOf((String) sourceBearerType)));
}
}
//SOURCE_TELEMATICS_ID
Object sourceTelematicsId = message.getProperty(SOURCE_TELEMATICS_ID);
if (sourceTelematicsId != null) {
if (sourceTelematicsId instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SOURCE_TELEMATICS_ID, (Byte) sourceTelematicsId));
} else if (sourceTelematicsId instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SOURCE_TELEMATICS_ID, Byte.valueOf((String) sourceTelematicsId)));
}
}
//QOS_TIME_TO_LIVE
Object qosTimeToLive = message.getProperty(QOS_TIME_TO_LIVE);
if (qosTimeToLive != null) {
if (qosTimeToLive instanceof Integer) {
optionalParameters.add(new OptionalParameter.Int(Tag.QOS_TIME_TO_LIVE, (Integer) qosTimeToLive));
} else if (qosTimeToLive instanceof String) {
optionalParameters.add(new OptionalParameter.Int(Tag.QOS_TIME_TO_LIVE, Integer.valueOf((String) qosTimeToLive)));
}
}
//PAYLOAD_TYPE
Object payloadType = message.getProperty(PAYLOAD_TYPE);
if (payloadType != null) {
if (payloadType instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.PAYLOAD_TYPE, (Byte) payloadType));
} else if (payloadType instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.PAYLOAD_TYPE, Byte.valueOf((String) payloadType)));
}
}
//ADDITIONAL_STATUS_INFO_TEXT
Object additionalStatusInfoText = message.getProperty(ADDITIONAL_STATUS_INFO_TEXT);
if (additionalStatusInfoText != null) {
if (additionalStatusInfoText instanceof String) {
optionalParameters.add(new OptionalParameter.COctetString(Tag.ADDITIONAL_STATUS_INFO_TEXT.code(), (String) additionalStatusInfoText));
}
}
//RECEIPTED_MESSAGE_ID
Object recipientMessageId = message.getProperty(RECEIPTED_MESSAGE_ID);
if (recipientMessageId != null) {
if (recipientMessageId instanceof String) {
optionalParameters.add(new OptionalParameter.COctetString(Tag.RECEIPTED_MESSAGE_ID.code(), (String) recipientMessageId));
}
}
//MS_MSG_WAIT_FACILITIES
Object msMsgWaitFacilities = message.getProperty(MS_MSG_WAIT_FACILITIES);
if (msMsgWaitFacilities != null) {
if (msMsgWaitFacilities instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MS_MSG_WAIT_FACILITIES, (Byte) msMsgWaitFacilities));
} else if (msMsgWaitFacilities instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MS_MSG_WAIT_FACILITIES, Byte.valueOf((String) msMsgWaitFacilities)));
}
}
//PRIVACY_INDICATOR
Object privacyIndicator = message.getProperty(PRIVACY_INDICATOR);
if (privacyIndicator != null) {
if (privacyIndicator instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.PRIVACY_INDICATOR, (Byte) privacyIndicator));
} else if (privacyIndicator instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.PRIVACY_INDICATOR, Byte.valueOf((String) privacyIndicator)));
}
}
//SOURCE_SUBADDRESS
Object sourceSubAddress = message.getProperty(SOURCE_SUBADDRESS);
if (sourceSubAddress != null) {
if (sourceSubAddress instanceof String) {
optionalParameters.add(new OptionalParameter.COctetString(Tag.SOURCE_SUBADDRESS.code(), (String) sourceSubAddress));
}
}
//DEST_SUBADDRESS
Object destSubAddress = message.getProperty(DEST_SUBADDRESS);
if (destSubAddress != null) {
if (destSubAddress instanceof String) {
optionalParameters.add(new OptionalParameter.COctetString(Tag.DEST_SUBADDRESS.code(), (String) destSubAddress));
}
}
//USER_MESSAGE_REFERENCE
Object userMessageReference = message.getProperty(USER_MESSAGE_REFERENCE);
if (userMessageReference != null) {
if (userMessageReference instanceof Short) {
optionalParameters.add(new OptionalParameter.Short(Tag.USER_MESSAGE_REFERENCE, (Short) userMessageReference));
} else if (userMessageReference instanceof String) {
optionalParameters.add(new OptionalParameter.Short(Tag.USER_MESSAGE_REFERENCE, Short.valueOf((String) userMessageReference)));
}
}
//USER_RESPONSE_CODE
Object userResponseCode = message.getProperty(USER_RESPONSE_CODE);
if (userResponseCode != null) {
if (userResponseCode instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.USER_RESPONSE_CODE, (Byte) userResponseCode));
} else if (userResponseCode instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.USER_RESPONSE_CODE, Byte.valueOf((String) userResponseCode)));
}
}
//SOURCE_PORT
Object sourcePort = message.getProperty(SOURCE_PORT);
if (sourcePort != null) {
if (sourcePort instanceof Short) {
optionalParameters.add(new OptionalParameter.Short(Tag.SOURCE_PORT, (Short) sourcePort));
} else if (sourcePort instanceof String) {
optionalParameters.add(new OptionalParameter.Short(Tag.SOURCE_PORT, Short.valueOf((String) sourcePort)));
}
}
//DESTINATION_PORT
Object desitinationPort = message.getProperty(DESTINATION_PORT);
if (desitinationPort != null) {
if (desitinationPort instanceof Short) {
optionalParameters.add(new OptionalParameter.Short(Tag.DESTINATION_PORT, (Short) desitinationPort));
} else if (desitinationPort instanceof String) {
optionalParameters.add(new OptionalParameter.Short(Tag.DESTINATION_PORT, Short.valueOf((String) desitinationPort)));
}
}
//SAR_MSG_REF_NUM
Object sarMsgRefNum = message.getProperty(SAR_MSG_REF_NUM);
if (sarMsgRefNum != null) {
if (sarMsgRefNum instanceof Short) {
optionalParameters.add(new OptionalParameter.Short(Tag.SAR_MSG_REF_NUM, (Short) sarMsgRefNum));
} else if (sarMsgRefNum instanceof String) {
optionalParameters.add(new OptionalParameter.Short(Tag.SAR_MSG_REF_NUM, Short.valueOf((String) sarMsgRefNum)));
}
}
//LANGUAGE_INDICATOR
Object languageIndicator = message.getProperty(LANGUAGE_INDICATOR);
if (languageIndicator != null) {
if (languageIndicator instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.LANGUAGE_INDICATOR, (Byte) languageIndicator));
} else if (languageIndicator instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.LANGUAGE_INDICATOR, Byte.valueOf((String) languageIndicator)));
}
}
//SAR_TOTAL_SEGMENTS
Object sarTotalSegments = message.getProperty(SAR_TOTAL_SEGMENTS);
if (sarTotalSegments != null) {
if (sarTotalSegments instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SAR_TOTAL_SEGMENTS, (Byte) sarTotalSegments));
} else if (sarTotalSegments instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SAR_TOTAL_SEGMENTS, Byte.valueOf((String) sarTotalSegments)));
}
}
//SAR_SEGMENT_SEQNUM
Object sarSegmentSeqNum = message.getProperty(SAR_SEGMENT_SEQNUM);
if (sarSegmentSeqNum != null) {
if (sarSegmentSeqNum instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SAR_SEGMENT_SEQNUM, (Byte) sarSegmentSeqNum));
} else if (sarSegmentSeqNum instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SAR_SEGMENT_SEQNUM, Byte.valueOf((String) sarSegmentSeqNum)));
}
}
//SC_INTERFACE_VERSION
Object scInterfaceVersion = message.getProperty(SC_INTERFACE_VERSION);
if (scInterfaceVersion != null) {
if (scInterfaceVersion instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SC_INTERFACE_VERSION, (Byte) scInterfaceVersion));
} else if (scInterfaceVersion instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SC_INTERFACE_VERSION, Byte.valueOf((String) scInterfaceVersion)));
}
}
//CALLBACK_NUM_PRES_IND
Object callbackNumPresInd = message.getProperty(CALLBACK_NUM_PRES_IND);
if (callbackNumPresInd != null) {
if (callbackNumPresInd instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.CALLBACK_NUM_PRES_IND, (Byte) callbackNumPresInd));
} else if (callbackNumPresInd instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.CALLBACK_NUM_PRES_IND, Byte.valueOf((String) callbackNumPresInd)));
}
}
//CALLBACK_NUM_ATAG
Object callbackNumAtag = message.getProperty(CALLBACK_NUM_ATAG);
if (callbackNumAtag != null) {
if (callbackNumAtag instanceof String) {
optionalParameters.add(new OptionalParameter.COctetString(Tag.CALLBACK_NUM_ATAG.code(), (String) callbackNumAtag));
}
}
//NUMBER_OF_MESSAGES
Object numberOfMessages = message.getProperty(NUMBER_OF_MESSAGES);
if (numberOfMessages != null) {
if (numberOfMessages instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.NUMBER_OF_MESSAGES, (Byte) numberOfMessages));
} else if (numberOfMessages instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.NUMBER_OF_MESSAGES, Byte.valueOf((String) numberOfMessages)));
}
}
//CALLBACK_NUM
Object callbackNum = message.getProperty(CALLBACK_NUM);
if (callbackNum != null) {
if (callbackNum instanceof String) {
optionalParameters.add(new OptionalParameter.COctetString(Tag.CALLBACK_NUM.code(), (String) callbackNum));
}
}
//DPF_RESULT
Object dpfResult = message.getProperty(DPF_RESULT);
if (dpfResult != null) {
if (dpfResult instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DPF_RESULT, (Byte) dpfResult));
} else if (dpfResult instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DPF_RESULT, Byte.valueOf((String) dpfResult)));
}
}
//SET_DPF
Object setDpf = message.getProperty(SET_DPF);
if (setDpf != null) {
if (setDpf instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SET_DPF, (Byte) setDpf));
} else if (setDpf instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SET_DPF, Byte.valueOf((String) setDpf)));
}
}
//MS_AVAILABILITY_STATUS
Object msAvailabilityStatus = message.getProperty(MS_AVAILABILITY_STATUS);
if (msAvailabilityStatus != null) {
if (msAvailabilityStatus instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MS_AVAILABILITY_STATUS, (Byte) msAvailabilityStatus));
} else if (msAvailabilityStatus instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MS_AVAILABILITY_STATUS, Byte.valueOf((String) msAvailabilityStatus)));
}
}
//NETWORK_ERROR_CODE
Object networkErrorCode = message.getProperty(NETWORK_ERROR_CODE);
if (networkErrorCode != null) {
if (networkErrorCode instanceof String) {
optionalParameters.add(new OptionalParameter.COctetString(Tag.NETWORK_ERROR_CODE.code(), (String) networkErrorCode));
}
}
//MESSAGE_PAYLOAD
Object messagePayload = message.getProperty(MESSAGE_PAYLOAD);
if (messagePayload != null) {
if (messagePayload instanceof String) {
optionalParameters.add(new OptionalParameter.COctetString(Tag.MESSAGE_PAYLOAD.code(), (String) messagePayload));
}
}
//DELIVERY_FAILURE_REASON
Object deliveryFailureReason = message.getProperty(DELIVERY_FAILURE_REASON);
if (deliveryFailureReason != null) {
if (deliveryFailureReason instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DELIVERY_FAILURE_REASON, (Byte) deliveryFailureReason));
} else if (deliveryFailureReason instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DELIVERY_FAILURE_REASON, Byte.valueOf((String) deliveryFailureReason)));
}
}
//MORE_MESSAGES_TO_SEND
Object moreMessagesToSent = message.getProperty(MORE_MESSAGES_TO_SEND);
if (moreMessagesToSent != null) {
if (moreMessagesToSent instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MORE_MESSAGES_TO_SEND, (Byte) moreMessagesToSent));
} else if (moreMessagesToSent instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MORE_MESSAGES_TO_SEND, Byte.valueOf((String) moreMessagesToSent)));
}
}
//MESSAGE_STATE
Object messageState = message.getProperty(MESSAGE_STATE);
if (messageState != null) {
if (messageState instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MESSAGE_STATE, (Byte) messageState));
} else if (messageState instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MESSAGE_STATE, Byte.valueOf((String) messageState)));
}
}
//USSD_SERVICE_OP
Object ussdServiceOP = message.getProperty(USSD_SERVICE_OP);
if (ussdServiceOP != null) {
if (ussdServiceOP instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.USSD_SERVICE_OP, (Byte) ussdServiceOP));
} else if (ussdServiceOP instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.USSD_SERVICE_OP, Byte.valueOf((String) ussdServiceOP)));
}
}
//DISPLAY_TIME
Object displayTime = message.getProperty(DISPLAY_TIME);
if (displayTime != null) {
if (displayTime instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DISPLAY_TIME, (Byte) displayTime));
} else if (displayTime instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.DISPLAY_TIME, Byte.valueOf((String) displayTime)));
}
}
//SMS_SIGNAL
Object smsSignal = message.getProperty(SMS_SIGNAL);
if (smsSignal != null) {
if (smsSignal instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SMS_SIGNAL, (Byte) smsSignal));
} else if (smsSignal instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.SMS_SIGNAL, Byte.valueOf((String) smsSignal)));
}
}
//ALERT_ON_MESSAGE_DELIVERY
Object alertOnMessageDelivery = message.getProperty(ALERT_ON_MESSAGE_DELIVERY);
if (alertOnMessageDelivery != null) {
optionalParameters.add(new OptionalParameter.Null(Tag.ALERT_ON_MESSAGE_DELIVERY));
}
//MS_VALIDITY
Object msValidity = message.getProperty(MS_VALIDITY);
if (msValidity != null) {
if (msValidity instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MS_VALIDITY, (Byte) msValidity));
} else if (msValidity instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.MS_VALIDITY, Byte.valueOf((String) msValidity)));
}
}
//ITS_REPLY_TYPE
Object itsReplyType = message.getProperty(ITS_REPLY_TYPE);
if (itsReplyType != null) {
if (itsReplyType instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.ITS_REPLY_TYPE, (Byte) itsReplyType));
} else if (itsReplyType instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.ITS_REPLY_TYPE, Byte.valueOf((String) itsReplyType)));
}
}
//ITS_SESSION_INFO
Object itsSessionInfo = message.getProperty(ITS_SESSION_INFO);
if (itsSessionInfo != null) {
if (itsSessionInfo instanceof Byte) {
optionalParameters.add(new OptionalParameter.Byte(Tag.ITS_SESSION_INFO, (Byte) itsSessionInfo));
} else if (itsSessionInfo instanceof String) {
optionalParameters.add(new OptionalParameter.Byte(Tag.ITS_SESSION_INFO, Byte.valueOf((String) itsSessionInfo)));
}
}
if (!optionalParameters.isEmpty()) {
request.setOptionalParametes(optionalParameters.toArray(new OptionalParameter[optionalParameters.size()]));
}
}