54 lines
1.8 KiB
Java
54 lines
1.8 KiB
Java
package org.gcube.portal.social.networking.ws.methods.v1;
|
|
|
|
import javax.ws.rs.FormParam;
|
|
import javax.ws.rs.POST;
|
|
import javax.ws.rs.Path;
|
|
import javax.ws.rs.Produces;
|
|
import javax.ws.rs.core.MediaType;
|
|
import javax.ws.rs.core.Response;
|
|
import javax.ws.rs.core.Response.Status;
|
|
|
|
import org.gcube.portal.social.networking.liferay.ws.UserManagerWSBuilder;
|
|
import org.gcube.portal.social.networking.ws.utils.ErrorMessages;
|
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
/**
|
|
* Messages services REST interface
|
|
* @author Costantino Perciante at ISTI-CNR
|
|
* (costantino.perciante@isti.cnr.it)
|
|
*/
|
|
@Path("/messages")
|
|
@Deprecated
|
|
public class Messages {
|
|
// Logger
|
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Messages.class);
|
|
|
|
public Messages() {
|
|
}
|
|
|
|
@POST
|
|
@Path("writeMessageToUsers/")
|
|
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
|
|
/**
|
|
* Try to send a message to recipientsIds. The sender is the owner of the gcube-token if not otherwise stated.
|
|
* @param body
|
|
* @param subject
|
|
* @return ok on success, error otherwise
|
|
*/
|
|
@Deprecated
|
|
public Response writeMessageToUsers(
|
|
@FormParam("sender") String sender, // the optional sender, if missing the sender will be the token's owner.
|
|
@FormParam("body") String body,
|
|
@FormParam("subject") String subject,
|
|
@FormParam("recipients") String recipientsIds) {
|
|
|
|
if(body == null || body.isEmpty() || subject == null || subject.isEmpty() || recipientsIds == null || recipientsIds.isEmpty()){
|
|
logger.error("Missing/wrong request parameters");
|
|
return Response.status(Status.BAD_REQUEST).entity(ErrorMessages.MISSING_PARAMETERS).build();
|
|
}
|
|
|
|
return Response.status(Status.METHOD_NOT_ALLOWED).entity(ErrorMessages.DEPRECATED_METHOD).build();
|
|
}
|
|
}
|