Working Service

This commit is contained in:
Ahmed Salah Tawfik Ibrahim 2023-12-04 17:34:47 +01:00
parent d20bb95b1a
commit 1861f0a4d6
13 changed files with 65 additions and 193 deletions

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>social-networking-library-ws</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

View File

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@ -1,16 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId"/>

View File

@ -1,7 +0,0 @@
<root>
<facet id="jst.jaxrs">
<node name="libprov">
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
</node>
</facet>
</root>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.jaxrs" version="1.1"/>
<installed facet="java" version="1.8"/>
</faceted-project>

View File

@ -1 +0,0 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

View File

@ -1 +0,0 @@
Window

View File

@ -1,2 +0,0 @@
disabled=06target
eclipse.preferences.version=1

View File

@ -1,12 +1,10 @@
package org.gcube.portal.social.networking.ws.lib; package org.gcube.portal.social.networking.ws.methods.v2;
import com.webcohesion.enunciate.metadata.Ignore;
import com.webcohesion.enunciate.metadata.rs.RequestHeader; import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders; import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResponseCode; import com.webcohesion.enunciate.metadata.rs.ResponseCode;
import com.webcohesion.enunciate.metadata.rs.StatusCodes; import com.webcohesion.enunciate.metadata.rs.StatusCodes;
import org.apache.commons.lang.Validate;
import org.gcube.portal.databook.shared.*; import org.gcube.portal.databook.shared.*;
import org.gcube.portal.social.networking.ws.outputs.ResponseBean; import org.gcube.portal.social.networking.ws.outputs.ResponseBean;
import org.gcube.portal.social.networking.ws.utils.CassandraConnection; import org.gcube.portal.social.networking.ws.utils.CassandraConnection;
@ -18,7 +16,6 @@ import javax.validation.ValidationException;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.Response.Status;
@ -29,22 +26,21 @@ import java.util.Map;
* REST interface for the social networking library (comments). * REST interface for the social networking library (comments).
* @author Ahmed Ibrahim ISTI-CNR * @author Ahmed Ibrahim ISTI-CNR
*/ */
@Path("lib/") @Path("2/lib")
@RequestHeaders ({ @RequestHeaders ({
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"), @RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
@RequestHeader( name = "Content-Type", description = "application/json") @RequestHeader( name = "Content-Type", description = "application/json")
}) })
@Ignore public class Lib {
public class LibRestAPI {
// Logger // Logger
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(LibRestAPI.class); private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Lib.class);
//Comments //Comments
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("add-comment-lib") @Path("add-comment-lib/")
public Response addCommentLib(@NotNull(message="Comment to write is missing") public Response addCommentLib(@NotNull(message="Comment to write is missing")
@Valid @Valid
Comment comment)throws ValidationException { Comment comment)throws ValidationException {
@ -67,7 +63,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("read-comment-by-id-lib") @Path("read-comment-by-id-lib/")
public Response readCommentByIdLib(@QueryParam("commentid") public Response readCommentByIdLib(@QueryParam("commentid")
String commentid)throws ValidationException{ String commentid)throws ValidationException{
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
@ -89,7 +85,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-comments-by-post-id-lib") @Path("get-comments-by-post-id-lib/")
@StatusCodes ({ @StatusCodes ({
@ResponseCode ( code = 200, condition = "The list of comments is put into the 'result' field"), @ResponseCode ( code = 200, condition = "The list of comments is put into the 'result' field"),
@ResponseCode ( code = 500, condition = ErrorMessages.ERROR_IN_API_RESULT) @ResponseCode ( code = 500, condition = ErrorMessages.ERROR_IN_API_RESULT)
@ -120,7 +116,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-recent-comments-by-user-and-date-lib") @Path("get-recent-comments-by-user-and-date-lib/")
public Response getRecentCommentsByUserAndDateLib( public Response getRecentCommentsByUserAndDateLib(
@QueryParam("time") @QueryParam("time")
@Min(value = 0, message="time cannot be negative") @Min(value = 0, message="time cannot be negative")
@ -152,7 +148,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("edit-comment-lib") @Path("edit-comment-lib/")
public Response editCommentLib( public Response editCommentLib(
@NotNull(message="Comment to edit is missing") @NotNull(message="Comment to edit is missing")
@Valid @Valid
@ -178,7 +174,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("delete-comment-lib") @Path("delete-comment-lib/")
public Response deleteCommentLib( public Response deleteCommentLib(
@QueryParam("commentid") @QueryParam("commentid")
String commentid, String commentid,
@ -206,7 +202,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("save-hashtag-lib") @Path("save-hashtag-lib/")
public Response saveHashTagsLib( public Response saveHashTagsLib(
@QueryParam("feedid") @QueryParam("feedid")
String feedid, String feedid,
@ -237,7 +233,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("delete-hashtag-lib") @Path("delete-hashtag-lib/")
public Response deleteHashTagsLib( public Response deleteHashTagsLib(
@QueryParam("feedid") @QueryParam("feedid")
String feedid, String feedid,
@ -268,7 +264,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("save-hashtag-comment-lib") @Path("save-hashtag-comment-lib/")
public Response saveHashTagsCommentLib( public Response saveHashTagsCommentLib(
@QueryParam("commentid") @QueryParam("commentid")
String commentid, String commentid,
@ -298,7 +294,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("delete-hashtag-comment-lib") @Path("delete-hashtag-comment-lib/")
public Response deleteHashTagsCommentLib( public Response deleteHashTagsCommentLib(
@QueryParam("commentid") @QueryParam("commentid")
String commentid, String commentid,
@ -328,7 +324,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-vre-hashtags-occurrences-lib") @Path("get-vre-hashtags-occurrences-lib/")
public Response getVREHashtagsWithOccurrenceLib( public Response getVREHashtagsWithOccurrenceLib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid String vreid
@ -356,7 +352,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-vre-hashtags-occurrences-time-lib") @Path("get-vre-hashtags-occurrences-time-lib/")
public Response getVREHashtagsWithOccurrenceFilteredByTimeLib( public Response getVREHashtagsWithOccurrenceFilteredByTimeLib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid, String vreid,
@ -386,7 +382,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-vre-post-by-hashtag-lib") @Path("get-vre-post-by-hashtag-lib/")
public Response getVREFeedsByHashtagLib( public Response getVREFeedsByHashtagLib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid, String vreid,
@ -417,7 +413,7 @@ public class LibRestAPI {
//Invites //Invites
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("is-existing-invite-lib") @Path("is-existing-invite-lib/")
public Response isExistingInviteLib( public Response isExistingInviteLib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid, String vreid,
@ -446,7 +442,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("save-invite-lib") @Path("save-invite-lib/")
public Response saveInviteLib( public Response saveInviteLib(
@NotNull(message="invite to save is missing") @NotNull(message="invite to save is missing")
@Valid @Valid
@ -472,7 +468,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("read-invite-lib") @Path("read-invite-lib/")
public Response readInviteLib( public Response readInviteLib(
@QueryParam("inviteid") @QueryParam("inviteid")
String inviteid String inviteid
@ -500,7 +496,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("set-invite-status-lib") @Path("set-invite-status-lib/")
public Response setInviteStatusLib( public Response setInviteStatusLib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid, String vreid,
@ -532,7 +528,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-invited-email-by-vre-lib") @Path("get-invited-email-by-vre-lib/")
public Response getInvitedEmailsByVRELib( public Response getInvitedEmailsByVRELib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid, String vreid,
@ -562,7 +558,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("like-lib") @Path("like-lib/")
public Response likeLib( public Response likeLib(
@NotNull(message="like to add is missing") @NotNull(message="like to add is missing")
@Valid @Valid
@ -588,7 +584,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("unlike-lib") @Path("unlike-lib/")
public Response unlikeLib( public Response unlikeLib(
@QueryParam("userid") @QueryParam("userid")
String userid, String userid,
@ -617,7 +613,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-all-liked-posts-by-user-lib") @Path("get-all-liked-posts-by-user-lib/")
public Response getAllLikedPostIdsByUserLib( public Response getAllLikedPostIdsByUserLib(
@QueryParam("userid") @QueryParam("userid")
String userid String userid
@ -645,7 +641,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-all-likes-by-post-lib") @Path("get-all-likes-by-post-lib/")
public Response getAllLikesByPostLib( public Response getAllLikesByPostLib(
@QueryParam("postid") @QueryParam("postid")
String postid String postid
@ -674,7 +670,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("save-notification-lib") @Path("save-notification-lib/")
public Response saveNotificationLib( public Response saveNotificationLib(
@NotNull(message="notification to add is missing") @NotNull(message="notification to add is missing")
@Valid @Valid
@ -698,7 +694,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("read-notification-lib") @Path("read-notification-lib/")
public Response readNotificationLib( public Response readNotificationLib(
@QueryParam("notid") @QueryParam("notid")
String notid String notid
@ -722,7 +718,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("set-notification-read-lib") @Path("set-notification-read-lib/")
public Response setNotificationReadLib( public Response setNotificationReadLib(
@QueryParam("notid") @QueryParam("notid")
String notid String notid
@ -745,7 +741,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-all-notifications-user") @Path("get-all-notifications-user/")
public Response getAllNotificationByUserLib( public Response getAllNotificationByUserLib(
@QueryParam("userid") @QueryParam("userid")
String userid, String userid,
@ -770,7 +766,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-unread-notifications-user") @Path("get-unread-notifications-user/")
public Response getUnreadNotificationsByUserLib( public Response getUnreadNotificationsByUserLib(
@QueryParam("userid") @QueryParam("userid")
String userid String userid
@ -793,7 +789,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-range-notifications-user") @Path("get-range-notifications-user/")
public Response getRangeNotificationsByUserLib( public Response getRangeNotificationsByUserLib(
@QueryParam("userid") @QueryParam("userid")
String userid, String userid,
@ -821,7 +817,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("set-all-notification-read-lib") @Path("set-all-notification-read-lib/")
public Response setAllNotificationReadByUserLib( public Response setAllNotificationReadByUserLib(
@QueryParam("userid") @QueryParam("userid")
String userid String userid
@ -845,7 +841,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("check-unread-notification-lib") @Path("check-unread-notification-lib/")
public Response checkUnreadNotificationsLib( public Response checkUnreadNotificationsLib(
@QueryParam("userid") @QueryParam("userid")
String userid String userid
@ -869,7 +865,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("check-unread-messages-notification-lib") @Path("check-unread-messages-notification-lib/")
public Response checkUnreadMessagesNotificationsLib( public Response checkUnreadMessagesNotificationsLib(
@QueryParam("userid") @QueryParam("userid")
String userid String userid
@ -894,18 +890,17 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-user-notification-channels-lib") @Path("get-user-notification-channels-lib/")
public Response getUserNotificationChannelsLib( public Response getUserNotificationChannelsLib(
@QueryParam("userid") @QueryParam("userid")
String userid, String userid,
@NotNull(message="notificationtype to get is missing") @QueryParam("type")
@Valid String type
NotificationType notificationType
) throws ValidationException{ ) throws ValidationException{
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
Status status = Status.OK; Status status = Status.OK;
try{ try{
List<NotificationChannelType> result = CassandraConnection.getInstance().getDatabookStore().getUserNotificationChannels(userid,notificationType); List<NotificationChannelType> result = CassandraConnection.getInstance().getDatabookStore().getUserNotificationChannels(userid,NotificationType.valueOf(type));
responseBean.setResult(result); responseBean.setResult(result);
responseBean.setMessage(""); responseBean.setMessage("");
responseBean.setSuccess(true); responseBean.setSuccess(true);
@ -921,7 +916,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("set-notification-preference-lib") @Path("set-notification-preference-lib/")
public Response setUserNotificationPreferencesLib( public Response setUserNotificationPreferencesLib(
@QueryParam("userid") @QueryParam("userid")
String userid, String userid,
@ -930,6 +925,12 @@ public class LibRestAPI {
Map<NotificationType, NotificationChannelType[]> enabledChannels Map<NotificationType, NotificationChannelType[]> enabledChannels
) throws ValidationException{ ) throws ValidationException{
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
for(NotificationType notificationType: enabledChannels.keySet()){
logger.info("Type: " + notificationType.toString());
for(NotificationChannelType channelType: enabledChannels.get(notificationType)){
logger.info(channelType.toString());
}
}
Status status = Status.OK; Status status = Status.OK;
try{ try{
boolean result = CassandraConnection.getInstance().getDatabookStore().setUserNotificationPreferences(userid,enabledChannels); boolean result = CassandraConnection.getInstance().getDatabookStore().setUserNotificationPreferences(userid,enabledChannels);
@ -937,7 +938,7 @@ public class LibRestAPI {
responseBean.setMessage(""); responseBean.setMessage("");
responseBean.setSuccess(true); responseBean.setSuccess(true);
}catch(Exception e){ }catch(Exception e){
logger.error("Unable to write comment.", e); logger.error("Unable to write settings.", e);
responseBean.setMessage(e.getMessage()); responseBean.setMessage(e.getMessage());
responseBean.setSuccess(false); responseBean.setSuccess(false);
status = Status.INTERNAL_SERVER_ERROR; status = Status.INTERNAL_SERVER_ERROR;
@ -948,7 +949,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-notification-preference-lib") @Path("get-notification-preference-lib/")
public Response getUserNotificationPreferencesLib( public Response getUserNotificationPreferencesLib(
@QueryParam("userid") @QueryParam("userid")
String userid String userid
@ -973,7 +974,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("save-user-post-lib") @Path("save-user-post-lib/")
public Response saveUserPostLib( public Response saveUserPostLib(
@NotNull(message="post to add is missing") @NotNull(message="post to add is missing")
@Valid @Valid
@ -998,7 +999,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("save-attachment-lib") @Path("save-attachment-lib/")
public Response saveAttachmentEntryLib( public Response saveAttachmentEntryLib(
@QueryParam("postid") @QueryParam("postid")
String postkey, String postkey,
@ -1026,7 +1027,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("save-app-post-lib") @Path("save-app-post-lib/")
public Response saveAppPostLib( public Response saveAppPostLib(
@NotNull(message="post to add is missing") @NotNull(message="post to add is missing")
@Valid @Valid
@ -1052,7 +1053,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("save-post-to-vretimeline-lib") @Path("save-post-to-vretimeline-lib/")
public Response savePostToVRETimelineLib( public Response savePostToVRETimelineLib(
@QueryParam("postid") @QueryParam("postid")
String postid, String postid,
@ -1078,7 +1079,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("read-post-lib") @Path("read-post-lib/")
public Response readPostLib( public Response readPostLib(
@QueryParam("postid") @QueryParam("postid")
String postid String postid
@ -1102,7 +1103,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-recent-posts-by-user-date-lib") @Path("get-recent-posts-by-user-date-lib/")
public Response getRecentPostsByUserAndDateLib( public Response getRecentPostsByUserAndDateLib(
@QueryParam("userid") @QueryParam("userid")
String userid, String userid,
@ -1128,7 +1129,7 @@ public class LibRestAPI {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("delete-post-lib") @Path("delete-post-lib/")
public Response deletePostLib( public Response deletePostLib(
@QueryParam("postid") @QueryParam("postid")
String postid String postid
@ -1152,7 +1153,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-all-posts-by-user-lib") @Path("get-all-posts-by-user-lib/")
public Response getAllPostsByUserLib( public Response getAllPostsByUserLib(
@QueryParam("userid") @QueryParam("userid")
String userid String userid
@ -1176,7 +1177,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-all-posts-by-app-lib") @Path("get-all-posts-by-app-lib/")
public Response getAllPostsByAppLib( public Response getAllPostsByAppLib(
@QueryParam("appid") @QueryParam("appid")
String appid String appid
@ -1200,7 +1201,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-recent-commented-posts-by-user-lib") @Path("get-recent-commented-posts-by-user-lib/")
public Response getRecentCommentedPostsByUserAndDateLib( public Response getRecentCommentedPostsByUserAndDateLib(
@QueryParam("userid") @QueryParam("userid")
String userid, String userid,
@ -1227,7 +1228,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-portal-privacy-level-posts-lib") @Path("get-portal-privacy-level-posts-lib/")
public Response getAllPortalPrivacyLevelPostsLib() throws ValidationException{ public Response getAllPortalPrivacyLevelPostsLib() throws ValidationException{
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
Status status = Status.OK; Status status = Status.OK;
@ -1248,7 +1249,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-recent-posts-by-user-lib") @Path("get-recent-posts-by-user-lib/")
public Response getRecentPostsByUserLib( public Response getRecentPostsByUserLib(
@QueryParam("userid") @QueryParam("userid")
String userid, String userid,
@ -1273,7 +1274,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-all-posts-by-vre-lib") @Path("get-all-posts-by-vre-lib/")
public Response getAllPostsByVRELib( public Response getAllPostsByVRELib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid String vreid
@ -1296,7 +1297,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-recent-posts-by-vre-lib") @Path("get-recent-posts-by-vre-lib/")
public Response getRecentPostsByVRELib( public Response getRecentPostsByVRELib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid, String vreid,
@ -1321,7 +1322,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-recent-posts-by-vre-range-lib") @Path("get-recent-posts-by-vre-range-lib/")
public Response getRecentPostsByVREAndRangeLib( public Response getRecentPostsByVREAndRangeLib(
@QueryParam("vreid") @QueryParam("vreid")
String vreid, String vreid,
@ -1349,7 +1350,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-attachment-by-postid-lib") @Path("get-attachment-by-postid-lib/")
public Response getAttachmentsByFeedIdLib( public Response getAttachmentsByFeedIdLib(
@QueryParam("postid") @QueryParam("postid")
String postid String postid
@ -1373,7 +1374,7 @@ public class LibRestAPI {
@GET @GET
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("get-all-vre-ids-lib") @Path("get-all-vre-ids-lib/")
public Response getAllVREIdsLib() throws ValidationException{ public Response getAllVREIdsLib() throws ValidationException{
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
Status status = Status.OK; Status status = Status.OK;