Skip to content

Commit

Permalink
[Task 70050] fixes after master merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Raf-atmire committed May 6, 2020
1 parent 9e6a746 commit 5e21219
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
*/
package org.dspace.app.rest;

import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn;

import java.sql.SQLException;
import java.util.List;
Expand All @@ -30,7 +29,8 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PagedResourcesAssembler;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.PagedResources;
import org.springframework.hateoas.PagedModel;
import org.springframework.hateoas.server.mvc.WebMvcLinkBuilder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
Expand Down Expand Up @@ -72,7 +72,7 @@ public ProcessFileWrapperResource listFilesFromProcess(@PathVariable(name = "pro
}

@RequestMapping(method = RequestMethod.GET, value = "/{processId}/files/{fileType}")
public PagedResources<BitstreamResource> listFilesWithTypeFromProcess(
public PagedModel<BitstreamResource> listFilesWithTypeFromProcess(
@PathVariable(name = "processId") Integer processId,
@PathVariable(name = "fileType") String fileType,
Pageable pageable, PagedResourcesAssembler assembler) throws SQLException, AuthorizeException {
Expand All @@ -88,14 +88,15 @@ public PagedResources<BitstreamResource> listFilesWithTypeFromProcess(

Page<BitstreamResource> page = utils.getPage(bitstreamResources, pageable);

Link link = linkTo(
Link link = WebMvcLinkBuilder.linkTo(
methodOn(this.getClass()).listFilesWithTypeFromProcess(processId, fileType, pageable, assembler))
.withSelfRel();
PagedResources<BitstreamResource> result = assembler.toResource(page, link);
PagedModel<BitstreamResource> result = assembler.toModel(page, link);

return result;
}


@RequestMapping(method = RequestMethod.GET, value = "/{processId}/files/name/{fileName:.+}")
public BitstreamResource getBitstreamByName(@PathVariable(name = "processId") Integer processId,
@PathVariable(name = "fileName") String fileName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.dspace.app.rest.scripts.handler.impl.RestDSpaceRunnableHandler;
import org.dspace.authorize.AuthorizeException;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.scripts.DSpaceCommandLineParameter;
import org.dspace.scripts.DSpaceRunnable;
import org.dspace.scripts.configuration.ScriptConfiguration;
Expand Down

0 comments on commit 5e21219

Please sign in to comment.