congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
MessageService
Code IndexAdd Tabnine to your IDE (free)

How to use
MessageService
in
org.apache.shindig.social.opensocial.spi

Best Java code snippets using org.apache.shindig.social.opensocial.spi.MessageService (Showing top 15 results out of 315)

origin: org.apache.shindig/shindig-social-api

/**
 * Creates a new message collection or message
 */
@Operation(httpMethods = "POST", bodyParam = "entity")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 UserId user = request.getUsers().iterator().next();
 if (msgCollId == null) {
  // Request to create a new message collection
  MessageCollection msgCollection = request.getTypedParameter("entity", MessageCollection.class);
  return service.createMessageCollection(user, msgCollection, request.getToken());
 }
 // A message collection has been specified, allow for posting
 HandlerPreconditions.requireEmpty(messageIds,"Message IDs not allowed here, use PUT instead");
 Message message = request.getTypedParameter("entity", Message.class);
 HandlerPreconditions.requireNotEmpty(message.getRecipients(), "No recipients specified");
 return service.createMessage(userIds.iterator().next(), request.getAppId(), msgCollId, message,
   request.getToken());
}
origin: org.apache.shindig/shindig-social-api

@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 if (msgCollId == null) {
  throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
    "A message collection is required");
 }
 UserId user = request.getUsers().iterator().next();
 if (messageIds == null || messageIds.isEmpty()) {
  // MessageIds may be null if the complete collection should be deleted
  return service.deleteMessageCollection(user, msgCollId, request.getToken());
 }
 // Delete specific messages
 return service.deleteMessages(user, msgCollId, messageIds, request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 CollectionOptions options = collectionOptionsFactory.create(request);
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 UserId user = request.getUsers().iterator().next();
 if (msgCollId == null) {
  // No message collection specified, return list of message collections
  Set<String> fields = request.getFields(MessageCollection.Field.ALL_FIELDS);
  return service.getMessageCollections(user, fields, options, request.getToken());
 }
 // If messageIds are specified return them, otherwise return entries in the given collection.
 Set<String> fields = request.getFields(Message.Field.ALL_FIELDS);
 return service.getMessages(user, msgCollId, fields, messageIds, options, request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

 @Test
 @Ignore
 public void testPostMessage() throws Exception {
  MessageImpl message = new MessageImpl("A message body", "A title", Message.Type.PRIVATE_MESSAGE);
  message.setRecipients(recipients);

  EasyMock.expect(converter.convertToObject(null, Message.class)).andReturn(message);
  EasyMock.expect(messageService.createMessage(sender, "messageHandlerTest", "@outbox", message,
    token)).andReturn(Futures.immediateFuture((Void) null));

  EasyMock.replay(messageService, converter);

  RestHandler operation = registry.getRestHandler("/messages/" + sender.getUserId() + "/@outbox", "POST");
  Map<String,String[]> params = ImmutableMap.of(RequestItem.APP_ID, new String[]{"messageHandlerTest"});

  operation.execute(params,null, token, converter).get();
  EasyMock.verify(converter, messageService);
 }
}
origin: org.wso2.org.apache.shindig/shindig-social-api

 return service.modifyMessageCollection(user, msgCollection, request.getToken());
return service.modifyMessage(user, msgCollId, messageIds.get(0), message, request.getToken());
origin: com.lmco.shindig/shindig-social-api

@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 if (msgCollId == null) {
  throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
    "A message collection is required");
 }
 
 HandlerPreconditions.requireNotEmpty(messageIds, "No message IDs specified");
 UserId user = request.getUsers().iterator().next();
 return service.deleteMessages(user, msgCollId, messageIds, request.getToken());
}
origin: org.apache.shindig/shindig-social-api

 @Test
 @Ignore
 public void testPostMessage() throws Exception {
  MessageImpl message = new MessageImpl("A message body", "A title", Message.Type.PRIVATE_MESSAGE);
  message.setRecipients(recipients);

  EasyMock.expect(converter.convertToObject(null, Message.class)).andReturn(message);
  EasyMock.expect(messageService.createMessage(sender, "messageHandlerTest", "@outbox", message,
    token)).andReturn(Futures.immediateFuture((Void) null));

  EasyMock.replay(messageService, converter);

  RestHandler operation = registry.getRestHandler("/messages/" + sender.getUserId() + "/@outbox", "POST");
  Map<String,String[]> params = ImmutableMap.of(RequestItem.APP_ID, new String[]{"messageHandlerTest"});

  operation.execute(params,null, token, converter).get();
  EasyMock.verify(converter, messageService);
 }
}
origin: org.apache.shindig/shindig-social-api

 return service.modifyMessageCollection(user, msgCollection, request.getToken());
return service.modifyMessage(user, msgCollId, messageIds.get(0), message, request.getToken());
origin: org.wso2.org.apache.shindig/shindig-social-api

/**
 * Creates a new message collection or message
 */
