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

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

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

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

 /**
  * Create an instance of {@link CollectionOptions} from the provided {@code request}.
  *
  * @param requestItem
  * @return a suitable instance of {@link CollectionOptions}, never {@code null}.
  */
 public CollectionOptions create(RequestItem requestItem) {
  return new CollectionOptions(requestItem);
 }
}
origin: com.lmco.shindig/shindig-social-api

public CollectionOptions(RequestItem request) {
 this.sortBy = request.getSortBy();
 this.sortOrder = request.getSortOrder();
 this.setFilter(request.getFilterBy());
 this.setFilterOperation(request.getFilterOperation());
 this.setFilterValue(request.getFilterValue());
 this.setFirst(request.getStartIndex());
 this.setMax(request.getCount());
 this.setUpdatedSince(request.getUpdatedSince());
}
/**
origin: com.lmco.shindig/shindig-social-api

 if (options.getSortBy().equals(Person.Field.NAME.toString())) {
  Collections.sort(result, NAME_COMPARATOR);
  if (options.getSortOrder() == SortOrder.descending) {
   Collections.reverse(result);
 int last = options.getFirst() + options.getMax();
 result = result.subList(options.getFirst(), Math.min(last, totalSize));
 return ImmediateFuture.newInstance(new RestfulCollection<Person>(result, options.getFirst(), totalSize, options.getMax()));
} catch (JSONException je) {
 throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
origin: org.apache.shindig/shindig-social-api

  @Test
  public void testOptionalParams() throws Exception {
    CollectionOptions op = new CollectionOptions(request);
    Map<String, String> optionalParams = op.getOptionalParameter();
    Map<String, String> optionalParams1 = Maps.newHashMap();
    optionalParams1.put("condition1","cvalue1");
    optionalParams1.put("condition2","cvalue2");
    assertEquals(optionalParams, optionalParams1);
  }
}
origin: org.wso2.org.apache.shindig/shindig-social-api

RestHandler operation = registry.getRestHandler(path, "GET");
CollectionOptions options = new CollectionOptions();
options.setSortBy(Person.Field.NAME.toString());
options.setSortOrder(SortOrder.descending);
options.setFilter(PersonService.TOP_FRIENDS_FILTER);
options.setFilterOperation(FilterOperation.present);
options.setFilterValue("cassie");
options.setFirst(5);
options.setMax(10);
params.put("sortBy", new String[]{options.getSortBy()});
params.put("sortOrder", new String[]{options.getSortOrder().toString()});
params.put("filterBy", new String[]{options.getFilter()});
params.put("filterOp", new String[]{options.getFilterOperation().toString()});
params.put("filterValue", new String[]{options.getFilterValue()});
params.put("startIndex", new String[]{"5"});
params.put("count", new String[]{"10"});
origin: org.apache.shindig/shindig-social-api

@Test
public void testGetExpectedUsersForPlural() throws Exception {
 CollectionOptions options = new CollectionOptions();
 options.setSortBy(PersonService.TOP_FRIENDS_SORT);
 options.setSortOrder(SortOrder.ascending);
 options.setFilter(null);
 options.setFilterOperation(FilterOperation.contains);
 options.setFilterValue("");
 options.setFirst(0);
 options.setMax(20);
 RestfulCollection<Person> responseItem = db.getPeople(
   ImmutableSet.of(JOHN_DOE, JANE_DOE), new GroupId(GroupId.Type.friends, null),
   options, Collections.<String>emptySet(), token).get();
 assertNotNull(responseItem);
 assertEquals(4, responseItem.getTotalResults());
 // Test a couple of users
 assertEquals("john.doe", responseItem.getList().get(0).getId());
 assertEquals("jane.doe", responseItem.getList().get(1).getId());
}
origin: org.apache.shindig/shindig-samples

@Test
public void getJohnDoeFriendsOrderedByName() throws Exception {
 // Set collection options
 CollectionOptions collectionOptions = new CollectionOptions();
 collectionOptions.setSortBy("name");
 collectionOptions.setSortOrder(SortOrder.ascending);
 collectionOptions.setMax(20);
 
 // Get all friends of john.doe
 Future<RestfulCollection<Person>> result = this.personServiceDb.getPeople(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.friends, "@friends"), collectionOptions, Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
 
 RestfulCollection<Person> peopleCollection = result.get();
 assertEquals(3, peopleCollection.getTotalResults());
 assertEquals(0, peopleCollection.getStartIndex());    
 List<Person> people = peopleCollection.getEntry();    
 // The users should be in alphabetical order
 SpiTestUtil.assertPersonEquals(people.get(0), "george.doe", "George Doe");
 SpiTestUtil.assertPersonEquals(people.get(1), "jane.doe", "Jane Doe");     
}

origin: com.lmco.shindig/shindig-social-api

CollectionOptions options = new CollectionOptions(request);
  if (groupId.getType() == GroupId.Type.self) {
   if (options.getFilter() != null) {
    Future<RestfulCollection<Person>> people = personService.getPeople(
      userIds, groupId, options, fields, request.getToken());
origin: org.apache.shindig/shindig-social-api

if (groupId.getType() == GroupId.Type.self) {
 if (options.getFilter() != null) {
  Future<RestfulCollection<Person>> people = personService.getPeople(
    userIds, groupId, options, fields, request.getToken());
origin: org.apache.shindig/shindig-social-api

RestHandler operation = registry.getRestHandler(path, "GET");
CollectionOptions options = new CollectionOptions();
options.setSortBy(Person.Field.NAME.toString());
options.setSortOrder(SortOrder.descending);
options.setFilter(PersonService.TOP_FRIENDS_FILTER);
options.setFilterOperation(FilterOperation.present);
options.setFilterValue("cassie");
options.setFirst(5);
options.setMax(10);
params.put("sortBy", new String[]{options.getSortBy()});
params.put("sortOrder", new String[]{options.getSortOrder().toString()});
params.put("filterBy", new String[]{options.getFilter()});
params.put("filterOp", new String[]{options.getFilterOperation().toString()});
params.put("filterValue", new String[]{options.getFilterValue()});
params.put("startIndex", new String[]{"5"});
params.put("count", new String[]{"10"});
origin: com.lmco.shindig/shindig-social-api

@Test
public void testGetExpectedFriends() throws Exception {
 CollectionOptions options = new CollectionOptions();
 options.setSortBy(PersonService.TOP_FRIENDS_SORT);
 options.setSortOrder(SortOrder.ascending);
 options.setFilter(null);
 options.setFilterOperation(FilterOperation.contains);
 options.setFilterValue("");
 options.setFirst(0);
 options.setMax(20);
 RestfulCollection<Person> responseItem = db.getPeople(
   ImmutableSet.of(CANON_USER), new GroupId(GroupId.Type.friends, null),
   options, Collections.<String>emptySet(), token).get();
 assertNotNull(responseItem);
 assertEquals(4, responseItem.getTotalResults());
 // Test a couple of users
 assertEquals("john.doe", responseItem.getEntry().get(0).getId());
 assertEquals("jane.doe", responseItem.getEntry().get(1).getId());
}
origin: org.apache.shindig/shindig-samples

@Test
public void getJohnDoeFriendsOrderedByNameWithPagination() throws Exception {    
 // Set collection options
 CollectionOptions collectionOptions = new CollectionOptions();
 collectionOptions.setSortBy("name");
 collectionOptions.setSortOrder(SortOrder.ascending);
 collectionOptions.setFirst(0);
 collectionOptions.setMax(1);
 
 // Get first friend of john.doe
 Future<RestfulCollection<Person>> result = this.personServiceDb.getPeople(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.friends, "@friends"), collectionOptions, Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);    
 RestfulCollection<Person> peopleCollection = result.get();
 assertEquals(3, peopleCollection.getTotalResults());
 assertEquals(0, peopleCollection.getStartIndex());    
 List<Person> people = peopleCollection.getEntry();    
 SpiTestUtil.assertPersonEquals(people.get(0), "george.doe", "George Doe");
 
 // Get second friend of john.doe
 collectionOptions.setFirst(1);
 result = this.personServiceDb.getPeople(SpiTestUtil.buildUserIds("john.doe"), new GroupId(GroupId.Type.friends, "@friends"), collectionOptions, Person.Field.ALL_FIELDS, SpiTestUtil.DEFAULT_TEST_SECURITY_TOKEN);
 peopleCollection = result.get();
 assertEquals(3, peopleCollection.getTotalResults());
 assertEquals(1, peopleCollection.getStartIndex());    
 people = peopleCollection.getEntry();    
 SpiTestUtil.assertPersonEquals(people.get(0), "jane.doe", "Jane Doe");    
}

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

  @Test
  public void testOptionalParams() throws Exception {
    CollectionOptions op = new CollectionOptions(request);
    Map<String, String> optionalParams = op.getOptionalParameter();
    Map<String, String> optionalParams1 = Maps.newHashMap();
    optionalParams1.put("condition1","cvalue1");
    optionalParams1.put("condition2","cvalue2");
    assertEquals(optionalParams, optionalParams1);
  }
}
origin: org.wso2.org.apache.shindig/shindig-social-api

if (groupId.getType() == GroupId.Type.self) {
 if (options.getFilter() != null) {
  Future<RestfulCollection<Person>> people = personService.getPeople(
    userIds, groupId, options, fields, request.getToken());
origin: com.lmco.shindig/shindig-social-api

RestHandler operation = registry.getRestHandler(path, "GET");
CollectionOptions options = new CollectionOptions();
options.setSortBy(Person.Field.NAME.toString());
options.setSortOrder(SortOrder.descending);
options.setFilter(PersonService.TOP_FRIENDS_FILTER);
options.setFilterOperation(FilterOperation.present);
options.setFilterValue("cassie");
options.setFirst(5);
options.setMax(10);
params.put("sortBy", new String[]{options.getSortBy()});
params.put("sortOrder", new String[]{options.getSortOrder().toString()});
params.put("filterBy", new String[]{options.getFilter()});
params.put("filterOp", new String[]{options.getFilterOperation().toString()});
params.put("filterValue", new String[]{options.getFilterValue()});
params.put("startIndex", new String[]{"5"});
params.put("count", new String[]{"10"});
origin: com.lmco.shindig/shindig-social-api

@Test
public void testGetExpectedUsersForPlural() throws Exception {
 CollectionOptions options = new CollectionOptions();
 options.setSortBy(PersonService.TOP_FRIENDS_SORT);
 options.setSortOrder(SortOrder.ascending);
 options.setFilter(null);
 options.setFilterOperation(FilterOperation.contains);
 options.setFilterValue("");
 options.setFirst(0);
 options.setMax(20);
 RestfulCollection<Person> responseItem = db.getPeople(
   ImmutableSet.of(JOHN_DOE, JANE_DOE), new GroupId(GroupId.Type.friends, null),
   options, Collections.<String>emptySet(), token).get();
 assertNotNull(responseItem);
 assertEquals(4, responseItem.getTotalResults());
 // Test a couple of users
 assertEquals("john.doe", responseItem.getEntry().get(0).getId());
 assertEquals("jane.doe", responseItem.getEntry().get(1).getId());
}
origin: org.wso2.org.apache.shindig/shindig-social-api

@VisibleForTesting
public CollectionOptions(RequestItem request) {
 this.sortBy = request.getSortBy();
 this.sortOrder = request.getSortOrder();
 this.setFilter(request.getFilterBy());
 this.setFilterOperation(request.getFilterOperation());
 this.setFilterValue(request.getFilterValue());
 this.setFirst(request.getStartIndex());
 this.setMax(request.getCount());
 this.setUpdatedSince(request.getUpdatedSince());
 Set<String> parameterNames = Sets.newHashSet(request.getParameterNames());
 parameterNames.removeAll(Arrays.asList(predefinedParameters));
 Map<String, String> optionalParameters = Maps.newHashMap();
 for (String parameter : parameterNames) {
  optionalParameters.put(parameter, request.getParameter(parameter));
 }
 this.setOptionalParameters(optionalParameters);
}
/**
origin: org.apache.shindig/shindig-social-api

 /**
  * Create an instance of {@link CollectionOptions} from the provided {@code request}.
  *
  * @param requestItem
  * @return a suitable instance of {@link CollectionOptions}, never {@code null}.
  */
 public CollectionOptions create(RequestItem requestItem) {
  return new CollectionOptions(requestItem);
 }
}
origin: org.apache.shindig/shindig-social-api

 if (options.getSortBy().equals(Person.Field.NAME.toString())) {
  Collections.sort(result, NAME_COMPARATOR);
  if (options.getSortOrder() == SortOrder.descending) {
   Collections.reverse(result);
 int last = options.getFirst() + options.getMax();
 result = result.subList(options.getFirst(), Math.min(last, totalSize));
 return Futures.immediateFuture(new RestfulCollection<Person>(result, options.getFirst(), totalSize, options.getMax()));
} catch (JSONException je) {
 throw new ProtocolException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, je.getMessage(),
origin: org.apache.shindig/shindig-social-api

@Test
public void testGetExpectedFriends() throws Exception {
 CollectionOptions options = new CollectionOptions();
 options.setSortBy(PersonService.TOP_FRIENDS_SORT);
 options.setSortOrder(SortOrder.ascending);
 options.setFilter(null);
 options.setFilterOperation(FilterOperation.contains);
 options.setFilterValue("");
 options.setFirst(0);
 options.setMax(20);
 RestfulCollection<Person> responseItem = db.getPeople(
   ImmutableSet.of(CANON_USER), new GroupId(GroupId.Type.friends, null),
   options, Collections.<String>emptySet(), token).get();
 assertNotNull(responseItem);
 assertEquals(4, responseItem.getTotalResults());
 // Test a couple of users
 assertEquals("john.doe", responseItem.getList().get(0).getId());
 assertEquals("jane.doe", responseItem.getList().get(1).getId());
}
org.apache.shindig.social.opensocial.spiCollectionOptions

Javadoc

Data structure representing many of the RPC/REST requests we receive.

Most used methods

  • <init>
  • setFirst
  • setMax
  • getFilter
    This filter can be any field of the object being filtered or the special js filters, hasApp or topF
  • getSortBy
    This sortBy can be any field of the object being sorted or the special js sort of topFriends.
  • getSortOrder
  • setFilter
  • setFilterOperation
  • setFilterValue
  • setSortBy
  • setSortOrder
  • getFilterOperation
  • setSortOrder,
  • getFilterOperation,
  • getFilterValue,
  • getFirst,
  • getMax,
  • setUpdatedSince,
  • getOptionalParameter,
  • setOptionalParameters

Popular in Java

  • Making http post requests using okhttp
  • onRequestPermissionsResult (Fragment)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getContentResolver (Context)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JCheckBox (javax.swing)
  • JPanel (javax.swing)
  • 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