use of org.craftercms.commons.mongo.MongoDataException in project profile by craftercms.
the class ProfileServiceImpl method getProfilesByAttributeValue.
@Override
public List<Profile> getProfilesByAttributeValue(String tenantName, String attributeName, String attributeValue, String sortBy, SortOrder sortOrder, String... attributesToReturn) throws ProfileException {
checkIfManageProfilesIsAllowed(tenantName);
try {
List<Profile> profiles = IterableUtils.toList(profileRepository.findByTenantAndAttributeValue(tenantName, attributeName, attributeValue, sortBy, sortOrder, attributesToReturn));
filterNonReadableAttributes(profiles);
return profiles;
} catch (MongoDataException e) {
throw new I10nProfileException(ERROR_KEY_GET_PROFILES_BY_ATTRIB_VALUE_ERROR, e, attributeName, attributeValue, tenantName);
}
}
use of org.craftercms.commons.mongo.MongoDataException in project profile by craftercms.
the class ProfileServiceImpl method getProfileRange.
@Override
public List<Profile> getProfileRange(String tenantName, String sortBy, SortOrder sortOrder, Integer start, Integer count, String... attributesToReturn) throws ProfileException {
checkIfManageProfilesIsAllowed(tenantName);
try {
List<Profile> profiles = IterableUtils.toList(profileRepository.findRange(tenantName, sortBy, sortOrder, start, count, attributesToReturn));
filterNonReadableAttributes(profiles);
return profiles;
} catch (MongoDataException e) {
throw new I10nProfileException(ERROR_KEY_GET_PROFILE_RANGE_ERROR, e, start, count, tenantName);
}
}
use of org.craftercms.commons.mongo.MongoDataException in project profile by craftercms.
the class ProfileServiceImpl method getProfileByUsername.
@Override
public Profile getProfileByUsername(String tenantName, String username, String... attributesToReturn) throws ProfileException {
checkIfManageProfilesIsAllowed(tenantName);
try {
Profile profile = profileRepository.findByTenantAndUsername(tenantName, username, attributesToReturn);
filterNonReadableAttributes(profile);
return profile;
} catch (MongoDataException e) {
throw new I10nProfileException(ERROR_KEY_GET_PROFILE_BY_USERNAME_ERROR, e, username, tenantName);
}
}
use of org.craftercms.commons.mongo.MongoDataException in project profile by craftercms.
the class ProfileServiceImpl method getProfilesByRole.
@Override
public List<Profile> getProfilesByRole(String tenantName, String role, String sortBy, SortOrder sortOrder, String... attributesToReturn) throws ProfileException {
checkIfManageProfilesIsAllowed(tenantName);
try {
List<Profile> profiles = IterableUtils.toList(profileRepository.findByTenantAndRole(tenantName, role, sortBy, sortOrder, attributesToReturn));
filterNonReadableAttributes(profiles);
return profiles;
} catch (MongoDataException e) {
throw new I10nProfileException(ERROR_KEY_GET_PROFILES_BY_ROLE_ERROR, e, role, tenantName);
}
}
Aggregations