Search in sources :

Example 1 with DiameterException

use of net.java.slee.resource.diameter.base.DiameterException in project jain-slee.diameter by RestComm.

the class CreditControlClientSessionImpl method validateState.

private void validateState(CreditControlRequest 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!!");
    }
    int t = ccr.getCcRequestType().getValue();
    CreditControlSessionState currentState = this.getState();
    if (t == CcRequestType._INITIAL_REQUEST) {
        if (currentState != CreditControlSessionState.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 != CreditControlSessionState.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 != CreditControlSessionState.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 != CreditControlSessionState.IDLE) {
            // FIXME: change all exception to DiameterException
            throw new DiameterException("Failed to validate, intial event, wrong state: " + currentState);
        }
    }
}
Also used : DiameterException(net.java.slee.resource.diameter.base.DiameterException) CreditControlSessionState(net.java.slee.resource.diameter.cca.CreditControlSessionState)

Example 2 with DiameterException

use of net.java.slee.resource.diameter.base.DiameterException 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);
        }
    }
}
Also used : DiameterException(net.java.slee.resource.diameter.base.DiameterException) GxSessionState(net.java.slee.resource.diameter.gx.GxSessionState) ClientGxSessionState(org.jdiameter.common.api.app.gx.ClientGxSessionState)

Example 3 with DiameterException

use of net.java.slee.resource.diameter.base.DiameterException in project jain-slee.diameter by RestComm.

the class RoClientSessionActivityImpl method validateState.

private void validateState(RoCreditControlRequest 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!!");
    }
    int t = ccr.getCcRequestType().getValue();
    RoSessionState currentState = this.getState();
    if (t == CcRequestType._INITIAL_REQUEST) {
        if (currentState != RoSessionState.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 != RoSessionState.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 != RoSessionState.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 != RoSessionState.IDLE) {
            // FIXME: change all exception to DiameterException
            throw new DiameterException("Failed to validate, intial event, wrong state: " + currentState);
        }
    }
}
Also used : DiameterException(net.java.slee.resource.diameter.base.DiameterException) RoSessionState(net.java.slee.resource.diameter.ro.RoSessionState) ClientRoSessionState(org.jdiameter.common.api.app.ro.ClientRoSessionState)

Aggregations

DiameterException (net.java.slee.resource.diameter.base.DiameterException)3 CreditControlSessionState (net.java.slee.resource.diameter.cca.CreditControlSessionState)1 GxSessionState (net.java.slee.resource.diameter.gx.GxSessionState)1 RoSessionState (net.java.slee.resource.diameter.ro.RoSessionState)1 ClientGxSessionState (org.jdiameter.common.api.app.gx.ClientGxSessionState)1 ClientRoSessionState (org.jdiameter.common.api.app.ro.ClientRoSessionState)1