Class RESTSampleMetadataController
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.web.controller.api.samples.RESTSampleMetadataController
-
@Controller public class RESTSampleMetadataController extends java.lang.Object
REST controller to handle storing and retrieving metadata from aSample
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALL_METADATA_REL
static java.lang.String
METADATA_REL
static java.lang.String
SAMPLE_REL
-
Constructor Summary
Constructors Constructor Description RESTSampleMetadataController(SampleService sampleService, MetadataTemplateService metadataTemplateService, ProjectService projectService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResponseResource<SampleMetadataResponse>
addSampleMetadata(java.lang.Long sampleId, java.util.Map<java.lang.String,MetadataEntry> metadataMap)
Add select new metadata fields to theSample
.ResponseResource<ResourceCollection<SampleMetadataResponse>>
getProjectSampleMetadata(java.lang.Long projectId)
Get all the sample metadata for a givenProject
ResponseResource<SampleMetadataResponse>
getSampleMetadata(java.lang.Long sampleId)
Get the metadata for a givenSample
ResponseResource<SampleMetadataResponse>
saveSampleMetadata(java.lang.Long sampleId, java.util.Map<java.lang.String,MetadataEntry> metadataMap)
Save new metadata for aSample
.
-
-
-
Field Detail
-
METADATA_REL
public static final java.lang.String METADATA_REL
- See Also:
- Constant Field Values
-
ALL_METADATA_REL
public static final java.lang.String ALL_METADATA_REL
- See Also:
- Constant Field Values
-
SAMPLE_REL
public static final java.lang.String SAMPLE_REL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RESTSampleMetadataController
@Autowired public RESTSampleMetadataController(SampleService sampleService, MetadataTemplateService metadataTemplateService, ProjectService projectService)
-
-
Method Detail
-
getSampleMetadata
@RequestMapping(value="/api/samples/{sampleId}/metadata", method=GET) public ResponseResource<SampleMetadataResponse> getSampleMetadata(@PathVariable java.lang.Long sampleId)
Get the metadata for a givenSample
- Parameters:
sampleId
- the id of theSample
to get metadata for- Returns:
- the metadata for the sample
-
getProjectSampleMetadata
@RequestMapping(value="/api/projects/{projectId}/samples/metadata", method=GET) public ResponseResource<ResourceCollection<SampleMetadataResponse>> getProjectSampleMetadata(@PathVariable java.lang.Long projectId)
Get all the sample metadata for a givenProject
-
saveSampleMetadata
@RequestMapping(value="/api/samples/{sampleId}/metadata", method=POST) public ResponseResource<SampleMetadataResponse> saveSampleMetadata(@PathVariable java.lang.Long sampleId, @RequestBody java.util.Map<java.lang.String,MetadataEntry> metadataMap)
Save new metadata for aSample
. Note this will overwrite the existing metadata
-
addSampleMetadata
@RequestMapping(value="/api/samples/{sampleId}/metadata", method=PUT) public ResponseResource<SampleMetadataResponse> addSampleMetadata(@PathVariable java.lang.Long sampleId, @RequestBody java.util.Map<java.lang.String,MetadataEntry> metadataMap)
Add select new metadata fields to theSample
. Note this will only overwrite duplicate terms. Existing metadata will not be affected.
-
-