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

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
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: com.lmco.shindig/shindig-social-api

@Operation(httpMethods = "PUT", bodyParam = "mediaItem")
public Future<?> update(SocialRequestItem request) throws ProtocolException {
 // Retrieve userIds, albumIds, and mediaItemIds
 Set<UserId> userIds = request.getUsers();
 Set<String> albumIds = ImmutableSet.copyOf(request.getListParameter("albumId"));
 Set<String> mediaItemIds = ImmutableSet.copyOf(request.getListParameter("mediaItemIds"));
 // 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.updateMediaItem(Iterables.getOnlyElement(userIds),
   request.getAppId(), Iterables.getOnlyElement(albumIds),
   Iterables.getOnlyElement(mediaItemIds),
   request.getTypedParameter("mediaItem", MediaItem.class),
   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 = "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: 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

/**
 * Allowed end-points /people/{userId}/{groupId}
 *
 * examples: /people/john.doe/@all /people/john.doe/@friends /people/john.doe/@self
 */
@Operation(httpMethods = "PUT", bodyParam = "person")
public Future<?> update(SocialRequestItem request) throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 // Enforce preconditions - exactly one user is specified
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 UserId userId = userIds.iterator().next();
 // Update person and return it
 return personService.updatePerson(Iterables.getOnlyElement(userIds),
   request.getTypedParameter("person", Person.class),
   request.getToken());
}
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 = "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 = "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 = "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.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: 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.apache.shindig/shindig-social-api

/**
 * Allowed endpoints /appdata/{userId}/{groupId}/{appId} - fields={field1, field2}
 *
 * examples: /appdata/john.doe/@friends/app?fields=count /appdata/john.doe/@self/app
 *
 * The post data should be a regular json object. All of the fields vars will be pulled from the
 * values and set on the person object. If there are no fields vars then all of the data will be
 * overridden.
 */
@Operation(httpMethods = "DELETE")
public Future<?> delete(SocialRequestItem request)
  throws ProtocolException {
 Set<UserId> userIds = request.getUsers();
 HandlerPreconditions.requireNotEmpty(userIds, "No userId specified");
 HandlerPreconditions.requireSingular(userIds, "Multiple userIds not supported");
 return service.deletePersonData(userIds.iterator().next(), request.getGroup(),
   request.getAppId(), request.getFields(), 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

@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

@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());
}
org.apache.shindig.protocolHandlerPreconditionsrequireSingular

Popular methods of HandlerPreconditions

  • requireEmpty
  • requireNotEmpty

Popular in Java

  • Making http post requests using okhttp
  • addToBackStack (FragmentTransaction)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • putExtra (Intent)
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Table (org.hibernate.mapping)
    A relational table
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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