Skip to content

Commit

Permalink
BXC-4430 add javadocs and a bit of cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sharonluong committed Feb 22, 2024
1 parent aa0f178 commit 612e6c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
Expand All @@ -28,6 +27,9 @@
import static edu.unc.lib.boxc.auth.fcrepo.services.GroupsThreadStore.getAgentPrincipals;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;

/**
* Controller for handling view setting requests. This may include things like setting a viewBehavior.
*/
@Controller
public class ViewSettingController {
private static final Logger LOG = LoggerFactory.getLogger(ViewSettingController.class);
Expand All @@ -36,7 +38,11 @@ public class ViewSettingController {
@Autowired
private RepositoryObjectLoader repositoryObjectLoader;

@CrossOrigin
/**
* This endpoint gets the view settings of the object
* @param id UUID of the object
* @return json with the UUID and key value pairs that are the view setting : value and response status
*/
@GetMapping(value = "/edit/viewSettings/{id}", produces = APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<Object> getViewSetting(@PathVariable("id") String id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import edu.unc.lib.boxc.model.api.objects.WorkObject;
import edu.unc.lib.boxc.model.api.rdf.CdrView;
import edu.unc.lib.boxc.model.fcrepo.ids.PIDs;
import edu.unc.lib.boxc.operations.jms.viewSettings.ViewSettingRequest;
import edu.unc.lib.boxc.web.services.rest.MvcTestHelpers;
import edu.unc.lib.boxc.web.services.rest.exceptions.RestResponseEntityExceptionHandler;
import org.apache.jena.rdf.model.Resource;
Expand Down Expand Up @@ -80,7 +79,7 @@ void closeService() throws Exception {

@Test
public void testGetViewSetting() throws Exception {
var paged = ViewSettingRequest.ViewBehavior.PAGED.toString();
var paged = "paged";
when(resource.getProperty(eq(CdrView.viewBehavior))).thenReturn(stmt);
when(stmt.getString()).thenReturn(paged);

Expand Down

0 comments on commit 612e6c4

Please sign in to comment.