Search in sources :

Example 11 with AMPostViewBean

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

the class AgentProfileViewBean method handleButton1Request.

/**
     * Handles Save button click.
     *
     * @param event Request Invocation Event.
     * @throws ModelControlException if cannot access to framework model.
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    boolean bRefresh = false;
    AgentsModel model = (AgentsModel) getModel();
    String universalId = (String) getPageSessionAttribute(UNIVERSAL_ID);
    String type = getAgentType();
    String choice = (String) getPageSessionAttribute(AgentsViewBean.LOCAL_OR_NOT);
    try {
        Map values = getFormValues();
        if (checkAgentType(type)) {
            if (!isGroup && !is2dot2Agent() && !isAgentAuthenticator() && (choice != null) && !choice.equals(AgentsViewBean.PROP_LOCAL)) {
                for (Iterator i = inheritedPropertyNames.iterator(); i.hasNext(); ) {
                    values.remove(i.next());
                }
                if (type.equals(AgentsViewBean.DEFAULT_ID_TYPE)) {
                    Iterator itr = values.keySet().iterator();
                    while (itr.hasNext()) {
                        String name = (String) itr.next();
                        Set v = (Set) values.get(name);
                        if ((v != null) && !v.isEmpty() && (v.size() == 1)) {
                            Iterator itr2 = v.iterator();
                            while (itr2.hasNext()) {
                                String subv = (String) itr2.next();
                                subv.trim();
                                if (subv.length() == 0) {
                                    values.put(name, null);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if (!isGroup && !is2dot2Agent() && !isAgentAuthenticator()) {
                for (Iterator i = inheritedPropertyNames.iterator(); i.hasNext(); ) {
                    values.remove(i.next());
                }
            }
        }
        model.setAttributeValues(universalId, values);
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        if (checkAgentType(type)) {
            if (!isGroup && !is2dot2Agent() && isFirstTab() && !isAgentAuthenticator() && (choice != null) && !choice.equals(AgentsViewBean.PROP_LOCAL)) {
                String agentGroup = getDisplayFieldStringValue(CHILD_AGENT_GROUP);
                bRefresh = model.setGroup(curRealm, universalId, agentGroup);
                String status = getDisplayFieldStringValue(AgentsViewBean.ATTR_CONFIG_REPO);
                if (status.equals("local")) {
                    setPageSessionAttribute(AgentsViewBean.LOCAL_OR_NOT, AgentsViewBean.PROP_LOCAL);
                    bRefresh = true;
                }
            }
        } else {
            if (!isGroup && !is2dot2Agent() && !isAgentAuthenticator() && isFirstTab()) {
                String agentGroup = getDisplayFieldStringValue(CHILD_AGENT_GROUP);
                bRefresh = model.setGroup(curRealm, universalId, agentGroup);
            }
        }
        setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        bRefresh = false;
    }
    if (bRefresh) {
        setPageSessionAttribute(UPDATED_PROFILE, "true");
        AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
        passPgSessionMap(vb);
        String url = this.getDefaultDisplayURL();
        int idx = url.indexOf("/", 1);
        url = ".." + url.substring(idx);
        vb.setTargetViewBeanURL(url);
        vb.forwardTo(getRequestContext());
    } else {
        forwardTo();
    }
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) AMPostViewBean(com.sun.identity.console.base.AMPostViewBean)

Example 12 with AMPostViewBean

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

the class EntityEditViewBean method handleMembersViewForwarding.

private void handleMembersViewForwarding(int nodeID, EntitiesModel model) {
    String type = (String) getPageSessionAttribute(ENTITY_TYPE);
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        Set memberOfs = model.getIdTypeMemberOf(curRealm, type);
        IdType idType = getIdType(nodeID);
        if (idType != null) {
            /*
                 * 20050328 Dennis
                 * bug 6246346
                 */
            String viewURL = null;
            if (memberOfs.contains(idType)) {
                viewURL = "../idm/EntityMembership";
            } else {
                viewURL = (model.canAddMember(curRealm, type, idType.getName())) ? "../idm/EntityMembers" : "../idm/EntityMembersFilteredIdentity";
            }
            AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
            setPageSessionAttribute(PG_SESSION_MEMBER_TYPE, idType.getName());
            passPgSessionMap(vb);
            vb.setTargetViewBeanURL(viewURL);
            vb.forwardTo(getRequestContext());
        } else {
            forwardTo();
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) AMPostViewBean(com.sun.identity.console.base.AMPostViewBean) IdType(com.sun.identity.idm.IdType)

Example 13 with AMPostViewBean

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

the class SubSchemaTypeSelectViewBean method handleButton2Request.

/**
     * Handles cancel request.
     *
     * @param event Request invocation event
     */
public void handleButton2Request(RequestInvocationEvent event) {
    List urls = (List) getPageSessionAttribute(AMServiceProfile.PG_SESSION_PROFILE_VIEWBEANS);
    String url = (String) urls.remove(0);
    AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
    backTrail();
    passPgSessionMap(vb);
    vb.setTargetViewBeanURL(url);
    vb.forwardTo(getRequestContext());
}
Also used : OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) AMPostViewBean(com.sun.identity.console.base.AMPostViewBean)

Example 14 with AMPostViewBean

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

the class SubConfigAddViewBean method backToProfileViewBean.

private void backToProfileViewBean() {
    List urls = (List) getPageSessionAttribute(AMServiceProfile.PG_SESSION_PROFILE_VIEWBEANS);
    String url = (String) urls.remove(0);
    AMPostViewBean vb = (AMPostViewBean) getViewBean(AMPostViewBean.class);
    backTrail();
    passPgSessionMap(vb);
    vb.setTargetViewBeanURL(url);
    vb.forwardTo(getRequestContext());
}
Also used : OptionList(com.iplanet.jato.view.html.OptionList) List(java.util.List) AMPostViewBean(com.sun.identity.console.base.AMPostViewBean)

Aggregations

AMPostViewBean (com.sun.identity.console.base.AMPostViewBean)14 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)5 List (java.util.List)4 ArrayList (java.util.ArrayList)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3 OptionList (com.iplanet.jato.view.html.OptionList)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 AgentsModel (com.sun.identity.console.agentconfig.model.AgentsModel)1 AMViewBeanBase (com.sun.identity.console.base.AMViewBeanBase)1 AMViewConfig (com.sun.identity.console.base.AMViewConfig)1 EntityResourceOfferingViewBean (com.sun.identity.console.idm.EntityResourceOfferingViewBean)1 EntityResourceOfferingModel (com.sun.identity.console.idm.model.EntityResourceOfferingModel)1 EntityResourceOfferingModelImpl (com.sun.identity.console.idm.model.EntityResourceOfferingModelImpl)1 RealmResourceOfferingViewBean (com.sun.identity.console.realm.RealmResourceOfferingViewBean)1 ServicesNoAttributeViewBean (com.sun.identity.console.realm.ServicesNoAttributeViewBean)1 RealmResourceOfferingModel (com.sun.identity.console.realm.model.RealmResourceOfferingModel)1 RealmResourceOfferingModelImpl (com.sun.identity.console.realm.model.RealmResourceOfferingModelImpl)1 SCConfigModel (com.sun.identity.console.service.model.SCConfigModel)1 IdType (com.sun.identity.idm.IdType)1