Package com.linkedin.data.template

Examples of com.linkedin.data.template.RecordTemplate.data()


          assertTrue(requestContext.getFilterScratchpad().get(spKey) == spValue);
          RecordTemplate entity = responseContext.getResponseData().getEntityResponse();
          if (entity != null && requestContext.getMethodType() == ResourceMethod.GET
              && responseContext.getHttpStatus() == HttpStatus.S_200_OK)
          {
            Greeting greeting = new Greeting(entity.data());
            if (greeting.hasTone())
            {
              greeting.setTone(mapToneForOutgoingResponse(greeting.getTone()));
              responseContext.getResponseData().setEntityResponse(greeting);
            }
View Full Code Here


    {
      record = (RecordTemplate) result;
      status = HttpStatus.S_200_OK;
    }
    final ResourceContext resourceContext = routingResult.getContext();
    final DataMap data = RestUtils.projectFields(record.data(), resourceContext.getProjectionMode(),
        resourceContext.getProjectionMask());
    return new AugmentedRestLiResponseData.Builder(routingResult.getResourceMethod().getMethodType()).headers(headers)
                                                                                                     .status(status)
                                                                                                     .entity(new AnyRecord(data))
                                                                                                     .build();
View Full Code Here

    //If the client decides they want total in their paging response, then the resource method will see total in their
    //paging path spec and then decide to set total to a non null value. We will then also include it when we project
    //paging.
    final RecordTemplate anyRecord = new AnyRecord(RestUtils.projectFields(paging.data(),
        ProjectionMode.AUTOMATIC, resourceContext.getPagingProjectionMask()));
    final CollectionMetadata projectedPaging = new CollectionMetadata(anyRecord.data());

    //For root object entities
    List<AnyRecord> processedElements = new ArrayList<AnyRecord>(elements.size());
    for (RecordTemplate entry : elements)
    {
View Full Code Here

        @SuppressWarnings("unchecked")
        final Class<RecordTemplate> entityClass = (Class<RecordTemplate>) entityTemplate.getClass();
        entityResponse = new EntityResponse<RecordTemplate>(entityClass);

        final DataMap projectedData =
            RestUtils.projectFields(entityTemplate.data(), context.getProjectionMode(), context.getProjectionMask());
        CheckedUtil.putWithoutChecking(entityResponse.data(), EntityResponse.ENTITY, projectedData);
      }

      entityResponse.setStatus(statuses.get(key), SetMode.IGNORE_NULL);
      entityResponse.setError(errors.get(key), SetMode.IGNORE_NULL);
View Full Code Here

   * @param complexResourceKey The complex key to be fixed.
   */
  public static ComplexResourceKey<?, ?> fixUpComplexKeySingletonArray(ComplexResourceKey<?,?> complexResourceKey)
  {
    RecordTemplate key = complexResourceKey.getKey();
    DataMap dataMap = key.data();

    for (RecordDataSchema.Field f : key.schema().getFields())
    {
      DataSchema.Type type = f.getType().getType();
      String fieldName = f.getName();
View Full Code Here

    else
    {
      EasyMock.expect(mockRequest.getMethodName()).andReturn(null);
    }

    EasyMock.expect(mockRecordTemplate.data()).andReturn(entityBody).once();

    Capture<RestRequest> restRequestCapture = new Capture<RestRequest>();

    EasyMock.expect(mockClient.getMetadata(new URI(HOST + SERVICE_NAME)))
        .andReturn(Collections.<String, Object>emptyMap()).once();
View Full Code Here

  {
    RecordTemplate recordTemplate = wrapWithSchema(dataMap, spec);
    // Validate against the class schema with FixupMode.STRING_TO_PRIMITIVE to parse the
    // strings into the
    // corresponding primitive types.
    ValidateDataAgainstSchema.validate(recordTemplate.data(),
                                       recordTemplate.schema(),
                                       new ValidationOptions(RequiredMode.CAN_BE_ABSENT_IF_HAS_DEFAULT,
                                                             CoercionMode.STRING_TO_PRIMITIVE));
    return recordTemplate;
  }
View Full Code Here

      }
      else
      {
        inputRecordTemplate = request.getInputRecord();
      }
      checkInput(inputRecordTemplate.data().getDataMap(com.linkedin.restli.common.BatchRequest.ENTITIES),
                 expectedInput,
                 uriIds);
    }

    Set<Object> idObjects = request.getObjectIds();
View Full Code Here

      }
      else
      {
        inputRecordTemplate = request.getInputRecord();
      }
      checkInput(inputRecordTemplate.data().getDataMap(com.linkedin.restli.common.BatchRequest.ENTITIES),
                 expectedInput,
                 uriIds);
    }

    Set<Object> idObjects = request.getObjectIds();
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.