aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json')
-rw-r--r--examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json
index 2651355fd..7318a4393 100644
--- a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json
+++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/1/MyFirstPolicyModel_0.0.1.alt.json
@@ -21,7 +21,7 @@
"version" : "0.0.1"
},
"UUID" : "3351b0f4-cf06-4fa2-8823-edf67bd30223",
- "description" : "This task checks if the sales request is for an item that contains alcohol. \nIf the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised. \nIn this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-)"
+ "description" : "This task checks if the sales request is for an item that contains alcohol.\nIf the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised.\nIn this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-)"
}
}, {
"key" : {
@@ -593,7 +593,7 @@
"taskLogic" : {
"key" : "TaskLogic",
"logicFlavour" : "JAVASCRIPT",
- "logic" : "/**============LICENSE_START=======================================================*Copyright(C)2016-2018Ericsson.Allrightsreserved.*================================================================================*LicensedundertheApacheLicense,Version2.0(the\"License\");*youmaynotusethisfileexceptincompliancewiththeLicense.*YoumayobtainacopyoftheLicenseat**http://www.apache.org/licenses/LICENSE-2.0**Unlessrequiredbyapplicablelaworagreedtoinwriting,software*distributedundertheLicenseisdistributedonan\"ASIS\"BASIS,*WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.*SeetheLicenseforthespecificlanguagegoverningpermissionsand*limitationsundertheLicense.**SPDX-License-Identifier:Apache-2.0*============LICENSE_END=========================================================*/\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);\n\n// Load compatibility script for imports etc \nload(\"nashorn:mozilla_compat.js\");\nimportPackage(java.text);\nimportClass(java.text.SimpleDateFormat);\n\nexecutor.logger.info(\"Task Execution: '\"+executor.subject.id+\"'. Input Fields: '\"+executor.inFields+\"'\");\n\nexecutor.outFields.put(\"amount\" , executor.inFields.get(\"amount\"));\nexecutor.outFields.put(\"assistant_ID\", executor.inFields.get(\"assistant_ID\"));\nexecutor.outFields.put(\"notes\" , executor.inFields.get(\"notes\"));\nexecutor.outFields.put(\"quantity\" , executor.inFields.get(\"quantity\"));\nexecutor.outFields.put(\"branch_ID\" , executor.inFields.get(\"branch_ID\"));\nexecutor.outFields.put(\"item_ID\" , executor.inFields.get(\"item_ID\"));\nexecutor.outFields.put(\"time\" , executor.inFields.get(\"time\"));\nexecutor.outFields.put(\"sale_ID\" , executor.inFields.get(\"sale_ID\"));\n\nitem_id = executor.inFields.get(\"item_ID\");\n\n//All times in this script are in GMT/UTC since the policy and events assume time is in GMT. \nvar timenow_gmt = new Date(Number(executor.inFields.get(\"time\")));\n\nvar midnight_gmt = new Date(Number(executor.inFields.get(\"time\")));\nmidnight_gmt.setUTCHours(0,0,0,0);\n\nvar eleven30_gmt = new Date(Number(executor.inFields.get(\"time\")));\neleven30_gmt.setUTCHours(11,30,0,0);\n\nvar timeformatter = new java.text.SimpleDateFormat(\"HH:mm:ss z\");\n\nvar itemisalcohol = false;\nif(item_id != null && item_id >=1000 && item_id < 2000)\n itemisalcohol = true;\n \nif( itemisalcohol\n && timenow_gmt.getTime() >= midnight_gmt.getTime()\n && timenow_gmt.getTime() < eleven30_gmt.getTime()) {\n\n executor.outFields.put(\"authorised\", false);\n executor.outFields.put(\"message\", \"Sale not authorised by policy task \" +\n executor.subject.taskName+ \" for time \" + timeformatter.format(timenow_gmt.getTime()) +\n \". Alcohol can not be sold between \" + timeformatter.format(midnight_gmt.getTime()) +\n \" and \" + timeformatter.format(eleven30_gmt.getTime()));\n}\nelse{\n executor.outFields.put(\"authorised\", true);\n executor.outFields.put(\"message\", \"Sale authorised by policy task \" + \n executor.subject.taskName + \" for time \"+timeformatter.format(timenow_gmt.getTime()));\n}\n\n/*\nThis task checks if a sale request is for an item that is an alcoholic drink.\nIf the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not\nauthorised. Otherwise the sale is authorised. \nIn this implementation we assume that items with item_ID value between 1000 and \n2000 are all alcoholic drinks :-)\n*/"
+ "logic" : "/**============LICENSE_START=======================================================*Copyright(C)2016-2018Ericsson.Allrightsreserved.*ModificationsCopyright(C)2020NordixFoundation.*================================================================================*LicensedundertheApacheLicense,Version2.0(the\"License\");*youmaynotusethisfileexceptincompliancewiththeLicense.*YoumayobtainacopyoftheLicenseat**http://www.apache.org/licenses/LICENSE-2.0**Unlessrequiredbyapplicablelaworagreedtoinwriting,software*distributedundertheLicenseisdistributedonan\"ASIS\"BASIS,*WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.*SeetheLicenseforthespecificlanguagegoverningpermissionsand*limitationsundertheLicense.**SPDX-License-Identifier:Apache-2.0*============LICENSE_END=========================================================*/\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);\n\n// Load compatibility script for imports etc\nload(\"nashorn:mozilla_compat.js\");\nimportPackage(java.text);\nimportClass(java.text.SimpleDateFormat);\n\nexecutor.logger.info(\"Task Execution: '\"+executor.subject.id+\"'. Input Fields: '\"+executor.inFields+\"'\");\n\nexecutor.outFields.put(\"amount\" , executor.inFields.get(\"amount\"));\nexecutor.outFields.put(\"assistant_ID\", executor.inFields.get(\"assistant_ID\"));\nexecutor.outFields.put(\"notes\" , executor.inFields.get(\"notes\"));\nexecutor.outFields.put(\"quantity\" , executor.inFields.get(\"quantity\"));\nexecutor.outFields.put(\"branch_ID\" , executor.inFields.get(\"branch_ID\"));\nexecutor.outFields.put(\"item_ID\" , executor.inFields.get(\"item_ID\"));\nexecutor.outFields.put(\"time\" , executor.inFields.get(\"time\"));\nexecutor.outFields.put(\"sale_ID\" , executor.inFields.get(\"sale_ID\"));\n\nitem_id = executor.inFields.get(\"item_ID\");\n\n//All times in this script are in GMT/UTC since the policy and events assume time is in GMT.\nvar timenow_gmt = new Date(Number(executor.inFields.get(\"time\")));\n\nvar midnight_gmt = new Date(Number(executor.inFields.get(\"time\")));\nmidnight_gmt.setUTCHours(0,0,0,0);\n\nvar eleven30_gmt = new Date(Number(executor.inFields.get(\"time\")));\neleven30_gmt.setUTCHours(11,30,0,0);\n\nvar timeformatter = new java.text.SimpleDateFormat(\"HH:mm:ss z\");\n\nvar itemisalcohol = false;\nif(item_id != null && item_id >=1000 && item_id < 2000)\n itemisalcohol = true;\n\nif( itemisalcohol\n && timenow_gmt.getTime() >= midnight_gmt.getTime()\n && timenow_gmt.getTime() < eleven30_gmt.getTime()) {\n\n executor.outFields.put(\"authorised\", false);\n executor.outFields.put(\"message\", \"Sale not authorised by policy task \" +\n executor.subject.taskName+ \" for time \" + timeformatter.format(timenow_gmt.getTime()) +\n \". Alcohol can not be sold between \" + timeformatter.format(midnight_gmt.getTime()) +\n \" and \" + timeformatter.format(eleven30_gmt.getTime()));\n}\nelse{\n executor.outFields.put(\"authorised\", true);\n executor.outFields.put(\"message\", \"Sale authorised by policy task \" + \n executor.subject.taskName + \" for time \"+timeformatter.format(timenow_gmt.getTime()));\n}\n\n/*\nThis task checks if a sale request is for an item that is an alcoholic drink.\nIf the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not\nauthorised. Otherwise the sale is authorised.\nIn this implementation we assume that items with item_ID value between 1000 and\n2000 are all alcoholic drinks :-)\n*/"
}
}
} ]