Class RESTProjectsController
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.web.controller.api.RESTGenericController<Project>
-
- ca.corefacility.bioinformatics.irida.web.controller.api.projects.RESTProjectsController
-
@Controller @RequestMapping("/api/projects") public class RESTProjectsController extends RESTGenericController<Project>
Controller for managingProject
s in the database.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROJECT_HASH_REL
rel used for the project status hashstatic java.lang.String
REL_PROJECT
rel used for accessing an individual project.-
Fields inherited from class ca.corefacility.bioinformatics.irida.web.controller.api.RESTGenericController
crudService, REL_COLLECTION, REL_RELATIONSHIP, RELATED_RESOURCES_NAME, RESOURCE_NAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RESTProjectsController()
Default constructor.RESTProjectsController(ProjectService projectService)
Constructor forRESTProjectsController
, requires a reference to aProjectService
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Collection<org.springframework.hateoas.Link>
constructCustomResourceLinks(Project p)
TheRESTProjectsController
should tell the client how to find the users for a specificProject
.ResponseResource<Project>
create(Project resource, javax.servlet.http.HttpServletResponse response)
Create a new instance ofType
in the database, then respond to the client with the location of the resource.ResponseResource<RootResource>
delete(java.lang.Long identifier)
Delete the instance of the resource identified by a specific identifier.ResponseResource<ProjectHashResource>
getProjectHash(java.lang.Long projectId)
Get the deep project hash for the requested projectResponseResource<Project>
getResource(java.lang.Long identifier)
Retrieve and serialize an individual instance of a resource by identifier.ResponseResource<ResourceCollection<Project>>
listAllResources()
Get all resources in the application.ResponseResource<RootResource>
update(java.lang.Long identifier, java.util.Map<java.lang.String,java.lang.Object> representation)
Update some of the fields of an individual resource in the database.-
Methods inherited from class ca.corefacility.bioinformatics.irida.web.controller.api.RESTGenericController
constructCollectionResourceLinks
-
-
-
-
Field Detail
-
REL_PROJECT
public static final java.lang.String REL_PROJECT
rel used for accessing an individual project.- See Also:
- Constant Field Values
-
PROJECT_HASH_REL
public static final java.lang.String PROJECT_HASH_REL
rel used for the project status hash- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RESTProjectsController
protected RESTProjectsController()
Default constructor. Should not be used.
-
RESTProjectsController
@Autowired public RESTProjectsController(ProjectService projectService)
Constructor forRESTProjectsController
, requires a reference to aProjectService
.- Parameters:
projectService
- theProjectService
to be used by this controller.
-
-
Method Detail
-
listAllResources
public ResponseResource<ResourceCollection<Project>> listAllResources()
Get all resources in the application.- Overrides:
listAllResources
in classRESTGenericController<Project>
- Returns:
- a model containing all resources of the specified type in the application.
-
getResource
public ResponseResource<Project> getResource(@PathVariable java.lang.Long identifier)
Retrieve and serialize an individual instance of a resource by identifier.- Overrides:
getResource
in classRESTGenericController<Project>
- Parameters:
identifier
- the identifier of the resource to retrieve from the database.- Returns:
- the model and view for the individual resource.
-
create
public ResponseResource<Project> create(@RequestBody Project resource, javax.servlet.http.HttpServletResponse response)
Create a new instance ofType
in the database, then respond to the client with the location of the resource.- Overrides:
create
in classRESTGenericController<Project>
- Parameters:
resource
- theType
that we should de-serialize to get an instance ofType
to persist.response
- a reference to the servlet response.- Returns:
- a response containing the location of the newly persisted resource.
-
delete
public ResponseResource<RootResource> delete(@PathVariable java.lang.Long identifier)
Delete the instance of the resource identified by a specific identifier.- Overrides:
delete
in classRESTGenericController<Project>
- Parameters:
identifier
- the identifier that should be deleted from the database.- Returns:
- a response indicating that the resource was deleted.
-
update
public ResponseResource<RootResource> update(@PathVariable java.lang.Long identifier, @RequestBody java.util.Map<java.lang.String,java.lang.Object> representation)
Update some of the fields of an individual resource in the database. The client should only send the key-value pairs for the properties that are to be updated in the database.- Overrides:
update
in classRESTGenericController<Project>
- Parameters:
identifier
- the identifier of the resource to be updated.representation
- the properties to be updated and their new values.- Returns:
- a response indicating that the resource was updated.
-
getProjectHash
@RequestMapping(value="/{projectId}/hash", method=GET) public ResponseResource<ProjectHashResource> getProjectHash(@PathVariable java.lang.Long projectId)
Get the deep project hash for the requested project- Parameters:
projectId
- the ID of the project to read the hash for- Returns:
- a response containing the
ProjectHashResource
-
constructCustomResourceLinks
protected java.util.Collection<org.springframework.hateoas.Link> constructCustomResourceLinks(Project p)
TheRESTProjectsController
should tell the client how to find the users for a specificProject
.- Overrides:
constructCustomResourceLinks
in classRESTGenericController<Project>
- Parameters:
p
- theProject
to construct custom links for.- Returns:
- a collection of custom links.
-
-