/** * Return the given tosca type with all related dependencies. Note if a tosca context exists it will reuse it, if not it will create a new Tosca Context * based on the dependencies of the type's archive. * * @param toscaType The tosca type from which to extract the dependencies. * @return a TypeWithDependenciesResult instance that contains the type and all related types. */ @ToscaContextual public TypeWithDependenciesResult buildTypeWithDependencies(AbstractToscaType toscaType) { if (toscaType instanceof NodeType) { return buildNodeTypeWithDependencies((NodeType) toscaType); } throw new NotImplementedException("Type not currently supported."); }
/** * Get a Tosca Type and all related dependency types. * * @param typeId The id (element id) of the tosca type. * @param typeVersion The version of the tosca type. * @return A {@link RestResponse} that contains an {@link TypeWithDependenciesResult} . */ @RequestMapping(value = "adv/typewithdependencies/{typeId:.+}/{typeVersion:.+}", method = RequestMethod.GET) @PreAuthorize("hasAnyAuthority('ADMIN', 'COMPONENTS_MANAGER', 'COMPONENTS_BROWSER')") public RestResponse<TypeWithDependenciesResult> getTypeWithDependencies(@PathVariable String typeId, @PathVariable String typeVersion) { AbstractToscaType type = toscaTypeSearchService.findOrFail(AbstractToscaType.class, typeId, typeVersion); return RestResponseBuilder.<TypeWithDependenciesResult> builder().data(toscaWithDependenciesBuilder.buildTypeWithDependencies(type)).build(); } }