Added a type to OtherInformation

This commit is contained in:
Giuseppe Digilio
2018-12-27 17:47:51 +01:00
parent 5bbea16265
commit f9c69b7441
2 changed files with 7 additions and 12 deletions

View File

@@ -1,41 +1,32 @@
import { IntegrationModel } from './integration.model'; import { IntegrationModel } from './integration.model';
import { autoserialize } from 'cerialize';
import { isNotEmpty } from '../../../shared/empty.util'; import { isNotEmpty } from '../../../shared/empty.util';
import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
import { OtherInformation } from '../../../shared/form/builder/models/form-field-metadata-value.model';
export class AuthorityValue extends IntegrationModel { export class AuthorityValue extends IntegrationModel {
@autoserialize
id: string; id: string;
@autoserialize
display: string; display: string;
@autoserialize
value: string; value: string;
@autoserialize otherInformation: OtherInformation;
otherInformation: any;
@autoserialize
language: string; language: string;
@autoserialize
hasAuthority(): boolean { hasAuthority(): boolean {
return isNotEmpty(this.id); return isNotEmpty(this.id);
} }
@autoserialize
hasValue(): boolean { hasValue(): boolean {
return isNotEmpty(this.value); return isNotEmpty(this.value);
} }
@autoserialize
hasOtherInformation(): boolean { hasOtherInformation(): boolean {
return isNotEmpty(this.otherInformation); return isNotEmpty(this.otherInformation);
} }
@autoserialize
hasPlaceholder() { hasPlaceholder() {
return this.hasValue() && this.value === PLACEHOLDER_PARENT_METADATA; return this.hasValue() && this.value === PLACEHOLDER_PARENT_METADATA;
} }

View File

@@ -2,6 +2,10 @@ import { isEmpty, isNotEmpty, isNotNull } from '../../../empty.util';
import { ConfidenceType } from '../../../../core/integration/models/confidence-type'; import { ConfidenceType } from '../../../../core/integration/models/confidence-type';
import { PLACEHOLDER_PARENT_METADATA } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { PLACEHOLDER_PARENT_METADATA } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
export interface OtherInformation {
[name: string]: string
}
export class FormFieldMetadataValueObject { export class FormFieldMetadataValueObject {
metadata?: string; metadata?: string;
value: any; value: any;
@@ -12,7 +16,7 @@ export class FormFieldMetadataValueObject {
place: number; place: number;
closed: boolean; closed: boolean;
label: string; label: string;
otherInformation: any; otherInformation: OtherInformation;
constructor(value: any = null, constructor(value: any = null,
language: any = null, language: any = null,