use of net.java.slee.resource.diameter.gx.GxSessionState in project jain-slee.diameter by RestComm.
the class GxClientSessionActivityImpl method validateState.
private void validateState(GxCreditControlRequest ccr) {
// this is used for methods that send specific messages. should be done in jdiam, but there is not hook for it now.
if (ccr.getCcRequestType() == null) {
throw new DiameterException("No request type is present!!");
}
final int t = ccr.getCcRequestType().getValue();
GxSessionState currentState = this.getState();
if (t == CcRequestType._INITIAL_REQUEST) {
if (currentState != GxSessionState.IDLE) {
// FIXME: change all exception to DiameterException
throw new DiameterException("Failed to validate, intial event, wrong state: " + currentState);
}
} else if (t == CcRequestType._UPDATE_REQUEST) {
if (currentState != GxSessionState.OPEN) {
// FIXME: change all exception to DiameterException
throw new DiameterException("Failed to validate, intial event, wrong state: " + currentState);
}
} else if (t == CcRequestType._TERMINATION_REQUEST) {
if (currentState != GxSessionState.OPEN) {
// FIXME: change all exception to DiameterException
throw new DiameterException("Failed to validate, intial event, wrong state: " + currentState);
}
} else if (t == CcRequestType._EVENT_REQUEST) {
if (currentState != GxSessionState.IDLE) {
// FIXME: change all exception to DiameterException
throw new DiameterException("Failed to validate, intial event, wrong state: " + currentState);
}
}
}
Aggregations