ilog.rules.teamserver.model.states

Class RoleTransitionSystem<State extends java.lang.Enum<State>>

  • Type Parameters:
    State - A Java enumeration.


    public class RoleTransitionSystem<State extends java.lang.Enum<State>>
    extends TableConditionalTransitionSystem<State>

    Declares a conditional transition system where a distinct condition can be attached to each transition, with additional methods to allow a transition to, or deny it from, users in a given role.

    • Field Detail

      • session

        protected IlrSession session
        The session used to check the role membership.
    • Constructor Detail

      • RoleTransitionSystem

        public RoleTransitionSystem(java.lang.Class<State> stateClass,
                            IlrSession session)

        Constructs a transition system for the states in the State enumeration passed as a parameter to this class.

        Since type information is not available at run-time for Java generic classes, the reflective Class object for the state enumeration has to be provided to the constructor.

        Parameters:
        stateClass - The reflective object for the state enumeration.
        session - The session used to check the role membership.
    • Method Detail

      • allowTransition

        public TransitionCondition<State> allowTransition(State s1,
                                                 State s2,
                                                 java.lang.String role)

        Adds a condition to the specified transition to allow the transition if the current user is in the provided role. Previously attached conditions remain in effect when the current user is not in the provided role.

        If the provided role is null, the transition is allowed to all users.

        Note: The transition must exist in the table of transition (see TableTransitionSystem.addNextStates(State, State...)) for this method to have an effect.

        Throws:
        java.lang.NullPointerException - if s2 is null.
        Parameters:
        s1 - The start state of the transition, or null for transitions to s2 as an initial state.
        s2 - Then end state of the transition. Cannot be null.
        role - The name of a role. Passing null will allow the transition to all users.
        Returns:
        the previously attached condition.
      • denyTransition

        public TransitionCondition<State> denyTransition(State s1,
                                                State s2,
                                                java.lang.String role)

        Adds a condition to the specified transition to forbid the transition if the current user is in the provided role. Previously attached conditions remain in effect when the current user is not in the provided role.

        If the provided role is null, the transition is denied from all users.

        Note: The transition must exist in the table of transition (see TableTransitionSystem.addNextStates(State, State...)) for this method to have an effect.

        Throws:
        java.lang.NullPointerException - if s2 is null.
        Parameters:
        s1 - The start state of the transition, or null for transitions to s2 as an initial state.
        s2 - Then end state of the transition. Cannot be null.
        role - The name of a role. Passing null will deny the transition from all users.
        Returns:
        the previously attached condition.

© Copyright IBM Corp. 1987, 2017