]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/share/marc-edit/marcrecord.ts
LP1834665 Angular catalog MARC flat text editor
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / share / marc-edit / marcrecord.ts
1 /**
2   * Simple wrapper class for our external MARC21.Record JS library.
3   */
4
5 declare var MARC21;
6
7 export class MarcRecord {
8
9     id: number; // Database ID when known.
10     deleted: boolean;
11     record: any; // MARC21.Record object
12     breakerText: string;
13
14     constructor(xml: string) {
15         this.record = new MARC21.Record({marcxml: xml});
16         this.breakerText = this.record.toBreaker();
17     }
18
19     toXml(): string {
20         return this.record.toXmlString();
21     }
22
23     toBreaker(): string {
24         return this.record.toBreaker();
25     }
26
27     absorbBreakerChanges() {
28         this.record = new MARC21.Record({marcbreaker: this.breakerText});
29     }
30 }
31