diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java index b0e0f4bd82..d3bccd0c3c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java @@ -18,9 +18,89 @@ */ package org.wso2.carbon.device.application.mgt.common.services; +import org.wso2.carbon.device.application.mgt.common.Comment; +import org.wso2.carbon.device.application.mgt.common.PaginationRequest; +import org.wso2.carbon.device.application.mgt.common.PaginationResult; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; +import org.wso2.carbon.device.application.mgt.common.exception.CommentManagementException; +import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; + +import java.sql.SQLException; + /** * CommentsManager is responsible for handling all the add/update/delete/get operations related with - * {@link org.wso2.carbon.device.application.mgt.common.Comment}. + * */ public interface CommentsManager { + + /** + * To add a comment to a application + * + * @param comment comment of the application. + * @param uuid uuid of the application release + * @param tenantId tenant id of the application + * @return {@link Comment} + * @throws CommentManagementException Exceptions of the comment management. + */ + + /** + * Get all comments to pagination + * + *@param request Pagination request + * @param uuid uuid of the application release + * @return {@link PaginationResult} pagination result with starting index and limit + * @throws CommentManagementException Exceptions of the comment management. + * @throws SQLException SQL Exception + */ + PaginationResult getAllComments(PaginationRequest request,String uuid) throws CommentManagementException, SQLException; + + /** + * To get the comment with id. + * + * @param apAppCommentId id of the comment + * @return Comment of the comment id + * @throws CommentManagementException Exceptions of the comment management. + */ + Comment getComment(int apAppCommentId)throws CommentManagementException; + + + /** + * To update a comment. + * + * @param comment comment of the application. + * @param apAppCommentId id of the comment + * @return updated comment + * @throws CommentManagementException Exceptions of the comment management + * @throws SQLException SQL Exception + * @throws DBConnectionException Database connection Exception + */ + Comment updateComment(Comment comment,int apAppCommentId) throws CommentManagementException, SQLException, DBConnectionException; + + /** + * To get the average of stars + * + * @param uuid uuid of the comment + * @return value of the stars of an application + * @throws SQLException sql exception + */ + int getStars(String uuid)throws SQLException; + + /** + * To update rating stars + * + * @param stars amount of stars + * @param uuid uuid of the application + * @return value of the added stars + * @throws ApplicationManagementException Application Management Exception. + */ + int updateStars(int stars, String uuid) throws ApplicationManagementException; + + /** + * To get number of rated users + * + * @param uuid uuid of the application + * @return number of rated users + * @throws SQLException sql exception + */ + int getRatedUser(String uuid)throws SQLException; }