Merge branch 'search-features' into resolvers-branch

This commit is contained in:
lotte
2018-08-09 15:38:29 +02:00
18 changed files with 295 additions and 33 deletions

21
.dockerignore Normal file
View File

@@ -0,0 +1,21 @@
.git
node-modules
__build__
__server_build__
typings
tsd_typings
npm-debug.log
dist
coverage
.idea
*.iml
*.ngfactory.ts
*.css.shim.ts
*.scss.shim.ts
.DS_Store
webpack.records.json
npm-debug.log.*
morgan.log
yarn-error.log
*.css
package-lock.json

10
Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
# This image will be published as dspace/dspace-angular
# See https://dspace-labs.github.io/DSpace-Docker-Images/ for usage details
FROM node:8-alpine
WORKDIR /app
ADD . /app/
EXPOSE 3000
RUN yarn install
CMD yarn run watch

View File

@@ -60,7 +60,7 @@ describe('CollectionsComponent', () => {
}); });
}); });
describe('When the requested item request has succeeded', () => { describe('When the requested item request has failed', () => {
beforeEach(() => { beforeEach(() => {
collectionsComponent.item = failedMockItem; collectionsComponent.item = failedMockItem;
fixture.detectChanges(); fixture.detectChanges();

View File

@@ -1,4 +1,4 @@
import { IDToUUIDSerializer } from './it-to-uuid-serializer'; import { IDToUUIDSerializer } from './id-to-uuid-serializer';
describe('IDToUUIDSerializer', () => { describe('IDToUUIDSerializer', () => {
let serializer: IDToUUIDSerializer; let serializer: IDToUUIDSerializer;

View File

@@ -0,0 +1,35 @@
import { hasValue } from '../../shared/empty.util';
/**
* Serializer to create unique fake UUID's from id's that might otherwise be the same across multiple object types
*/
export class IDToUUIDSerializer {
/**
* @param {string} prefix To prepend the original ID with
*/
constructor(private prefix: string) {
}
/**
* Method to serialize a UUID
* @param {string} uuid
* @returns {any} undefined Fake UUID's should not be sent back to the server, but only be used in the UI
*/
Serialize(uuid: string): any {
return undefined;
}
/**
* Method to deserialize a UUID
* @param {string} id Identifier to transform in to a UUID
* @returns {string} UUID based on the prefix and the given id
*/
Deserialize(id: string): string {
if (hasValue(id)) {
return `${this.prefix}-${id}`;
} else {
return id;
}
}
}

View File

@@ -1,19 +0,0 @@
import { hasValue } from '../../shared/empty.util';
export class IDToUUIDSerializer {
constructor(private prefix: string) {
}
Serialize(uuid: string): any {
return undefined; // ui-only uuid doesn't need to be sent back to the server
}
Deserialize(id: string): string {
if (hasValue(id)) {
return `${this.prefix}-${id}`;
} else {
return id;
}
}
}

View File

@@ -0,0 +1,64 @@
/**
* Enum representing the Action Type of a Resource Policy
*/
export enum ActionType {
/**
* Action of reading, viewing or downloading something
*/
READ = 0,
/**
* Action of modifying something
*/
WRITE = 1,
/**
* Action of deleting something
*/
DELETE = 2,
/**
* Action of adding something to a container
*/
ADD = 3,
/**
* Action of removing something from a container
*/
REMOVE = 4,
/**
* Action of performing workflow step 1
*/
WORKFLOW_STEP_1 = 5,
/**
* Action of performing workflow step 2
*/
WORKFLOW_STEP_2 = 6,
/**
* Action of performing workflow step 3
*/
WORKFLOW_STEP_3 = 7,
/**
* Action of performing a workflow abort
*/
WORKFLOW_ABORT = 8,
/**
* Default Read policies for Bitstreams submitted to container
*/
DEFAULT_BITSTREAM_READ = 9,
/**
* Default Read policies for Items submitted to container
*/
DEFAULT_ITEM_READ = 10,
/**
* Administrative actions
*/
ADMIN = 11,
}

View File

@@ -2,34 +2,65 @@ import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'
import { BitstreamFormat } from '../../shared/bitstream-format.model'; import { BitstreamFormat } from '../../shared/bitstream-format.model';
import { mapsTo } from '../builders/build-decorators'; import { mapsTo } from '../builders/build-decorators';
import { IDToUUIDSerializer } from '../it-to-uuid-serializer'; import { IDToUUIDSerializer } from '../id-to-uuid-serializer';
import { NormalizedObject } from './normalized-object.model'; import { NormalizedObject } from './normalized-object.model';
import { SupportLevel } from './support-level.model';
/**
* Normalized model class for a Bitstream Format
*/
@mapsTo(BitstreamFormat) @mapsTo(BitstreamFormat)
@inheritSerialization(NormalizedObject) @inheritSerialization(NormalizedObject)
export class NormalizedBitstreamFormat extends NormalizedObject { export class NormalizedBitstreamFormat extends NormalizedObject {
/**
* Short description of this Bitstream Format
*/
@autoserialize @autoserialize
shortDescription: string; shortDescription: string;
/**
* Description of this Bitstream Format
*/
@autoserialize @autoserialize
description: string; description: string;
/**
* String representing the MIME type of this Bitstream Format
*/
@autoserialize @autoserialize
mimetype: string; mimetype: string;
/**
* The level of support the system offers for this Bitstream Format
*/
@autoserialize @autoserialize
supportLevel: number; supportLevel: SupportLevel;
/**
* True if the Bitstream Format is used to store system information, rather than the content of items in the system
*/
@autoserialize @autoserialize
internal: boolean; internal: boolean;
/**
* String representing this Bitstream Format's file extension
*/
@autoserialize @autoserialize
extensions: string; extensions: string;
/**
* Identifier for this Bitstream Format
* Note that this ID is unique for bitstream formats,
* but might not be unique across different object types
*/
@autoserialize @autoserialize
id: string; id: string;
/**
* Universally unique identifier for this Bitstream Format
* Consist of a prefix and the id field to ensure the identifier is unique across all object types
*/
@autoserializeAs(new IDToUUIDSerializer('bitstream-format'), 'id') @autoserializeAs(new IDToUUIDSerializer('bitstream-format'), 'id')
uuid: string; uuid: string;
} }

View File

@@ -5,6 +5,9 @@ import { Bitstream } from '../../shared/bitstream.model';
import { mapsTo, relationship } from '../builders/build-decorators'; import { mapsTo, relationship } from '../builders/build-decorators';
import { ResourceType } from '../../shared/resource-type'; import { ResourceType } from '../../shared/resource-type';
/**
* Normalized model class for a DSpace Bitstream
*/
@mapsTo(Bitstream) @mapsTo(Bitstream)
@inheritSerialization(NormalizedDSpaceObject) @inheritSerialization(NormalizedDSpaceObject)
export class NormalizedBitstream extends NormalizedDSpaceObject { export class NormalizedBitstream extends NormalizedDSpaceObject {

View File

@@ -5,6 +5,9 @@ import { Bundle } from '../../shared/bundle.model';
import { mapsTo, relationship } from '../builders/build-decorators'; import { mapsTo, relationship } from '../builders/build-decorators';
import { ResourceType } from '../../shared/resource-type'; import { ResourceType } from '../../shared/resource-type';
/**
* Normalized model class for a DSpace Bundle
*/
@mapsTo(Bundle) @mapsTo(Bundle)
@inheritSerialization(NormalizedDSpaceObject) @inheritSerialization(NormalizedDSpaceObject)
export class NormalizedBundle extends NormalizedDSpaceObject { export class NormalizedBundle extends NormalizedDSpaceObject {
@@ -25,6 +28,9 @@ export class NormalizedBundle extends NormalizedDSpaceObject {
*/ */
owner: string; owner: string;
/**
* List of Bitstreams that are part of this Bundle
*/
@autoserialize @autoserialize
@relationship(ResourceType.Bitstream, true) @relationship(ResourceType.Bitstream, true)
bitstreams: string[]; bitstreams: string[];

View File

@@ -5,6 +5,9 @@ import { Collection } from '../../shared/collection.model';
import { mapsTo, relationship } from '../builders/build-decorators'; import { mapsTo, relationship } from '../builders/build-decorators';
import { ResourceType } from '../../shared/resource-type'; import { ResourceType } from '../../shared/resource-type';
/**
* Normalized model class for a DSpace Collection
*/
@mapsTo(Collection) @mapsTo(Collection)
@inheritSerialization(NormalizedDSpaceObject) @inheritSerialization(NormalizedDSpaceObject)
export class NormalizedCollection extends NormalizedDSpaceObject { export class NormalizedCollection extends NormalizedDSpaceObject {
@@ -36,6 +39,9 @@ export class NormalizedCollection extends NormalizedDSpaceObject {
@relationship(ResourceType.Community, false) @relationship(ResourceType.Community, false)
owner: string; owner: string;
/**
* List of Items that are part of (not necessarily owned by) this Collection
*/
@autoserialize @autoserialize
@relationship(ResourceType.Item, true) @relationship(ResourceType.Item, true)
items: string[]; items: string[];

View File

@@ -1,10 +1,13 @@
import { autoserialize, inheritSerialization, autoserializeAs } from 'cerialize'; import { autoserialize, inheritSerialization } from 'cerialize';
import { NormalizedDSpaceObject } from './normalized-dspace-object.model'; import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
import { Community } from '../../shared/community.model'; import { Community } from '../../shared/community.model';
import { mapsTo, relationship } from '../builders/build-decorators'; import { mapsTo, relationship } from '../builders/build-decorators';
import { ResourceType } from '../../shared/resource-type'; import { ResourceType } from '../../shared/resource-type';
/**
* Normalized model class for a DSpace Community
*/
@mapsTo(Community) @mapsTo(Community)
@inheritSerialization(NormalizedDSpaceObject) @inheritSerialization(NormalizedDSpaceObject)
export class NormalizedCommunity extends NormalizedDSpaceObject { export class NormalizedCommunity extends NormalizedDSpaceObject {
@@ -36,6 +39,9 @@ export class NormalizedCommunity extends NormalizedDSpaceObject {
@relationship(ResourceType.Community, false) @relationship(ResourceType.Community, false)
owner: string; owner: string;
/**
* List of Collections that are owned by this Community
*/
@autoserialize @autoserialize
@relationship(ResourceType.Collection, true) @relationship(ResourceType.Collection, true)
collections: string[]; collections: string[];

View File

@@ -5,6 +5,9 @@ import { Item } from '../../shared/item.model';
import { mapsTo, relationship } from '../builders/build-decorators'; import { mapsTo, relationship } from '../builders/build-decorators';
import { ResourceType } from '../../shared/resource-type'; import { ResourceType } from '../../shared/resource-type';
/**
* Normalized model class for a DSpace Item
*/
@mapsTo(Item) @mapsTo(Item)
@inheritSerialization(NormalizedDSpaceObject) @inheritSerialization(NormalizedDSpaceObject)
export class NormalizedItem extends NormalizedDSpaceObject { export class NormalizedItem extends NormalizedDSpaceObject {
@@ -53,6 +56,9 @@ export class NormalizedItem extends NormalizedDSpaceObject {
@relationship(ResourceType.Collection, false) @relationship(ResourceType.Collection, false)
owningCollection: string; owningCollection: string;
/**
* List of Bitstreams that are owned by this Item
*/
@autoserialize @autoserialize
@relationship(ResourceType.Bitstream, true) @relationship(ResourceType.Bitstream, true)
bitstreams: string[]; bitstreams: string[];

View File

@@ -1,23 +1,49 @@
import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize'; import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
import { ResourcePolicy } from '../../shared/resource-policy.model'; import { ResourcePolicy } from '../../shared/resource-policy.model';
import { mapsTo } from '../builders/build-decorators'; import { mapsTo, relationship } from '../builders/build-decorators';
import { IDToUUIDSerializer } from '../it-to-uuid-serializer';
import { NormalizedObject } from './normalized-object.model'; import { NormalizedObject } from './normalized-object.model';
import { IDToUUIDSerializer } from '../id-to-uuid-serializer';
import { ResourceType } from '../../shared/resource-type';
import { ActionType } from './action-type.model';
/**
* Normalized model class for a Resource Policy
*/
@mapsTo(ResourcePolicy) @mapsTo(ResourcePolicy)
@inheritSerialization(NormalizedObject) @inheritSerialization(NormalizedObject)
export class NormalizedResourcePolicy extends NormalizedObject { export class NormalizedResourcePolicy extends NormalizedObject {
/**
* The action that is allowed by this Resource Policy
*/
action: ActionType;
/**
* The name for this Resource Policy
*/
@autoserialize @autoserialize
name: string; name: string;
/**
* The uuid of the Group this Resource Policy applies to
*/
@relationship(ResourceType.Group, false)
@autoserializeAs(String, 'groupUUID') @autoserializeAs(String, 'groupUUID')
group: string; group: string;
/**
* Identifier for this Resource Policy
* Note that this ID is unique for resource policies,
* but might not be unique across different object types
*/
@autoserialize @autoserialize
id: string; id: string;
/**
* The universally unique identifier for this Resource Policy
* Consist of a prefix and the id field to ensure the identifier is unique across all object types
*/
@autoserializeAs(new IDToUUIDSerializer('resource-policy'), 'id') @autoserializeAs(new IDToUUIDSerializer('resource-policy'), 'id')
uuid: string; uuid: string;
} }

View File

@@ -0,0 +1,19 @@
/**
* Enum representing the Support Level of a Bitstream Format
*/
export enum SupportLevel {
/**
* Unknown for Bitstream Formats that are unknown to the system
*/
Unknown = 0,
/**
* Unknown for Bitstream Formats that are known to the system, but not fully supported
*/
Known = 1,
/**
* Supported for Bitstream Formats that are known to the system and fully supported
*/
Supported = 2,
}

View File

@@ -196,8 +196,6 @@ describe('IntegrationResponseParsingService', () => {
it('should return a IntegrationSuccessResponse with data definition', () => { it('should return a IntegrationSuccessResponse with data definition', () => {
const response = service.parse(validRequest, validResponse); const response = service.parse(validRequest, validResponse);
console.log((response as any).dataDefinition);
console.log(definitions);
expect((response as any).dataDefinition).toEqual(definitions); expect((response as any).dataDefinition).toEqual(definitions);
}); });

View File

@@ -2,24 +2,54 @@
import { CacheableObject } from '../cache/object-cache.reducer'; import { CacheableObject } from '../cache/object-cache.reducer';
import { ResourceType } from './resource-type'; import { ResourceType } from './resource-type';
/**
* Model class for a Bitstream Format
*/
export class BitstreamFormat implements CacheableObject { export class BitstreamFormat implements CacheableObject {
/**
* Short description of this Bitstream Format
*/
shortDescription: string; shortDescription: string;
/**
* Description of this Bitstream Format
*/
description: string; description: string;
/**
* String representing the MIME type of this Bitstream Format
*/
mimetype: string; mimetype: string;
/**
* The level of support the system offers for this Bitstream Format
*/
supportLevel: number; supportLevel: number;
/**
* True if the Bitstream Format is used to store system information, rather than the content of items in the system
*/
internal: boolean; internal: boolean;
/**
* String representing this Bitstream Format's file extension
*/
extensions: string; extensions: string;
/**
* The link to the rest endpoint where this Bitstream Format can be found
*/
self: string; self: string;
/**
* A ResourceType representing the kind of Object of this BitstreamFormat
*/
type: ResourceType; type: ResourceType;
/**
* Universally unique identifier for this Bitstream Format
*/
uuid: string; uuid: string;
} }

View File

@@ -1,20 +1,40 @@
import { CacheableObject } from '../cache/object-cache.reducer'; import { CacheableObject } from '../cache/object-cache.reducer';
import { ResourceType } from './resource-type'; import { ResourceType } from './resource-type';
import { Group } from '../eperson/models/group.model';
import { ActionType } from '../cache/models/action-type.model';
/**
* Model class for a Resource Policy
*/
export class ResourcePolicy implements CacheableObject { export class ResourcePolicy implements CacheableObject {
/**
* The action that is allowed by this Resource Policy
*/
action: ActionType;
action: string; /**
* The name for this Resource Policy
*/
name: string; name: string;
// TODO group should ofcourse become a group object /**
group: string; * The Group this Resource Policy applies to
*/
group: Group;
/**
* The link to the rest endpoint where this Resource Policy can be found
*/
self: string; self: string;
/**
* A ResourceType representing the kind of Object of this ResourcePolicy
*/
type: ResourceType; type: ResourceType;
/**
* The universally unique identifier for this Resource Policy
*/
uuid: string; uuid: string;
} }