-
Notifications
You must be signed in to change notification settings - Fork 529
Add support for routing by handle #256
Copy link
Copy link
Closed
Labels
Difficulty: HighEstimated at more than 16 hoursEstimated at more than 16 hours
Milestone
Description
In order to support retrieving DSpace objects by handles, we'll add support for any kind of external identifier in one go:
- Create an IdentifierType enum containing the supported identifiers
- This is likely temporary, as eventually this list will come from rest as well, but if we need to replace it later, it's good to use an enum now, instead of strings everywhere.
- only add
UUID = 'uuid'andHANDLE = 'handle'for now
- Create an index that maps identifiers to self links
- Remove the IndexName enum. Since the available indices will depend on the available identifier we can no longer enumerate them. Instead
- replace
REQUESTby a constant - replace
OBJECTby agetIdentifierIndexName(idType: IdentifierType): stringmethod, that returnsobject/id-to-self-link/${idType} - remember to update all the places that use the old IndexName values
- replace
- Remove the IndexName enum. Since the available indices will depend on the available identifier we can no longer enumerate them. Instead
- Modify the IndexEffects, to update all ID indices instead of only the UUID index, every time an object is added to the cache
- Rename it to IdentifierIndexEffects
- In ObjectCacheService replace hasByUUID and getByUUID by hasByID and getByID methods that take the IdentifierType as an optional parameter, if it isn't specified, use UUID
- In DataService, do the same for findById()
- If the identifier is UUID, keep using the current endpoints
- Otherwise, use the new Rest Endpoint.
- Take in to account that creating the REST endpoint is a Sprint task as well, so if it doesn't exist yet, you won't be able to test this actual call.
- But due to the cache, this findBy method will still return objects that have been retrieved in another way and indexed in the id index.
- Create a DSODataService that does nothing but extend
Dataservice<NormalizedDspaceObject, DSpaceObject> - modify RequestService.isCachedOrPending() to check by other identifiers as well to determine if something is cached.
- currently it only checks the objectCache by selfLink, but if the request has a property associated with another configured identifier (e.g.
request[IdentifierType.HANDLE]) it should also checkhasByIDfor that IdentifierType.
- currently it only checks the objectCache by selfLink, but if the request has a property associated with another configured identifier (e.g.
- configure identifier based routes, that redirect to the DSOType based route
- routes should be
/id/${idType}/${id}- these are under
/idto prevent accidental clashes with other routes added by dspace or modules built on top of dspace later
- these are under
- Also add
/handle/${handle}for backwards compatibility. It should do the same thing as/id/handle/${handle} - Use
DSODataService.findById()to retrieve the object from the api and then redirect to${object.type}/${object.id} - Because it is already cached it should not be fetched again when that route is loaded.
- routes should be
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Difficulty: HighEstimated at more than 16 hoursEstimated at more than 16 hours