Search in sources :

Example 6 with QueryResults

use of com.sun.identity.console.base.model.QueryResults in project OpenAM by OpenRock.

the class PolicyOpViewBeanBase method handleTblSubjectsButtonAddRequest.

public void handleTblSubjectsButtonAddRequest(RequestInvocationEvent event) throws ModelControlException {
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    PolicyModel model = (PolicyModel) getModel();
    try {
        if (!reconstructPolicy()) {
            QueryResults queryResults = model.getActiveSubjectTypes(curRealm);
            Map activeSubjectTypes = (Map) queryResults.getResults();
            unlockPageTrail();
            if (activeSubjectTypes.size() == 1) {
                String subjectType = (String) activeSubjectTypes.keySet().iterator().next();
                String viewBeanURL = model.getSubjectViewBeanURL(curRealm, subjectType);
                removePageSessionAttribute(WIZARD);
                setPageSessionAttribute(SubjectOpViewBeanBase.CALLING_VIEW_BEAN, getClass().getName());
                if ((viewBeanURL != null) && (viewBeanURL.trim().length() > 0)) {
                    forwardToSubjectURL(viewBeanURL, "", subjectType, curRealm, "add");
                } else {
                    forwardToSubjectAddViewBean(curRealm, subjectType);
                }
            } else {
                setPageSessionAttribute(SelectSubjectTypeViewBean.CALLING_VIEW_BEAN, getClass().getName());
                SelectSubjectTypeViewBean vb = (SelectSubjectTypeViewBean) getViewBean(SelectSubjectTypeViewBean.class);
                setPageSessionAttribute(WIZARD, "true");
                passPgSessionMap(vb);
                vb.forwardTo(getRequestContext());
            }
        } else {
            forwardTo();
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyOpViewBeanBase.handleTblSubjectsButtonAddRequest", e);
        redirectToStartURL();
    }
}
Also used : PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) QueryResults(com.sun.identity.console.base.model.QueryResults)

Aggregations

QueryResults (com.sun.identity.console.base.model.QueryResults)6 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)5 Map (java.util.Map)5 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)3 HashMap (java.util.HashMap)3 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)2 Syntax (com.sun.identity.policy.Syntax)2 Subject (com.sun.identity.policy.interfaces.Subject)2 Iterator (java.util.Iterator)2 Set (java.util.Set)2 SSOException (com.iplanet.sso.SSOException)1 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)1 Policy (com.sun.identity.policy.Policy)1 PolicyException (com.sun.identity.policy.PolicyException)1 PolicyManager (com.sun.identity.policy.PolicyManager)1 SubjectTypeManager (com.sun.identity.policy.SubjectTypeManager)1 CCButton (com.sun.web.ui.view.html.CCButton)1 HashSet (java.util.HashSet)1