Package com.linkedin.data.transform.filter.request

Examples of com.linkedin.data.transform.filter.request.MaskTree


  public static MaskTree parseProjectionParameter(final String projectionParam) throws
          RestLiSyntaxException
  {
    if (projectionParam == null)
    {
      return new MaskTree();
    }
    else
    {
      return decodeMaskUriFormat(projectionParam);
    }
View Full Code Here


    ResourceContext context = getContext();

    Greeting greeting = new Greeting();

    context.setProjectionMode(ProjectionMode.MANUAL);
    MaskTree mask = context.getProjectionMask();
    if(mask != null && ignoreProjection == false)
    {
      if(mask.getOperations().get(Greeting.fields().message()) == MaskOperation.POSITIVE_MASK_OP)
      {
        greeting.setMessage("Projected message!");
      }

      if(mask.getOperations().get(Greeting.fields().tone()) == MaskOperation.POSITIVE_MASK_OP)
      {
        greeting.setTone(Tone.FRIENDLY);
      }

      if(mask.getOperations().get(Greeting.fields().id()) == MaskOperation.POSITIVE_MASK_OP)
      {
        greeting.setId(key);
      }
    }
    else
View Full Code Here

    final String resourceNamespace = "resourceNamespace";
    final ResourceMethod methodType = ResourceMethod.GET;
    final DataMap customAnnotations = new DataMap();
    customAnnotations.put("foo", "Bar");
    final ProjectionMode projectionMode = ProjectionMode.AUTOMATIC;
    final MaskTree maskTree = new MaskTree();
    final MutablePathKeys pathKeys = new PathKeysImpl();
    final Map<String, String> requestHeaders = new HashMap<String, String>();
    requestHeaders.put("Key1", "Value1");
    final URI requestUri = new URI("foo.bar.com");
    final ProtocolVersion protoVersion = AllProtocolVersions.BASELINE_PROTOCOL_VERSION;
View Full Code Here

  {
    ResourceContext mockContext = EasyMock.createMock(ResourceContext.class);
    EasyMock.expect(mockContext.getProjectionMode()).andReturn(ProjectionMode.AUTOMATIC).once();
    final DataMap projectionMask = new DataMap();
    projectionMask.put("stringField", 1);
    EasyMock.expect(mockContext.getProjectionMask()).andReturn(new MaskTree(projectionMask)).once();
    EasyMock.replay(mockContext);
    return mockContext;
  }
View Full Code Here

  }

  @Test
  public void testEmptyFilter()
  {
    final MaskTree filter = new MaskTree();

    Assert.assertFalse(ProjectionUtil.isPathPresent(filter, new PathSpec("foo")));
  }
View Full Code Here

  }

  @Test
  public void testEmptyPath()
  {
    final MaskTree filter = new MaskTree();
    filter.addOperation(new PathSpec("foo"), MaskOperation.POSITIVE_MASK_OP);

    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec()));
  }
View Full Code Here

  }

  @Test
  public void testPositiveSinglePath()
  {
    final MaskTree filter = new MaskTree();
    filter.addOperation(new PathSpec("foo", "bar", "baz"), MaskOperation.POSITIVE_MASK_OP);

    // ancestor nodes are considered present if matched in path
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar")));
View Full Code Here

  }

  @Test
  public void testPositiveWithWildcardSinglePath()
  {
    final MaskTree filter = new MaskTree();
    filter.addOperation(new PathSpec("foo", PathSpec.WILDCARD, "baz"), MaskOperation.POSITIVE_MASK_OP);

    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "baz")));
    Assert.assertTrue(ProjectionUtil.isPathPresent(filter, new PathSpec("foo", "bar", "baz", "xyz")));
View Full Code Here

  }

  @Test
  public void testPositiveMultiPaths()
  {
    final MaskTree filter = new MaskTree();
    filter.addOperation(new PathSpec("foo", "bar", "baz"), MaskOperation.POSITIVE_MASK_OP);

    final Collection<PathSpec> positivePaths = new HashSet<PathSpec>(Arrays.asList(
      new PathSpec("foo"),
      new PathSpec("foo", "bar"),
      new PathSpec("foo", "bar", "baz"),
View Full Code Here

  }

  @Test
  public void testPositiveWithWildcardMultiPaths()
  {
    final MaskTree filter = new MaskTree();
    filter.addOperation(new PathSpec("foo", PathSpec.WILDCARD, "baz"), MaskOperation.POSITIVE_MASK_OP);

    final Collection<PathSpec> positivePaths = new HashSet<PathSpec>(Arrays.asList(
      new PathSpec("foo"),
      new PathSpec("foo", "bar"),
      new PathSpec("foo", "bar", "baz"),
View Full Code Here

TOP

Related Classes of com.linkedin.data.transform.filter.request.MaskTree

Copyright © 2018 www.massapicom. 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.