@Operation(httpMethods = "POST", bodyParam = "entity")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 UserId user = request.getUsers().iterator().next();
 if (msgCollId == null) {
  // Request to create a new message collection
  MessageCollection msgCollection = request.getTypedParameter("entity", MessageCollection.class);
  return service.createMessageCollection(user, msgCollection, request.getToken());
 }
 // A message collection has been specified, allow for posting
 HandlerPreconditions.requireEmpty(messageIds,"Message IDs not allowed here, use PUT instead");
 Message message = request.getTypedParameter("entity", Message.class);
 HandlerPreconditions.requireNotEmpty(message.getRecipients(), "No recipients specified");
 return service.createMessage(userIds.iterator().next(), request.getAppId(), msgCollId, message,
   request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

 @Test
 public void testPostMessage() throws Exception {
  MessageImpl message = new MessageImpl("A message body", "A title", Message.Type.PRIVATE_MESSAGE);
  message.setRecipients(recipients);

  EasyMock.expect(converter.convertToObject(null, Message.class)).andReturn(message);
  EasyMock.expect(messageService.createMessage(sender, "messageHandlerTest", "@outbox", message,
    token)).andReturn(ImmediateFuture.newInstance((Void) null));

  EasyMock.replay(messageService, converter);

  RestHandler operation = registry.getRestHandler("/messages/" + sender.getUserId() + "/@outbox", "POST");
  Map<String,String[]> params = ImmutableMap.of(RequestItem.APP_ID, new String[]{"messageHandlerTest"});

  operation.execute(params,null, token, converter).get();
  EasyMock.verify(converter, messageService);
 }
}
origin: org.apache.shindig/shindig-social-api

@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 CollectionOptions options = collectionOptionsFactory.create(request);
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 UserId user = request.getUsers().iterator().next();
 if (msgCollId == null) {
  // No message collection specified, return list of message collections
  Set<String> fields = request.getFields(MessageCollection.Field.ALL_FIELDS);
  return service.getMessageCollections(user, fields, options, request.getToken());
 }
 // If messageIds are specified return them, otherwise return entries in the given collection.
 Set<String> fields = request.getFields(Message.Field.ALL_FIELDS);
 return service.getMessages(user, msgCollId, fields, messageIds, options, request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

 return service.modifyMessageCollection(user, msgCollection, request.getToken());
return service.modifyMessage(user, msgCollId, messageIds.get(0), message, request.getToken());
origin: org.wso2.org.apache.shindig/shindig-social-api

@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 if (msgCollId == null) {
  throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST,
    "A message collection is required");
 }
 UserId user = request.getUsers().iterator().next();
 if (messageIds == null || messageIds.isEmpty()) {
  // MessageIds may be null if the complete collection should be deleted
  return service.deleteMessageCollection(user, msgCollId, request.getToken());
 }
 // Delete specific messages
 return service.deleteMessages(user, msgCollId, messageIds, request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

/**
 * Creates a new message collection or message
 */
@Operation(httpMethods = "POST", bodyParam = "entity")
public Future<?> modify(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 UserId user = request.getUsers().iterator().next();
 if (msgCollId == null) {
  // Request to create a new message collection
  MessageCollection msgCollection = request.getTypedParameter("entity", MessageCollection.class);
  return service.createMessageCollection(user, msgCollection, request.getToken());
 }
 // A message collection has been specified, allow for posting
 HandlerPreconditions.requireEmpty(messageIds,"Message IDs not allowed here, use PUT instead");
 Message message = request.getTypedParameter("entity", Message.class);
 HandlerPreconditions.requireNotEmpty(message.getRecipients(), "No recipients specified");
 return service.createMessage(userIds.iterator().next(), request.getAppId(), msgCollId, message,
   request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 String msgCollId = request.getParameter("msgCollId");
 List<String> messageIds = request.getListParameter("messageIds");
 CollectionOptions options = new CollectionOptions(request);
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 UserId user = request.getUsers().iterator().next();
 if (msgCollId == null) {
  // No message collection specified, return list of message collections
  Set<String> fields = request.getFields(MessageCollection.Field.ALL_FIELDS);
  return service.getMessageCollections(user, fields, options, request.getToken());
 }
 // If messageIds are specified return them, otherwise return entries in the given collection.
 Set<String> fields = request.getFields(Message.Field.ALL_FIELDS);
 return service.getMessages(user, msgCollId, fields, messageIds, options, request.getToken());
}
org.apache.shindig.social.opensocial.spiMessageService

Javadoc

The MessageService interface defines the service provider interface to post messages to the underlying SNS.

Most used methods

  • createMessage
    Posts a message to the user's specified message collection, to be sent to the set of recipients spec
  • createMessageCollection
    Creates a new message collection for the given arguments
  • deleteMessages
    Deletes a set of messages for a given user/message collection
  • getMessageCollections
    Returns a list of message collections corresponding to the given user
  • getMessages
    Returns a list of messages that correspond to the passed in data
  • modifyMessage
    Modifies/Updates a specific message with new data
  • modifyMessageCollection
    Modifies/Updates a message collection for the given arguments
  • deleteMessageCollection
    Deletes a message collection for the given arguments

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Path (java.nio.file)
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • JFileChooser (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now