Package com.linkedin.data

Examples of com.linkedin.data.DataList


        case TYPEREF:
          Object ref = map.get(REF_KEY);
          parseObject(ref);
          break;
        case RECORD:
          DataList includeList = getDataList(map, INCLUDE_KEY, false);
          if (includeList != null)
          {
            parseList(includeList);
          }
          DataList fieldsList = getDataList(map, FIELDS_KEY, true);
          if (fieldsList != null)
          {
            for (Object o : fieldsList)
            {
              if (o.getClass() == DataMap.class)
View Full Code Here


    {
      // Parse all query parameters into a data map.
      DataMap allParametersDataMap = context.getParameters();

      // Get the batch request keys from the IDS list at the root of the map.
      DataList batchIds = allParametersDataMap.getDataList(RestConstants.QUERY_BATCH_IDS_PARAM);
      if (batchIds == null)
      {
        batchKeys = null;
      }
      else if (batchIds.isEmpty())
      {
        batchKeys = Collections.emptySet();
      }
      else
      {
        batchKeys = new HashSet<Object>();

        // Validate the complex keys and put them into the context batch keys
        for (Object complexKey : batchIds)
        {
          if (!(complexKey instanceof DataMap))
          {
            log.warn("Invalid structure of key '" + complexKey.toString() + "', skipping key.");
            context.getBatchKeyErrors().put(complexKey, new RestLiServiceException(HttpStatus.S_400_BAD_REQUEST));
            continue;
          }
          batchKeys.add(ComplexResourceKey.buildFromDataMap((DataMap) complexKey, ComplexKeySpec.forClassesMaybeNull(resource.getKeyKeyClass(), resource.getKeyParamsClass())));
        }
      }
    }
    else if (CompoundKey.class.equals(keyClass)
      && version.compareTo(AllProtocolVersions.RESTLI_PROTOCOL_2_0_0.getProtocolVersion()) >= 0)
    {
      DataMap allParametersDataMap = context.getParameters();

      // Get the batch request keys from the IDS list at the root of the map.
      DataList batchIds = allParametersDataMap.getDataList(RestConstants.QUERY_BATCH_IDS_PARAM);
      if (batchIds == null)
      {
        batchKeys = null;
      }
      else if (batchIds.isEmpty())
      {
        batchKeys = Collections.emptySet();
      }
      else
      {
View Full Code Here

  {
    private static final ArrayDataSchema SCHEMA = (ArrayDataSchema) DataTemplateUtil.parseSchema(EDGE_LIST_SCHEMA);

    public EdgeList()
    {
      super(new DataList(), SCHEMA, Edge.class);
    }
View Full Code Here

        new Integer(1),
        new Long(1),
        new Float(1),
        new Double(1),
        new DataMap(),
        new DataList(),
        new String("\u0100"),
        new String("ab\u0100c"),
        new String("ab\u0100c\u0200")
    };
View Full Code Here

        new Integer(1),
        new Long(1),
        new Float(1),
        new Double(1),
        new DataMap(),
        new DataList(),
        new String(),
        "1",
        "12",
        "123",
        "12345",
View Full Code Here

        new String("foobar"),
        new String("Apple"),
        new String("Orange"),
        new String("BaNaNa"),
        new DataMap(),
        new DataList()
    };

    // There is no coercion for this type.
    // Test with all coercion validation options, result should be the same for all cases.
    testCoercionValidation(schemaText, "bar", goodObjects, badObjects, noCoercionValidationOption());
View Full Code Here

      "{ \"type\" : \"record\", \"name\" : \"foo\", \"fields\" : " +
      "[ { \"name\" : \"bar\", \"type\" : { \"type\" : \"array\", \"items\" : \"int\" } } ] }";

    Object goodObjects[] =
    {
        new DataList(),
        new DataList(asList(new Integer(1))),
        new DataList(asList(new Integer(2), new Integer(3))),
    };

    Object badObjects[] =
    {
        new Boolean(true),
        new Integer(1),
        new Long(1),
        new Float(1),
        new Double(1),
        new String(),
        new DataMap(),
        new DataList(asList(new Boolean(true))),
        new DataList(asList(new Long(1))),
        new DataList(asList(new Float(1))),
        new DataList(asList(new Double(1))),
        new DataList(asList(new String("1"))),
        new DataList(asList(new DataMap())),
        new DataList(asList(new DataList())),
        new DataList(asList(new Boolean(true), new Integer(1))),
        new DataList(asList(new Integer(1), new Boolean(true)))
    };

    testCoercionValidation(schemaText, "bar", goodObjects, badObjects, noCoercionValidationOption());
  }
View Full Code Here

      "{ \"type\" : \"record\", \"name\" : \"foo\", \"fields\" : " +
      "[ { \"name\" : \"bar\", \"type\" : { \"type\" : \"array\", \"items\" : \"int\" } } ] }";

    Object inputs[][] =
      {
        { new DataList(), new DataList() },
        { new DataList(asList(1)), new DataList(asList(1)) },
        { new DataList(asList(2, 3)), new DataList(asList(2, 3)) },
        { new DataList(asList(1L)), new DataList(asList(1)) },
        { new DataList(asList(1.0f)), new DataList(asList(1)) },
        { new DataList(asList(1.0)), new DataList(asList(1)) }
      };

    Object badObjects[] =
      {
        new Boolean(true),
        new Integer(1),
        new Long(1),
        new Float(1),
        new Double(1),
        new String(),
        new DataMap(),
        new DataList(asList(new Boolean(true))),
        new DataList(asList(new String("1"))),
        new DataList(asList(new DataMap())),
        new DataList(asList(new DataList())),
        new DataList(asList(new Boolean(true), new Integer(1))),
        new DataList(asList(new Integer(1), new Boolean(true)))
      };

    testNormalCoercionValidation(schemaText, "bar", inputs, badObjects);
  }
View Full Code Here

        "{ \"type\" : \"record\", \"name\" : \"foo\", \"fields\" : " +
            "[ { \"name\" : \"bar\", \"type\" : { \"type\" : \"array\", \"items\" : \"int\" } } ] }";

    Object inputs[][] =
        {
            { new DataList(asList("1")), new DataList(asList(1)) },
            { new DataList(asList("1", "2", "3")), new DataList(asList(1, 2, 3)) },

            { new DataList(), new DataList() },
            { new DataList(asList(1)), new DataList(asList(1)) },
            { new DataList(asList(2, 3)), new DataList(asList(2, 3)) },
            { new DataList(asList(1L)), new DataList(asList(1)) },
            { new DataList(asList(1.0f)), new DataList(asList(1)) },
            { new DataList(asList(1.0)), new DataList(asList(1)) }
        };

    Object badObjects[] =
        {
            new Boolean(true),
            new Integer(1),
            new Long(1),
            new Float(1),
            new Double(1),
            new String(),
            new DataMap(),
            new DataList(asList(new Boolean(true))),
            new DataList(asList(new DataMap())),
            new DataList(asList(new DataList())),
            new DataList(asList(new Boolean(true), new Integer(1))),
            new DataList(asList(new Integer(1), new Boolean(true)))
        };

    testStringToPrimitiveCoercionValidation(schemaText, "bar", inputs, badObjects);
  }
View Full Code Here

        new Integer(1),
        new Long(1),
        new Float(1),
        new Double(1),
        new String(),
        new DataList(),
        new DataMap(asMap("key1", new Boolean(true))),
        new DataMap(asMap("key1", new Long(1))),
        new DataMap(asMap("key1", new Float(1))),
        new DataMap(asMap("key1", new Double(1))),
        new DataMap(asMap("key1", new String("1"))),
        new DataMap(asMap("key1", new DataMap())),
        new DataMap(asMap("key1", new DataList())),
        new DataMap(asMap("key1", new Integer(1), "key2", new Long(1))),
        new DataMap(asMap("key1", new Long(1), "key2", new Integer(1)))
    };

    testCoercionValidation(schemaText, "bar", goodObjects, badObjects, noCoercionValidationOption());
View Full Code Here

TOP

Related Classes of com.linkedin.data.DataList

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.