diff --git a/modules/cmpapi/src/encoder/GppModel.ts b/modules/cmpapi/src/encoder/GppModel.ts index 3b38838..387783a 100644 --- a/modules/cmpapi/src/encoder/GppModel.ts +++ b/modules/cmpapi/src/encoder/GppModel.ts @@ -111,6 +111,7 @@ export class GppModel { if (section) { section.setFieldValue(fieldName, value); this.dirty = true; + section.setIsDirty(true); } else { throw new InvalidFieldError(sectionName + "." + fieldName + " not found"); } @@ -242,6 +243,7 @@ export class GppModel { let sectionName = Sections.SECTION_ORDER[i]; if (sections.has(sectionName)) { let section = sections.get(sectionName); + section.setIsDirty(true); encodedSections.push(section.encode()); sectionIds.push(section.getId()); } diff --git a/modules/cmpapi/src/encoder/section/AbstractLazilyEncodableSection.ts b/modules/cmpapi/src/encoder/section/AbstractLazilyEncodableSection.ts index 2905891..3217124 100644 --- a/modules/cmpapi/src/encoder/section/AbstractLazilyEncodableSection.ts +++ b/modules/cmpapi/src/encoder/section/AbstractLazilyEncodableSection.ts @@ -105,4 +105,8 @@ export abstract class AbstractLazilyEncodableSection implements EncodableSection this.dirty = false; this.decoded = false; } + + public setIsDirty(status: boolean): void { + this.dirty = status; + } } diff --git a/modules/cmpapi/src/encoder/section/EncodableSection.ts b/modules/cmpapi/src/encoder/section/EncodableSection.ts index 7eefd05..6cc7f12 100644 --- a/modules/cmpapi/src/encoder/section/EncodableSection.ts +++ b/modules/cmpapi/src/encoder/section/EncodableSection.ts @@ -14,4 +14,6 @@ export interface EncodableSection { encode(): string; decode(encodedString: string): void; + + setIsDirty(status: boolean): void; }