Class RESTProjectSamplesController
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.web.controller.api.projects.RESTProjectSamplesController
-
@Controller public class RESTProjectSamplesController extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
REL_PROJECT
Rel to get to the project that this sample belongs to.static java.lang.String
REL_PROJECT_SAMPLE
static java.lang.String
REL_PROJECT_SAMPLES
rel used for accessing the list of samples associated with a project.
-
Constructor Summary
Constructors Modifier Constructor Description protected
RESTProjectSamplesController()
RESTProjectSamplesController(ProjectService projectService, SampleService sampleService, org.springframework.context.MessageSource messageSource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseResource<Sample>
addSampleToProject(java.lang.Long projectId, @Valid Sample sample, javax.servlet.http.HttpServletResponse response)
Create a new sample resource and create a relationship between the sample and the project.ResponseResource<ResourceCollection<LabelledRelationshipResource<Project,Sample>>>
copySampleToProject(java.lang.Long projectId, java.util.List<java.lang.Long> sampleIds, boolean ownership, javax.servlet.http.HttpServletResponse response, java.util.Locale locale)
Copy an existing sample to a project.ResponseResource<Sample>
getProjectSample(java.lang.Long projectId, java.lang.Long sampleId)
Get the representation of a specific sample that's associated with the project.org.springframework.web.servlet.ModelAndView
getProjectSampleBySequencerId(java.lang.Long projectId, java.lang.String seqeuncerId)
Get samples by a given string nameResponseResource<ResourceCollection<Sample>>
getProjectSamples(java.lang.Long projectId)
ResponseResource<Sample>
getSample(java.lang.Long sampleId)
Read aSample
by its idResponseResource<RootResource>
removeSampleFromProject(java.lang.Long projectId, java.lang.Long sampleId)
ResponseResource<Sample>
updateSample(java.lang.Long sampleId, java.util.Map<java.lang.String,java.lang.Object> updatedFields)
Update aSample
details.
-
-
-
Field Detail
-
REL_PROJECT
public static final java.lang.String REL_PROJECT
Rel to get to the project that this sample belongs to.- See Also:
- Constant Field Values
-
REL_PROJECT_SAMPLES
public static final java.lang.String REL_PROJECT_SAMPLES
rel used for accessing the list of samples associated with a project.- See Also:
- Constant Field Values
-
REL_PROJECT_SAMPLE
public static final java.lang.String REL_PROJECT_SAMPLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RESTProjectSamplesController
protected RESTProjectSamplesController()
-
RESTProjectSamplesController
@Autowired public RESTProjectSamplesController(ProjectService projectService, SampleService sampleService, org.springframework.context.MessageSource messageSource)
-
-
Method Detail
-
copySampleToProject
@RequestMapping(value="/api/projects/{projectId}/samples", method=POST, consumes="application/idcollection+json") public ResponseResource<ResourceCollection<LabelledRelationshipResource<Project,Sample>>> copySampleToProject(@PathVariable java.lang.Long projectId, @RequestBody java.util.List<java.lang.Long> sampleIds, @RequestParam(name="ownership",defaultValue="false") boolean ownership, javax.servlet.http.HttpServletResponse response, java.util.Locale locale)
Copy an existing sample to a project.- Parameters:
projectId
- the project to copy the sample to.sampleIds
- the collection of sample IDs to copy.ownership
- Whether the receiving project should have ownership of the sampleresponse
- a reference to the servlet response.locale
- The user's in case a warning message is needed- Returns:
- the response indicating that the sample was joined to the project.
-
addSampleToProject
@RequestMapping(value="/api/projects/{projectId}/samples", method=POST, consumes="!application/idcollection+json") public ResponseResource<Sample> addSampleToProject(@PathVariable java.lang.Long projectId, @RequestBody @Valid @Valid Sample sample, javax.servlet.http.HttpServletResponse response)
Create a new sample resource and create a relationship between the sample and the project.- Parameters:
projectId
- the identifier of the project that you want to add the sample to.sample
- the sample that you want to create.response
- a reference to the servlet response.- Returns:
- a response indicating that the sample was created and appropriate location information.
-
getProjectSamples
@RequestMapping(value="/api/projects/{projectId}/samples", method=GET) public ResponseResource<ResourceCollection<Sample>> getProjectSamples(@PathVariable java.lang.Long projectId)
-
getProjectSampleBySequencerId
@RequestMapping(value="/api/projects/{projectId}/samples/bySequencerId/{seqeuncerId}", method=GET) public org.springframework.web.servlet.ModelAndView getProjectSampleBySequencerId(@PathVariable java.lang.Long projectId, @PathVariable java.lang.String seqeuncerId)
Get samples by a given string name- Parameters:
projectId
- the Project to get samples fromseqeuncerId
- the string id of the sample- Returns:
- The found sample
-
getProjectSample
@RequestMapping(value="/api/projects/{projectId}/samples/{sampleId}", method=GET) public ResponseResource<Sample> getProjectSample(@PathVariable java.lang.Long projectId, @PathVariable java.lang.Long sampleId)
Get the representation of a specific sample that's associated with the project.
-
getSample
@RequestMapping(value="/api/samples/{sampleId}", method=GET) public ResponseResource<Sample> getSample(@PathVariable java.lang.Long sampleId)
Read aSample
by its id- Parameters:
sampleId
- the id of theSample
to read- Returns:
- representation of the sample
-
removeSampleFromProject
@RequestMapping(value="/api/projects/{projectId}/samples/{sampleId}", method=DELETE) public ResponseResource<RootResource> removeSampleFromProject(@PathVariable java.lang.Long projectId, @PathVariable java.lang.Long sampleId)
-
updateSample
@RequestMapping(value="/api/samples/{sampleId}", method=PATCH, consumes="application/json") public ResponseResource<Sample> updateSample(@PathVariable java.lang.Long sampleId, @RequestBody java.util.Map<java.lang.String,java.lang.Object> updatedFields)
Update aSample
details.
-
-