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));
}
}
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;
}
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());
}
}
}
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;
}
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);
}
}
Aggregations