Class ProfileController
java.lang.Object
org.craftercms.profile.controllers.rest.ProfileController
REST controller for the profile service.
- Author:
- avasquez
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.fasterxml.jackson.databind.ObjectMapper
protected ProfileService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddRoles
(String profileId, Collection<String> roles, String[] attributesToReturn) changePassword
(String resetTokenId, String newPassword, String[] attributesToReturn) createProfile
(String tenantName, String username, String password, String email, boolean enabled, Set<String> roles, String serializedAttributes, String verificationUrl) createVerificationToken
(String profileId) void
deleteProfile
(String profileId) void
deleteVerificationToken
(String tokenId) deserializeAttributes
(String serializedAttributes) disableProfile
(String profileId, String[] attributesToReturn) enableProfile
(String profileId, String[] attributesToReturn) void
getAttachment
(String profileId, String attachmentId, javax.servlet.http.HttpServletResponse response) getAttachmentDetails
(String profileId, String attachmentId) getAttachments
(String profileId) getAttributes
(String profileId, String[] attributesToReturn) getProfile
(String profileId, String[] attributesToReturn) getProfileByIds
(List<String> profileIds, String sortBy, SortOrder sortOrder, String[] attributesToReturn) getProfileByQuery
(String tenantName, String query, String[] attributesToReturn) getProfileByTicket
(String ticketId, String[] attributesToReturn) getProfileByUsername
(String tenantName, String username, String[] attributesToReturn) long
getProfileCount
(String tenantName) long
getProfileCount
(String tenantName, String query) getProfileRange
(String tenantName, String sortBy, SortOrder sortOrder, Integer start, Integer count, String[] attributesToReturn) getProfilesByAttributeValue
(String tenantName, String attributeName, String attributeValue, String sortBy, SortOrder sortOrder, String[] attributesToReturn) getProfilesByExistingAttribute
(String tenantName, String attributeName, String sortBy, SortOrder sortOrder, String[] attributesToReturn) getProfilesByQuery
(String tenantName, String query, String sortBy, SortOrder sortOrder, Integer start, Integer count, String[] attributesToReturn) getProfilesByRole
(String tenantName, String role, String sortBy, SortOrder sortOrder, String[] attributesToReturn) getVerificationToken
(String tokenId) removeAttributes
(String profileId, Collection<String> attributeNames, String[] attributesToReturn) removeRoles
(String profileId, Collection<String> roles, String[] attributesToReturn) resetPassword
(String profileId, String resetPasswordUrl, String[] attributesToReturn) void
setObjectMapper
(com.fasterxml.jackson.databind.ObjectMapper objectMapper) void
setProfileService
(ProfileService profileService) updateProfile
(String profileId, String username, String password, String email, Boolean enabled, Set<String> roles, String serializedAttributes, String[] attributesToReturn) uploadProfileAttachment
(String profileId, String filename, org.springframework.web.multipart.MultipartFile attachment) verifyProfile
(String verificationTokenId, String[] attributesToReturn)
-
Field Details
-
profileService
-
objectMapper
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
-
Constructor Details
-
ProfileController
public ProfileController()
-
-
Method Details
-
setProfileService
-
setObjectMapper
public void setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
createProfile
@RequestMapping(value="/create", method=POST) @ResponseBody public Profile createProfile(@RequestParam("tenantName") String tenantName, @RequestParam("username") String username, @RequestParam(value="password",required=false) String password, @RequestParam("email") String email, @RequestParam("enabled") boolean enabled, @RequestParam(value="role",required=false) Set<String> roles, @RequestParam(value="attributes",required=false) String serializedAttributes, @RequestParam(value="verificationUrl",required=false) String verificationUrl) throws ProfileException - Throws:
ProfileException
-
updateProfile
@RequestMapping(value="/{id}/update", method=POST) @ResponseBody public Profile updateProfile(@PathVariable("id") String profileId, @RequestParam(value="username",required=false) String username, @RequestParam(value="password",required=false) String password, @RequestParam(value="email",required=false) String email, @RequestParam(value="enabled",required=false) Boolean enabled, @RequestParam(value="role",required=false) Set<String> roles, @RequestParam(value="attributes",required=false) String serializedAttributes, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
enableProfile
@RequestMapping(value="/{id}/enable", method=POST) @ResponseBody public Profile enableProfile(@PathVariable("id") String profileId, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
disableProfile
@RequestMapping(value="/{id}/disable", method=POST) @ResponseBody public Profile disableProfile(@PathVariable("id") String profileId, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
addRoles
@RequestMapping(value="/{id}/roles/add", method=POST) @ResponseBody public Profile addRoles(@PathVariable("id") String profileId, @RequestParam("role") Collection<String> roles, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
removeRoles
@RequestMapping(value="/{id}/roles/remove", method=POST) @ResponseBody public Profile removeRoles(@PathVariable("id") String profileId, @RequestParam("role") Collection<String> roles, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
verifyProfile
@RequestMapping(value="/verify", method=POST) @ResponseBody public Profile verifyProfile(@RequestParam("verificationTokenId") String verificationTokenId, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getAttributes
@RequestMapping(value="/{id}/attributes", method=GET) @ResponseBody public Map<String,Object> getAttributes(@PathVariable("id") String profileId, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
updateAttributes
@RequestMapping(value="/{id}/attributes/update", method=POST) @ResponseBody public Profile updateAttributes(@PathVariable("id") String profileId, @RequestBody Map<String, Object> attributes, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException- Throws:
ProfileException
-
removeAttributes
@RequestMapping(value="/{id}/attributes/remove", method=POST) @ResponseBody public Profile removeAttributes(@PathVariable("id") String profileId, @RequestParam("attributeName") Collection<String> attributeNames, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
deleteProfile
@RequestMapping(value="/{id}/delete", method=POST) @ResponseStatus(OK) public void deleteProfile(@PathVariable("id") String profileId) throws ProfileException - Throws:
ProfileException
-
getProfileByQuery
@RequestMapping(value="/one_by_query", method=GET) @ResponseBody public Profile getProfileByQuery(@RequestParam("tenantName") String tenantName, @RequestParam("query") String query, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfile
@RequestMapping(value="/{id}", method=GET) @ResponseBody public Profile getProfile(@PathVariable("id") String profileId, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfileByUsername
@RequestMapping(value="/by_username", method=GET) @ResponseBody public Profile getProfileByUsername(@RequestParam("tenantName") String tenantName, @RequestParam("username") String username, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfileByTicket
@RequestMapping(value="/by_ticket", method=GET) @ResponseBody public Profile getProfileByTicket(@RequestParam("ticketId") String ticketId, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfileCount
@RequestMapping(value="/count", method=GET) @ResponseBody public long getProfileCount(@RequestParam("tenantName") String tenantName) throws ProfileException - Throws:
ProfileException
-
getProfileCount
@RequestMapping(value="/count_by_query", method=GET) @ResponseBody public long getProfileCount(@RequestParam("tenantName") String tenantName, @RequestParam("query") String query) throws ProfileException - Throws:
ProfileException
-
getProfilesByQuery
@RequestMapping(value="/by_query", method=GET) @ResponseBody public List<Profile> getProfilesByQuery(@RequestParam("tenantName") String tenantName, @RequestParam("query") String query, @RequestParam(value="sortBy",required=false) String sortBy, @RequestParam(value="sortOrder",required=false) SortOrder sortOrder, @RequestParam(value="start",required=false) Integer start, @RequestParam(value="count",required=false) Integer count, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfileByIds
@RequestMapping(value="/by_ids", method=GET) @ResponseBody public List<Profile> getProfileByIds(@RequestParam("id") List<String> profileIds, @RequestParam(value="sortBy",required=false) String sortBy, @RequestParam(value="sortOrder",required=false) SortOrder sortOrder, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfileRange
@RequestMapping(value="/range", method=GET) @ResponseBody public List<Profile> getProfileRange(@RequestParam("tenantName") String tenantName, @RequestParam(value="sortBy",required=false) String sortBy, @RequestParam(value="sortOrder",required=false) SortOrder sortOrder, @RequestParam(value="start",required=false) Integer start, @RequestParam(value="count",required=false) Integer count, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfilesByRole
@RequestMapping(value="/by_role", method=GET) @ResponseBody public List<Profile> getProfilesByRole(@RequestParam("tenantName") String tenantName, @RequestParam("role") String role, @RequestParam(value="sortBy",required=false) String sortBy, @RequestParam(value="sortOrder",required=false) SortOrder sortOrder, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfilesByExistingAttribute
@RequestMapping(value="/by_existing_attribute", method=GET) @ResponseBody public List<Profile> getProfilesByExistingAttribute(@RequestParam("tenantName") String tenantName, @RequestParam("attributeName") String attributeName, @RequestParam(value="sortBy",required=false) String sortBy, @RequestParam(value="sortOrder",required=false) SortOrder sortOrder, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
getProfilesByAttributeValue
@RequestMapping(value="/by_attribute_value", method=GET) @ResponseBody public List<Profile> getProfilesByAttributeValue(@RequestParam("tenantName") String tenantName, @RequestParam("attributeName") String attributeName, @RequestParam("attributeValue") String attributeValue, @RequestParam(value="sortBy",required=false) String sortBy, @RequestParam(value="sortOrder",required=false) SortOrder sortOrder, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
resetPassword
@RequestMapping(value="/{id}/reset_password", method=POST) @ResponseBody public Profile resetPassword(@PathVariable("id") String profileId, @RequestParam("resetPasswordUrl") String resetPasswordUrl, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
changePassword
@RequestMapping(value="/change_password", method=POST) @ResponseBody public Profile changePassword(@RequestParam("resetTokenId") String resetTokenId, @RequestParam("newPassword") String newPassword, @RequestParam(value="attributeToReturn",required=false) String[] attributesToReturn) throws ProfileException - Throws:
ProfileException
-
createVerificationToken
@RequestMapping(value="/{id}/verification_token/create", method=POST) @ResponseBody public VerificationToken createVerificationToken(@PathVariable("id") String profileId) throws ProfileException - Throws:
ProfileException
-
getVerificationToken
@RequestMapping(value="/verification_token/{id}", method=GET) @ResponseBody public VerificationToken getVerificationToken(@PathVariable("id") String tokenId) throws ProfileException - Throws:
ProfileException
-
deleteVerificationToken
@RequestMapping(value="/verification_token/{id}/delete", method=POST) @ResponseStatus(OK) public void deleteVerificationToken(@PathVariable("id") String tokenId) throws ProfileException - Throws:
ProfileException
-
uploadProfileAttachment
@ResponseBody @RequestMapping(value="/{id}/uploadAttachment", method=POST) public ProfileAttachment uploadProfileAttachment(@PathVariable("id") String profileId, @RequestParam(name="filename",required=false) String filename, org.springframework.web.multipart.MultipartFile attachment) throws ProfileException - Throws:
ProfileException
-
getAttachments
@RequestMapping(value="/{id}/attachments/", method=GET) @ResponseBody public List<ProfileAttachment> getAttachments(String profileId) throws ProfileException, IOException - Throws:
ProfileException
IOException
-
getAttachmentDetails
@RequestMapping(value="/{id}/attachment/{attachmentId}/details", method=GET) @ResponseBody public ProfileAttachment getAttachmentDetails(@PathVariable("id") String profileId, @PathVariable("attachmentId") String attachmentId) throws ProfileException, IOException - Throws:
ProfileException
IOException
-
getAttachment
@RequestMapping(value="/{id}/attachment/{attachmentId}", method=GET) public void getAttachment(@PathVariable("id") String profileId, @PathVariable("attachmentId") String attachmentId, javax.servlet.http.HttpServletResponse response) throws ProfileException, IOException - Throws:
ProfileException
IOException
-
deserializeAttributes
protected Map<String,Object> deserializeAttributes(String serializedAttributes) throws ParamDeserializationException - Throws:
ParamDeserializationException
-