Class ProfileServiceRestClient
- java.lang.Object
-
- org.craftercms.commons.rest.AbstractRestClientBase
-
- org.craftercms.profile.services.impl.AbstractProfileRestClientBase
-
- org.craftercms.profile.services.impl.ProfileServiceRestClient
-
- All Implemented Interfaces:
ProfileService
public class ProfileServiceRestClient extends AbstractProfileRestClientBase implements ProfileService
REST client implementation ofProfileService
.- Author:
- avasquez
-
-
Field Summary
Fields Modifier and Type Field Description static org.springframework.core.ParameterizedTypeReference<byte[]>
byteArrayTypeRef
static String
ERROR_KEY_ATTRIBUTES_SERIALIZATION_ERROR
static String
ERROR_KEY_INVALID_URI_ERROR
static String
ERROR_KEY_TMP_COPY_FAILED
static org.springframework.core.ParameterizedTypeReference<List<ProfileAttachment>>
profileAttachmentListTypeRef
static org.springframework.core.ParameterizedTypeReference<List<Profile>>
profileListTypeRef
-
Fields inherited from class org.craftercms.profile.services.impl.AbstractProfileRestClientBase
accessTokenIdResolver
-
-
Constructor Summary
Constructors Constructor Description ProfileServiceRestClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProfileAttachment
addProfileAttachment(String profileId, String attachmentName, InputStream file)
protected String
addQueryParams(String url, org.springframework.util.MultiValueMap<String,String> params, boolean encodeValues)
Profile
addRoles(String profileId, Collection<String> roles, String... attributesToReturn)
Profile
changePassword(String resetTokenId, String newPassword, String... attributesToReturn)
Profile
createProfile(String tenantName, String username, String password, String email, boolean enabled, Set<String> roles, Map<String,Object> attributes, String verificationUrl)
VerificationToken
createVerificationToken(String profileId)
void
deleteProfile(String profileId)
void
deleteVerificationToken(String tokenId)
Profile
disableProfile(String profileId, String... attributesToReturn)
Profile
enableProfile(String profileId, String... attributesToReturn)
Map<String,Object>
getAttributes(String profileId, String... attributesToReturn)
Profile
getProfile(String profileId, String... attributesToReturn)
InputStream
getProfileAttachment(String attachmentId, String profileId)
ProfileAttachment
getProfileAttachmentInformation(String profileId, String attachmentId)
List<ProfileAttachment>
getProfileAttachments(String profileId)
Profile
getProfileByQuery(String tenantName, String query, String... attributesToReturn)
Profile
getProfileByTicket(String ticketId, String... attributesToReturn)
Profile
getProfileByUsername(String tenantName, String username, String... attributesToReturn)
long
getProfileCount(String tenantName)
long
getProfileCountByQuery(String tenantName, String query)
List<Profile>
getProfileRange(String tenantName, String sortBy, SortOrder sortOrder, Integer start, Integer count, String... attributesToReturn)
List<Profile>
getProfilesByAttributeValue(String tenantName, String attributeName, String attributeValue, String sortBy, SortOrder sortOrder, String... attributesToReturn)
List<Profile>
getProfilesByExistingAttribute(String tenantName, String attributeName, String sortBy, SortOrder sortOrder, String... attributesToReturn)
List<Profile>
getProfilesByIds(List<String> profileIds, String sortBy, SortOrder sortOrder, String... attributesToReturn)
List<Profile>
getProfilesByQuery(String tenantName, String query, String sortBy, SortOrder sortOrder, Integer start, Integer count, String... attributesToReturn)
List<Profile>
getProfilesByRole(String tenantName, String role, String sortBy, SortOrder sortOrder, String... attributesToReturn)
VerificationToken
getVerificationToken(String tokenId)
Profile
removeAttributes(String profileId, Collection<String> attributeNames, String... attributesToReturn)
Profile
removeRoles(String profileId, Collection<String> roles, String... attributesToReturn)
Profile
resetPassword(String profileId, String resetPasswordUrl, String... attributesToReturn)
protected String
serializeAttributes(Map<String,Object> attributes)
Profile
setFailedLoginAttempts(String profileId, int failedLoginAttempts, String... attributesToReturn)
Profile
setLastFailedLogin(String profileId, Date lastFailedLogin, String... attributesToReturn)
void
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Profile
updateAttributes(String profileId, Map<String,Object> attributes, String... attributesToReturn)
Profile
updateProfile(String profileId, String username, String password, String email, Boolean enabled, Set<String> roles, Map<String,Object> attributes, String... attributesToReturn)
Profile
verifyProfile(String verificationTokenId, String... attributesToReturn)
-
Methods inherited from class org.craftercms.profile.services.impl.AbstractProfileRestClientBase
createBaseParams, doGetForObject, doGetForObject, doGetForObject, doGetForObject, doPostForLocation, doPostForObject, doPostForUpload, getAbsoluteUrlWithAccessTokenIdParam, handleException, handleRestServiceException, setAccessTokenIdResolver
-
-
-
-
Field Detail
-
profileListTypeRef
public static final org.springframework.core.ParameterizedTypeReference<List<Profile>> profileListTypeRef
-
byteArrayTypeRef
public static final org.springframework.core.ParameterizedTypeReference<byte[]> byteArrayTypeRef
-
profileAttachmentListTypeRef
public static final org.springframework.core.ParameterizedTypeReference<List<ProfileAttachment>> profileAttachmentListTypeRef
-
ERROR_KEY_ATTRIBUTES_SERIALIZATION_ERROR
public static final String ERROR_KEY_ATTRIBUTES_SERIALIZATION_ERROR
- See Also:
- Constant Field Values
-
ERROR_KEY_INVALID_URI_ERROR
public static final String ERROR_KEY_INVALID_URI_ERROR
- See Also:
- Constant Field Values
-
ERROR_KEY_TMP_COPY_FAILED
public static final String ERROR_KEY_TMP_COPY_FAILED
- See Also:
- Constant Field Values
-
-
Method Detail
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
createProfile
public Profile createProfile(String tenantName, String username, String password, String email, boolean enabled, Set<String> roles, Map<String,Object> attributes, String verificationUrl) throws ProfileException
- Specified by:
createProfile
in interfaceProfileService
- Throws:
ProfileException
-
updateProfile
public Profile updateProfile(String profileId, String username, String password, String email, Boolean enabled, Set<String> roles, Map<String,Object> attributes, String... attributesToReturn) throws ProfileException
- Specified by:
updateProfile
in interfaceProfileService
- Throws:
ProfileException
-
verifyProfile
public Profile verifyProfile(String verificationTokenId, String... attributesToReturn) throws ProfileException
- Specified by:
verifyProfile
in interfaceProfileService
- Throws:
ProfileException
-
enableProfile
public Profile enableProfile(String profileId, String... attributesToReturn) throws ProfileException
- Specified by:
enableProfile
in interfaceProfileService
- Throws:
ProfileException
-
disableProfile
public Profile disableProfile(String profileId, String... attributesToReturn) throws ProfileException
- Specified by:
disableProfile
in interfaceProfileService
- Throws:
ProfileException
-
addRoles
public Profile addRoles(String profileId, Collection<String> roles, String... attributesToReturn) throws ProfileException
- Specified by:
addRoles
in interfaceProfileService
- Throws:
ProfileException
-
removeRoles
public Profile removeRoles(String profileId, Collection<String> roles, String... attributesToReturn) throws ProfileException
- Specified by:
removeRoles
in interfaceProfileService
- Throws:
ProfileException
-
getAttributes
public Map<String,Object> getAttributes(String profileId, String... attributesToReturn) throws ProfileException
- Specified by:
getAttributes
in interfaceProfileService
- Throws:
ProfileException
-
updateAttributes
public Profile updateAttributes(String profileId, Map<String,Object> attributes, String... attributesToReturn) throws ProfileException
- Specified by:
updateAttributes
in interfaceProfileService
- Throws:
ProfileException
-
removeAttributes
public Profile removeAttributes(String profileId, Collection<String> attributeNames, String... attributesToReturn) throws ProfileException
- Specified by:
removeAttributes
in interfaceProfileService
- Throws:
ProfileException
-
deleteProfile
public void deleteProfile(String profileId) throws ProfileException
- Specified by:
deleteProfile
in interfaceProfileService
- Throws:
ProfileException
-
getProfileByQuery
public Profile getProfileByQuery(String tenantName, String query, String... attributesToReturn) throws ProfileException
- Specified by:
getProfileByQuery
in interfaceProfileService
- Throws:
ProfileException
-
getProfile
public Profile getProfile(String profileId, String... attributesToReturn) throws ProfileException
- Specified by:
getProfile
in interfaceProfileService
- Throws:
ProfileException
-
getProfileByUsername
public Profile getProfileByUsername(String tenantName, String username, String... attributesToReturn) throws ProfileException
- Specified by:
getProfileByUsername
in interfaceProfileService
- Throws:
ProfileException
-
getProfileByTicket
public Profile getProfileByTicket(String ticketId, String... attributesToReturn) throws ProfileException
- Specified by:
getProfileByTicket
in interfaceProfileService
- Throws:
ProfileException
-
getProfileCount
public long getProfileCount(String tenantName) throws ProfileException
- Specified by:
getProfileCount
in interfaceProfileService
- Throws:
ProfileException
-
getProfileCountByQuery
public long getProfileCountByQuery(String tenantName, String query) throws ProfileException
- Specified by:
getProfileCountByQuery
in interfaceProfileService
- Throws:
ProfileException
-
getProfilesByQuery
public List<Profile> getProfilesByQuery(String tenantName, String query, String sortBy, SortOrder sortOrder, Integer start, Integer count, String... attributesToReturn) throws ProfileException
- Specified by:
getProfilesByQuery
in interfaceProfileService
- Throws:
ProfileException
-
getProfilesByIds
public List<Profile> getProfilesByIds(List<String> profileIds, String sortBy, SortOrder sortOrder, String... attributesToReturn) throws ProfileException
- Specified by:
getProfilesByIds
in interfaceProfileService
- Throws:
ProfileException
-
getProfileRange
public List<Profile> getProfileRange(String tenantName, String sortBy, SortOrder sortOrder, Integer start, Integer count, String... attributesToReturn) throws ProfileException
- Specified by:
getProfileRange
in interfaceProfileService
- Throws:
ProfileException
-
getProfilesByRole
public List<Profile> getProfilesByRole(String tenantName, String role, String sortBy, SortOrder sortOrder, String... attributesToReturn) throws ProfileException
- Specified by:
getProfilesByRole
in interfaceProfileService
- Throws:
ProfileException
-
getProfilesByExistingAttribute
public List<Profile> getProfilesByExistingAttribute(String tenantName, String attributeName, String sortBy, SortOrder sortOrder, String... attributesToReturn) throws ProfileException
- Specified by:
getProfilesByExistingAttribute
in interfaceProfileService
- Throws:
ProfileException
-
getProfilesByAttributeValue
public List<Profile> getProfilesByAttributeValue(String tenantName, String attributeName, String attributeValue, String sortBy, SortOrder sortOrder, String... attributesToReturn) throws ProfileException
- Specified by:
getProfilesByAttributeValue
in interfaceProfileService
- Throws:
ProfileException
-
resetPassword
public Profile resetPassword(String profileId, String resetPasswordUrl, String... attributesToReturn) throws ProfileException
- Specified by:
resetPassword
in interfaceProfileService
- Throws:
ProfileException
-
changePassword
public Profile changePassword(String resetTokenId, String newPassword, String... attributesToReturn) throws ProfileException
- Specified by:
changePassword
in interfaceProfileService
- Throws:
ProfileException
-
createVerificationToken
public VerificationToken createVerificationToken(String profileId) throws ProfileException
- Specified by:
createVerificationToken
in interfaceProfileService
- Throws:
ProfileException
-
getVerificationToken
public VerificationToken getVerificationToken(String tokenId) throws ProfileException
- Specified by:
getVerificationToken
in interfaceProfileService
- Throws:
ProfileException
-
deleteVerificationToken
public void deleteVerificationToken(String tokenId) throws ProfileException
- Specified by:
deleteVerificationToken
in interfaceProfileService
- Throws:
ProfileException
-
addProfileAttachment
public ProfileAttachment addProfileAttachment(String profileId, String attachmentName, InputStream file) throws ProfileException
- Specified by:
addProfileAttachment
in interfaceProfileService
- Throws:
ProfileException
-
getProfileAttachmentInformation
public ProfileAttachment getProfileAttachmentInformation(String profileId, String attachmentId) throws ProfileException
- Specified by:
getProfileAttachmentInformation
in interfaceProfileService
- Throws:
ProfileException
-
getProfileAttachment
public InputStream getProfileAttachment(String attachmentId, String profileId) throws ProfileException
- Specified by:
getProfileAttachment
in interfaceProfileService
- Throws:
ProfileException
-
getProfileAttachments
public List<ProfileAttachment> getProfileAttachments(String profileId) throws ProfileException
- Specified by:
getProfileAttachments
in interfaceProfileService
- Throws:
ProfileException
-
serializeAttributes
protected String serializeAttributes(Map<String,Object> attributes) throws ProfileException
- Throws:
ProfileException
-
setLastFailedLogin
public Profile setLastFailedLogin(String profileId, Date lastFailedLogin, String... attributesToReturn) throws ProfileException
- Specified by:
setLastFailedLogin
in interfaceProfileService
- Throws:
ProfileException
-
setFailedLoginAttempts
public Profile setFailedLoginAttempts(String profileId, int failedLoginAttempts, String... attributesToReturn) throws ProfileException
- Specified by:
setFailedLoginAttempts
in interfaceProfileService
- Throws:
ProfileException
-
-