93803: Add missing docstrings

This commit is contained in:
Yura Bondarenko
2022-09-05 09:51:05 +02:00
parent ee26084d6a
commit 38203490c7
9 changed files with 90 additions and 26 deletions

View File

@@ -11,6 +11,9 @@ import { Item } from '../shared/item.model';
import { BaseDataService } from './base/base-data.service';
import { dataService } from './base/data-service.decorator';
/**
* Data service responsible for retrieving the access status of Items
*/
@Injectable()
@dataService(ACCESS_STATUS)
export class AccessStatusDataService extends BaseDataService<AccessStatusObject> {
@@ -26,7 +29,7 @@ export class AccessStatusDataService extends BaseDataService<AccessStatusObject>
/**
* Returns {@link RemoteData} of {@link AccessStatusObject} that is the access status of the given item
* @param item Item we want the access status of
* @param item Item we want the access status of
*/
findAccessStatusFor(item: Item): Observable<RemoteData<AccessStatusObject>> {
return this.findByHref(item._links.accessStatus.href);

View File

@@ -25,6 +25,11 @@ import { getDSORoute } from '../../app-routing-paths';
const ID_ENDPOINT = 'pid';
const UUID_ENDPOINT = 'dso';
/**
* A data service to retrieve DSpaceObjects by persistent identifier or UUID.
* Doesn't define a constant {@link linkPath} but switches between two endpoints on demand:
* {@link setLinkPath} must be called before each request.
*/
class DsoByIdOrUUIDDataService extends IdentifiableDataService<DSpaceObject> {
constructor(
protected requestService: RequestService,
@@ -56,6 +61,10 @@ class DsoByIdOrUUIDDataService extends IdentifiableDataService<DSpaceObject> {
}
}
/**
* A service to handle redirects from identifier paths to DSO path
* e.g.: redirect from /handle/... to /items/...
*/
@Injectable()
export class DsoRedirectService {
private dataService: DsoByIdOrUUIDDataService;
@@ -70,6 +79,11 @@ export class DsoRedirectService {
this.dataService = new DsoByIdOrUUIDDataService(requestService, rdbService, objectCache, halService);
}
/**
* Retrieve a DSpaceObject by
* @param id the identifier of the object to retrieve
* @param identifierType the type of the given identifier (defaults to UUID)
*/
findByIdAndIDType(id: string, identifierType = IdentifierType.UUID): Observable<RemoteData<DSpaceObject>> {
this.dataService.setLinkPath(identifierType);
return this.dataService.findById(id).pipe(

View File

@@ -1,24 +0,0 @@
/**
* 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
* tree and available online at
*
* http://www.dspace.org/license/
*/
import { RequestService } from './request.service';
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../cache/object-cache.service';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import { IdentifiableDataService } from './base/identifiable-data.service';
import { DSpaceObject } from '../shared/dspace-object.model';
export class PersistentIdentifierDataService extends IdentifiableDataService<DSpaceObject> {
constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super('pid', requestService, rdbService, objectCache, halService);
}
}