74 lines
2.5 KiB
TypeScript
74 lines
2.5 KiB
TypeScript
import { Entity } from '@iqser/common-ui';
|
|
import { List } from '@iqser/common-ui/lib/utils';
|
|
import { DICTIONARY_TYPE_KEY_MAP, DictionaryType } from '../redaction-log';
|
|
import { IDictionary } from './dictionary';
|
|
|
|
export class Dictionary extends Entity<IDictionary> implements IDictionary {
|
|
readonly addToDictionaryAction: boolean;
|
|
readonly caseInsensitive: boolean;
|
|
readonly description: string;
|
|
readonly dossierTemplateId?: string;
|
|
readonly hexColor?: string;
|
|
readonly recommendationHexColor?: string;
|
|
readonly skippedHexColor?: string;
|
|
readonly hint: boolean;
|
|
readonly label: string;
|
|
readonly rank?: number;
|
|
readonly recommendation: boolean;
|
|
readonly type: string;
|
|
readonly hasDictionary?: boolean;
|
|
readonly systemManaged?: boolean;
|
|
readonly dossierDictionaryOnly?: boolean;
|
|
readonly experimental?: boolean;
|
|
|
|
entries: List;
|
|
falsePositiveEntries: List;
|
|
falseRecommendationEntries: List;
|
|
|
|
constructor(
|
|
entity: IDictionary,
|
|
readonly virtual = false,
|
|
) {
|
|
super(entity);
|
|
this.addToDictionaryAction = !!entity.addToDictionaryAction;
|
|
this.caseInsensitive = !!entity.caseInsensitive;
|
|
this.description = entity.description ?? '';
|
|
this.dossierTemplateId = entity.dossierTemplateId;
|
|
this.entries = entity.entries ?? [];
|
|
this.falsePositiveEntries = entity.falsePositiveEntries ?? [];
|
|
this.falseRecommendationEntries = entity.falseRecommendationEntries ?? [];
|
|
this.hexColor = entity.hexColor;
|
|
this.recommendationHexColor = entity.recommendationHexColor;
|
|
this.skippedHexColor = entity.skippedHexColor;
|
|
this.hint = !!entity.hint;
|
|
this.label = entity.label ?? entity.type;
|
|
this.rank = entity.rank;
|
|
this.recommendation = !!entity.recommendation;
|
|
this.type = entity.type;
|
|
this.hasDictionary = entity.hasDictionary;
|
|
this.systemManaged = entity.systemManaged;
|
|
this.dossierDictionaryOnly = entity.dossierDictionaryOnly;
|
|
this.experimental = entity.experimental;
|
|
}
|
|
|
|
get id(): string {
|
|
return this.type;
|
|
}
|
|
|
|
get searchKey(): string {
|
|
return this.label ?? this.type;
|
|
}
|
|
|
|
get routerLink(): string {
|
|
return `/main/admin/dossier-templates/${this.dossierTemplateId}/entities/${this.type}`;
|
|
}
|
|
|
|
setEntries(entries: List, type: DictionaryType): void {
|
|
this[DICTIONARY_TYPE_KEY_MAP[type]] = entries;
|
|
}
|
|
|
|
getEntries(type: DictionaryType): List {
|
|
return this[DICTIONARY_TYPE_KEY_MAP[type]];
|
|
}
|
|
}
|