flysh
Version:
DOM Document Object Artifact Collector
93 lines • 2.53 kB
JavaScript
/**
* 'OutputMessage' class model
*
* Includes all the 'PageRecords' generated from a same domain.
* Once filled, this class instance is sent back asynchronously
*
*/
export class OutputMessage {
/**
* Constructor
*
* @param id Defines the current flysh ID instance
* @param domain Contains the domain name (i.e : 'www.abcd.efg')
*/
constructor(id, domain) {
this._pageRecordList = new Array();
this._domain = domain;
this._id = id;
}
/**
* Add a 'PageRecords' class instance
*
* @param pageRec Contains the records collected from the current page
*/
addPageRecords(pageRec) {
this._pageRecordList.push(pageRec);
}
/**
* Getter 'Domain'
*
* @returns Returns a 'string' that contains the '_domain' class property
*/
get domain() {
return this._domain;
}
/**
* Performs an 'Integrity Check' from the 'pageRecordList' class property.
* If any error(s) are found into the record lists then a 'false' value is returned
*
* @returns Returns a 'boolean' value after 'PageRecords 'Integrity Check'
*/
get integrityCheck() {
let _retVal = true;
for (let pr of this.pageRecordList)
if (pr.getError === true)
_retVal = false;
return _retVal;
}
/**
* Getter 'ID'
*
* @returns Returns the instance 'ID' number
*/
get ID() {
return this._id;
}
/**
* Getter number of pages
*
* @returns Returns the counts number of 'PageRecords' from the 'pagerecordList' class property
*/
get numberOfPages() {
return this.pageRecordList.length;
}
/**
* Getter number of records
*
* @returns Returns a 'number' that contains the total of records from all the 'PageRecords' ('pageRecordList')
*/
get numberOfRecords() {
let _retVal = 0;
for (let pr of this.pageRecordList)
_retVal += pr.numberRecords;
return _retVal;
}
/**
* Getter 'pageRecordList'
*
* @returns Returns a 'string' that contains the '_pageRecordList' class property
*/
get pageRecordList() {
return this._pageRecordList;
}
/**
* 'Stringify' the class instance
*
* @returns Returns a 'string' that contains all the class properties
*/
get toString() {
return 'ID : ' + this._id + '\n';
}
}
//# sourceMappingURL=OutputMessage.js.map