Search in sources :

Example 96 with AMPropertySheet

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

the class SubConfigEditViewBean method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    SubConfigModel model = (SubConfigModel) getModel();
    if (!submitCycle) {
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        propertySheetModel.clear();
        try {
            // If this is a dynamic request the UI is set with unsaved attribute values
            if (dynamicRequest) {
                ps.setAttributeValues(unsavedAttributeValues, model);
            } else {
                ps.setAttributeValues(model.getSubConfigAttributeValues(), model);
            }
        } catch (AMConsoleException a) {
            setInlineAlertMessage(CCAlert.TYPE_WARNING, "message.warning", "noproperties.message");
        }
    }
    if (model.hasGlobalSubSchema()) {
        if (!submitCycle) {
            populateTableModel(model.getSubConfigurations());
        }
        resetButtonState(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_DELETE);
        Map createable = model.getCreateableSubSchemaNames();
        if (createable.isEmpty()) {
            resetButtonState(AMPropertySheetModel.TBL_SUB_CONFIG_BUTTON_ADD);
        }
    }
    ptModel.setPageTitleText(MessageFormat.format(model.getLocalizedString("page.title.services.edit.subconfig"), model.getDisplayName()));
}
Also used : SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 97 with AMPropertySheet

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

the class SubConfigAddViewBean method handleButton1Request.

/**
     * Handles next button request.
     *
     * @param event Request invocation event.
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    String subConfigName = (String) getDisplayFieldValue(ATTR_SUBCONFIG_NAME);
    SubConfigModel model = (SubConfigModel) getModel();
    try {
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        String schemaName = (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);
        Map values = ps.getAttributeValues(model.getAttributeNames(schemaName));
        model.createSubConfig(subConfigName, schemaName, values);
        backToProfileViewBean();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 98 with AMPropertySheet

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

the class SubConfigAddViewBean method getAttributeValueMap.

@Override
protected Map<String, Set<String>> getAttributeValueMap() {
    try {
        SubConfigModel model = (SubConfigModel) getModel();
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        String schemaName = (String) getPageSessionAttribute(AMServiceProfile.PG_SESSION_SUB_SCHEMA_NAME);
        return ps.getAttributeValues(model.getAttributeNames(schemaName));
    } catch (AMConsoleException | ModelControlException e) {
        debug.error("Could not retrieve attribute values", e);
    }
    return Collections.emptyMap();
}
Also used : SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) ModelControlException(com.iplanet.jato.model.ModelControlException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 99 with AMPropertySheet

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

the class SubConfigEditViewBean method handleButton1Request.

/**
     * Handles next button request.
     *
     * @param event Request invocation event.
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    submitCycle = true;
    SubConfigModel model = (SubConfigModel) getModel();
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    try {
        Map orig = model.getSubConfigAttributeValues();
        Map values = ps.getAttributeValues(orig, true, true, model);
        model.setSubConfigAttributeValues(values);
        backToProfileViewBean();
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        forwardTo();
    }
}
Also used : SubConfigModel(com.sun.identity.console.service.model.SubConfigModel) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 100 with AMPropertySheet

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

the class AgentAddViewBean method handleButton1Request.

/**
     * Handles create request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) {
    AgentsModel model = (AgentsModel) getModel();
    String agentType = getAgentType();
    AMPropertySheet prop = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    String agentName = (String) propertySheetModel.getValue(TF_NAME);
    agentName = agentName.trim();
    String password = (String) propertySheetModel.getValue(TF_PASSWORD);
    String passwordConfirm = (String) propertySheetModel.getValue(TF_PASSWORD_CONFIRM);
    password = password.trim();
    passwordConfirm = passwordConfirm.trim();
    String choice = (String) propertySheetModel.getValue(RADIO_CHOICE);
    if (password.length() > 0) {
        if (password.equals(passwordConfirm)) {
            try {
                String curRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
                if (agentType.equals(AgentConfiguration.AGENT_TYPE_J2EE) || agentType.equals(AgentConfiguration.AGENT_TYPE_WEB)) {
                    String agentURL = (String) propertySheetModel.getValue(TF_AGENT_URL);
                    agentURL = agentURL.trim();
                    if (choice.equals(AgentsViewBean.PROP_LOCAL)) {
                        model.createAgentLocal(curRealm, agentName, agentType, password, agentURL);
                    } else {
                        String serverURL = (String) propertySheetModel.getValue(TF_SERVER_URL);
                        serverURL = serverURL.trim();
                        model.createAgent(curRealm, agentName, agentType, password, serverURL, agentURL);
                    }
                } else {
                    model.createAgent(curRealm, agentName, agentType, password, choice);
                }
                forwardToAgentsViewBean();
            } catch (AMConsoleException e) {
                setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
                forwardTo();
            }
        } else {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("agents.passwords.not.match"));
            forwardTo();
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("agents.password.blank"));
        forwardTo();
    }
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) AgentsModel(com.sun.identity.console.agentconfig.model.AgentsModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)122 Map (java.util.Map)79 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)76 HashMap (java.util.HashMap)37 SAMLv2Model (com.sun.identity.console.federation.model.SAMLv2Model)28 Set (java.util.Set)21 HashSet (java.util.HashSet)15 List (java.util.List)10 View (com.iplanet.jato.view.View)9 IDFFModel (com.sun.identity.console.federation.model.IDFFModel)8 SubConfigModel (com.sun.identity.console.service.model.SubConfigModel)8 CCAddRemoveModel (com.sun.web.ui.model.CCAddRemoveModel)8 ArrayList (java.util.ArrayList)7 Iterator (java.util.Iterator)7 CCPageTitle (com.sun.web.ui.view.pagetitle.CCPageTitle)6 ModelControlException (com.iplanet.jato.model.ModelControlException)5 WSFedPropertiesModel (com.sun.identity.console.federation.model.WSFedPropertiesModel)5 EntitiesModel (com.sun.identity.console.idm.model.EntitiesModel)5 AbstractAuditModel (com.sun.identity.console.audit.model.AbstractAuditModel)4 FSAuthDomainsModel (com.sun.identity.console.federation.model.FSAuthDomainsModel)4