Search in sources :

Example 1 with Resources

use of net.nemerosa.ontrack.ui.resource.Resources in project ontrack by nemerosa.

the class ProjectEntityExtensionController method getInformation.

/**
 * Gets the list of information extensions for an entity
 */
@RequestMapping(value = "information/{entityType}/{id}", method = RequestMethod.GET)
public Resources<EntityInformation> getInformation(@PathVariable ProjectEntityType entityType, @PathVariable ID id) {
    // Gets the entity
    ProjectEntity entity = getEntity(entityType, id);
    // List of informations to return
    List<EntityInformation> informations = extensionManager.getExtensions(EntityInformationExtension.class).stream().map(x -> x.getInformation(entity)).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
    // OK
    return Resources.of(informations, uri(MvcUriComponentsBuilder.on(getClass()).getInformation(entityType, id)));
}
Also used : EntityInformationExtension(net.nemerosa.ontrack.extension.api.EntityInformationExtension) PathVariable(org.springframework.web.bind.annotation.PathVariable) EntityInformation(net.nemerosa.ontrack.extension.api.model.EntityInformation) StructureService(net.nemerosa.ontrack.model.structure.StructureService) Autowired(org.springframework.beans.factory.annotation.Autowired) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) RequestMethod(org.springframework.web.bind.annotation.RequestMethod) Action(net.nemerosa.ontrack.model.support.Action) RestController(org.springframework.web.bind.annotation.RestController) Collectors(java.util.stream.Collectors) ProjectEntityType(net.nemerosa.ontrack.model.structure.ProjectEntityType) ProjectEntityActionExtension(net.nemerosa.ontrack.extension.api.ProjectEntityActionExtension) List(java.util.List) Resources(net.nemerosa.ontrack.ui.resource.Resources) MvcUriComponentsBuilder(org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder) EntityInformationExtension(net.nemerosa.ontrack.extension.api.EntityInformationExtension) ProjectEntity(net.nemerosa.ontrack.model.structure.ProjectEntity) Optional(java.util.Optional) ExtensionManager(net.nemerosa.ontrack.extension.api.ExtensionManager) ID(net.nemerosa.ontrack.model.structure.ID) Optional(java.util.Optional) ProjectEntity(net.nemerosa.ontrack.model.structure.ProjectEntity) EntityInformation(net.nemerosa.ontrack.extension.api.model.EntityInformation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 EntityInformationExtension (net.nemerosa.ontrack.extension.api.EntityInformationExtension)1 ExtensionManager (net.nemerosa.ontrack.extension.api.ExtensionManager)1 ProjectEntityActionExtension (net.nemerosa.ontrack.extension.api.ProjectEntityActionExtension)1 EntityInformation (net.nemerosa.ontrack.extension.api.model.EntityInformation)1 ID (net.nemerosa.ontrack.model.structure.ID)1 ProjectEntity (net.nemerosa.ontrack.model.structure.ProjectEntity)1 ProjectEntityType (net.nemerosa.ontrack.model.structure.ProjectEntityType)1 StructureService (net.nemerosa.ontrack.model.structure.StructureService)1 Action (net.nemerosa.ontrack.model.support.Action)1 Resources (net.nemerosa.ontrack.ui.resource.Resources)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 PathVariable (org.springframework.web.bind.annotation.PathVariable)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 RequestMethod (org.springframework.web.bind.annotation.RequestMethod)1 RestController (org.springframework.web.bind.annotation.RestController)1 MvcUriComponentsBuilder (org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder)1