mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
Add support for : in string identifier
This commit is contained in:
@@ -149,7 +149,7 @@ public class RestResourceController implements InitializingBean {
|
||||
* @return single DSpaceResource
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = REGEX_REQUESTMAPPING_IDENTIFIER_AS_DIGIT)
|
||||
public DSpaceResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model,
|
||||
public HALResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model,
|
||||
@PathVariable Integer id) {
|
||||
return findOneInternal(apiCategory, model, id);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ public class RestResourceController implements InitializingBean {
|
||||
* @return single DSpaceResource
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = REGEX_REQUESTMAPPING_IDENTIFIER_AS_STRING_VERSION_STRONG)
|
||||
public DSpaceResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model,
|
||||
public HALResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model,
|
||||
@PathVariable String id) {
|
||||
return findOneInternal(apiCategory, model, id);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ public class RestResourceController implements InitializingBean {
|
||||
* @return single DSpaceResource
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = REGEX_REQUESTMAPPING_IDENTIFIER_AS_UUID)
|
||||
public DSpaceResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model,
|
||||
public HALResource<RestAddressableModel> findOne(@PathVariable String apiCategory, @PathVariable String model,
|
||||
@PathVariable UUID uuid) {
|
||||
return findOneInternal(apiCategory, model, uuid);
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class RestResourceController implements InitializingBean {
|
||||
* @param id Identifier from request
|
||||
* @return single DSpaceResource
|
||||
*/
|
||||
private <ID extends Serializable> DSpaceResource<RestAddressableModel> findOneInternal(String apiCategory,
|
||||
private <ID extends Serializable> HALResource<RestAddressableModel> findOneInternal(String apiCategory,
|
||||
String model, ID id) {
|
||||
DSpaceRestRepository<RestAddressableModel, ID> repository = utils.getResourceRepository(apiCategory, model);
|
||||
Optional<RestAddressableModel> modelObject = Optional.empty();
|
||||
|
@@ -28,7 +28,8 @@ public class RegexUtils {
|
||||
* identifier (digits or uuid)
|
||||
*/
|
||||
public static final String REGEX_REQUESTMAPPING_IDENTIFIER_AS_STRING_VERSION_STRONG = "/{id:^(?!^\\d+$)" +
|
||||
"(?!^[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}$)[\\w+\\-\\.]+$+}";
|
||||
"(?!^[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}$)"
|
||||
+ "[\\w+\\-\\.:]+$+}";
|
||||
|
||||
/**
|
||||
* Regular expression in the request mapping to accept number as identifier
|
||||
|
Reference in New Issue
Block a user