Search in sources :

Example 1 with CCButton

use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.

the class AgentsViewBean method getAgentNames.

private void getAgentNames() {
    AgentsModel model = (AgentsModel) getModel();
    String filter = ((String) getDisplayFieldValue(TF_FILTER));
    String gfilter = ((String) getDisplayFieldValue(TF_GROUP_FILTER));
    if ((filter == null) || (filter.length() == 0)) {
        filter = "*";
        setDisplayFieldValue(TF_FILTER, "*");
    } else {
        filter = filter.trim();
    }
    if ((gfilter == null) || (gfilter.length() == 0)) {
        gfilter = "*";
        setDisplayFieldValue(TF_GROUP_FILTER, "*");
    } else {
        gfilter = gfilter.trim();
    }
    // this is to faciliate combined types.
    String agentType = getDisplayIDType();
    AMViewConfig cfg = AMViewConfig.getInstance();
    Set agentTypes = cfg.getCombineAgentTypes(agentType);
    if (agentTypes == null) {
        agentTypes = new HashSet(2);
        agentTypes.add(agentType);
    } else {
        supportedTypes.addAll(agentTypes);
    }
    try {
        Set agents = new HashSet();
        String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        int errorCode = model.getAgentNames(curRealm, agentTypes, filter, agents);
        switch(errorCode) {
            case IdSearchResults.SIZE_LIMIT_EXCEEDED:
                setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.sizelimit.exceeded");
                break;
            case IdSearchResults.TIME_LIMIT_EXCEEDED:
                setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.timelimit.exceeded");
                break;
        }
        Set agentGroups = new HashSet();
        errorCode = model.getAgentGroupNames(curRealm, agentTypes, gfilter, agentGroups);
        switch(errorCode) {
            case IdSearchResults.SIZE_LIMIT_EXCEEDED:
                setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.sizelimit.exceeded");
                break;
            case IdSearchResults.TIME_LIMIT_EXCEEDED:
                setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "message.timelimit.exceeded");
                break;
        }
        Map results = new HashMap(4);
        results.put(CACHE_AGENTS, agents);
        results.put(CACHE_AGENT_GROUPS, agentGroups);
        populateTableModel(results);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        CCButton b = (CCButton) getChild(TBL_BUTTON_ADD);
        b.setDisabled(true);
        b = (CCButton) getChild(TBL_BUTTON_ADD_GROUP);
        b.setDisabled(true);
    }
}
Also used : AMViewConfig(com.sun.identity.console.base.AMViewConfig) Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) HashMap(java.util.HashMap) CCButton(com.sun.web.ui.view.html.CCButton) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) HashSet(java.util.HashSet)

Example 2 with CCButton

use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.

the class AgentsViewBean method beginDisplay.

/**
     * Sets the agent title and populates the agent and agent group
     * action table.
     *
     * @param event Display Event.
     * @throws ModelControlException if cannot access to framework model.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event, false);
    resetButtonState(TBL_BUTTON_DELETE);
    AgentsModel model = (AgentsModel) getModel();
    String agentType = getDisplayIDType();
    Object[] param = { agentType };
    ptModel.setPageTitleText(model.getLocalizedString("agenttype." + agentType));
    ptModel.setPageTitleHelpMessage(model.getLocalizedString("agenttype." + agentType + ".help"));
    tblModel.setTitle(MessageFormat.format(model.getLocalizedString("table.agents.title.name"), param));
    tblModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.agents.summary"), param));
    tblModel.setSummary(MessageFormat.format(model.getLocalizedString("table.agents.summary"), param));
    tblGroupModel.setTitle(MessageFormat.format(model.getLocalizedString("table.agent.groups.title.name"), param));
    tblGroupModel.setTitleLabel(MessageFormat.format(model.getLocalizedString("table.agent.groups.summary"), param));
    tblGroupModel.setSummary(MessageFormat.format(model.getLocalizedString("table.agent.groups.summary"), param));
    getAgentNames();
    CCButton b = (CCButton) getChild(TBL_BUTTON_DELETE);
    b.setDisabled(true);
    b = (CCButton) getChild(TBL_BUTTON_DELETE_GROUP);
    b.setDisabled(true);
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel)

Example 3 with CCButton

use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.

the class PolicyNormalViewBeanBase method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    try {
        populateAttributes();
    } catch (AMConsoleException e) {
    //NO-OP
    /* attribute values will not be populated if cached policy
             * cannot be located.
             */
    }
    CCButton btn = (CCButton) getChild("tblSubjectsButtonDelete");
    btn.setDisabled(true);
    btn = (CCButton) getChild("tblResponseProvidersButtonDelete");
    btn.setDisabled(true);
    btn = (CCButton) getChild("tblConditionsButtonDelete");
    btn.setDisabled(true);
    PolicyModel model = (PolicyModel) getModel();
    String realm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    QueryResults subjectsQuery = model.getActiveSubjectTypes(realm);
    Map subjects = (Map) subjectsQuery.getResults();
    if ((subjects == null) || subjects.isEmpty()) {
        ((CCButton) getChild("tblSubjectsButtonAdd")).setDisabled(true);
        setDisplayFieldValue("tblSubjectsNote", model.getLocalizedString("policy.no.subject.types"));
    } else {
        setDisplayFieldValue("tblSubjectsNote", "");
    }
    Map conditions = model.getActiveConditionTypes(realm);
    if ((conditions == null) || conditions.isEmpty()) {
        ((CCButton) getChild("tblConditionsButtonAdd")).setDisabled(true);
        setDisplayFieldValue("tblConditionsNote", model.getLocalizedString("policy.no.condition.types"));
    } else {
        setDisplayFieldValue("tblConditionsNote", "");
    }
    Map responseProviders = model.getActiveResponseProviderTypes(realm);
    if ((responseProviders == null) || responseProviders.isEmpty()) {
        ((CCButton) getChild("tblResponseProvidersButtonAdd")).setDisabled(true);
        setDisplayFieldValue("tblResponseProvidersNote", model.getLocalizedString("policy.no.response.providers.types"));
    } else {
        setDisplayFieldValue("tblResponseProvidersNote", "");
    }
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) QueryResults(com.sun.identity.console.base.model.QueryResults)

