use of org.gluu.persist.exception.operation.DuplicateEntryException in project oxTrust by GluuFederation.
the class GroupWebServiceDecorator method updateGroup.
public Response updateGroup(GroupResource group, String id, String attrsList, String excludedAttrsList) {
Response response;
try {
// empty externalId, no place to store it in LDAP
group.setExternalId(null);
// Check if the ids match in case the group coming has one
if (group.getId() != null && !group.getId().equals(id))
throw new SCIMException("Parameter id does not match with id attribute of Group");
response = validateExistenceOfGroup(id);
if (response == null) {
executeValidation(group, true);
if (StringUtils.isNotEmpty(group.getDisplayName()))
checkDisplayNameExistence(group.getDisplayName(), id);
// Proceed with actual implementation of updateGroup method
response = service.updateGroup(group, id, attrsList, excludedAttrsList);
}
} catch (DuplicateEntryException e) {
log.error(e.getMessage());
response = getErrorResponse(Response.Status.CONFLICT, ErrorScimType.UNIQUENESS, e.getMessage());
} catch (SCIMException e) {
log.error("Validation check at updateGroup returned: {}", e.getMessage());
response = getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_VALUE, e.getMessage());
}
return response;
}
use of org.gluu.persist.exception.operation.DuplicateEntryException in project oxTrust by GluuFederation.
the class UserWebServiceDecorator method createUser.
public Response createUser(UserResource user, String attrsList, String excludedAttrsList) {
Response response;
try {
executeDefaultValidation(user);
checkUidExistence(user.getUserName());
assignMetaInformation(user);
ScimResourceUtil.adjustPrimarySubAttributes(user);
// Proceed with actual implementation of createUser method
response = service.createUser(user, attrsList, excludedAttrsList);
} catch (DuplicateEntryException e) {
log.error(e.getMessage());
response = getErrorResponse(Response.Status.CONFLICT, ErrorScimType.UNIQUENESS, e.getMessage());
} catch (SCIMException e) {
log.error("Validation check at createUser returned: {}", e.getMessage());
response = getErrorResponse(Response.Status.BAD_REQUEST, ErrorScimType.INVALID_VALUE, e.getMessage());
}
return response;
}
Aggregations