66458: Use shared UUID regex instead of object's own one

This commit is contained in:
Peter Nijs
2019-11-22 13:27:01 +01:00
parent 4cc7cec563
commit 76347b0cf0
2 changed files with 6 additions and 14 deletions

View File

@@ -7,6 +7,8 @@
*/
package org.dspace.app.rest;
import static org.dspace.app.rest.utils.RegexUtils.REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID;
import java.io.IOException;
import java.sql.SQLException;
import java.util.UUID;
@@ -45,15 +47,9 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/api/" + CollectionRest.CATEGORY + "/" + CollectionRest.PLURAL_NAME
+ CollectionItemtemplateController.REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID + "/itemtemplate")
+ REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID + "/itemtemplate")
public class CollectionItemtemplateController {
/**
* Regular expression in the request mapping to accept UUID as identifier
*/
protected static final String REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID =
"/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}";
@Autowired
private Utils utils;

View File

@@ -7,6 +7,8 @@
*/
package org.dspace.app.rest;
import static org.dspace.app.rest.utils.RegexUtils.REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID;
import java.io.IOException;
import java.sql.SQLException;
import java.util.UUID;
@@ -42,15 +44,9 @@ import org.springframework.web.bind.annotation.RestController;
* Contrary to CollectionItemtemplateController, this class will receive the UUID of an Item template
*/
@RestController
@RequestMapping("/api/core/itemtemplates" + ItemtemplateRestController.REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID)
@RequestMapping("/api/core/itemtemplates" + REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID)
public class ItemtemplateRestController {
/**
* Regular expression in the request mapping to accept UUID as identifier
*/
protected static final String REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID =
"/{uuid:[0-9a-fxA-FX]{8}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{4}-[0-9a-fxA-FX]{12}}";
@Autowired
private Utils utils;