Example 4 with CCButton

use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.

the class PolicyOpViewBeanBase method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    try {
        populateRulesTable();
        CachedPolicy cachedPolicy = getCachedPolicy();
        Policy policy = cachedPolicy.getPolicy();
        String realmName = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
        PolicyModel model = (PolicyModel) getModel();
        CCButton btn = (CCButton) getChild("tblRulesButtonAdd");
        if (!model.canCreateRule(policy, realmName)) {
            btn.setDisabled(true);
        }
        btn = (CCButton) getChild("tblRulesButtonDelete");
        btn.setDisabled(true);
        Map serviceTypes = model.getServiceTypeNames();
        if ((serviceTypes == null) || serviceTypes.isEmpty()) {
            ((CCButton) getChild("tblRulesButtonDelete")).setDisabled(true);
            setDisplayFieldValue("tblRulesNote", model.getLocalizedString("policy.no.service.types"));
        } else {
            setDisplayFieldValue("tblRulesNote", "");
        }
        if (!isInlineAlertMessageSet() && cachedPolicy.isPolicyModified() && isProfilePage()) {
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "policy.unsaved.message");
        }
    } catch (AMConsoleException e) {
        CCButton btn = (CCButton) getChild("tblRulesButtonAdd");
        btn.setDisabled(true);
        btn = (CCButton) getChild("tblRulesButtonDelete");
        btn.setDisabled(true);
    }
}
Also used : Policy(com.sun.identity.policy.Policy) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) CCButton(com.sun.web.ui.view.html.CCButton) CachedPolicy(com.sun.identity.console.policy.model.CachedPolicy) PolicyModel(com.sun.identity.console.policy.model.PolicyModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with CCButton

use of com.sun.web.ui.view.html.CCButton in project OpenAM by OpenRock.

the class ServicesViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    resetButtonState(TBL_BUTTON_DELETE);
    getServiceNames();
    setPageTitle(getModel(), "page.title.realms.services");
    ServicesModel model = (ServicesModel) getModel();
    String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    try {
        if (model.getAssignableServiceNames(curRealm).isEmpty()) {
            CCButton btnAdd = (CCButton) getChild(TBL_BUTTON_ADD);
            btnAdd.setDisabled(true);
            setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "services.noservices.for.assignment.message");
        }
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        CCButton btnAdd = (CCButton) getChild(TBL_BUTTON_ADD);
        btnAdd.setDisabled(true);
    }
}
Also used : CCButton(com.sun.web.ui.view.html.CCButton) ServicesModel(com.sun.identity.console.realm.model.ServicesModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

CCButton (com.sun.web.ui.view.html.CCButton)14 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)7 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)3 Map (java.util.Map)3 AgentsModel (com.sun.identity.console.agentconfig.model.AgentsModel)2 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)2 HashMap (java.util.HashMap)2 AuthConfigurationModel (com.sun.identity.console.authentication.model.AuthConfigurationModel)1 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)1 AMViewConfig (com.sun.identity.console.base.AMViewConfig)1 QueryResults (com.sun.identity.console.base.model.QueryResults)1 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)1 IDRepoModel (com.sun.identity.console.realm.model.IDRepoModel)1 ServicesModel (com.sun.identity.console.realm.model.ServicesModel)1 IdSearchResults (com.sun.identity.idm.IdSearchResults)1 Policy (com.sun.identity.policy.Policy)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1