Search in sources :

Example 31 with AMConsoleException

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

the class ServerSiteModelImpl method getSiteFailoverURLs.

/**
     * Returns a set of failover URLs of site.
     *
     * @param name Name of Site.
     * @return a set of failover URLs of site.
     * @throws AMConsoleException if error occurs when getting the site primary
     *         URL.
     */
public Set getSiteFailoverURLs(String name) throws AMConsoleException {
    String[] param = { name };
    logEvent("ATTEMPT_GET_SITE_FAILOVER_URLS", param);
    try {
        Set urls = SiteConfiguration.getSiteSecondaryURLs(getUserSSOToken(), name);
        logEvent("SUCCEED_GET_SITE_FAILOVER_URLS", param);
        return urls;
    } catch (SMSException e) {
        String[] params = { name, e.getMessage() };
        logEvent("SMS_EXCEPTION_GET_SITE_FAILOVER_URLS", params);
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        String[] params = { name, e.getMessage() };
        logEvent("SSO_EXCEPTION_GET_SITE_FAILOVER_URLS", params);
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 32 with AMConsoleException

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

the class AMPropertySheet method getDateInUserLocale.

private Set getDateInUserLocale(String date, AMModel model) throws AMConsoleException {
    Set values = null;
    if ((date != null) && (date.trim().length() > 0)) {
        Date dt = com.sun.identity.shared.locale.Locale.parseDateString(date, model.getUserLocale());
        String dateString = com.sun.identity.shared.locale.Locale.getNormalizedDateString(dt);
        if (dateString != null) {
            values = new HashSet(2);
            values.add(dateString);
        } else {
            String[] arg = { date };
            throw new AMConsoleException(MessageFormat.format(model.getLocalizedString("invalid-date.message"), (Object[]) arg));
        }
    }
    return (values == null) ? Collections.EMPTY_SET : values;
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Date(java.util.Date) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 33 with AMConsoleException

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

the class AMServiceProfileViewBeanBase method createPropertyModel.

protected void createPropertyModel() {
    AMServiceProfileModel model = (AMServiceProfileModel) getModel();
    if (model != null) {
        try {
            propertySheetModel = new AMPropertySheetModel(getPropertySheetXML(model));
            propertySheetModel.clear();
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
        }
    }
}
Also used : AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) AMServiceProfileModel(com.sun.identity.console.base.model.AMServiceProfileModel)

Example 34 with AMConsoleException

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

the class AMPropertySheet method getAttributeValues.

/**
     * Returns a map of attribute name to values.
     *
     * @param attrNames Set of attribute names to retrieve.
     * @return map of attribute name to values.
     * @throws ModelControlException if cannot get model of property sheet.
     * @throws AMConsoleException if password and confirm password values do
     *         not match.
     */
public Map getAttributeValues(Collection attrNames) throws ModelControlException, AMConsoleException {
    restoreStateData(attrNames);
    AMPropertySheetModel model = (AMPropertySheetModel) getModel();
    Map attrValues = new HashMap(attrNames.size() * 2);
    Map multipleChoiceValues = getMultipleChoiceValues(model);
    for (Iterator iter = attrNames.iterator(); iter.hasNext(); ) {
        String name = (String) iter.next();
        Object childModel = model.getModel(name);
        Set values = null;
        if (CCAddRemoveModel.class.isInstance(childModel)) {
            values = getValues(((CCAddRemoveModel) childModel).getSelectedOptionList());
        } else if (CCUnOrderedListModel.class.isInstance(childModel)) {
            values = getListValues(((CCUnOrderedListModel) childModel).getOptionList());
            if ((values == null) || values.isEmpty()) {
                values = new HashSet(2);
                values.add("[0]=");
            }
        } else if (CCMapListModel.class.isInstance(childModel)) {
            values = getValues(((CCMapListModel) childModel).getOptionList());
            if ((values == null) || values.isEmpty()) {
                values = new HashSet(2);
                values.add("[]=");
            }
        } else if (CCEditableListModel.class.isInstance(childModel)) {
            values = getValues(((CCEditableListModel) childModel).getOptionList());
        } else if (CCOrderedListModel.class.isInstance(childModel)) {
            values = getListValues(((CCOrderedListModel) childModel).getSelectedOptionList());
            if ((values == null) || values.isEmpty()) {
                values = new HashSet(2);
                values.add("[0]=");
            }
        } else if (model.isChildSupported(name + PropertyTemplate.PWD_CONFIRM_SUFFIX)) {
            String pwd = (String) model.getValue(name);
            String confirmPwd = (String) model.getValue(name + PropertyTemplate.PWD_CONFIRM_SUFFIX);
            if (pwd.equals(confirmPwd)) {
                if (!pwd.equals(AMPropertySheetModel.passwordRandom)) {
                    values = new HashSet(2);
                    values.add(pwd);
                }
            } else {
                throw new AMConsoleException("password-mismatched");
            }
        } else {
            values = (Set) multipleChoiceValues.get(name);
            if (values == null) {
                values = AMAdminUtils.toSetIgnoreEmpty(model.getValues(name));
            }
        }
        if (values != null) {
            attrValues.put(name, values);
        }
    }
    return attrValues;
}
Also used : TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) CCAddRemoveModel(com.sun.web.ui.model.CCAddRemoveModel) HashMap(java.util.HashMap) CCMapListModel(com.sun.identity.console.ui.model.CCMapListModel) AMPropertySheetModel(com.sun.identity.console.base.model.AMPropertySheetModel) CCOrderedListModel(com.sun.identity.console.ui.model.CCOrderedListModel) Iterator(java.util.Iterator) CCUnOrderedListModel(com.sun.identity.console.ui.model.CCUnOrderedListModel) CCEditableListModel(com.sun.web.ui.model.CCEditableListModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 35 with AMConsoleException

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

the class AuthPropertiesModelImpl method setValues.

public void setValues(Map modifiedValues) throws AMConsoleException {
    String[] params = { currentRealm, CORE_AUTH_SERVICE };
    logEvent("ATTEMPT_MODIFY_AUTH_INSTANCE", params);
    try {
        ServiceConfig sc = getCoreAuthServiceConfig();
        sc.setAttributes(modifiedValues);
        logEvent("SUCCEED_MODIFY_AUTH_INSTANCE", params);
    } catch (SMSException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { currentRealm, CORE_AUTH_SERVICE, strError };
        logEvent("SMS_EXCEPTION_MODIFY_AUTH_INSTANCE", paramsEx);
        throw new AMConsoleException(strError);
    } catch (SSOException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { currentRealm, CORE_AUTH_SERVICE, strError };
        logEvent("SSO_EXCEPTION_MODIFY_AUTH_INSTANCE", paramsEx);
        throw new AMConsoleException(strError);
    }
}
Also used : ServiceConfig(com.sun.identity.sm.ServiceConfig) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)701 Map (java.util.Map)255 Set (java.util.Set)206 HashMap (java.util.HashMap)193 HashSet (java.util.HashSet)148 SSOException (com.iplanet.sso.SSOException)126 Iterator (java.util.Iterator)122 List (java.util.List)97 SMSException (com.sun.identity.sm.SMSException)83 ArrayList (java.util.ArrayList)78 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)76 IdRepoException (com.sun.identity.idm.IdRepoException)58 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)47 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)46 AMIdentity (com.sun.identity.idm.AMIdentity)44 SAMLv2Model (com.sun.identity.console.federation.model.SAMLv2Model)41 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)41 CCActionTable (com.sun.web.ui.view.table.CCActionTable)40 TreeSet (java.util.TreeSet)39 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)38