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IoRamtP4u19ZLtSCOjv-LMWICNR4YaWvcpPkru2jTKd9JOlN1pcVfSbVf4YBnEvsW0pKZ3JwnV0105C6G7i1X6cG8544C9Ryt-oKnY4ceepDqui5cHJa_RKasVNErjcYQVbCTF3ijHZojzo7zN2eT34WgwsiUZNRIF3vzGLXZ3COlxWFb30PqS1wJaog_JBJcmVBAcHVi1UDVXZ9chf16xveLwgOzhskkFhMEuhNqimIzdO5i8lnaIlVKFBHI77TKAARlszo2YwSaZfrepvXtpIzxZ0mdzXCvVti87yUYKwWaLCS3bDGhnbSOpL5qi6cbg6vHTpx8oD08jghtlq6nRrBItAeZ6_c
|
||||||
@ -25,11 +25,11 @@ LogUtils.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
write: function(message, options){
|
write: function(message, options = {}){
|
||||||
var {
|
var {
|
||||||
type = "info",
|
type = "info",
|
||||||
timestamp = new Date(),
|
timestamp = new Date(),
|
||||||
funcName = "Unknown",
|
funcName = "",
|
||||||
currentRecord = current
|
currentRecord = current
|
||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
|
|||||||
@ -8,52 +8,51 @@
|
|||||||
<description/>
|
<description/>
|
||||||
<name>ProcessorUtils</name>
|
<name>ProcessorUtils</name>
|
||||||
<script><![CDATA[var _source;
|
<script><![CDATA[var _source;
|
||||||
|
var _appScope;
|
||||||
|
|
||||||
var ProcessorUtils = Class.create();
|
var ProcessorUtils = Class.create();
|
||||||
ProcessorUtils.prototype = {
|
ProcessorUtils.prototype = {
|
||||||
initialize: function(options) {
|
initialize: function(appScope) {
|
||||||
var { table, scope, name } = options;
|
if(!appScope)
|
||||||
if(table) this.setSource(options.table, {scope, name});
|
new LogUtils().write("Application scope is not received.", {type: "error", funcName: "initialize"});
|
||||||
|
|
||||||
|
_appScope = appScope;
|
||||||
},
|
},
|
||||||
|
|
||||||
setSource: function(table, options){
|
wrapScriptInclude: function(scriptPrototype, options = {}){
|
||||||
var { scope, name } = options;
|
var {
|
||||||
|
table = "sys_script_include",
|
||||||
|
name = scriptPrototype.type,
|
||||||
|
sys_id = false
|
||||||
|
} = options;
|
||||||
|
|
||||||
var sourceGr = new GlideRecord(table);
|
var sourceRecord = this.getSourceRecord(table, { name, sys_id });
|
||||||
sourceGr.addQuery("name", name);
|
|
||||||
sourceGr.addQuery("sys_scope.scope", scope);
|
Object.getOwnPropertyNames(scriptPrototype).forEach(function(f) {
|
||||||
sourceGr.query();
|
if(Object.getOwnPropertyDescriptor(scriptPrototype,f).writable){
|
||||||
if(sourceGr.next()){
|
if (typeof scriptPrototype[f] === 'function') {
|
||||||
_source = sourceGr;
|
var old = scriptPrototype[f];
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
wrapper: function(scopedClass){
|
|
||||||
Object.getOwnPropertyNames(scopedClass).forEach(function(f) {
|
|
||||||
if(Object.getOwnPropertyDescriptor(scopedClass,f).writable){
|
|
||||||
if (typeof scopedClass[f] === 'function') {
|
|
||||||
var old = scopedClass[f];
|
|
||||||
var funcName = f.toString();
|
var funcName = f.toString();
|
||||||
if(_source){
|
if(_source){
|
||||||
var sourceTable = _source.getTableName();
|
var sourceTable = _source.getTableName();
|
||||||
var sourceID = _source.getValue("sys_id");
|
var sourceID = _source.getValue("sys_id");
|
||||||
}
|
}
|
||||||
scopedClass[f] = function() {
|
scriptPrototype[f] = function() {
|
||||||
|
functionName = Symbol(funcName);
|
||||||
var returnValue = false;
|
var returnValue = false;
|
||||||
try{
|
try{
|
||||||
if(old == undefined) throw new Error("Function: " + funcName + " does not exist");
|
if(old == undefined) throw new Error("Function: " + funcName + " does not exist");
|
||||||
returnValue = old.apply(this, arguments);
|
returnValue = old.apply(this, arguments);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
var func = funcName ? "Function: " + funcName : undefined;
|
|
||||||
var message = err.message ? "Message: " +err.message : undefined;
|
var message = err.message ? "Message: " +err.message : undefined;
|
||||||
var line = err.lineNumber ? "Line: " + err.lineNumber : undefined;
|
var line = err.lineNumber ? "Line: " + err.lineNumber : undefined;
|
||||||
|
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
type: "error",
|
type: "error",
|
||||||
funcName: funcName
|
funcName: funcName,
|
||||||
|
lineNumber: line
|
||||||
};
|
};
|
||||||
new LogUtils().write("message", options);
|
new LogUtils().write(message, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
@ -62,6 +61,19 @@ ProcessorUtils.prototype = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getSourceRecord: function(table, options){
|
||||||
|
var { sys_id, name } = options;
|
||||||
|
|
||||||
|
var sourceGr = new GlideRecord(table);
|
||||||
|
if(name) sourceGr.addQuery("name", name);
|
||||||
|
if(sys_id) sourceGr.addQuery("sys_id", sys_id);
|
||||||
|
sourceGr.addQuery("sys_scope.scope", _appScope);
|
||||||
|
sourceGr.query();
|
||||||
|
if(sourceGr.next()){
|
||||||
|
_source = sourceGr;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
type: 'ProcessorUtils'
|
type: 'ProcessorUtils'
|
||||||
};]]></script>
|
};]]></script>
|
||||||
|
|||||||
@ -14,14 +14,18 @@ QueueUtils.prototype = {
|
|||||||
|
|
||||||
writeToQueue: function(event, data){
|
writeToQueue: function(event, data){
|
||||||
gs.info('writer');
|
gs.info('writer');
|
||||||
|
this.tester();
|
||||||
|
new LogUtils().write("finished function",{ type: "debug", funcName: "writeToQueue" });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
tester: function(){
|
||||||
|
new LogUtils().write("tester",{ type: "debug", funcName: "tester" });
|
||||||
|
},
|
||||||
|
|
||||||
type: 'QueueUtils'
|
type: 'QueueUtils'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
new ProcessorUtils("x_355681_fa").wrapScriptInclude(QueueUtils.prototype);]]></script>
|
||||||
new ProcessorUtils({table: "sys_script_include", scope: "x_355681_fa", name: "QueueUtils"})
|
|
||||||
.wrapper(QueueUtils.prototype);]]></script>
|
|
||||||
<sys_class_name>sys_script_include</sys_class_name>
|
<sys_class_name>sys_script_include</sys_class_name>
|
||||||
<sys_created_by>admin</sys_created_by>
|
<sys_created_by>admin</sys_created_by>
|
||||||
<sys_created_on>2023-01-13 22:09:49</sys_created_on>
|
<sys_created_on>2023-01-13 22:09:49</sys_created_on>
|
||||||
|
|||||||
@ -2,18 +2,63 @@
|
|||||||
<sys_ui_list parent="" relationship="" sys_domain="global" table="x_355681_fa_log" version="2" view="">
|
<sys_ui_list parent="" relationship="" sys_domain="global" table="x_355681_fa_log" version="2" view="">
|
||||||
<sys_ui_list_element action="INSERT_OR_UPDATE">
|
<sys_ui_list_element action="INSERT_OR_UPDATE">
|
||||||
<average_value>false</average_value>
|
<average_value>false</average_value>
|
||||||
<element>sys_created_on</element>
|
<element>impacted_record</element>
|
||||||
<list_id display_value="x_355681_fa_log" element="NULL" name="x_355681_fa_log" parent="NULL" relationship="NULL" sys_domain="global" view="Default view">9a1af9369700211093a8337e6253af71</list_id>
|
<list_id display_value="x_355681_fa_log" element="NULL" name="x_355681_fa_log" parent="NULL" relationship="NULL" sys_domain="global" view="Default view">120c4307971021105838bfb3f153afe3</list_id>
|
||||||
<max_value>false</max_value>
|
<max_value>false</max_value>
|
||||||
<min_value>false</min_value>
|
<min_value>false</min_value>
|
||||||
<position>0</position>
|
<position>0</position>
|
||||||
<sum>false</sum>
|
<sum>false</sum>
|
||||||
<sys_created_by>admin</sys_created_by>
|
<sys_created_by>admin</sys_created_by>
|
||||||
<sys_created_on>2023-01-01 10:02:08</sys_created_on>
|
<sys_created_on>2023-01-14 20:54:17</sys_created_on>
|
||||||
<sys_id>121af9369700211093a8337e6253af73</sys_id>
|
<sys_id>1a0c4307971021105838bfb3f153afe4</sys_id>
|
||||||
<sys_mod_count>0</sys_mod_count>
|
<sys_mod_count>0</sys_mod_count>
|
||||||
<sys_updated_by>admin</sys_updated_by>
|
<sys_updated_by>admin</sys_updated_by>
|
||||||
<sys_updated_on>2023-01-01 10:02:08</sys_updated_on>
|
<sys_updated_on>2023-01-14 20:54:17</sys_updated_on>
|
||||||
|
</sys_ui_list_element>
|
||||||
|
<sys_ui_list_element action="INSERT_OR_UPDATE">
|
||||||
|
<average_value>false</average_value>
|
||||||
|
<element>message</element>
|
||||||
|
<list_id display_value="x_355681_fa_log" element="NULL" name="x_355681_fa_log" parent="NULL" relationship="NULL" sys_domain="global" view="Default view">120c4307971021105838bfb3f153afe3</list_id>
|
||||||
|
<max_value>false</max_value>
|
||||||
|
<min_value>false</min_value>
|
||||||
|
<position>1</position>
|
||||||
|
<sum>false</sum>
|
||||||
|
<sys_created_by>admin</sys_created_by>
|
||||||
|
<sys_created_on>2023-01-14 20:54:17</sys_created_on>
|
||||||
|
<sys_id>de0c4307971021105838bfb3f153afe4</sys_id>
|
||||||
|
<sys_mod_count>0</sys_mod_count>
|
||||||
|
<sys_updated_by>admin</sys_updated_by>
|
||||||
|
<sys_updated_on>2023-01-14 20:54:17</sys_updated_on>
|
||||||
|
</sys_ui_list_element>
|
||||||
|
<sys_ui_list_element action="INSERT_OR_UPDATE">
|
||||||
|
<average_value>false</average_value>
|
||||||
|
<element>timestamp</element>
|
||||||
|
<list_id display_value="x_355681_fa_log" element="NULL" name="x_355681_fa_log" parent="NULL" relationship="NULL" sys_domain="global" view="Default view">120c4307971021105838bfb3f153afe3</list_id>
|
||||||
|
<max_value>false</max_value>
|
||||||
|
<min_value>false</min_value>
|
||||||
|
<position>2</position>
|
||||||
|
<sum>false</sum>
|
||||||
|
<sys_created_by>admin</sys_created_by>
|
||||||
|
<sys_created_on>2023-01-14 20:54:17</sys_created_on>
|
||||||
|
<sys_id>520c4307971021105838bfb3f153afe5</sys_id>
|
||||||
|
<sys_mod_count>0</sys_mod_count>
|
||||||
|
<sys_updated_by>admin</sys_updated_by>
|
||||||
|
<sys_updated_on>2023-01-14 20:54:17</sys_updated_on>
|
||||||
|
</sys_ui_list_element>
|
||||||
|
<sys_ui_list_element action="INSERT_OR_UPDATE">
|
||||||
|
<average_value>false</average_value>
|
||||||
|
<element>sys_created_on</element>
|
||||||
|
<list_id display_value="x_355681_fa_log" element="NULL" name="x_355681_fa_log" parent="NULL" relationship="NULL" sys_domain="global" view="Default view">120c4307971021105838bfb3f153afe3</list_id>
|
||||||
|
<max_value>false</max_value>
|
||||||
|
<min_value>false</min_value>
|
||||||
|
<position>3</position>
|
||||||
|
<sum>false</sum>
|
||||||
|
<sys_created_by>admin</sys_created_by>
|
||||||
|
<sys_created_on>2023-01-14 20:54:17</sys_created_on>
|
||||||
|
<sys_id>d20c4307971021105838bfb3f153afe5</sys_id>
|
||||||
|
<sys_mod_count>0</sys_mod_count>
|
||||||
|
<sys_updated_by>admin</sys_updated_by>
|
||||||
|
<sys_updated_on>2023-01-14 20:54:17</sys_updated_on>
|
||||||
</sys_ui_list_element>
|
</sys_ui_list_element>
|
||||||
<sys_ui_list action="INSERT_OR_UPDATE">
|
<sys_ui_list action="INSERT_OR_UPDATE">
|
||||||
<average_value>false</average_value>
|
<average_value>false</average_value>
|
||||||
@ -27,10 +72,10 @@
|
|||||||
<sum>false</sum>
|
<sum>false</sum>
|
||||||
<sys_class_name>sys_ui_list</sys_class_name>
|
<sys_class_name>sys_ui_list</sys_class_name>
|
||||||
<sys_created_by>admin</sys_created_by>
|
<sys_created_by>admin</sys_created_by>
|
||||||
<sys_created_on>2023-01-01 10:02:08</sys_created_on>
|
<sys_created_on>2023-01-14 20:54:17</sys_created_on>
|
||||||
<sys_domain>global</sys_domain>
|
<sys_domain>global</sys_domain>
|
||||||
<sys_domain_path>/</sys_domain_path>
|
<sys_domain_path>/</sys_domain_path>
|
||||||
<sys_id>9a1af9369700211093a8337e6253af71</sys_id>
|
<sys_id>120c4307971021105838bfb3f153afe3</sys_id>
|
||||||
<sys_name>x_355681_fa_log</sys_name>
|
<sys_name>x_355681_fa_log</sys_name>
|
||||||
<sys_package display_value="Fulfilment Automater" source="x_355681_fa">c04afa629713111093a8337e6253af6d</sys_package>
|
<sys_package display_value="Fulfilment Automater" source="x_355681_fa">c04afa629713111093a8337e6253af6d</sys_package>
|
||||||
<sys_policy/>
|
<sys_policy/>
|
||||||
|
|||||||
Reference in New Issue
Block a user