use of org.mobicents.slee.resource.diameter.sh.events.SubscribeNotificationsAnswerImpl in project jain-slee.diameter by RestComm.
the class ShServerMessageFactoryImpl method createSubscribeNotificationsAnswer.
public SubscribeNotificationsAnswer createSubscribeNotificationsAnswer(SubscribeNotificationsRequest request) {
// Message msg = createShMessage(UserDataAnswer.commandCode, session !=
// null ? session.getSessionId() : null, false);
List<DiameterAvp> avps = new ArrayList<DiameterAvp>();
DiameterAvp sessionIdAvp = null;
try {
sessionIdAvp = localFactory.getBaseFactory().createAvp(0, DiameterAvpCodes.SESSION_ID, request.getSessionId());
avps.add(sessionIdAvp);
} catch (NoSuchAvpException e) {
logger.error("Unable to create Session-Id AVP.", e);
}
if (request.getUserIdentity() != null) {
avps.add(request.getUserIdentity());
}
Message msg = createShMessage(request.getHeader(), avps.toArray(new DiameterAvp[avps.size()]));
SubscribeNotificationsAnswerImpl answer = new SubscribeNotificationsAnswerImpl(msg);
answer.setRouteRecords(request.getRouteRecords());
// add more :) ?
addOrigin(answer);
return answer;
}
use of org.mobicents.slee.resource.diameter.sh.events.SubscribeNotificationsAnswerImpl in project jain-slee.diameter by RestComm.
the class DiameterShServerResourceAdaptor method createEvent.
/**
* Create Event object from a JDiameter message (request or answer)
*
* @return a DiameterMessage object wrapping the request/answer
* @throws OperationNotSupportedException
*/
private DiameterMessage createEvent(Message message) {
if (message == null) {
throw new NullPointerException("Message argument cannot be null while creating event.");
}
int commandCode = message.getCommandCode();
if (message.isError()) {
return new ErrorAnswerImpl(message);
}
boolean isRequest = message.isRequest();
switch(commandCode) {
case // PNR/PNA
PushNotificationRequest.commandCode:
return isRequest ? new PushNotificationRequestImpl(message) : new PushNotificationAnswerImpl(message);
case // PUR/PUA
ProfileUpdateRequest.commandCode:
return isRequest ? new ProfileUpdateRequestImpl(message) : new ProfileUpdateAnswerImpl(message);
case // SNR/SNA
SubscribeNotificationsRequest.commandCode:
return isRequest ? new SubscribeNotificationsRequestImpl(message) : new SubscribeNotificationsAnswerImpl(message);
case // UDR/UDA
UserDataRequest.commandCode:
return isRequest ? new UserDataRequestImpl(message) : new UserDataAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
use of org.mobicents.slee.resource.diameter.sh.events.SubscribeNotificationsAnswerImpl in project jain-slee.diameter by RestComm.
the class DiameterShClientResourceAdaptor method createEvent.
/**
* Create Event object from a JDiameter message (request or answer)
*
* @return a DiameterMessage object wrapping the request/answer
* @throws OperationNotSupportedException
*/
private DiameterMessage createEvent(Message message) {
if (message == null) {
throw new NullPointerException("Message argument cannot be null while creating event.");
}
int commandCode = message.getCommandCode();
if (message.isError()) {
return new ErrorAnswerImpl(message);
}
boolean isRequest = message.isRequest();
switch(commandCode) {
case // PNR/PNA
PushNotificationRequestImpl.commandCode:
return isRequest ? new PushNotificationRequestImpl(message) : new PushNotificationAnswerImpl(message);
case // PUR/PUA
ProfileUpdateRequestImpl.commandCode:
return isRequest ? new ProfileUpdateRequestImpl(message) : new ProfileUpdateAnswerImpl(message);
case // SNR/SNA
SubscribeNotificationsRequestImpl.commandCode:
return isRequest ? new SubscribeNotificationsRequestImpl(message) : new SubscribeNotificationsAnswerImpl(message);
case // UDR/UDA
net.java.slee.resource.diameter.sh.events.UserDataRequest.commandCode:
return isRequest ? new UserDataRequestImpl(message) : new UserDataAnswerImpl(message);
default:
return new ExtensionDiameterMessageImpl(message);
}
}
Aggregations