Java Code Examples for org.springframework.hateoas.Resources#getContent()
The following examples show how to use
org.springframework.hateoas.Resources#getContent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RubricsServiceImpl.java From sakai with Educational Community License v2.0 | 6 votes |
protected Collection<Resource<ToolItemRubricAssociation>> getRubricAssociationByRubric(String rubricId, String toSite) throws Exception { TypeReferences.ResourcesType<Resource<ToolItemRubricAssociation>> resourceParameterizedTypeReference = new TypeReferences.ResourcesType<Resource<ToolItemRubricAssociation>>() {}; URI apiBaseUrl = new URI(serverConfigurationService.getServerUrl() + RBCS_SERVICE_URL_PREFIX); Traverson traverson = new Traverson(apiBaseUrl, MediaTypes.HAL_JSON); Traverson.TraversalBuilder builder = traverson.follow("rubric-associations", "search", "by-rubric-id"); HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", String.format("Bearer %s", generateJsonWebToken(RubricsConstants.RBCS_TOOL, toSite))); builder.withHeaders(headers); Map<String, Object> parameters = new HashMap<>(); parameters.put("rubricId", Long.valueOf(rubricId)); Resources<Resource<ToolItemRubricAssociation>> associationResources = builder.withTemplateParameters(parameters).toObject(resourceParameterizedTypeReference); return associationResources.getContent(); }
Example 2
Source File: RubricsServiceImpl.java From sakai with Educational Community License v2.0 | 6 votes |
protected Collection<Resource<Evaluation>> getRubricEvaluationsByAssociation(Long associationId) throws Exception { TypeReferences.ResourcesType<Resource<Evaluation>> resourceParameterizedTypeReference = new TypeReferences.ResourcesType<Resource<Evaluation>>() {}; URI apiBaseUrl = new URI(serverConfigurationService.getServerUrl() + RBCS_SERVICE_URL_PREFIX); Traverson traverson = new Traverson(apiBaseUrl, MediaTypes.HAL_JSON); Traverson.TraversalBuilder builder = traverson.follow("evaluations", "search", "by-association-id"); HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", String.format("Bearer %s", generateJsonWebToken(RubricsConstants.RBCS_TOOL))); builder.withHeaders(headers); Map<String, Object> parameters = new HashMap<>(); parameters.put("toolItemRubricAssociationId", associationId); Resources<Resource<Evaluation>> evaluationResources = builder.withTemplateParameters(parameters).toObject(resourceParameterizedTypeReference); return evaluationResources.getContent(); }
Example 3
Source File: TacoCloudClient.java From spring-in-action-5-samples with Apache License 2.0 | 6 votes |
public Iterable<Taco> getRecentTacosWithTraverson() { ParameterizedTypeReference<Resources<Taco>> tacoType = new ParameterizedTypeReference<Resources<Taco>>() {}; Resources<Taco> tacoRes = traverson .follow("tacos") .follow("recents") .toObject(tacoType); // Alternatively, list the two paths in the same call to follow() // Resources<Taco> tacoRes = // traverson // .follow("tacos", "recents") // .toObject(tacoType); return tacoRes.getContent(); }
Example 4
Source File: RubricsServiceImpl.java From sakai with Educational Community License v2.0 | 6 votes |
protected Collection<Resource<Evaluation>> getRubricEvaluationsByAssociation(Long associationId) throws Exception { TypeReferences.ResourcesType<Resource<Evaluation>> resourceParameterizedTypeReference = new TypeReferences.ResourcesType<Resource<Evaluation>>() {}; URI apiBaseUrl = new URI(serverConfigurationService.getServerUrl() + RBCS_SERVICE_URL_PREFIX); Traverson traverson = new Traverson(apiBaseUrl, MediaTypes.HAL_JSON); Traverson.TraversalBuilder builder = traverson.follow("evaluations", "search", "by-association-id"); HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", String.format("Bearer %s", generateJsonWebToken(RubricsConstants.RBCS_TOOL))); builder.withHeaders(headers); Map<String, Object> parameters = new HashMap<>(); parameters.put("toolItemRubricAssociationId", associationId); Resources<Resource<Evaluation>> evaluationResources = builder.withTemplateParameters(parameters).toObject(resourceParameterizedTypeReference); return evaluationResources.getContent(); }
Example 5
Source File: RubricsServiceImpl.java From sakai with Educational Community License v2.0 | 6 votes |
protected Collection<Resource<ToolItemRubricAssociation>> getRubricAssociationByRubric(String rubricId, String toSite) throws Exception { TypeReferences.ResourcesType<Resource<ToolItemRubricAssociation>> resourceParameterizedTypeReference = new TypeReferences.ResourcesType<Resource<ToolItemRubricAssociation>>() {}; URI apiBaseUrl = new URI(serverConfigurationService.getServerUrl() + RBCS_SERVICE_URL_PREFIX); Traverson traverson = new Traverson(apiBaseUrl, MediaTypes.HAL_JSON); Traverson.TraversalBuilder builder = traverson.follow("rubric-associations", "search", "by-rubric-id"); HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", String.format("Bearer %s", generateJsonWebToken(RubricsConstants.RBCS_TOOL, toSite))); builder.withHeaders(headers); Map<String, Object> parameters = new HashMap<>(); parameters.put("rubricId", Long.valueOf(rubricId)); Resources<Resource<ToolItemRubricAssociation>> associationResources = builder.withTemplateParameters(parameters).toObject(resourceParameterizedTypeReference); return associationResources.getContent(); }
Example 6
Source File: ResourcesMapper.java From mobilecloud-15 with Apache License 2.0 | 5 votes |
@Override public void serialize(Resources value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { // Extracted the actual data inside of the Resources object // that we care about (e.g., the list of Video objects) Object content = value.getContent(); // Instead of all of the Resources member variables, etc. // Just mashall the actual content (Videos) into the JSON JsonSerializer<Object> s = provider.findValueSerializer( content.getClass(), null); s.serialize(content, jgen, provider); }
Example 7
Source File: ResourcesMapper.java From mobilecloud-15 with Apache License 2.0 | 5 votes |
@Override public void serialize(Resources value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { // Extracted the actual data inside of the Resources object // that we care about (e.g., the list of Video objects) Object content = value.getContent(); // Instead of all of the Resources member variables, etc. // Just mashall the actual content (Videos) into the JSON JsonSerializer<Object> s = provider.findValueSerializer( content.getClass(), null); s.serialize(content, jgen, provider); }
Example 8
Source File: ResourcesMapper.java From mobilecloud-15 with Apache License 2.0 | 5 votes |
@Override public void serialize(Resources value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { // Extracted the actual data inside of the Resources object // that we care about (e.g., the list of Video objects) Object content = value.getContent(); // Instead of all of the Resources member variables, etc. // Just mashall the actual content (Videos) into the JSON JsonSerializer<Object> s = provider.findValueSerializer( content.getClass(), null); s.serialize(content, jgen, provider); }
Example 9
Source File: ResourcesMapper.java From mobilecloud-15 with Apache License 2.0 | 5 votes |
@Override public void serialize(Resources value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { // Extracted the actual data inside of the Resources object // that we care about (e.g., the list of Video objects) Object content = value.getContent(); // Instead of all of the Resources member variables, etc. // Just mashall the actual content (Videos) into the JSON JsonSerializer<Object> s = provider.findValueSerializer( content.getClass(), null); s.serialize(content, jgen, provider); }
Example 10
Source File: ResourcesMapper.java From mobilecloud-15 with Apache License 2.0 | 5 votes |
@Override public void serialize(Resources value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { // Extracted the actual data inside of the Resources object // that we care about (e.g., the list of Video objects) Object content = value.getContent(); // Instead of all of the Resources member variables, etc. // Just mashall the actual content (Videos) into the JSON JsonSerializer<Object> s = provider.findValueSerializer( content.getClass(), null); s.serialize(content, jgen, provider); }
Example 11
Source File: ResourcesMapper.java From mobilecloud-15 with Apache License 2.0 | 5 votes |
@Override public void serialize(Resources value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { // Extracted the actual data inside of the Resources object // that we care about (e.g., the list of Video objects) Object content = value.getContent(); // Instead of all of the Resources member variables, etc. // Just mashall the actual content (Videos) into the JSON JsonSerializer<Object> s = provider.findValueSerializer( content.getClass(), null); s.serialize(content, jgen, provider); }
Example 12
Source File: ResourcesMapper.java From mobilecloud-15 with Apache License 2.0 | 5 votes |
@Override public void serialize(Resources value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { // Extracted the actual data inside of the Resources object // that we care about (e.g., the list of Video objects) Object content = value.getContent(); // Instead of all of the Resources member variables, etc. // Just mashall the actual content (Videos) into the JSON JsonSerializer<Object> s = provider.findValueSerializer( content.getClass(), null); s.serialize(content, jgen, provider); }
Example 13
Source File: TacoCloudClient.java From spring-in-action-5-samples with Apache License 2.0 | 5 votes |
public Iterable<Ingredient> getAllIngredientsWithTraverson() { ParameterizedTypeReference<Resources<Ingredient>> ingredientType = new ParameterizedTypeReference<Resources<Ingredient>>() {}; Resources<Ingredient> ingredientRes = traverson .follow("ingredients") .toObject(ingredientType); return ingredientRes.getContent(); }
Example 14
Source File: TacoCloudClient.java From spring-in-action-5-samples with Apache License 2.0 | 5 votes |
public Iterable<Ingredient> getAllIngredientsWithTraverson() { ParameterizedTypeReference<Resources<Ingredient>> ingredientType = new ParameterizedTypeReference<Resources<Ingredient>>() {}; Resources<Ingredient> ingredientRes = traverson .follow("ingredients") .toObject(ingredientType); return ingredientRes.getContent(); }
Example 15
Source File: TacoCloudClient.java From spring-in-action-5-samples with Apache License 2.0 | 5 votes |
public Iterable<Ingredient> getAllIngredientsWithTraverson() { ParameterizedTypeReference<Resources<Ingredient>> ingredientType = new ParameterizedTypeReference<Resources<Ingredient>>() {}; Resources<Ingredient> ingredientRes = traverson .follow("ingredients") .toObject(ingredientType); return ingredientRes.getContent(); }
Example 16
Source File: TacoCloudClient.java From spring-in-action-5-samples with Apache License 2.0 | 5 votes |
public Iterable<Ingredient> getAllIngredientsWithTraverson() { ParameterizedTypeReference<Resources<Ingredient>> ingredientType = new ParameterizedTypeReference<Resources<Ingredient>>() {}; Resources<Ingredient> ingredientRes = traverson .follow("ingredients") .toObject(ingredientType); Collection<Ingredient> ingredients = ingredientRes.getContent(); return ingredients; }
Example 17
Source File: TacoCloudClient.java From spring-in-action-5-samples with Apache License 2.0 | 5 votes |
public Iterable<Ingredient> getAllIngredientsWithTraverson() { ParameterizedTypeReference<Resources<Ingredient>> ingredientType = new ParameterizedTypeReference<Resources<Ingredient>>() {}; Resources<Ingredient> ingredientRes = traverson .follow("ingredients") .toObject(ingredientType); return ingredientRes.getContent(); }