@Test public void requirePossibleAction() throws Exception { EnumSet<PossibleActionEnum> actions = EnumSet.of(PossibleActionEnum.ACTIVATE); possibleActionsRuleEngine.requirePossibleAction(PossibleActionEnum.ACTIVATE, actions); try { possibleActionsRuleEngine.requirePossibleAction(PossibleActionEnum.DELETE, actions); fail("should throw exception"); } catch (ActionNotPossibleException expected) { } }
public void requirePossibleAction(PossibleActionEnum action, EnumSet<PossibleActionEnum> possibleActions) throws ActionNotPossibleException { if (!possibleActions.contains(action)) { throw new ActionNotPossibleException(action + " is not possible"); } }
PossibleActionsRuleEngine { public void requirePossibleAction(PossibleActionEnum action, EnumSet<PossibleActionEnum> possibleActions) throws ActionNotPossibleException { if (!possibleActions.contains(action)) { throw new ActionNotPossibleException(action + " is not possible"); } } }
PossibleActionsRuleEngine { public void requirePossibleAction(PossibleActionEnum action, EnumSet<PossibleActionEnum> possibleActions) throws ActionNotPossibleException { if (!possibleActions.contains(action)) { throw new ActionNotPossibleException(action + " is not possible"); } }  }
PossibleActionsRuleEngine { public void requirePossibleAction(PossibleActionEnum action, EnumSet<PossibleActionEnum> possibleActions) throws ActionNotPossibleException { if (!possibleActions.contains(action)) { throw new ActionNotPossibleException(action + " is not possible"); } }  EnumSet<PossibleActionEnum> getPossibleTokenActions(TokenInfo tokenInfo); boolean isKeyUnsupported(TokenInfo tokenInfo, KeyInfo keyInfo); EnumSet<PossibleActionEnum> getPossibleKeyActions(TokenInfo tokenInfo,
            KeyInfo keyInfo); EnumSet<PossibleActionEnum> getPossibleCertificateActions(TokenInfo tokenInfo,
            KeyInfo keyInfo,
            CertificateInfo certificateInfo); EnumSet<PossibleActionEnum> getPossibleCsrActions(TokenInfo tokenInfo); void requirePossibleAction(PossibleActionEnum action, EnumSet<PossibleActionEnum> possibleActions); void requirePossibleTokenAction(PossibleActionEnum action, TokenInfo tokenInfo); void requirePossibleKeyAction(PossibleActionEnum action, TokenInfo tokenInfo, KeyInfo keyInfo); void requirePossibleCertificateAction(PossibleActionEnum action, TokenInfo tokenInfo, KeyInfo keyInfo,
            CertificateInfo certificateInfo); void requirePossibleCsrAction(PossibleActionEnum action, TokenInfo tokenInfo, KeyInfo keyInfo,
            CertRequestInfo certRequestInfo); void requirePossibleAction(PossibleActionEnum action, ActionTargetType target,
            TokenInfo tokenInfo, KeyInfo keyInfo, CertificateInfo certificateInfo, CertRequestInfo certRequestInfo); }
PossibleActionsRuleEngine { public void requirePossibleAction(PossibleActionEnum action, EnumSet<PossibleActionEnum> possibleActions) throws ActionNotPossibleException { if (!possibleActions.contains(action)) { throw new ActionNotPossibleException(action + " is not possible"); } }  EnumSet<PossibleActionEnum> getPossibleTokenActions(TokenInfo tokenInfo); boolean isKeyUnsupported(TokenInfo tokenInfo, KeyInfo keyInfo); EnumSet<PossibleActionEnum> getPossibleKeyActions(TokenInfo tokenInfo,
            KeyInfo keyInfo); EnumSet<PossibleActionEnum> getPossibleCertificateActions(TokenInfo tokenInfo,
            KeyInfo keyInfo,
            CertificateInfo certificateInfo); EnumSet<PossibleActionEnum> getPossibleCsrActions(TokenInfo tokenInfo); void requirePossibleAction(PossibleActionEnum action, EnumSet<PossibleActionEnum> possibleActions); void requirePossibleTokenAction(PossibleActionEnum action, TokenInfo tokenInfo); void requirePossibleKeyAction(PossibleActionEnum action, TokenInfo tokenInfo, KeyInfo keyInfo); void requirePossibleCertificateAction(PossibleActionEnum action, TokenInfo tokenInfo, KeyInfo keyInfo,
            CertificateInfo certificateInfo); void requirePossibleCsrAction(PossibleActionEnum action, TokenInfo tokenInfo, KeyInfo keyInfo,
            CertRequestInfo certRequestInfo); void requirePossibleAction(PossibleActionEnum action, ActionTargetType target,
            TokenInfo tokenInfo, KeyInfo keyInfo, CertificateInfo certificateInfo, CertRequestInfo certRequestInfo); static final String SOFTWARE_TOKEN_ID; }