|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.silverpeas.web.RESTWebService
com.silverpeas.comment.web.CommentResource
@Service @RequestScoped @Authorized public class CommentResource
A REST Web resource representing a given comment. It is a web service that provides an access to a comment referenced by its URL.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.silverpeas.web.RESTWebService |
---|
RESTWebService.WebProcess<RETURN_VALUE>, RESTWebService.WebTreatment<RETURN_VALUE> |
Field Summary |
---|
Fields inherited from class com.silverpeas.web.RESTWebService |
---|
RESPONSE_HEADER_ARRAYSIZE, REST_WEB_SERVICES_URI_BASE |
Constructor Summary | |
---|---|
CommentResource()
|
Method Summary | |
---|---|
protected CommentEntity[] |
asWebEntities(List<Comment> comments)
Converts the specified list of comments into their corresponding web entities. |
protected CommentEntity |
asWebEntity(Comment comment,
URI commentURI)
Converts the comment into its corresponding web entity. |
protected static Comparator<Comment> |
byId()
Gets a comparator of comments by their identifier, from the lower to the higher one. |
protected CommentPK |
byPK(String id,
String componentId)
Gets the primary key of the specified resource. |
protected void |
checkIsValid(CommentEntity theComment)
Check the specified comment is valid. |
protected CommentService |
commentService()
Gets a business service on comments. |
void |
deleteComment(String onCommentId)
Deletes the specified existing comment. |
CommentEntity[] |
getAllComments()
Gets the JSON representation of all the comments on refered the resource. |
CommentEntity |
getComment(String onCommentId)
Gets the JSON representation of the specified existing comment. |
String |
getComponentId()
Gets the identifier of the component instance to which the requested resource belongs to. |
protected String |
getContentId()
|
protected String |
getContentType()
|
protected URI |
identifiedBy(URI uri)
|
protected String |
inComponentId()
Gets the identifier of the Silverpeas instance to which the commented content belongs. |
protected String |
onContentId()
Gets the identifier of the content that is commentable. |
protected String |
onContentType()
Gets the type of the content that is commentable. |
javax.ws.rs.core.Response |
saveNewComment(CommentEntity commentToSave)
Creates a new comment from its JSON representation and returns it with its URI identifying it in Silverpeas. |
CommentEntity |
updateComment(String commentId,
CommentEntity commentToUpdate)
Updates the comment from its JSON representation and returns it once updated. |
Methods inherited from class com.silverpeas.web.RESTWebService |
---|
getBundle, getBundleLocation, getGreaterUserRole, getHttpRequest, getHttpServletRequest, getHttpServletResponse, getOrganisationController, getUriInfo, getUserDetail, getUserPreferences, getUserRoles, process, validateUserAuthentication, validateUserAuthorization |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CommentResource()
Method Detail |
---|
public CommentEntity getComment(String onCommentId)
onCommentId
- the unique identifier of the comment.
public CommentEntity[] getAllComments()
public javax.ws.rs.core.Response saveNewComment(CommentEntity commentToSave)
commentToSave
- the comment to save in Silverpeas.
public CommentEntity updateComment(String commentId, CommentEntity commentToUpdate)
commentId
- the unique identifier of the comment to update.commentToUpdate
- the comment to update in Silverpeas.
public void deleteComment(String onCommentId)
onCommentId
- the unique identifier of the comment to delete.protected String inComponentId()
protected String onContentType()
protected String onContentId()
protected CommentService commentService()
protected CommentPK byPK(String id, String componentId)
id
- the unique identifier of the resource.componentId
- the unique identifier of the component instance to which the resource
belongs.
protected CommentEntity[] asWebEntities(List<Comment> comments)
comments
- the comments to convert.
protected CommentEntity asWebEntity(Comment comment, URI commentURI)
comment
- the comment to convert.commentURI
- the URI of the comment.
protected URI identifiedBy(URI uri)
public String getComponentId()
RESTWebService
getComponentId
in class RESTWebService
protected String getContentType()
protected String getContentId()
protected void checkIsValid(CommentEntity theComment)
theComment
- the comment to validate.protected static Comparator<Comment> byId()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |