Tabnine Logo
HandlerPreconditions.requireNotEmpty
Code IndexAdd Tabnine to your IDE (free)

How to use
requireNotEmpty
method
in
org.apache.shindig.protocol.HandlerPreconditions

Best Java code snippets using org.apache.shindig.protocol.HandlerPreconditions.requireNotEmpty (Showing top 20 results out of 315)

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

@Operation(httpMethods = "PUT", bodyParam = "album")
public Future<?> update(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 List<String> albumIds = request.getListParameter("albumId");
 // Enforce preconditions - exactly one user and one album specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 HandlerPreconditions.requireNotEmpty(albumIds, "No albumId specified");
 HandlerPreconditions.requireSingular(albumIds, "Multiple albumIds not supported");
 return service.updateAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(),
   request.getTypedParameter("album", Album.class),
   Iterables.getOnlyElement(albumIds), request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Operation(httpMethods = "PUT", bodyParam = "album")
public Future<?> update(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 List<String> albumIds = request.getListParameter("albumId");
 // Enforce preconditions - exactly one user and one album specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 HandlerPreconditions.requireNotEmpty(albumIds, "No albumId specified");
 HandlerPreconditions.requireSingular(albumIds, "Multiple albumIds not supported");
 return service.updateAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(),
   request.getTypedParameter("album", Album.class),
   Iterables.getOnlyElement(albumIds), 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: com.lmco.shindig/shindig-social-api

@Operation(httpMethods = "PUT", bodyParam = "album")
public Future<?> update(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 List<String> albumIds = request.getListParameter("albumId");
 // Enforce preconditions - exactly one user and one album specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 HandlerPreconditions.requireNotEmpty(albumIds, "No albumId specified");
 HandlerPreconditions.requireSingular(albumIds, "Multiple albumIds not supported");
 return service.updateAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(),
   request.getTypedParameter("album", Album.class),
   Iterables.getOnlyElement(albumIds), request.getToken());
}
origin: org.apache.shindig/shindig-social-api

 @Operation(httpMethods = "GET")
 public Future<?> get(SocialRequestItem request) throws ProtocolException {
  Set<UserId> userIds = request.getUsers();
  CollectionOptions options = collectionOptionsFactory.create(request);

  // Preconditions
  HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
  HandlerPreconditions.requireSingular(userIds, "Only one userId must be specified");

  return service.getGroups(userIds.iterator().next(), options, request.getFields(), request.getToken());
 }
}
origin: org.apache.shindig/shindig-social-api

@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request) throws ProtocolException {
 // Get users, Album ID, and MediaItem ID
 Set<UserId> userIds = request.getUsers();
 Set<String> albumIds = ImmutableSet.copyOf(request.getListParameter("albumId"));
 Set<String> mediaItemIds = ImmutableSet.copyOf(getRequestMediaItemIds(request));
 // Exactly one user, Album, and MediaItem must be specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Exactly one user ID must be specified");
 HandlerPreconditions.requireSingular(albumIds, "Exactly one Album ID must be specified");
 HandlerPreconditions.requireSingular(mediaItemIds, "Exactly one MediaItem ID must be specified");
 // Service request
 return service.deleteMediaItem(Iterables.getOnlyElement(userIds),
   request.getAppId(), Iterables.getOnlyElement(albumIds),
   Iterables.getOnlyElement(mediaItemIds), 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();
  CollectionOptions options = collectionOptionsFactory.create(request);

  // Preconditions
  HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
  HandlerPreconditions.requireSingular(userIds, "Only one userId must be specified");

  return service.getGroups(userIds.iterator().next(), options, request.getFields(), request.getToken());
 }
}
origin: com.lmco.shindig/shindig-social-api

 @Operation(httpMethods = "GET")
 public Future<?> get(SocialRequestItem request) throws ProtocolException {
  Set<UserId> userIds = request.getUsers();
  CollectionOptions options = new CollectionOptions(request);

  // Preconditions
  HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
  HandlerPreconditions.requireSingular(userIds, "Only one userId must be specified");

  return service.getGroups(userIds.iterator().next(), options, request.getFields(), request.getToken());
 }
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Operation(httpMethods = "POST", bodyParam = "data")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 Set<String> albumIds = ImmutableSet.copyOf(request.getListParameter("albumId"));
 // Exactly one user and Album must be specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Exactly one user ID must be specified");
 HandlerPreconditions.requireSingular(albumIds, "Exactly one Album ID must be specified");
 // Service request
 return service.createMediaItem(Iterables.getOnlyElement(userIds),
   request.getAppId(), Iterables.getOnlyElement(albumIds),
   getRequestMediaItem(request),
   request.getToken());
}
origin: org.apache.shindig/shindig-social-api

@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request) throws ProtocolException {
 // Get user and album ID
 Set<UserId> userIds = request.getUsers();
 String albumId = request.getParameter("albumId");
 // Enforce preconditions - userIds must contain exactly one element
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 // Service request
 return service.deleteAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(), albumId, request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request) throws ProtocolException {
 // Get user and album ID
 Set<UserId> userIds = request.getUsers();
 String albumId = request.getParameter("albumId");
 // Enforce preconditions - userIds must contain exactly one element
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 // Service request
 return service.deleteAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(), albumId, request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

@Operation(httpMethods = "POST", bodyParam = "mediaItem")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 Set<String> albumIds = ImmutableSet.copyOf(request.getListParameter("albumId"));
 // Exactly one user and Album must be specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Exactly one user ID must be specified");
 HandlerPreconditions.requireSingular(albumIds, "Exactly one Album ID must be specified");
 // Service request
 return service.createMediaItem(Iterables.getOnlyElement(userIds),
   request.getAppId(), Iterables.getOnlyElement(albumIds),
   request.getTypedParameter("mediaItem", MediaItem.class),
   request.getToken());
}
origin: org.apache.shindig/shindig-social-api

@Operation(httpMethods = "POST", bodyParam = "data")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 Set<String> albumIds = ImmutableSet.copyOf(request.getListParameter("albumId"));
 // Exactly one user and Album must be specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Exactly one user ID must be specified");
 HandlerPreconditions.requireSingular(albumIds, "Exactly one Album ID must be specified");
 // Service request
 return service.createMediaItem(Iterables.getOnlyElement(userIds),
   request.getAppId(), Iterables.getOnlyElement(albumIds),
   getRequestMediaItem(request),
   request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request) throws ProtocolException {
 // Get user and album ID
 Set<UserId> userIds = request.getUsers();
 String albumId = request.getParameter("albumId");
 // Enforce preconditions - userIds must contain exactly one element
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 // Service request
 return service.deleteAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(), albumId, request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@Operation(httpMethods = "POST", bodyParam = "album")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 List<String> albumIds = request.getListParameter("albumId");
 // Preconditions - exactly one userId specified, no albumIds specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 HandlerPreconditions.requireEmpty(albumIds, "Cannot specify albumId in create");
 return service.createAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(),
   request.getTypedParameter("album", Album.class),
   request.getToken());
}
origin: org.apache.shindig/shindig-social-api

@Operation(httpMethods = "POST", bodyParam = "album")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 List<String> albumIds = request.getListParameter("albumId");
 // Preconditions - exactly one userId specified, no albumIds specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 HandlerPreconditions.requireEmpty(albumIds, "Cannot specify albumId in create");
 return service.createAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(),
   request.getTypedParameter("album", Album.class),
   request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

@Operation(httpMethods = "POST", bodyParam = "album")
public Future<?> create(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds and albumIds
 Set<UserId> userIds = request.getUsers();
 List<String> albumIds = request.getListParameter("albumId");
 // Preconditions - exactly one userId specified, no albumIds specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 HandlerPreconditions.requireEmpty(albumIds, "Cannot specify albumId in create");
 return service.createAlbum(Iterables.getOnlyElement(userIds),
   request.getAppId(),
   request.getTypedParameter("album", Album.class),
   request.getToken());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

/**
 * /appdata/{userId}+/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 */
@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 // Preconditions
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 return service.getPersonData(userIds, request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
origin: com.lmco.shindig/shindig-social-api

/**
 * /appdata/{userId}+/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 */
@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 // Preconditions
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 return service.getPersonData(userIds, request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
origin: org.apache.shindig/shindig-social-api

/**
 * /appdata/{userId}+/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 */
@Operation(httpMethods = "GET")
public Future<?> get(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 // Preconditions
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 return service.getPersonData(userIds, request.getGroup(),
   request.getAppId(), request.getFields(), request.getToken());
}
org.apache.shindig.protocolHandlerPreconditionsrequireNotEmpty

Popular methods of HandlerPreconditions

  • requireEmpty
  • requireSingular

Popular in Java

  • Creating JSON documents from java classes using gson
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top plugins for WebStorm
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