use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.
the class EntityResourceOfferingModelImpl method assignService.
/**
* Assigns service to an entity.
*
* @param universalId Universal ID of the entity.
* @throws AMConsoleException if service cannot be assigned.
*/
public void assignService(String universalId) throws AMConsoleException {
String[] params = { universalId, AMAdminConstants.DISCOVERY_SERVICE };
logEvent("ATTEMPT_IDENTITY_ASSIGN_SERVICE", params);
try {
AMIdentity amid = IdUtils.getIdentity(getUserSSOToken(), universalId);
amid.assignService(AMAdminConstants.DISCOVERY_SERVICE, Collections.EMPTY_MAP);
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { universalId, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("SSO_EXCEPTION_IDENTITY_ASSIGN_SERVICE", paramsEx);
throw new AMConsoleException(strError);
} catch (IdRepoException e) {
String strError = getErrorString(e);
String[] paramsEx = { universalId, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("IDM_EXCEPTION_IDENTITY_ASSIGN_SERVICE", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.
the class EntityResourceOfferingModelImpl method getEntityDiscoEntry.
/**
* Returns resource offering entry stored for an entity.
*
* @param universalId Universal ID of the entity.
* @return resource offering entry stored.
* @throws AMConsoleException if entry cannot be determined.
*/
public SMDiscoveryServiceData getEntityDiscoEntry(String universalId) throws AMConsoleException {
SMDiscoveryServiceData resourceOffering = null;
String[] params = { universalId, AMAdminConstants.DISCOVERY_SERVICE };
logEvent("ATTEMPT_IDENTITY_READ_SERVICE_ATTRIBUTE_VALUES", params);
try {
AMIdentity amid = IdUtils.getIdentity(getUserSSOToken(), universalId);
Map map = new CaseInsensitiveHashMap();
map.putAll(amid.getServiceAttributes(AMAdminConstants.DISCOVERY_SERVICE));
logEvent("SUCCEED_IDENTITY_READ_SERVICE_ATTRIBUTE_VALUES", params);
resourceOffering = SMDiscoveryServiceData.getEntries((Set) map.get(AMAdminConstants.DISCOVERY_SERVICE_NAME_DYNAMIC_DISCO_ENTRIES));
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { universalId, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("SSO_EXCEPTION_IDENTITY_READ_SERVICE_ATTRIBUTE_VALUES", paramsEx);
debug.error("EntityResourceOfferingModelImpl.getAttributeValues", e);
} catch (IdRepoException e) {
String strError = getErrorString(e);
String[] paramsEx = { universalId, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("IDM_EXCEPTION_IDENTITY_READ_SERVICE_ATTRIBUTE_VALUES", paramsEx);
debug.error("EntityResourceOfferingModelImpl.getAttributeValues", e);
}
return resourceOffering;
}
use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.
the class EntitiesModelImpl method getMembers.
/**
* Returns members of an entity.
*
* @param realmName Name of Realm.
* @param universalId Universal ID of the entity.
* @param type Type of membership.
* @return members of an entity.
* @throws AMConsoleException if members cannot be returned.
*/
public Set getMembers(String realmName, String universalId, String type) throws AMConsoleException {
String[] params = { universalId, type };
logEvent("ATTEMPT_READ_IDENTITY_MEMBER", params);
try {
AMIdentity amid = IdUtils.getIdentity(getUserSSOToken(), universalId);
Set results = amid.getMembers(IdUtils.getType(type));
logEvent("SUCCEED_READ_IDENTITY_MEMBER", params);
return results;
} catch (SSOException e) {
String[] paramsEx = { universalId, type, getErrorString(e) };
logEvent("SSO_EXCEPTION_READ_IDENTITY_MEMBER", paramsEx);
debug.warning("EntitiesModelImpl.getMembers", e);
throw new AMConsoleException(getErrorString(e));
} catch (IdRepoException e) {
String[] paramsEx = { universalId, type, getErrorString(e) };
logEvent("IDM_EXCEPTION_READ_IDENTITY_MEMBER", paramsEx);
debug.warning("EntitiesModelImpl.getMembers", e);
throw new AMConsoleException(getErrorString(e));
}
}
use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.
the class EntitiesModelImpl method canAddMember.
/**
* Returns true of members can be added to a type.
*
* @param realmName Name of Realm.
* @param idType Type of Entity.
* @param containerIDType Type of Entity of Container.
* @return true of members can be added to a type.
*/
public boolean canAddMember(String realmName, String idType, String containerIDType) throws AMConsoleException {
boolean can = false;
try {
IdType type = IdUtils.getType(idType);
Set canAdd = type.canAddMembers();
IdType ctype = IdUtils.getType(containerIDType);
can = canAdd.contains(ctype);
} catch (IdRepoException e) {
debug.warning("EntitiesModelImpl.canAddMember", e);
throw new AMConsoleException(getErrorString(e));
}
return can;
}
use of com.sun.identity.idm.IdRepoException in project OpenAM by OpenRock.
the class EntitiesModelImpl method getDefaultAttributeValues.
/**
* Returns defauls values for an Entity Type.
*
* @param idType Type of Entity.
* @param agentType mainly for agent type
* @param bCreate true for creation page.
* @throws AMConsoleException if default values cannot be obtained.
*/
public Map getDefaultAttributeValues(String idType, String agentType, boolean bCreate) throws AMConsoleException {
try {
Set attributeSchemas = getAttributeSchemas(idType, agentType, bCreate);
Map values = new HashMap(attributeSchemas.size() * 2);
for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
values.put(as.getName(), as.getDefaultValues());
}
if (isWSSEnabled && bCreate && idType.equalsIgnoreCase("agent")) {
Set set = new HashSet(2);
set.add(RADIO_AGENT_TYPE_GENERIC);
values.put(RADIO_AGENT_TYPE, set);
}
return values;
} catch (IdRepoException e) {
debug.warning("EntitiesModelImpl.getDefaultAttributeValues", e);
throw new AMConsoleException(getErrorString(e));
} catch (SMSException e) {
debug.warning("EntitiesModelImpl.getDefaultAttributeValues", e);
throw new AMConsoleException(getErrorString(e));
} catch (SSOException e) {
debug.warning("EntitiesModelImpl.getDefaultAttributeValues", e);
throw new AMConsoleException(getErrorString(e));
}
}
Aggregations