Package com.linkedin.data

Examples of com.linkedin.data.DataMap


  }

  @Override
  public void renderResourceHome(OutputStream out)
  {
    final DataMap outputMap = createEmptyOutput();

    try
    {
      for (ResourceSchema resourceSchema:
           new HashSet<ResourceSchema>(_relationships.getResourceSchemaCollection().getResources().values()))
View Full Code Here


    if (resourceSchema == null)
    {
      throw new RoutingException(String.format("Resource named '%s' does not exist", resourceName), 404) ;
    }

    final DataMap outputMap = createEmptyOutput();

    try
    {
      renderResource(resourceSchema, outputMap);
      _codec.writeMap(outputMap, out);
View Full Code Here

  }

  @Override
  public void renderDataModelHome(OutputStream out)
  {
    final DataMap outputMap = createEmptyOutput();

    try
    {
      for (NamedDataSchema schema: new HashSet<NamedDataSchema>(_relationships.getDataModels().values()))
      {
View Full Code Here

    if (schema == null)
    {
      throw new RoutingException(String.format("Data model named '%s' does not exist", dataModelName), 404) ;
    }

    final DataMap outputMap = createEmptyOutput();

    try
    {
      renderDataModel(schema, outputMap);
      _codec.writeMap(outputMap, out);
View Full Code Here

    return RestConstants.HEADER_VALUE_APPLICATION_JSON;
  }

  private DataMap createEmptyOutput()
  {
    final DataMap emptyOutputMap = new DataMap();
    emptyOutputMap.put("resources", new DataMap());
    emptyOutputMap.put("models", new DataMap());

    return emptyOutputMap;
  }
View Full Code Here

    models.putAll(relatedSchemas);
  }

  private void renderResource(ResourceSchema resourceSchema, DataMap outputMap) throws IOException
  {
    final DataMap resources = outputMap.getDataMap("resources");
    final DataMap models = outputMap.getDataMap("models");

    resources.put(ResourceSchemaUtil.getFullName(resourceSchema), resourceSchema.data());
    addRelatedModels(resourceSchema, models);

    final List<ResourceSchema> subresources = _relationships.getResourceSchemaCollection().getAllSubResources(
View Full Code Here

    }
  }

  private void renderDataModel(NamedDataSchema schema, DataMap outputMap) throws IOException
  {
    final DataMap models = outputMap.getDataMap("models");
    final DataMap schemaData = _codec.stringToMap(schema.toString());
    models.put(schema.getFullName(), schemaData);
  }
View Full Code Here

      String responseEntity = null;
      if (capture != null)
      {
        try
        {
          DataMap entityMap;

          if (capture.getRequest().getEntity().length() > 0)
          {
            entityMap = DataMapUtils.readMap(capture.getRequest());
            requestEntity = new String(_codec.mapToBytes(entityMap));
View Full Code Here

    }

    final Map<String, Object> pageModel = createPageModel();
    pageModel.put("dataModel", schema);

    final DataMap example = SchemaSampleDataGenerator.buildRecordData(schema, new SchemaSampleDataGenerator.DataGenerationOptions());
    try
    {
      pageModel.put("example", new String(_codec.mapToBytes(example)));
    }
    catch (IOException e)
View Full Code Here

  {
    final String resultKey = keys.get(0);
    final String statusKey = keys.get(1);
    final String errorKey = keys.get(2);

    final DataMap resultData = new DataMap();
    resultData.put(resultKey, _record.data());

    final DataMap statusData = new DataMap();
    statusData.put(statusKey, _status.getCode());

    final DataMap errorData = new DataMap();
    errorData.put(errorKey, _error.data());

    final DataMap data = new DataMap();
    data.put(BatchResponse.RESULTS, resultData);
    data.put(BatchResponse.STATUSES, statusData);
    data.put(BatchResponse.ERRORS, errorData);

    final BatchEntityResponseDecoder<String, TestRecord> decoder =
      new BatchEntityResponseDecoder<String, TestRecord>(new TypeSpec<TestRecord>(TestRecord.class),
                                                         new TypeSpec<String>(String.class),
                                                         Collections.<String, CompoundKey.TypeInfo>emptyMap(),
View Full Code Here

TOP

Related Classes of com.linkedin.data.DataMap

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.