Examples of PagingContext


Examples of com.linkedin.restli.server.PagingContext

    Parameter<PagingContext> pagingContextParam = new Parameter<PagingContext>(
        "",
        PagingContext.class,
        null,
        false,
        new PagingContext(0, 10),
        Parameter.ParamType.PAGING_CONTEXT_PARAM,
        false,
        new AnnotationSet(new Annotation[]{}));
    getAllParams.add(pagingContextParam);
    Map<String, String> getAllContextParams = new HashMap<String, String>();
    getAllContextParams.put("start", "33");
    getAllContextParams.put("count", "444");

    List<Parameter<?>> finderParams = new ArrayList<Parameter<?>>();
    finderParams.add(pagingContextParam);
    Parameter<Integer> requiredIntParam = new Parameter<Integer>(
        "required",
        Integer.class,
        new IntegerDataSchema(),
        false,
        null,
        Parameter.ParamType.QUERY,
        true,
        new AnnotationSet(new Annotation[]{}));
    finderParams.add(requiredIntParam);
    Parameter<String> optionalStringParam = new Parameter<String>(
        "optional",
        String.class,
        new StringDataSchema(),
        true,
        null,
        Parameter.ParamType.QUERY,
        true,
        new AnnotationSet(new Annotation[]{}));
    finderParams.add(optionalStringParam);
    Map<String, String> finderContextParams = new HashMap<String, String>();
    finderContextParams.put("start", "33");
    finderContextParams.put("count", "444");
    finderContextParams.put("required", "777");
    finderContextParams.put("optional", null);

    Map<String, String> finderContextParamsWithOptionalString = new HashMap<String, String>(finderContextParams);
    finderContextParamsWithOptionalString.put("optional", "someString");

    List<Parameter<?>> finderWithAssocKeyParams = new ArrayList<Parameter<?>>();
    finderWithAssocKeyParams.add(new Parameter<String>(
        "string1",
        String.class,
        new StringDataSchema(),
        false,
        null,
        Parameter.ParamType.ASSOC_KEY_PARAM,
        true,
        new AnnotationSet(new Annotation[]{})));

    return new Object[][]
        {
            {
                getAllParams,
                getAllContextParams,
                null,
                new Object[]{new PagingContext(33, 444)}
            },
            {
                finderParams,
                finderContextParams,
                null,
                new Object[]{new PagingContext(33, 444), new Integer(777), null}
            },
            {
                finderParams,
                finderContextParamsWithOptionalString,
                null,
                new Object[]{new PagingContext(33, 444), new Integer(777), "someString"}
            },
            {
                finderWithAssocKeyParams,
                null,
                new PathKeysImpl().append("string1", "testString"),
View Full Code Here

Examples of com.linkedin.restli.server.PagingContext

    {
      throw new ResourceConfigException("Incorrect data type for param: @" + PagingContextParam.class.getSimpleName() + " or @" + Context.class.getSimpleName() +
              " parameter annotation must be of type " +  PagingContext.class.getName());
    }

    PagingContext defaultContext = null;
    Parameter.ParamType parameter = null;
    if(paramAnnotationType.equals(PagingContextParam.class))
    {
      PagingContextParam pagingContextParam = annotations.get(PagingContextParam.class);
      defaultContext = new PagingContext(pagingContextParam.defaultStart(), pagingContextParam.defaultCount(), false, false);
      parameter = Parameter.ParamType.PAGING_CONTEXT_PARAM;
    }
    else if (paramAnnotationType.equals(Context.class))
    {
      Context contextParam = annotations.get(Context.class);
      defaultContext = new PagingContext(contextParam.defaultStart(), contextParam.defaultCount(), false, false);
      parameter = Parameter.ParamType.CONTEXT;
    }
    else
    {
      throw new ResourceConfigException("Param Annotation type must be 'PagingContextParam' or the deprecated 'Context' for PagingContext");
View Full Code Here

Examples of com.linkedin.restli.server.PagingContext

      _res.purge();
      createPhoto("InEdible");
      createPhoto("InEdible");
      createPhoto("InEdible", PhotoFormats.BMP);

      final PagingContext pc = new PagingContext(0, 4);
      final PagingContext pc2 = new PagingContext(0, 2);

      final List<Photo> foundByTitle = _res.find(pc, "InEdible", null);
      Assert.assertEquals(foundByTitle.size(), 3);

      final List<Photo> foundByFormat = _res.find(pc, null, PhotoFormats.BMP);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.