add docs, process PR feedback

This commit is contained in:
Art Lowel
2020-02-20 11:00:43 +01:00
parent f7f6600806
commit dea6638c1f
43 changed files with 225 additions and 91 deletions

View File

@@ -54,7 +54,7 @@ export class AuthStatus implements CacheableObject {
authenticated: boolean;
/**
* The HALLinks for this AuthStatus
* The {@link HALLink}s for this AuthStatus
*/
@deserialize
_links: {
@@ -64,7 +64,7 @@ export class AuthStatus implements CacheableObject {
/**
* The EPerson of this auth status
* Will be undefined unless the eperson HALLink has been resolved.
* Will be undefined unless the eperson {@link HALLink} has been resolved.
*/
@link(EPERSON)
eperson?: Observable<RemoteData<EPerson>>;

View File

@@ -86,7 +86,7 @@ export class LinkDefinition<T extends HALResource> {
* @param resourceType the resource type of the object(s) the link retrieves
* @param isList an optional boolean indicating whether or not it concerns a list,
* defaults to false
* @param linkName an optional string in case the HALLink name differs from the
* @param linkName an optional string in case the {@link HALLink} name differs from the
* property name
*/
export const link = <T extends HALResource>(

View File

@@ -7,7 +7,7 @@ import { getDataServiceFor, getLinkDefinition, getLinkDefinitions, LinkDefinitio
/**
* A Service to handle the resolving and removing
* of resolved HALLinks on HALResources
* of resolved {@link HALLink}s on HALResources
*/
@Injectable({
providedIn: 'root'

View File

@@ -38,7 +38,7 @@ export class RemoteDataBuildService {
* Creates a single {@link RemoteData} object based on the response of a request to the REST server, with a list of
* {@link FollowLinkConfig} that indicate which embedded info should be added to the object
* @param href$ Observable href of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
buildSingle<T extends CacheableObject>(href$: string | Observable<string>, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<T>> {
if (typeof href$ === 'string') {
@@ -122,7 +122,7 @@ export class RemoteDataBuildService {
* Creates a list of {@link RemoteData} objects based on the response of a request to the REST server, with a list of
* {@link FollowLinkConfig} that indicate which embedded info should be added to the objects
* @param href$ Observable href of objects we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
buildList<T extends CacheableObject>(href$: string | Observable<string>, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
if (typeof href$ === 'string') {

View File

@@ -43,7 +43,7 @@ export class SubmissionSectionModel extends ConfigObject {
visibility: SubmissionSectionVisibility;
/**
* The HALLinks for this SubmissionSectionModel
* The {@link HALLink}s for this SubmissionSectionModel
*/
@deserialize
_links: {

View File

@@ -25,12 +25,18 @@ import { RemoteDataError } from './remote-data-error';
import { FindListOptions } from './request.models';
import { RequestService } from './request.service';
/**
* A service to retrieve {@link Bitstream}s from the REST API
*/
@Injectable({
providedIn: 'root'
})
@dataService(BITSTREAM)
export class BitstreamDataService extends DataService<Bitstream> {
/**
* The HAL path to the bitstream endpoint
*/
protected linkPath = 'bitstreams';
constructor(
@@ -49,7 +55,7 @@ export class BitstreamDataService extends DataService<Bitstream> {
}
/**
* Retrieves the bitstreams in a given bundle
* Retrieves the {@link Bitstream}s in a given bundle
*
* @param bundle the bundle to retrieve bitstreams from
* @param options options for the find all request
@@ -60,9 +66,9 @@ export class BitstreamDataService extends DataService<Bitstream> {
/**
* Retrieves the thumbnail for the given item
* @returns {Observable<RemoteData<Bitstream>>} the first bitstream in the THUMBNAIL bundle
* @returns {Observable<RemoteData<{@link Bitstream}>>} the first bitstream in the THUMBNAIL bundle
*/
// TODO should be implemented rest side. Item should get a thumbnail link
// TODO should be implemented rest side. {@link Item} should get a thumbnail link
public getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
return this.bundleService.findByItemAndName(item, 'THUMBNAIL').pipe(
switchMap((bundleRD: RemoteData<Bundle>) => {
@@ -89,6 +95,15 @@ export class BitstreamDataService extends DataService<Bitstream> {
);
}
/**
* Retrieve the matching thumbnail for a {@link Bitstream}.
*
* The {@link Item} is technically redundant, but is available
* in all current use cases, and having it simplifies this method
*
* @param item The {@link Item} the {@link Bitstream} and its thumbnail are a part of
* @param bitstreamInOriginal The original {@link Bitstream} to find the thumbnail for
*/
// TODO should be implemented rest side
public getMatchingThumbnail(item: Item, bitstreamInOriginal: Bitstream): Observable<RemoteData<Bitstream>> {
return this.bundleService.findByItemAndName(item, 'THUMBNAIL').pipe(
@@ -129,6 +144,17 @@ export class BitstreamDataService extends DataService<Bitstream> {
);
}
/**
* Retrieve all {@link Bitstream}s in a certain {@link Bundle}.
*
* The {@link Item} is technically redundant, but is available
* in all current use cases, and having it simplifies this method
*
* @param item the {@link Item} the {@link Bundle} is a part of
* @param bundleName the name of the {@link Bundle} we want to find {@link Bitstream}s for
* @param options the {@link FindListOptions} for the request
* @param linksToFollow the {@link FollowLinkConfig}s for the request
*/
public findAllByItemAndBundleName(item: Item, bundleName: string, options?: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<Bitstream>>): Observable<RemoteData<PaginatedList<Bitstream>>> {
return this.bundleService.findByItemAndName(item, bundleName).pipe(
switchMap((bundleRD: RemoteData<Bundle>) => {

View File

@@ -22,7 +22,7 @@ import { FindListOptions } from './request.models';
import { RequestService } from './request.service';
/**
* A service responsible for fetching/sending data from/to the REST API on the bundles endpoint
* A service to retrieve {@link Bundle}s from the REST API
*/
@Injectable(
{providedIn: 'root'}
@@ -43,10 +43,24 @@ export class BundleDataService extends DataService<Bundle> {
super();
}
/**
* Retrieve all {@link Bundle}s in the given {@link Item}
*
* @param item the {@link Item} the {@link Bundle}s are a part of
* @param options the {@link FindListOptions} for the request
* @param linksToFollow the {@link FollowLinkConfig}s for the request
*/
findAllByItem(item: Item, options?: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<Bundle>>): Observable<RemoteData<PaginatedList<Bundle>>> {
return this.findAllByHref(item._links.bundles.href, options, ...linksToFollow);
}
/**
* Retrieve a {@link Bundle} in the given {@link Item} by name
*
* @param item the {@link Item} the {@link Bundle}s are a part of
* @param bundleName the name of the {@link Bundle} to retrieve
* @param linksToFollow the {@link FollowLinkConfig}s for the request
*/
// TODO should be implemented rest side
findByItemAndName(item: Item, bundleName: string, ...linksToFollow: Array<FollowLinkConfig<Bundle>>): Observable<RemoteData<Bundle>> {
return this.findAllByItem(item, { elementsPerPage: Number.MAX_SAFE_INTEGER }, ...linksToFollow).pipe(

View File

@@ -209,7 +209,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
* Fetches a list of items that are mapped to a collection
* @param collectionId The id of the collection
* @param searchOptions Search options to sort or filter out items
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
getMappedItems(collectionId: string, searchOptions?: PaginatedSearchOptions, ...linksToFollow: Array<FollowLinkConfig<Item>>): Observable<RemoteData<PaginatedList<DSpaceObject>>> {
const requestUuid = this.requestService.generateRequestId();

View File

@@ -152,7 +152,7 @@ export abstract class DataService<T extends CacheableObject> {
/**
* Returns {@link RemoteData} of all object with a list of {@link FollowLinkConfig}, to indicate which embedded
* info should be added to the objects
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findAll(options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
return this.findList(this.getFindAllHref(options), options, ...linksToFollow);
@@ -160,9 +160,9 @@ export abstract class DataService<T extends CacheableObject> {
/**
* Returns an observable of {@link RemoteData} of an object, based on href observable,
* with a list of {@link FollowLinkConfig}, to automatically resolve HALLinks of the object
* with a list of {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
* @param href$ Observable of href of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
protected findList(href$, options: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<T>>) {
href$.pipe(
@@ -189,9 +189,9 @@ export abstract class DataService<T extends CacheableObject> {
/**
* Returns an observable of {@link RemoteData} of an object, based on its ID, with a list of {@link FollowLinkConfig},
* to automatically resolve HALLinks of the object
* to automatically resolve {@link HALLink}s of the object
* @param id ID of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findById(id: string, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<T>> {
@@ -213,9 +213,9 @@ export abstract class DataService<T extends CacheableObject> {
/**
* Returns an observable of {@link RemoteData} of an object, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve HALLinks of the object
* @param href Href of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* to automatically resolve {@link HALLink}s of the object
* @param href The url of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByHref(href: string, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<T>> {
const requestHref = this.buildHrefFromFindOptions(href, {}, []);
@@ -229,9 +229,9 @@ export abstract class DataService<T extends CacheableObject> {
/**
* Returns a list of observables of {@link RemoteData} of objects, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve HALLinks of the object
* @param id ID of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* to automatically resolve {@link HALLink}s of the object
* @param href The url of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findAllByHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
const requestHref = this.buildHrefFromFindOptions(href, findListOptions, []);

View File

@@ -19,6 +19,10 @@ import { FindListOptions } from './request.models';
import { RequestService } from './request.service';
/* tslint:disable:max-classes-per-file */
/**
* A private DataService implementation to delegate specific methods to.
*/
class DataServiceImpl extends DataService<ItemType> {
protected linkPath = 'entitytypes';
@@ -35,9 +39,15 @@ class DataServiceImpl extends DataService<ItemType> {
}
}
/**
* A service to retrieve {@link ItemType}s from the REST API.
*/
@Injectable()
@dataService(ITEM_TYPE)
export class ItemTypeDataService {
/**
* A private DataService instance to delegate specific methods to.
*/
private dataService: DataServiceImpl;
constructor(
@@ -53,20 +63,20 @@ export class ItemTypeDataService {
}
/**
* Returns an observable of {@link RemoteData} of an object, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve HALLinks of the object
* @param href Href of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* Returns an observable of {@link RemoteData} of an {@link ItemType}, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve {@link HALLink}s of the {@link ItemType}
* @param href The url of {@link ItemType} we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByHref(href: string, ...linksToFollow: Array<FollowLinkConfig<ItemType>>): Observable<RemoteData<ItemType>> {
return this.dataService.findByHref(href, ...linksToFollow);
}
/**
* Returns a list of observables of {@link RemoteData} of objects, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve HALLinks of the object
* @param id ID of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* Returns a list of observables of {@link RemoteData} of {@link ItemType}s, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve {@link HALLink}s of the {@link ItemType}
* @param href The url of the {@link ItemType} we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByAllHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<ItemType>>): Observable<RemoteData<PaginatedList<ItemType>>> {
return this.dataService.findAllByHref(href, findListOptions, ...linksToFollow);

View File

@@ -54,7 +54,7 @@ export class EntityTypeService extends DataService<ItemType> {
/**
* Get the allowed relationship types for an entity type
* @param entityTypeId
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
getEntityTypeRelationships(entityTypeId: string, ...linksToFollow: Array<FollowLinkConfig<RelationshipType>>): Observable<RemoteData<PaginatedList<RelationshipType>>> {

View File

@@ -19,6 +19,10 @@ import { FindListOptions } from './request.models';
import { RequestService } from './request.service';
/* tslint:disable:max-classes-per-file */
/**
* A private DataService implementation to delegate specific methods to.
*/
class DataServiceImpl extends DataService<License> {
protected linkPath = '';
@@ -35,9 +39,15 @@ class DataServiceImpl extends DataService<License> {
}
}
/**
* A service to retrieve {@link License}s from the REST API.
*/
@Injectable()
@dataService(LICENSE)
export class LicenseDataService {
/**
* A private DataService instance to delegate specific methods to.
*/
private dataService: DataServiceImpl;
constructor(
@@ -52,10 +62,22 @@ export class LicenseDataService {
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
}
/**
* Returns an observable of {@link RemoteData} of a {@link License}, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve {@link HALLink}s of the {@link License}
* @param href The URL of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByHref(href: string, ...linksToFollow: Array<FollowLinkConfig<License>>): Observable<RemoteData<License>> {
return this.dataService.findByHref(href, ...linksToFollow);
}
/**
* Returns a list of observables of {@link RemoteData} of {@link License}s, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve {@link HALLink}s of the {@link License}
* @param href The URL of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByAllHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<License>>): Observable<RemoteData<PaginatedList<License>>> {
return this.dataService.findAllByHref(href, findListOptions, ...linksToFollow);
}

View File

@@ -23,6 +23,10 @@ import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service';
import { PaginatedList } from './paginated-list';
/* tslint:disable:max-classes-per-file */
/**
* A private DataService implementation to delegate specific methods to.
*/
class DataServiceImpl extends DataService<ResourcePolicy> {
protected linkPath = 'resourcepolicies';
@@ -59,14 +63,32 @@ export class ResourcePolicyService {
this.dataService = new DataServiceImpl(requestService, rdbService, null, objectCache, halService, notificationsService, http, comparator);
}
/**
* Returns an observable of {@link RemoteData} of a {@link ResourcePolicy}, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve {@link HALLink}s of the {@link ResourcePolicy}
* @param href The url of {@link ResourcePolicy} we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByHref(href: string, ...linksToFollow: Array<FollowLinkConfig<ResourcePolicy>>): Observable<RemoteData<ResourcePolicy>> {
return this.dataService.findByHref(href, ...linksToFollow);
}
/**
* Returns a list of observables of {@link RemoteData} of {@link ResourcePolicy}s, based on an href, with a list of {@link FollowLinkConfig},
* to automatically resolve {@link HALLink}s of the {@link ResourcePolicy}
* @param href The url of the {@link ResourcePolicy} we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findAllByHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<ResourcePolicy>>): Observable<RemoteData<PaginatedList<ResourcePolicy>>> {
return this.dataService.findAllByHref(href, findListOptions, ...linksToFollow);
}
/**
* Return the defaultAccessConditions {@link ResourcePolicy} list for a given {@link Collection}
*
* @param collection the {@link Collection} to retrieve the defaultAccessConditions for
* @param findListOptions the {@link FindListOptions} for the request
*/
getDefaultAccessConditionsFor(collection: Collection, findListOptions?: FindListOptions): Observable<RemoteData<PaginatedList<ResourcePolicy>>> {
return this.dataService.findAllByHref(collection._links.defaultAccessConditions.href, findListOptions);
}

View File

@@ -13,6 +13,9 @@ import { HALEndpointService } from '../shared/hal-endpoint.service';
import { EPerson } from './models/eperson.model';
import { EPERSON } from './models/eperson.resource-type';
/**
* A service to retrieve {@link EPerson}s from the REST API
*/
@Injectable()
@dataService(EPERSON)
export class EPersonDataService extends DataService<EPerson> {

View File

@@ -71,7 +71,7 @@ export class EPerson extends DSpaceObject {
/**
* The list of Groups this EPerson is part of
* Will be undefined unless the groups HALLink has been resolved.
* Will be undefined unless the groups {@link HALLink} has been resolved.
*/
@link(GROUP, true)
public groups?: Observable<RemoteData<PaginatedList<Group>>>;

View File

@@ -26,7 +26,7 @@ export class Group extends DSpaceObject {
public permanent: boolean;
/**
* The HALLinks for this Group
* The {@link HALLink}s for this Group
*/
@deserialize
_links: {
@@ -36,7 +36,7 @@ export class Group extends DSpaceObject {
/**
* The list of Groups this Group is part of
* Will be undefined unless the groups HALLink has been resolved.
* Will be undefined unless the groups {@link HALLink} has been resolved.
*/
@link(GROUP, true)
public groups?: Observable<RemoteData<PaginatedList<Group>>>;

View File

@@ -47,7 +47,7 @@ export class AuthorityValue extends IntegrationModel implements MetadataValueInt
language: string;
/**
* The HALLinks for this AuthorityValue
* The {@link HALLink}s for this AuthorityValue
*/
@deserialize
_links: {

View File

@@ -49,7 +49,7 @@ export class MetadataField extends ListableObject implements HALResource {
scopeNote: string;
/**
* The HALLinks for this MetadataField
* The {@link HALLink}s for this MetadataField
*/
@deserialize
_links: {
@@ -59,7 +59,7 @@ export class MetadataField extends ListableObject implements HALResource {
/**
* The MetadataSchema for this MetadataField
* Will be undefined unless the schema HALLink has been resolved.
* Will be undefined unless the schema {@link HALLink} has been resolved.
*/
// TODO the responseparsingservice assumes schemas are always embedded. This should use remotedata, and be a link instead.
// @link(METADATA_SCHEMA)

View File

@@ -10,7 +10,7 @@ export class RegistryBitstreamformatsResponse {
page: PageInfo;
/**
* The HALLinks for this RegistryBitstreamformatsResponse
* The {@link HALLink}s for this RegistryBitstreamformatsResponse
*/
@deserialize
_links: {

View File

@@ -75,7 +75,7 @@ export class BitstreamFormat implements CacheableObject {
id: string;
/**
* The HALLinks for this BitstreamFormat
* The {@link HALLink}s for this BitstreamFormat
*/
@deserialize
_links: {

View File

@@ -33,7 +33,7 @@ export class Bitstream extends DSpaceObject implements HALResource {
bundleName: string;
/**
* The HALLinks for this Bitstream
* The {@link HALLink}s for this Bitstream
*/
@deserialize
_links: {
@@ -45,14 +45,14 @@ export class Bitstream extends DSpaceObject implements HALResource {
/**
* The thumbnail for this Bitstream
* Needs to be resolved first, but isn't available as a HALLink yet
* Needs to be resolved first, but isn't available as a {@link HALLink} yet
* Use BitstreamDataService.getThumbnailFor(…) for now.
*/
thumbnail?: Observable<RemoteData<Bitstream>>;
/**
* The BitstreamFormat of this Bitstream
* Will be undefined unless the format HALLink has been resolved.
* Will be undefined unless the format {@link HALLink} has been resolved.
*/
@link(BITSTREAM_FORMAT)
format?: Observable<RemoteData<BitstreamFormat>>;

View File

@@ -10,7 +10,7 @@ export class Bundle extends DSpaceObject {
static type = BUNDLE;
/**
* The HALLinks for this Bundle
* The {@link HALLink}s for this Bundle
*/
@deserialize
_links: {

View File

@@ -25,7 +25,7 @@ export class Collection extends DSpaceObject {
handle: string;
/**
* The HALLinks for this Collection
* The {@link HALLink}s for this Collection
*/
@deserialize
_links: {
@@ -40,21 +40,21 @@ export class Collection extends DSpaceObject {
/**
* The license for this Collection
* Will be undefined unless the license HALLink has been resolved.
* Will be undefined unless the license {@link HALLink} has been resolved.
*/
@link(LICENSE)
license?: Observable<RemoteData<License>>;
/**
* The logo for this Collection
* Will be undefined unless the logo HALLink has been resolved.
* Will be undefined unless the logo {@link HALLink} has been resolved.
*/
@link(BITSTREAM)
logo?: Observable<RemoteData<Bitstream>>;
/**
* The default access conditions for this Collection
* Will be undefined unless the defaultAccessConditions HALLink has been resolved.
* Will be undefined unless the defaultAccessConditions {@link HALLink} has been resolved.
*/
@link(RESOURCE_POLICY, true)
defaultAccessConditions?: Observable<RemoteData<PaginatedList<ResourcePolicy>>>;

View File

@@ -23,7 +23,7 @@ export class Community extends DSpaceObject {
handle: string;
/**
* The HALLinks for this Community
* The {@link HALLink}s for this Community
*/
@deserialize
_links: {
@@ -35,21 +35,21 @@ export class Community extends DSpaceObject {
/**
* The logo for this Community
* Will be undefined unless the logo HALLink has been resolved.
* Will be undefined unless the logo {@link HALLink} has been resolved.
*/
@link(BITSTREAM)
logo?: Observable<RemoteData<Bitstream>>;
/**
* The list of Collections that are direct children of this Community
* Will be undefined unless the collections HALLink has been resolved.
* Will be undefined unless the collections {@link HALLink} has been resolved.
*/
@link(COLLECTION, true)
collections?: Observable<RemoteData<PaginatedList<Collection>>>;
/**
* The list of Communities that are direct children of this Community
* Will be undefined unless the subcommunities HALLink has been resolved.
* Will be undefined unless the subcommunities {@link HALLink} has been resolved.
*/
@link(COMMUNITY, true)
subcommunities?: Observable<RemoteData<PaginatedList<Community>>>;

View File

@@ -55,7 +55,7 @@ export class ContentSource implements HALResource {
metadataConfigs: MetadataConfig[];
/**
* The HALLinks for this ContentSource
* The {@link HALLink}s for this ContentSource
*/
@deserialize
_links: {

View File

@@ -53,7 +53,7 @@ export class ExternalSourceEntry extends ListableObject {
metadata: MetadataMap;
/**
* The HALLinks for this ExternalSourceEntry
* The {@link HALLink}s for this ExternalSourceEntry
*/
@deserialize
_links: {

View File

@@ -39,7 +39,7 @@ export class ExternalSource extends CacheableObject {
hierarchical: boolean;
/**
* The HALLinks for this ExternalSource
* The {@link HALLink}s for this ExternalSource
*/
@deserialize
_links: {

View File

@@ -1,5 +1,23 @@
/**
* A single link in the _links section of a {@link HALResource}
*/
export class HALLink {
/**
* The url of the {@link HALLink}'s target
*/
href: string;
/**
* The name of the {@link HALLink}
*/
name?: string;
/**
* A boolean indicating whether the href contains a template.
*
* e.g. if href is "http://haltalk.herokuapp.com/docs/{rel}"
* {rel} would be the template
*/
templated?: boolean
}

View File

@@ -1,8 +1,23 @@
import { HALLink } from './hal-link.model';
/**
* Represents HAL resources.
*
* A HAL resource has a _links section with at least a self link.
*/
export class HALResource {
/**
* The {@link HALLink}s for this {@link HALResource}
*/
_links: {
/**
* The {@link HALLink} that refers to this {@link HALResource}
*/
self: HALLink
/**
* {@link HALLink}s to related {@link HALResource}s
*/
[k: string]: HALLink;
};
}

View File

@@ -39,7 +39,7 @@ export class ItemType implements CacheableObject {
uuid: string;
/**
* The HALLinks for this ItemType
* The {@link HALLink}s for this ItemType
*/
@deserialize
_links: {

View File

@@ -82,7 +82,7 @@ export class RelationshipType implements CacheableObject {
rightMinCardinality: number;
/**
* The HALLinks for this RelationshipType
* The {@link HALLink}s for this RelationshipType
*/
@deserialize
_links: {
@@ -93,14 +93,14 @@ export class RelationshipType implements CacheableObject {
/**
* The type of Item found on the left side of this RelationshipType
* Will be undefined unless the leftType HALLink has been resolved.
* Will be undefined unless the leftType {@link HALLink} has been resolved.
*/
@link(ITEM_TYPE)
leftType?: Observable<RemoteData<ItemType>>;
/**
* The type of Item found on the right side of this RelationshipType
* Will be undefined unless the rightType HALLink has been resolved.
* Will be undefined unless the rightType {@link HALLink} has been resolved.
*/
@link(ITEM_TYPE)
rightType?: Observable<RemoteData<ItemType>>;

View File

@@ -66,7 +66,7 @@ export class Relationship implements CacheableObject {
rightwardValue: string;
/**
* The HALLinks for this Relationship
* The {@link HALLink}s for this Relationship
*/
@deserialize
_links: {
@@ -78,21 +78,21 @@ export class Relationship implements CacheableObject {
/**
* The item on the left side of this relationship
* Will be undefined unless the leftItem HALLink has been resolved.
* Will be undefined unless the leftItem {@link HALLink} has been resolved.
*/
@link(ITEM)
leftItem?: Observable<RemoteData<Item>>;
/**
* The item on the right side of this relationship
* Will be undefined unless the rightItem HALLink has been resolved.
* Will be undefined unless the rightItem {@link HALLink} has been resolved.
*/
@link(ITEM)
rightItem?: Observable<RemoteData<Item>>;
/**
* The RelationshipType for this Relationship
* Will be undefined unless the relationshipType HALLink has been resolved.
* Will be undefined unless the relationshipType {@link HALLink} has been resolved.
*/
@link(RELATIONSHIP_TYPE)
relationshipType?: Observable<RemoteData<RelationshipType>>;

View File

@@ -57,7 +57,7 @@ export class Item extends DSpaceObject {
isWithdrawn: boolean;
/**
* The HALLinks for this Item
* The {@link HALLink}s for this Item
*/
@deserialize
_links: {
@@ -71,21 +71,21 @@ export class Item extends DSpaceObject {
/**
* The owning Collection for this Item
* Will be undefined unless the owningCollection HALLink has been resolved.
* Will be undefined unless the owningCollection {@link HALLink} has been resolved.
*/
@link(COLLECTION)
owningCollection?: Observable<RemoteData<Collection>>;
/**
* The list of Bundles inside this Item
* Will be undefined unless the bundles HALLink has been resolved.
* Will be undefined unless the bundles {@link HALLink} has been resolved.
*/
@link(BUNDLE, true)
bundles?: Observable<RemoteData<PaginatedList<Bundle>>>;
/**
* The list of Relationships this Item has with others
* Will be undefined unless the relationships HALLink has been resolved.
* Will be undefined unless the relationships {@link HALLink} has been resolved.
*/
@link(RELATIONSHIP, true)
relationships?: Observable<RemoteData<PaginatedList<Relationship>>>;

View File

@@ -33,7 +33,7 @@ export class PageInfo implements HALResource {
currentPage: number;
/**
* The HALLinks for this PageInfo
* The {@link HALLink}s for this PageInfo
*/
@deserialize
_links: {

View File

@@ -49,7 +49,7 @@ export class ResourcePolicy implements CacheableObject {
uuid: string;
/**
* The HALLinks for this ResourcePolicy
* The {@link HALLink}s for this ResourcePolicy
*/
@deserialize
_links: {

View File

@@ -39,7 +39,7 @@ export abstract class SubmissionObject extends DSpaceObject implements Cacheable
/**
* The collection this submission applies to
* Will be undefined unless the collection HALLink has been resolved.
* Will be undefined unless the collection {@link HALLink} has been resolved.
*/
@link(COLLECTION)
collection?: Observable<RemoteData<Collection>> | Collection;
@@ -57,7 +57,7 @@ export abstract class SubmissionObject extends DSpaceObject implements Cacheable
errors: SubmissionObjectError[];
/**
* The HALLinks for this SubmissionObject
* The {@link HALLink}s for this SubmissionObject
*/
@deserialize
_links: {
@@ -74,20 +74,20 @@ export abstract class SubmissionObject extends DSpaceObject implements Cacheable
/**
* The submission item
* Will be undefined unless the item HALLink has been resolved.
* Will be undefined unless the item {@link HALLink} has been resolved.
*/
@link(ITEM)
item?: Observable<RemoteData<Item>> | Item;
/**
* The configuration object that define this submission
* Will be undefined unless the submissionDefinition HALLink has been resolved.
* Will be undefined unless the submissionDefinition {@link HALLink} has been resolved.
*/
@link(SubmissionDefinitionsModel.type)
submissionDefinition?: Observable<RemoteData<SubmissionDefinitionsModel>> | SubmissionDefinitionsModel;
/**
* The submitter for this SubmissionObject
* Will be undefined unless the submitter HALLink has been resolved.
* Will be undefined unless the submitter {@link HALLink} has been resolved.
*/
@link(EPERSON)
submitter?: Observable<RemoteData<EPerson>> | EPerson;

View File

@@ -28,7 +28,7 @@ export class SubmissionObjectDataService {
* Retrieve a submission object based on its ID.
*
* @param id The identifier of a submission object
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which HALLinks should be automatically resolved
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findById(id: string, ...linksToFollow: Array<FollowLinkConfig<SubmissionObject>>): Observable<RemoteData<SubmissionObject>> {
switch (this.submissionService.getSubmissionScope()) {

View File

@@ -12,8 +12,6 @@ import { BaseResponseParsingService } from '../data/base-response-parsing.servic
import { GLOBAL_CONFIG } from '../../../config';
import { GlobalConfig } from '../../../config/global-config.interface';
import { ObjectCacheService } from '../cache/object-cache.service';
import { Serializer } from '../serializer';
import { GenericConstructor } from '../shared/generic-constructor';
import { FormFieldMetadataValueObject } from '../../shared/form/builder/models/form-field-metadata-value.model';
import { SubmissionObject } from './models/submission-object.model';
import { WorkflowItem } from './models/workflowitem.model';
@@ -78,6 +76,17 @@ export function normalizeSectionData(obj: any, objIndex?: number) {
export class SubmissionResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
protected toCache = false;
/**
* The submission assumes certain related HALResources will always be embedded.
* It only works if the responseparser finds these embedded resources, and directly
* attaches them to the requested object, instead of putting them in the cache and
* treating them as separate objects. This boolean was added to allow us to disable
* that behavior for the rest of the application, while keeping it for the submission.
*
* It should be removed after the submission has been refactored to treat embeds as
* resources that may need to be retrieved separately.
*/
protected shouldDirectlyAttachEmbeds = true;
constructor(@Inject(GLOBAL_CONFIG) protected EnvConfig: GlobalConfig,

View File

@@ -40,7 +40,7 @@ export class TaskObject extends DSpaceObject implements CacheableObject {
action: string;
/**
* The HALLinks for this TaskObject
* The {@link HALLink}s for this TaskObject
*/
@deserialize
_links: {
@@ -52,21 +52,21 @@ export class TaskObject extends DSpaceObject implements CacheableObject {
/**
* The EPerson for this task
* Will be undefined unless the eperson HALLink has been resolved.
* Will be undefined unless the eperson {@link HALLink} has been resolved.
*/
@link(EPERSON)
eperson?: Observable<RemoteData<EPerson>>;
/**
* The Group for this task
* Will be undefined unless the group HALLink has been resolved.
* Will be undefined unless the group {@link HALLink} has been resolved.
*/
@link(GROUP)
group?: Observable<RemoteData<Group>>;
/**
* The WorkflowItem for this task
* Will be undefined unless the workflowitem HALLink has been resolved.
* Will be undefined unless the workflowitem {@link HALLink} has been resolved.
*/
@link(WorkflowItem.type)
workflowitem?: Observable<RemoteData<WorkflowItem>> | WorkflowItem;

View File

@@ -54,10 +54,6 @@ export class WorkspaceitemActionsComponent extends MyDSpaceActionsComponent<Work
super(WorkspaceItem.type, injector, router, notificationsService, translate, searchService, requestService);
}
ngOnInit() {
console.log('ngOnInit', this.object);
}
/**
* Delete the target workspaceitem object
*/
@@ -82,7 +78,6 @@ export class WorkspaceitemActionsComponent extends MyDSpaceActionsComponent<Work
* @param {WorkspaceItem} object
*/
initObjects(object: WorkspaceItem) {
console.log('object', object);
this.object = object;
}

View File

@@ -25,7 +25,7 @@ export class FacetValue implements HALResource {
count: number;
/**
* The HALLinks for this FacetValue
* The {@link HALLink}s for this FacetValue
*/
@deserialize
_links: {

View File

@@ -20,7 +20,7 @@ export class SearchResult<T extends DSpaceObject> extends ListableObject {
hitHighlights: MetadataMap;
/**
* The HALLinks for this SearchResult
* The {@link HALLink}s for this SearchResult
*/
@deserialize
_links: {

View File

@@ -2,12 +2,12 @@ import { FindListOptions } from '../../core/data/request.models';
import { HALResource } from '../../core/shared/hal-resource.model';
/**
* A class to configure the retrieval of a HALLink
* A class to configure the retrieval of a {@link HALLink}
*/
export class FollowLinkConfig<R extends HALResource> {
/**
* The name of the link to fetch.
* Can only be a HALLink of the object you're working with
* Can only be a {@link HALLink} of the object you're working with
*/
name: keyof R['_links'];
@@ -30,7 +30,7 @@ export class FollowLinkConfig<R extends HALResource> {
* in order to create them in a less verbose way.
*
* @param linkName: the name of the link to fetch.
* Can only be a HALLink of the object you're working with
* Can only be a {@link HALLink} of the object you're working with
* @param findListOptions: {@link FindListOptions} for the query,
* allows you to resolve the link using a certain page, or sorted
* in a certain way