reformat to DSpace style guidelines.

This commit is contained in:
Bill Tantzen
2018-05-10 15:32:48 -05:00
parent 76d60c2e94
commit 195bc622e9

View File

@@ -2,7 +2,7 @@
* The contents of this file are subject to the license and copyright * The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source * detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at * tree and available online at
* * <p>
* http://www.dspace.org/license/ * http://www.dspace.org/license/
*/ */
package org.dspace.app.rest; package org.dspace.app.rest;
@@ -61,7 +61,7 @@ public class IdentifierRestController implements InitializingBean {
List<Link> links = new ArrayList<Link>(); List<Link> links = new ArrayList<Link>();
Link l = new Link("/api", "pid"); Link l = new Link("/api", "pid");
links.add ( l ); links.add(l);
} }
@RequestMapping(method = RequestMethod.GET, value = "/{prefix}/{suffix}") @RequestMapping(method = RequestMethod.GET, value = "/{prefix}/{suffix}")
@@ -79,25 +79,21 @@ public class IdentifierRestController implements InitializingBean {
try { try {
dso = identifierService.resolve(context, prefix + "/" + suffix); dso = identifierService.resolve(context, prefix + "/" + suffix);
if ( dso != null ) { if (dso != null) {
DSpaceObjectRest dsor = convertDSpaceObject(dso); DSpaceObjectRest dsor = convertDSpaceObject(dso);
URI link = linkTo(dsor.getController(), dsor.getCategory(), URI link = linkTo(dsor.getController(), dsor.getCategory(),
English.plural(dsor.getType())) English.plural(dsor.getType()))
.slash(dsor.getId()).toUri(); .slash(dsor.getId()).toUri();
response.setStatus ( HttpServletResponse.SC_FOUND ); response.setStatus(HttpServletResponse.SC_FOUND);
response.sendRedirect ( link.toString() ); response.sendRedirect(link.toString());
} } else {
else {
response.setStatus ( HttpServletResponse.SC_NOT_FOUND );
}
}
catch (IdentifierNotFoundException e ) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND); response.setStatus(HttpServletResponse.SC_NOT_FOUND);
} }
catch (IdentifierNotResolvableException e) { } catch (IdentifierNotFoundException e) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND); response.setStatus(HttpServletResponse.SC_NOT_FOUND);
} } catch (IdentifierNotResolvableException e) {
finally { response.setStatus(HttpServletResponse.SC_NOT_FOUND);
} finally {
log.info("DBG " + "aborting context"); log.info("DBG " + "aborting context");
context.abort(); context.abort();
} }