message.setHeader(SmppConstants.ID, cancelSm.getMessageId());
}
protected CancelSm createCancelSm(Exchange exchange) {
Message in = exchange.getIn();
CancelSm cancelSm = new CancelSm();
if (in.getHeaders().containsKey(SmppConstants.ID)) {
cancelSm.setMessageId(in.getHeader(SmppConstants.ID, String.class));
}
if (in.getHeaders().containsKey(SmppConstants.SOURCE_ADDR)) {
cancelSm.setSourceAddr(in.getHeader(SmppConstants.SOURCE_ADDR, String.class));
} else {
cancelSm.setSourceAddr(config.getSourceAddr());
}
if (in.getHeaders().containsKey(SmppConstants.SOURCE_ADDR_TON)) {
cancelSm.setSourceAddrTon(in.getHeader(SmppConstants.SOURCE_ADDR_TON, Byte.class));
} else {
cancelSm.setSourceAddrTon(config.getSourceAddrTon());
}
if (in.getHeaders().containsKey(SmppConstants.SOURCE_ADDR_NPI)) {
cancelSm.setSourceAddrNpi(in.getHeader(SmppConstants.SOURCE_ADDR_NPI, Byte.class));
} else {
cancelSm.setSourceAddrNpi(config.getSourceAddrNpi());
}
if (in.getHeaders().containsKey(SmppConstants.DEST_ADDR)) {
cancelSm.setDestinationAddress(in.getHeader(SmppConstants.DEST_ADDR, String.class));
} else {
cancelSm.setDestinationAddress(config.getDestAddr());
}
if (in.getHeaders().containsKey(SmppConstants.DEST_ADDR_TON)) {
cancelSm.setDestAddrTon(in.getHeader(SmppConstants.DEST_ADDR_TON, Byte.class));
} else {
cancelSm.setDestAddrTon(config.getDestAddrTon());
}
if (in.getHeaders().containsKey(SmppConstants.DEST_ADDR_NPI)) {
cancelSm.setDestAddrNpi(in.getHeader(SmppConstants.DEST_ADDR_NPI, Byte.class));
} else {
cancelSm.setDestAddrNpi(config.getDestAddrNpi());
}
if (in.getHeaders().containsKey(SmppConstants.SERVICE_TYPE)) {
cancelSm.setServiceType(in.getHeader(SmppConstants.SERVICE_TYPE, String.class));
} else {
cancelSm.setServiceType(config.getServiceType());
}
return cancelSm;
}