Last active
December 18, 2015 07:09
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MultiPartMessageUpdater { | |
private final MultipartMessageParameterFactory multipartMessageParameterFactory; | |
public MultiPartMessageUpdater(final MultipartMessageParameterFactory parameterFactory) { | |
this.multipartMessageParameterFactory = parameterFactory; | |
} | |
public OperatorMessage updateParameters(OperatorMessage operatorMessage, String messagepartInfo) throws ProtocolConversionException { | |
OperatorMessage updatedMessage = operatorMessage; | |
if (StringUtils.isNotBlank(messagepartInfo)) { | |
MultipartParameters parameters = multipartMessageParameterFactory.createFrom(messagepartInfo); | |
updatedMessage.setMessageReferenceNumber(parameters.getMessageReferenceNumber()); | |
try { | |
updatedMessage.setSegmentSeqnum(parameters.getSegmentSequenceNumber()); | |
} catch (IntegerOutOfRangeException ioore) { | |
throw new ProtocolConversionException("UDH segment sequence number out of range", ioore); | |
} | |
try { | |
updatedMessage.setTotalSegments(parameters.getTotalSegments()); | |
} catch (IntegerOutOfRangeException ioore) { | |
throw new ProtocolConversionException("MessagePart total sequence number out of range", ioore); | |
} | |
} | |
return updatedMessage; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment