Search in sources :

Example 1 with ModelControlException

use of com.iplanet.jato.model.ModelControlException in project OpenAM by OpenRock.

the class SubConfigEditViewBean method getAttributeValueMap.

@Override
protected Map<String, Set<String>> getAttributeValueMap() {
    try {
        SubConfigModel model = (SubConfigModel) getModel();
        AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
        return ps.getAttributeValues(model.getSubConfigAttributeValues().keySet());
    } catch (AMConsoleException e) {
        debug.error("Could not retrieve attribute values", e);
    } catch (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 2 with ModelControlException

use of com.iplanet.jato.model.ModelControlException in project OpenAM by OpenRock.

the class STSEditViewBeanBase method instanceNameUpdated.

/*
    The deploymentUrl of an existing sts instance cannot be edited, as it constitutes (along with the realm) the dn of the
    rest-sts instance state. This method returns true if the changes include the deployment url.
     */
private boolean instanceNameUpdated(String realm, String instanceName) throws ModelControlException, AMConsoleException {
    STSInstanceModel model = (STSInstanceModel) getModel();
    Map<String, Set<String>> currentPersistedInstanceState;
    try {
        currentPersistedInstanceState = model.getInstanceState(stsType, realm, instanceName);
    } catch (AMConsoleException e) {
        throw new ModelControlException(e.getMessage(), e);
    }
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    Map<String, Set<String>> updatedValues = ps.getAttributeValues(currentPersistedInstanceState, model);
    return !CollectionUtils.isEmpty(updatedValues.get(SharedSTSConstants.DEPLOYMENT_URL_ELEMENT));
}
Also used : Set(java.util.Set) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) RestSTSInstanceModel(com.sun.identity.console.sts.model.RestSTSInstanceModel) STSInstanceModel(com.sun.identity.console.sts.model.STSInstanceModel) SoapSTSInstanceModel(com.sun.identity.console.sts.model.SoapSTSInstanceModel) ModelControlException(com.iplanet.jato.model.ModelControlException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 3 with ModelControlException

use of com.iplanet.jato.model.ModelControlException in project OpenAM by OpenRock.

the class STSEditViewBeanBase method getUpdatedConfigurationState.

/**
     * Called to harvest the full set of updated configuration properties.
     * @param realm
     * @param instanceName
     * @return The set up updated properties. An empty-set will be returned if no properties updated.
     * @throws ModelControlException thrown by AMPropertySheet#getAttributeValues if model for property-sheet cannot be
     * obtained
     * @throws AMConsoleException thrown by AMPropertySheet#getAttributeValues if passwords are mis-matched.
     */
private Map<String, Set<String>> getUpdatedConfigurationState(String realm, String instanceName) throws ModelControlException, AMConsoleException {
    STSInstanceModel model = (STSInstanceModel) getModel();
    Map<String, Set<String>> currentPersistedInstanceState;
    try {
        currentPersistedInstanceState = model.getInstanceState(stsType, realm, instanceName);
    } catch (AMConsoleException e) {
        throw new ModelControlException(e.getMessage(), e);
    }
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    Map<String, Set<String>> updatedValues = ps.getAttributeValues(currentPersistedInstanceState, model);
    if (updatedValues.isEmpty()) {
        return updatedValues;
    } else {
        currentPersistedInstanceState.putAll(updatedValues);
        return currentPersistedInstanceState;
    }
}
Also used : Set(java.util.Set) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) RestSTSInstanceModel(com.sun.identity.console.sts.model.RestSTSInstanceModel) STSInstanceModel(com.sun.identity.console.sts.model.STSInstanceModel) SoapSTSInstanceModel(com.sun.identity.console.sts.model.SoapSTSInstanceModel) ModelControlException(com.iplanet.jato.model.ModelControlException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 4 with ModelControlException

use of com.iplanet.jato.model.ModelControlException in project OpenAM by OpenRock.

the class STSEditViewBeanBase method beginDisplay.

public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    final String instanceName = (String) getPageSessionAttribute(STSHomeViewBean.INSTANCE_NAME);
    final String currentRealm = (String) getPageSessionAttribute(AMAdminConstants.CURRENT_REALM);
    if (!submitCycle) {
        STSInstanceModel model = (STSInstanceModel) getModel();
        Map map;
        try {
            map = model.getInstanceState(stsType, currentRealm, instanceName);
        } catch (AMConsoleException e) {
            throw new ModelControlException(e);
        }
        if (!map.isEmpty()) {
            AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
            propertySheetModel.clear();
            ps.setAttributeValues(map, getModel());
        } else {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", MessageFormat.format(model.getLocalizedString("rest.sts.view.no.instance.message"), instanceName));
        }
    }
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) RestSTSInstanceModel(com.sun.identity.console.sts.model.RestSTSInstanceModel) STSInstanceModel(com.sun.identity.console.sts.model.STSInstanceModel) SoapSTSInstanceModel(com.sun.identity.console.sts.model.SoapSTSInstanceModel) ModelControlException(com.iplanet.jato.model.ModelControlException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 5 with ModelControlException

use of com.iplanet.jato.model.ModelControlException in project OpenAM by OpenRock.

the class SessionPropertyConditionEditViewBean method setPropertiesValues.

protected void setPropertiesValues(Map values) {
    Object cached = getPageSessionAttribute(SessionPropertyConditionHelper.PG_SESSION_PROPERTY_VALUES);
    if (cached == null) {
        Map map = new HashMap();
        map.putAll(values);
        setPageSessionAttribute(SessionPropertyConditionHelper.PG_SESSION_PROPERTY_VALUES, (HashMap) map);
        try {
            CCActionTable tbl = (CCActionTable) getChild(SessionPropertyConditionHelper.ATTR_VALUES);
            tbl.resetStateData();
        } catch (ModelControlException e) {
        //no-op, cannot reset action table
        }
        helper.populateTable(map, propertySheetModel);
        Map orig = new HashMap();
        orig.putAll(values);
        setPageSessionAttribute(PG_SESSION_ORIG, (HashMap) orig);
    }
}
Also used : HashMap(java.util.HashMap) ModelControlException(com.iplanet.jato.model.ModelControlException) CCActionTable(com.sun.web.ui.view.table.CCActionTable) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

ModelControlException (com.iplanet.jato.model.ModelControlException)10 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)7 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)5 RestSTSInstanceModel (com.sun.identity.console.sts.model.RestSTSInstanceModel)5 STSInstanceModel (com.sun.identity.console.sts.model.STSInstanceModel)5 SoapSTSInstanceModel (com.sun.identity.console.sts.model.SoapSTSInstanceModel)5 Map (java.util.Map)4 Set (java.util.Set)4 SubConfigModel (com.sun.identity.console.service.model.SubConfigModel)2 STSInstanceModelResponse (com.sun.identity.console.sts.model.STSInstanceModelResponse)2 HashMap (java.util.HashMap)2 DatasetModel (com.iplanet.jato.model.DatasetModel)1 HiddenField (com.iplanet.jato.view.html.HiddenField)1 PWResetQuestionModel (com.sun.identity.password.ui.model.PWResetQuestionModel)1 CCActionTable (com.sun.web.ui.view.table.CCActionTable)1 IOException (java.io.IOException)1 Iterator (java.util.Iterator)1 ServletException (javax.servlet.ServletException)1 Cookie (javax.servlet.http.Cookie)1