mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
101623: Add HierarchicalBrowseDefinition model + base BrowseDefinition class
This commit is contained in:
10
src/app/core/shared/browse-definition.ts
Normal file
10
src/app/core/shared/browse-definition.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Base class for BrowseDefinition models
|
||||
*/
|
||||
export abstract class BrowseDefinition {
|
||||
|
||||
/**
|
||||
* Get the render type of the BrowseDefinition model
|
||||
*/
|
||||
abstract getRenderType(): string;
|
||||
}
|
@@ -7,9 +7,10 @@ import { ResourceType } from './resource-type';
|
||||
import { SortOption } from './sort-option.model';
|
||||
import { CacheableObject } from '../cache/cacheable-object.model';
|
||||
import { BrowseByDataType } from '../../browse-by/browse-by-switcher/browse-by-decorator';
|
||||
import { BrowseDefinition } from './browse-definition';
|
||||
|
||||
@typedObject
|
||||
export class FlatBrowseDefinition extends CacheableObject {
|
||||
export class FlatBrowseDefinition extends CacheableObject implements BrowseDefinition {
|
||||
static type = FLAT_BROWSE_DEFINITION;
|
||||
|
||||
/**
|
||||
@@ -46,4 +47,8 @@ export class FlatBrowseDefinition extends CacheableObject {
|
||||
entries: HALLink;
|
||||
items: HALLink;
|
||||
};
|
||||
|
||||
getRenderType(): string {
|
||||
return this.dataType;
|
||||
}
|
||||
}
|
||||
|
47
src/app/core/shared/hierarchical-browse-definition.model.ts
Normal file
47
src/app/core/shared/hierarchical-browse-definition.model.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { autoserialize, autoserializeAs, deserialize } from 'cerialize';
|
||||
import { typedObject } from '../cache/builders/build-decorators';
|
||||
import { excludeFromEquals } from '../utilities/equals.decorators';
|
||||
import { HIERARCHICAL_BROWSE_DEFINITION } from './hierarchical-browse-definition.resource-type';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { CacheableObject } from '../cache/cacheable-object.model';
|
||||
import { BrowseDefinition } from './browse-definition';
|
||||
|
||||
@typedObject
|
||||
export class HierarchicalBrowseDefinition extends CacheableObject implements BrowseDefinition {
|
||||
static type = HIERARCHICAL_BROWSE_DEFINITION;
|
||||
|
||||
/**
|
||||
* The object type
|
||||
*/
|
||||
@excludeFromEquals
|
||||
type: ResourceType = HIERARCHICAL_BROWSE_DEFINITION;
|
||||
|
||||
@autoserialize
|
||||
id: string;
|
||||
|
||||
@autoserialize
|
||||
facetType: string;
|
||||
|
||||
@autoserialize
|
||||
vocabulary: string;
|
||||
|
||||
@autoserializeAs('metadata')
|
||||
metadataKeys: string[];
|
||||
|
||||
get self(): string {
|
||||
return this._links.self.href;
|
||||
}
|
||||
|
||||
@deserialize
|
||||
_links: {
|
||||
self: HALLink;
|
||||
entries: HALLink;
|
||||
items: HALLink;
|
||||
vocabulary: HALLink;
|
||||
};
|
||||
|
||||
getRenderType(): string {
|
||||
return 'hierarchy';
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for HierarchicalBrowseDefinition
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const HIERARCHICAL_BROWSE_DEFINITION = new ResourceType('hierarchicalBrowse');
|
Reference in New Issue
Block a user