Class RESTProjectSamplesController


  • @Controller
    public class RESTProjectSamplesController
    extends java.lang.Object
    Controller for managing relationships between Project and Sample.
    • 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 sample
        response - 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)
        Get the list of Sample associated with this Project.
        Parameters:
        projectId - the identifier of the Project to get the Samples for.
        Returns:
        the list of Samples associated with this Project.
      • 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 from
        seqeuncerId - 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.
        Parameters:
        projectId - the Project identifier that the Sample should be associated with.
        sampleId - the Sample identifier that we're looking for.
        Returns:
        a representation of the specific sample.
      • getSample

        @RequestMapping(value="/api/samples/{sampleId}",
                        method=GET)
        public ResponseResource<Sample> getSample​(@PathVariable
                                                  java.lang.Long sampleId)
        Read a Sample by its id
        Parameters:
        sampleId - the id of the Sample 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)
        Remove a specific Sample from the collection of Samples associated with a Project.
        Parameters:
        projectId - the Project identifier.
        sampleId - the Sample identifier.
        Returns:
        a response including links back to the specific Project and collection of Sample.
      • 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 a Sample details.
        Parameters:
        sampleId - the identifier of the Sample.
        updatedFields - the updated fields of the Sample.
        Returns:
        a response including links to the Project and Sample.