use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class EntitiesModelImpl method deleteEntities.
/**
* Deletes entities.
*
* @param realmName Name of Realm.
* @param names Name of Entities to be deleted.
* @throws AMConsoleException if entity cannot be deleted.
*/
public void deleteEntities(String realmName, Set names) throws AMConsoleException {
if ((names != null) && !names.isEmpty()) {
String idNames = AMFormatUtils.toCommaSeparatedFormat(names);
String[] params = { realmName, idNames };
logEvent("ATTEMPT_DELETE_IDENTITY", params);
try {
AMIdentityRepository repo = new AMIdentityRepository(getUserSSOToken(), realmName);
repo.deleteIdentities(getAMIdentity(names));
logEvent("SUCCEED_DELETE_IDENTITY", params);
} catch (IdRepoException e) {
String[] paramsEx = { realmName, idNames, getErrorString(e) };
logEvent("IDM_EXCEPTION_DELETE_IDENTITY", paramsEx);
throw new AMConsoleException(getErrorString(e));
} catch (SSOException e) {
String[] paramsEx = { realmName, idNames, getErrorString(e) };
logEvent("SSO_EXCEPTION_DELETE_IDENTITY", paramsEx);
throw new AMConsoleException(getErrorString(e));
}
}
}
use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class EntitiesModelImpl method getAssignedServiceNames.
/**
* Returns assigned services. Map of service name to its display name.
*
* @param universalId Universal ID of the entity.
* @return assigned services.
* @throws AMConsoleException if service information cannot be determined.
*/
public Map getAssignedServiceNames(String universalId) throws AMConsoleException {
Map assigned = null;
String[] param = { universalId };
logEvent("ATTEMPT_READ_IDENTITY_ASSIGNED_SERVICE", param);
try {
AMIdentity amid = IdUtils.getIdentity(getUserSSOToken(), universalId);
Set serviceNames = amid.getAssignedServices();
// don't show auth config or user services in the user profile.
IdType type = amid.getType();
if (type.equals(IdType.USER)) {
serviceNames.remove(AMAdminConstants.USER_SERVICE);
serviceNames.remove(AMAdminConstants.AUTH_CONFIG_SERVICE);
}
assigned = getLocalizedServiceNames(serviceNames);
logEvent("SUCCEED_READ_IDENTITY_ASSIGNED_SERVICE", param);
} catch (SSOException e) {
String[] paramsEx = { universalId, getErrorString(e) };
logEvent("SSO_EXCEPTION_READ_IDENTITY_ASSIGNED_SERVICE", paramsEx);
debug.warning("EntitiesModelImpl.getAssignedServiceNames", e);
throw new AMConsoleException(getErrorString(e));
} catch (IdRepoFatalException e) {
String[] paramsEx = { universalId, getErrorString(e) };
logEvent("IDM_EXCEPTION_READ_IDENTITY_ASSIGNED_SERVICE", paramsEx);
debug.warning("EntitiesModelImpl.getAssignedServiceNames", e);
// exception is too cryptic
if (e.getErrorCode().equals(IdRepoErrorCode.PLUGIN_OPERATION_NOT_SUPPORTED)) {
isServicesSupported = false;
throw new AMConsoleException(getLocalizedString("idrepo.sevices.not.supported"));
} else {
throw new AMConsoleException(getErrorString(e));
}
} catch (IdRepoException e) {
String[] paramsEx = { universalId, getErrorString(e) };
logEvent("IDM_EXCEPTION_READ_IDENTITY_ASSIGNED_SERVICE", paramsEx);
debug.warning("EntitiesModelImpl.getAssignedServiceNames", e);
throw new AMConsoleException(getErrorString(e));
}
return (assigned != null) ? assigned : Collections.EMPTY_MAP;
}
use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class ServicesAddViewBean method handleButton2Request.
/**
* Handles add service request.
*
* @param event Request invocation event.
*/
public void handleButton2Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
EntitiesModel model = (EntitiesModel) getModel();
try {
Map values = getValues();
String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
String serviceName = (String) getPageSessionAttribute(SERVICE_NAME);
model.assignService(universalId, serviceName, values);
forwardToServicesViewBean();
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
forwardTo();
}
}
use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class ServicesAddViewBean method getDefaultValuesForIdentity.
private Map getDefaultValuesForIdentity(String universalId, EntitiesModel model) {
Map defaultValues = null;
try {
AMIdentity amid = IdUtils.getIdentity(model.getUserSSOToken(), universalId);
defaultValues = model.getDefaultValues(amid.getType().getName(), serviceName);
AMAdminUtils.makeMapValuesEmpty(defaultValues);
} catch (AMConsoleException e) {
defaultValues = Collections.EMPTY_MAP;
} catch (IdRepoException e) {
defaultValues = Collections.EMPTY_MAP;
}
return defaultValues;
}
use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class ServicesEditViewBean method handleButton1Request.
/**
* Handles add service request.
*
* @param event Request invocation event.
*/
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
submitCycle = true;
EntitiesModel model = (EntitiesModel) getModel();
try {
Map values = getValues();
String universalId = (String) getPageSessionAttribute(EntityEditViewBean.UNIVERSAL_ID);
String serviceName = (String) getPageSessionAttribute(SERVICE_NAME);
model.setServiceAttributeValues(universalId, serviceName, values);
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "message.updated");
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
Aggregations