added missing typedoc

This commit is contained in:
Lotte Hofstede
2019-07-25 11:55:55 +02:00
parent 200b29f6f8
commit b0cf35e422
4 changed files with 26 additions and 1 deletions

View File

@@ -276,7 +276,7 @@ export class SearchConfigurationService implements OnDestroy {
} }
/** /**
* Make sure to unsubscribe from all existing subscription to prevent memory leaksNormalizedRelationship * Make sure to unsubscribe from all existing subscription to prevent memory leaks
*/ */
ngOnDestroy(): void { ngOnDestroy(): void {
this.subs.forEach((sub) => { this.subs.forEach((sub) => {

View File

@@ -10,6 +10,11 @@ const relationshipKey = Symbol('relationship');
const relationshipMap = new Map(); const relationshipMap = new Map();
const typeMap = new Map(); const typeMap = new Map();
/**
* Decorator function to map a normalized class to it's not-normalized counter part class
* It will also maps a type to the matching class
* @param value The not-normalized class to map to
*/
export function mapsTo(value: GenericConstructor<TypedObject>) { export function mapsTo(value: GenericConstructor<TypedObject>) {
return function decorator(objectConstructor: GenericConstructor<TypedObject>) { return function decorator(objectConstructor: GenericConstructor<TypedObject>) {
Reflect.defineMetadata(mapsToMetadataKey, value, objectConstructor); Reflect.defineMetadata(mapsToMetadataKey, value, objectConstructor);
@@ -17,6 +22,12 @@ export function mapsTo(value: GenericConstructor<TypedObject>) {
} }
} }
/**
* Maps a type to the matching class
* @param value The resourse type
* @param objectConstructor The class to map to
*/
function mapsToType(value: ResourceType, objectConstructor: GenericConstructor<TypedObject>) { function mapsToType(value: ResourceType, objectConstructor: GenericConstructor<TypedObject>) {
if (!objectConstructor || !value) { if (!objectConstructor || !value) {
return; return;
@@ -24,10 +35,18 @@ function mapsToType(value: ResourceType, objectConstructor: GenericConstructor<T
typeMap.set(value.value, objectConstructor); typeMap.set(value.value, objectConstructor);
} }
/**
* Returns the mapped class for the given normalized class
* @param target The normalized class
*/
export function getMapsTo(target: any) { export function getMapsTo(target: any) {
return Reflect.getOwnMetadata(mapsToMetadataKey, target); return Reflect.getOwnMetadata(mapsToMetadataKey, target);
} }
/**
* Returns the mapped class for the given type
* @param type The resource type
*/
export function getMapsToType(type: string | ResourceType) { export function getMapsToType(type: string | ResourceType) {
if (typeof(type) === 'object') { if (typeof(type) === 'object') {
type = (type as ResourceType).value; type = (type as ResourceType).value;

View File

@@ -3,6 +3,9 @@ import { SubmissionSectionModel } from './config-submission-section.model';
import { PaginatedList } from '../../data/paginated-list'; import { PaginatedList } from '../../data/paginated-list';
import { ResourceType } from '../../shared/resource-type'; import { ResourceType } from '../../shared/resource-type';
/**
* Class for the configuration describing the submission
*/
export class SubmissionDefinitionModel extends ConfigObject { export class SubmissionDefinitionModel extends ConfigObject {
static type = new ResourceType('submissiondefinition'); static type = new ResourceType('submissiondefinition');

View File

@@ -1,3 +1,6 @@
/**
* Class that represents the type of an object as returned by the REST server
*/
export class ResourceType { export class ResourceType {
constructor(public value: string) { constructor(public value: string) {
} }