@Override public LinkBuilder linkFor(Class<?> type) { return getPluginFor(type).linkFor(type); }
/** * Return a {@link ResourceSupport} object containing the resources * served by the admin server. * * @return {@code ResourceSupport} object containing the admin server's resources */ @RequestMapping("/") public ResourceSupport info() { ResourceSupport resourceSupport = new ResourceSupport(); resourceSupport.add(entityLinks.linkToCollectionResource(StreamDefinitionResource.class).withRel("streams/definitions")); resourceSupport.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(StreamDefinitionResource.class, "{name}").withRel("streams/definitions/definition"))); resourceSupport.add(entityLinks.linkToCollectionResource(StreamDeploymentResource.class).withRel("streams/deployments")); resourceSupport.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(StreamDeploymentResource.class, "{name}").withRel("streams/deployments/deployment"))); resourceSupport.add(entityLinks.linkToCollectionResource(TaskDefinitionResource.class).withRel("tasks")); resourceSupport.add(entityLinks.linkToCollectionResource(CounterResource.class).withRel("counters")); resourceSupport.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(CounterResource.class, "{name}").withRel("counters/counter"))); resourceSupport.add(entityLinks.linkToCollectionResource(ModuleRegistrationResource.class).withRel("modules")); resourceSupport.add(entityLinks.linkToCollectionResource(LibraryRegistrationResource.class).withRel("libraries")); resourceSupport.add(entityLinks.linkToCollectionResource(ModuleStatusResource.class).withRel("runtime/modules")); resourceSupport.add(unescapeTemplateVariables(entityLinks.linkForSingleResource(ModuleStatusResource.class, "{moduleId}").withRel("runtime/module"))); resourceSupport.add(unescapeTemplateVariables(entityLinks.linkFor(ModuleInstanceStatusResource.class, UriComponents.UriTemplateVariables.SKIP_VALUE).withRel("runtime/modules/instances"))); String templated = entityLinks.linkFor(CompletionProposalsResource.class).withSelfRel().getHref() + ("/stream{?start,detailLevel}"); resourceSupport.add(new Link(templated).withRel("completions/stream")); return resourceSupport; }
entityLinks.linkForSingleResource(AppStatusResource.class, "{appId}").withRel("runtime/apps/app"))); root.add(unescapeTemplateVariables( entityLinks.linkFor(AppInstanceStatusResource.class, "{appId}") .withRel("runtime/apps/instances"))); root.add(ControllerLinkBuilder.linkTo(MetricsController.class).withRel("metrics/streams")); root.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(JobExecutionResource.class, "{id}") .withRel("jobs/executions/execution"))); root.add(unescapeTemplateVariables(entityLinks.linkFor(StepExecutionResource.class, "{jobExecutionId}") .withRel("jobs/executions/execution/steps"))); root.add(unescapeTemplateVariables(entityLinks.linkFor(StepExecutionResource.class, "{jobExecutionId}") .slash("{stepId}").withRel("jobs/executions/execution/steps/step"))); root.add(unescapeTemplateVariables( entityLinks.linkFor(StepExecutionProgressInfoResource.class, "{jobExecutionId}").slash("{stepId}") .slash("progress").withRel("jobs/executions/execution/steps/step/progress"))); taskTemplated = entityLinks.linkToCollectionResource(JobInstanceResource.class).getHref() + "{?name}"; root.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(JobInstanceResource.class, "{id}") .withRel("jobs/instances/instance"))); root.add(entityLinks.linkFor(TaskToolsResource.class).withRel("tools/parseTaskTextToGraph")); root.add(entityLinks.linkFor(TaskToolsResource.class).withRel("tools/convertTaskGraphToText")); String completionStreamTemplated = entityLinks.linkFor(CompletionProposalsResource.class).withSelfRel() .getHref() + ("/stream{?start,detailLevel}"); root.add(new Link(completionStreamTemplated).withRel("completions/stream")); String completionTaskTemplated = entityLinks.linkFor(CompletionProposalsResource.class).withSelfRel().getHref() + ("/task{?start,detailLevel}"); root.add(new Link(completionTaskTemplated).withRel("completions/task"));
@Override public LinkBuilder linkFor(Class<?> type, Object... parameters) { return getPluginFor(type).linkFor(type, parameters); }
@Override public LinkBuilder linkFor(Class<?> type) { return getPluginFor(type).linkFor(type); }
@Override public LinkBuilder linkFor(Class<?> type, Object... parameters) { return getPluginFor(type).linkFor(type, parameters); }
@BasePathAwareController @RequestMapping("/users") public class RestApiController implements ResourceProcessor<Resource<User>>{ @Autowired private EntityLinks entityLinks; @RequestMapping(method=RequestMethod.POST) @ResponseBody public ResponseEntity<Resource<User>> saveUser(@Param("name") String name) { // Testing System.out.println(name); Resource<User> resource = new Resource<>(new User()); return new ResponseEntity<>(resource , HttpStatus.OK); } @Override public Resource<User> process(Resource<User> resource) { LinkBuilder lb = entityLinks.linkFor(User.class); resource.add(new Link(lb.toString())); return resource; } }
@Override public PagedResources<Resource<Taco>> process(PagedResources<Resource<Taco>> resources) { resources .add(entityLinks .linkFor(Taco.class) .slash("recent") .withRel("recents")); return resources; }
root.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(JobExecutionResource.class, "{id}") .withRel("jobs/executions/execution"))); root.add(unescapeTemplateVariables(entityLinks.linkFor(StepExecutionResource.class, "{jobExecutionId}") .withRel("jobs/executions/execution/steps"))); root.add(unescapeTemplateVariables(entityLinks.linkFor(StepExecutionResource.class, "{jobExecutionId}") .slash("{stepId}").withRel("jobs/executions/execution/steps/step"))); root.add(unescapeTemplateVariables( entityLinks.linkFor(StepExecutionProgressInfoResource.class, "{jobExecutionId}").slash("{stepId}") .slash("progress").withRel("jobs/executions/execution/steps/step/progress"))); taskTemplated = entityLinks.linkToCollectionResource(JobInstanceResource.class).getHref() + "{?name}"; root.add(unescapeTemplateVariables(entityLinks.linkToSingleResource(JobInstanceResource.class, "{id}") .withRel("jobs/instances/instance"))); root.add(entityLinks.linkFor(TaskToolsResource.class).withRel("tools/parseTaskTextToGraph")); root.add(entityLinks.linkFor(TaskToolsResource.class).withRel("tools/convertTaskGraphToText")); root.add(entityLinks.linkToCollectionResource(JobExecutionThinResource.class).withRel("jobs/thinexecutions")); taskTemplated = entityLinks.linkToCollectionResource(JobExecutionThinResource.class).getHref() + "{?name}"; root.add(entityLinks.linkToCollectionResource(AboutResource.class).withRel("about")); String completionStreamTemplated = entityLinks.linkFor(CompletionProposalsResource.class).withSelfRel() .getHref() + ("/stream{?start,detailLevel}"); root.add(new Link(completionStreamTemplated).withRel("completions/stream")); String completionTaskTemplated = entityLinks.linkFor(CompletionProposalsResource.class).withSelfRel().getHref() + ("/task{?start,detailLevel}"); root.add(new Link(completionTaskTemplated).withRel("completions/task"));