Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/app/core/data-services-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { RESOURCE_POLICY } from './resource-policy/models/resource-policy.resour
import { ACCESS_STATUS } from './shared/access-status.resource-type';
import { ADMIN_NOTIFY_MESSAGE } from './shared/admin-notify-message.resource-type';
import { AUTHORIZATION } from './shared/authorization.resource-type';
import { BIBLIOGRAPHY } from './shared/bibliography/bibliography.resource-type';
import { BITSTREAM } from './shared/bitstream.resource-type';
import { BITSTREAM_FORMAT } from './shared/bitstream-format.resource-type';
import { BROWSE_DEFINITION } from './shared/browse-definition.resource-type';
Expand Down Expand Up @@ -88,6 +89,7 @@ export const LAZY_DATA_SERVICES: LazyDataServicesMap = new Map([
[SUBSCRIPTION.value, () => import('./data/subscriptions-data.service').then(m => m.SubscriptionsDataService)],
[COMMUNITY.value, () => import('./data/community-data.service').then(m => m.CommunityDataService)],
[VOCABULARY.value, () => import('./submission/vocabularies/vocabulary.data.service').then(m => m.VocabularyDataService)],
[BIBLIOGRAPHY.value, () => import('./data/bibliography-data.service').then(m => m.ItemBibliographyService)],
[BUNDLE.value, () => import('./data/bundle-data.service').then(m => m.BundleDataService)],
[CONFIG_PROPERTY.value, () => import('./data/configuration-data.service').then(m => m.ConfigurationDataService)],
[POOL_TASK.value, () => import('./tasks/pool-task-data.service').then(m => m.PoolTaskDataService)],
Expand Down
37 changes: 37 additions & 0 deletions src/app/core/data/bibliography-data.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Injectable } from '@angular/core';
import {
map,
Observable,
} from 'rxjs';

import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
import { ObjectCacheService } from '../cache/object-cache.service';
import { BibliographyData } from '../shared/bibliography/bibliography-data.model';
import { HALEndpointService } from '../shared/hal-endpoint.service';
import { Item } from '../shared/item.model';
import { getFirstCompletedRemoteData } from '../shared/operators';
import { BaseDataService } from './base/base-data.service';
import { RequestService } from './request.service';




@Injectable({ providedIn: 'root' })
export class ItemBibliographyService extends BaseDataService<BibliographyData> {

constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super('bibliographies', requestService, rdbService, objectCache, halService);
}

getBibliographies(item: Item): Observable<BibliographyData> {
return this.findByHref(item._links.bibliography.href).pipe(
getFirstCompletedRemoteData(),
map(res => res.payload),
);
}
}
2 changes: 2 additions & 0 deletions src/app/core/provide-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { ResearcherProfile } from './profile/model/researcher-profile.model';
import { ResourcePolicy } from './resource-policy/models/resource-policy.model';
import { AccessStatusObject } from './shared/access-status.model';
import { Authorization } from './shared/authorization.model';
import { BibliographyData } from './shared/bibliography/bibliography-data.model';
import { Bitstream } from './shared/bitstream.model';
import { BitstreamFormat } from './shared/bitstream-format.model';
import { BrowseDefinition } from './shared/browse-definition.model';
Expand Down Expand Up @@ -134,6 +135,7 @@ export const models =
[
Root,
DSpaceObject,
BibliographyData,
Bundle,
Bitstream,
BitstreamFormat,
Expand Down
42 changes: 42 additions & 0 deletions src/app/core/shared/bibliography/bibliography-data.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {
autoserialize,
deserialize,
} from 'cerialize';
import { typedObject } from 'src/app/core/cache/builders/build-decorators';
import { DSpaceObject } from 'src/app/core/shared/dspace-object.model';
import { HALLink } from 'src/app/core/shared/hal-link.model';
import { ResourceType } from 'src/app/core/shared/resource-type';
import { excludeFromEquals } from 'src/app/core/utilities/equals.decorators';

import { Bibliography } from './bibliography.model';
import { BIBLIOGRAPHY } from './bibliography.resource-type';

/**
* Class representing a DSpace Version
*/
@typedObject
export class BibliographyData extends DSpaceObject {
static type = BIBLIOGRAPHY;

/**
* The type for this IdentifierData
*/
@excludeFromEquals
@autoserialize
type: ResourceType;

/**
* The
*/
@autoserialize
bibliographies: Bibliography[];

/**
* The {@link HALLink}s for this IdentifierData
*/
@deserialize
_links: {
self: HALLink;
};

}
9 changes: 9 additions & 0 deletions src/app/core/shared/bibliography/bibliography.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { autoserialize } from 'cerialize';

export class Bibliography {
@autoserialize
style: string;

@autoserialize
value: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { ResourceType } from 'src/app/core/shared/resource-type';

/**
* The resource type for Bibliography
*
* Needs to be in a separate file to prevent circular
* dependencies in webpack.
*/
export const BIBLIOGRAPHY = new ResourceType('bibliography');
5 changes: 3 additions & 2 deletions src/app/core/shared/item.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class Item extends DSpaceObject implements ChildHALResource, HandleObject
mappedCollections: HALLink;
relationships: HALLink;
bundles: HALLink;
bibliography: HALLink;
owningCollection: HALLink;
templateItemOf: HALLink;
version: HALLink;
Expand Down Expand Up @@ -155,8 +156,8 @@ export class Item extends DSpaceObject implements ChildHALResource, HandleObject
* The access status for this Item
* Will be undefined unless the access status {@link HALLink} has been resolved.
*/
@link(ACCESS_STATUS, false, 'accessStatus')
accessStatus?: Observable<RemoteData<AccessStatusObject>>;
@link(ACCESS_STATUS, false, 'accessStatus')
accessStatus?: Observable<RemoteData<AccessStatusObject>>;

/**
* The identifier data for this Item
Expand Down
Loading