Add AVRO example for MyFirstPolicy 77/134877/1
authorwaynedunican <wayne.dunican@est.tech>
Fri, 9 Jun 2023 08:56:49 +0000 (09:56 +0100)
committerwaynedunican <wayne.dunican@est.tech>
Wed, 14 Jun 2023 13:24:32 +0000 (14:24 +0100)
- Avro example added for MFP
- Documentation review to follow
- Avro schemaTypes created individally in .avsc files

Issue-ID: POLICY-4691
Change-Id: I6be22763eeac9251d75b80f67052ba4ae7274f75
Signed-off-by: waynedunican <wayne.dunican@est.tech>
27 files changed:
examples/examples-myfirstpolicy/pom.xml
examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigFile2StdoutJsonEvent.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigStdin2StdoutJsonEvent.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigWs2WsServerJsonEvent.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_BoozeItem_084106GMT.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_BoozeItem_201713GMT.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_NonBoozeItem_101309GMT.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_BoozeItem_084106GMT.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_BoozeItem_201713GMT.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_NonBoozeItem_101309GMT.json [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventsIn.json.txt [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventsOut.json.txt [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/AlternateRecommendationCreate.mvel [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/BoozeConcessionCheck.mvel [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MorningBoozeCheck.mvel [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MyFirstPolicyModelAvro_0.0.1.apex [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MyFirstPolicy_SFL.js [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/assistantIDType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/authorisedType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/branchIDType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/itemIDType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/messageType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/notesType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/priceType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/quantityType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/saleIDType.avsc [new file with mode: 0644]
examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/timestampType.avsc [new file with mode: 0644]

index 861c550..dd74435 100644 (file)
@@ -38,6 +38,7 @@
     <policymodel1j.name>MyFirstPolicyModelJavascript_0.0.1</policymodel1j.name>
     <policymodel2.name>MyFirstPolicyModel_0.0.1</policymodel2.name>
     <policymodel3.name>MyFirstPolicyModelSFL_0.0.1</policymodel3.name>
+    <policymodel4.name>MyFirstPolicyModelAvro_0.0.1</policymodel4.name>
   </properties>
 
   <dependencies>
               </arguments>
             </configuration>
           </execution>
+          <execution>
+            <id>generate-policy4</id>
+            <phase>compile</phase>
+            <goals>
+              <goal>java</goal>
+            </goals>
+            <configuration>
+              <mainClass>org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain</mainClass>
+              <classpathScope>compile</classpathScope>
+              <arguments>
+                <argument>
+                  --command-file=${project.basedir}/src/main/resources/examples/models/MyFirstPolicy/4/${policymodel4.name}.apex
+                </argument>
+                <argument>
+                  --output-model-file=${project.build.directory}/classes/examples/models/MyFirstPolicy/4/${policymodel4.name}.json
+                </argument>
+                <argument>
+                  --log-file=${project.build.directory}/${policymodel4.name}_policygeneration.log
+                </argument>
+                <argument>--working-dir=${project.basedir}</argument>
+              </arguments>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
     </plugins>
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigFile2StdoutJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigFile2StdoutJsonEvent.json
new file mode 100644 (file)
index 0000000..0a1731c
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "engineServiceParameters": {
+    "name": "MyFirstPolicyApexEngine",
+    "version": "0.0.1",
+    "id": 103,
+    "instanceCount": 4,
+    "deploymentPort": 12345,
+    "engineParameters": {
+      "executorParameters": {
+        "MVEL": {
+          "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters"
+        },
+        "JAVASCRIPT": {
+          "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+        }
+      }
+    }
+  },
+  "eventOutputParameters": {
+    "FirstProducer": {
+      "carrierTechnologyParameters": {
+        "carrierTechnology": "FILE",
+        "parameters": {
+          "standardIo": true
+        }
+      },
+      "eventProtocolParameters": {
+        "eventProtocol": "JSON"
+      }
+    }
+  },
+  "eventInputParameters": {
+    "FirstConsumer": {
+      "carrierTechnologyParameters": {
+        "carrierTechnology": "FILE",
+        "parameters": {
+          "fileName": "examples/events/MyFirstPolicy/3/EventsIn.json.txt"
+        }
+      },
+      "eventProtocolParameters": {
+        "eventProtocol": "JSON"
+      }
+    }
+  }
+}
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigStdin2StdoutJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigStdin2StdoutJsonEvent.json
new file mode 100644 (file)
index 0000000..1975238
--- /dev/null
@@ -0,0 +1,45 @@
+{
+  "engineServiceParameters": {
+    "name": "MyFirstPolicyApexEngine",
+    "version": "0.0.1",
+    "id": 101,
+    "instanceCount": 4,
+    "deploymentPort": 12345,
+    "engineParameters": {
+      "executorParameters": {
+        "MVEL": {
+          "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters"
+        },
+        "JAVASCRIPT": {
+          "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+        }
+      }
+    }
+  },
+  "eventOutputParameters": {
+    "FirstProducer": {
+      "carrierTechnologyParameters": {
+        "carrierTechnology": "FILE",
+        "parameters": {
+          "standardIo": true
+        }
+      },
+      "eventProtocolParameters": {
+        "eventProtocol": "JSON"
+      }
+    }
+  },
+  "eventInputParameters": {
+    "FirstConsumer": {
+      "carrierTechnologyParameters": {
+        "carrierTechnology": "FILE",
+        "parameters": {
+          "standardIo": true
+        }
+      },
+      "eventProtocolParameters": {
+        "eventProtocol": "JSON"
+      }
+    }
+  }
+}
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigWs2WsServerJsonEvent.json b/examples/examples-myfirstpolicy/src/main/resources/examples/config/MyFirstPolicy/4/MyFirstPolicyConfigWs2WsServerJsonEvent.json
new file mode 100644 (file)
index 0000000..f6c4994
--- /dev/null
@@ -0,0 +1,49 @@
+{
+  "engineServiceParameters": {
+    "name": "MyFirstPolicyApexEngine",
+    "version": "0.0.1",
+    "id": 101,
+    "instanceCount": 4,
+    "deploymentPort": 12345,
+    "engineParameters": {
+      "executorParameters": {
+        "MVEL": {
+          "parameterClassName": "org.onap.policy.apex.plugins.executor.mvel.MvelExecutorParameters"
+        },
+        "JAVASCRIPT": {
+          "parameterClassName": "org.onap.policy.apex.plugins.executor.javascript.JavascriptExecutorParameters"
+        }
+      }
+    }
+  },
+  "eventOutputParameters": {
+    "aProducer": {
+      "carrierTechnologyParameters": {
+        "carrierTechnology": "WEBSOCKET",
+        "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WebSocketCarrierTechnologyParameters",
+        "parameters": {
+          "wsClient": false,
+          "port": 4000
+        }
+      },
+      "eventProtocolParameters": {
+        "eventProtocol": "JSON"
+      }
+    }
+  },
+  "eventInputParameters": {
+    "aConsumer": {
+      "carrierTechnologyParameters": {
+        "carrierTechnology": "WEBSOCKET",
+        "parameterClassName": "org.onap.policy.apex.plugins.event.carrier.websocket.WebSocketCarrierTechnologyParameters",
+        "parameters": {
+          "wsClient": false,
+          "port": 3000
+        }
+      },
+      "eventProtocolParameters": {
+        "eventProtocol": "JSON"
+      }
+    }
+  }
+}
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_BoozeItem_084106GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_BoozeItem_084106GMT.json
new file mode 100644 (file)
index 0000000..4c5af6c
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "nameSpace": "com.hyperm",
+  "name": "SALE_INPUT",
+  "version": "0.0.1",
+  "time": 1483346466000,
+  "sale_ID": 99999992,
+  "amount": 1249,
+  "item_ID": 1012,
+  "quantity": 1,
+  "assistant_ID": 12,
+  "branch_ID": 2
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_BoozeItem_201713GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_BoozeItem_201713GMT.json
new file mode 100644 (file)
index 0000000..cc18e7d
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "nameSpace": "com.hyperm",
+  "name": "SALE_INPUT",
+  "version": "0.0.1",
+  "time": 1482265033000,
+  "sale_ID": 99999993,
+  "amount": 4799,
+  "item_ID": 1943,
+  "quantity": 2,
+  "assistant_ID": 9,
+  "branch_ID": 3
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_NonBoozeItem_101309GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventIn_NonBoozeItem_101309GMT.json
new file mode 100644 (file)
index 0000000..1cdc499
--- /dev/null
@@ -0,0 +1,13 @@
+{
+  "nameSpace": "com.hyperm",
+  "name": "SALE_INPUT",
+  "version": "0.0.1",
+  "time": 1483351989000,
+  "sale_ID": 99999991,
+  "amount": 299,
+  "item_ID": 5123,
+  "quantity": 1,
+  "assistant_ID": 23,
+  "branch_ID": 1,
+  "notes": "Special Offer!!"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_BoozeItem_084106GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_BoozeItem_084106GMT.json
new file mode 100644 (file)
index 0000000..3625f90
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "nameSpace": "com.hyperm",
+  "name": "SALE_AUTH",
+  "version": "0.0.1",
+  "source": "",
+  "target": "",
+  "amount": 1249,
+  "assistant_ID": 12,
+  "authorised": false,
+  "branch_ID": 2,
+  "item_ID": 1012,
+  "message": "Sale not authorised by policy task MorningBoozeCheck for time 08:41:06 GMT. Alcohol can not be sold between 00:00:00 GMT and 11:30:00 GMT",
+  "notes": null,
+  "quantity": 1,
+  "sale_ID": 99999992,
+  "time": 1483346466000
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_BoozeItem_201713GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_BoozeItem_201713GMT.json
new file mode 100644 (file)
index 0000000..2b760d5
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "name": "SALE_AUTH",
+  "version": "0.0.1",
+  "nameSpace": "com.hyperm",
+  "source": "",
+  "target": "",
+  "amount": 4799,
+  "assistant_ID": 9,
+  "authorised": true,
+  "branch_ID": 3,
+  "item_ID": 1943,
+  "message": "Sale authorised by policy task MorningBoozeCheck for time 20:17:13 GMT",
+  "notes": null,
+  "quantity": 2,
+  "sale_ID": 99999993,
+  "time": 1482265033000
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_NonBoozeItem_101309GMT.json b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventOut_NonBoozeItem_101309GMT.json
new file mode 100644 (file)
index 0000000..b90c6fa
--- /dev/null
@@ -0,0 +1,17 @@
+{
+  "name": "SALE_AUTH",
+  "version": "0.0.1",
+  "nameSpace": "com.hyperm",
+  "source": "",
+  "target": "",
+  "amount": 299,
+  "assistant_ID": 23,
+  "authorised": true,
+  "branch_ID": 1,
+  "item_ID": 5123,
+  "message": "Sale authorised by policy task MorningBoozeCheck for time 10:13:09 GMT",
+  "notes": "Special Offer!!",
+  "quantity": 1,
+  "sale_ID": 99999991,
+  "time": 1483351989000
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventsIn.json.txt b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventsIn.json.txt
new file mode 100644 (file)
index 0000000..a9570f9
--- /dev/null
@@ -0,0 +1,37 @@
+{
+  "nameSpace": "com.hyperm",
+  "name": "SALE_INPUT",
+  "version": "0.0.1",
+  "time": 1483346466000,
+  "sale_ID": 99999992,
+  "amount": 1249,
+  "item_ID": 1012,
+  "quantity": 1,
+  "assistant_ID": 12,
+  "branch_ID": 2
+}
+{
+  "nameSpace": "com.hyperm",
+  "name": "SALE_INPUT",
+  "version": "0.0.1",
+  "time": 1482265033000,
+  "sale_ID": 99999993,
+  "amount": 4799,
+  "item_ID": 1943,
+  "quantity": 2,
+  "assistant_ID": 9,
+  "branch_ID": 3
+}
+{
+  "nameSpace": "com.hyperm",
+  "name": "SALE_INPUT",
+  "version": "0.0.1",
+  "time": 1483351989000,
+  "sale_ID": 99999991,
+  "amount": 299,
+  "item_ID": 5123,
+  "quantity": 1,
+  "assistant_ID": 23,
+  "branch_ID": 1,
+  "notes": "Special Offer!!"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventsOut.json.txt b/examples/examples-myfirstpolicy/src/main/resources/examples/events/MyFirstPolicy/4/EventsOut.json.txt
new file mode 100644 (file)
index 0000000..46fd887
--- /dev/null
@@ -0,0 +1,51 @@
+{
+  "nameSpace": "com.hyperm",
+  "name": "SALE_AUTH",
+  "version": "0.0.1",
+  "source": "",
+  "target": "",
+  "amount": 1249,
+  "assistant_ID": 12,
+  "authorised": false,
+  "branch_ID": 2,
+  "item_ID": 1012,
+  "message": "Sale not authorised by policy task MorningBoozeCheck for time 08:41:06 GMT. Alcohol can not be sold between 00:00:00 GMT and 11:30:00 GMT",
+  "notes": null,
+  "quantity": 1,
+  "sale_ID": 99999992,
+  "time": 1483346466000
+}
+{
+  "name": "SALE_AUTH",
+  "version": "0.0.1",
+  "nameSpace": "com.hyperm",
+  "source": "",
+  "target": "",
+  "amount": 4799,
+  "assistant_ID": 9,
+  "authorised": true,
+  "branch_ID": 3,
+  "item_ID": 1943,
+  "message": "Sale authorised by policy task MorningBoozeCheck for time 20:17:13 GMT",
+  "notes": null,
+  "quantity": 2,
+  "sale_ID": 99999993,
+  "time": 1482265033000
+}
+{
+  "name": "SALE_AUTH",
+  "version": "0.0.1",
+  "nameSpace": "com.hyperm",
+  "source": "",
+  "target": "",
+  "amount": 299,
+  "assistant_ID": 23,
+  "authorised": true,
+  "branch_ID": 1,
+  "item_ID": 5123,
+  "message": "Sale authorised by policy task MorningBoozeCheck for time 10:13:09 GMT",
+  "notes": "Special Offer!!",
+  "quantity": 1,
+  "sale_ID": 99999991,
+  "time": 1483351989000
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/AlternateRecommendationCreate.mvel b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/AlternateRecommendationCreate.mvel
new file mode 100644 (file)
index 0000000..3c98c9f
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) (C) 2020 Nordix Foundation. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+logger.info("Task Execution: '"+subject.id+"'. Input Fields: '"+inFields+"'");
+
+outFields.put("sale_ID"     , inFields.get("sale_ID"));
+outFields.put("message", "Please choose a non -alcoholic drink :)");
+return true;
+
+/*
+This task provides recommendation to buy a non alcoholic drink. :-)
+*/
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/BoozeConcessionCheck.mvel b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/BoozeConcessionCheck.mvel
new file mode 100644 (file)
index 0000000..b129333
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+logger.info("Task Execution: '"+subject.id+"'. Input Fields: '"+inFields+"'");
+
+outFields.put("sale_ID"     , inFields.get("sale_ID"));
+
+if(inFields.get("quantity") != null && inFields.get("quantity") >2){
+  outFields.put("message", false);
+  outFields.put("message", "Sale authorised by policy task "+subject.taskName+
+  " concession 10%");
+  return true;
+}
+else{
+  outFields.put("message", "Sale authorised by policy task "+subject.taskName+
+  " is not eligible for concession");
+  return true;
+}
+
+/*
+This task checks if a sale quantity for an item that is approved for sale.
+If the quantity is greater than 2 , the user is eligible for 10 % concession.
+*/
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MorningBoozeCheck.mvel b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MorningBoozeCheck.mvel
new file mode 100644 (file)
index 0000000..fc669dc
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+import java.util.Date;
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.text.SimpleDateFormat;
+
+logger.info("Task Execution: '"+subject.id+"'. Input Fields: '"+inFields+"'");
+
+outFields.put("amount"      , inFields.get("amount"));
+outFields.put("assistant_ID", inFields.get("assistant_ID"));
+outFields.put("notes"       , inFields.get("notes"));
+outFields.put("quantity"    , inFields.get("quantity"));
+outFields.put("branch_ID"   , inFields.get("branch_ID"));
+outFields.put("item_ID"     , inFields.get("item_ID"));
+outFields.put("time"        , inFields.get("time"));
+outFields.put("sale_ID"     , inFields.get("sale_ID"));
+
+item_id = inFields.get("item_ID");
+
+//The events used later to test this task use GMT timezone!
+gmt = TimeZone.getTimeZone("GMT");
+timenow = Calendar.getInstance(gmt);
+df = new SimpleDateFormat("HH:mm:ss z");
+df.setTimeZone(gmt);
+timenow.setTimeInMillis(inFields.get("time"));
+
+midnight = timenow.clone();
+midnight.set(
+    timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),
+    timenow.get(Calendar.DATE),0,0,0);
+eleven30 = timenow.clone();
+eleven30.set(
+    timenow.get(Calendar.YEAR),timenow.get(Calendar.MONTH),
+    timenow.get(Calendar.DATE),11,30,0);
+
+itemisalcohol = false;
+if(item_id != null && item_id >=1000 && item_id < 2000)
+    itemisalcohol = true;
+
+if( itemisalcohol
+    && timenow.after(midnight) && timenow.before(eleven30)){
+  outFields.put("authorised", false);
+  outFields.put("message", "Sale not authorised by policy task "+subject.taskName+
+    " for time "+df.format(timenow.getTime())+
+    ". Alcohol can not be sold between "+df.format(midnight.getTime())+
+    " and "+df.format(eleven30.getTime()));
+  return true;
+}
+else{
+  outFields.put("authorised", true);
+  outFields.put("message", "Sale authorised by policy task "+subject.taskName+
+    " for time "+df.format(timenow.getTime()));
+  return true;
+}
+
+/*
+This task checks if a sale request is for an item that is an alcoholic drink.
+If the local time is between 00:00:00 GMT and 11:30:00 GMT then the sale is not
+authorised. Otherwise the sale is authorised.
+In this implementation we assume that items with item_ID value between 1000 and
+2000 are all alcoholic drinks :-)
+*/
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MyFirstPolicyModelAvro_0.0.1.apex b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MyFirstPolicyModelAvro_0.0.1.apex
new file mode 100644 (file)
index 0000000..f521232
--- /dev/null
@@ -0,0 +1,182 @@
+#-------------------------------------------------------------------------------
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#-------------------------------------------------------------------------------
+
+model create name=MyFirstPolicyModel version=0.0.1 uuid=540226fb-55ee-4f0e-a444-983a0494818e description="This is my first Apex Policy Model."
+
+schema create name=assistant_ID_type version=0.0.1 uuid=36df4c71-9616-4206-8b53-976a5cd4bd87 description="A type for 'assistant_ID' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/assistantIDType.avsc"
+LE
+
+schema create name=authorised_type version=0.0.1 uuid=d48b619e-d00d-4008-b884-02d76ea4350b description="A type for 'authorised' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/authorisedType.avsc"
+LE
+
+schema create name=branch_ID_type version=0.0.1 uuid=6468845f-4122-4128-8e49-0f52c26078b5 description="A type for 'branch_ID' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/branchIDType.avsc"
+LE
+
+schema create name=item_ID_type version=0.0.1 uuid=4f227ff1-aee0-453a-b6b6-9a4b2e0da932 description="A type for 'item_ID' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/itemIDType.avsc"
+LE
+
+schema create name=message_type version=0.0.1 uuid=ad1431bb-3155-4e73-b5a3-b89bee498749 description="A type for 'message' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/messageType.avsc"
+LE
+
+schema create name=notes_type version=0.0.1 uuid=eecfde90-896c-4343-8f9c-2603ced94e2d description="A type for 'notes' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/notesType.avsc"
+LE
+
+schema create name=price_type version=0.0.1 uuid=52c2fc45-fd8c-463c-bd6f-d91b0554aea7 description="A type for 'amount'/'price' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/assistantIDType.avsc"
+LE
+
+schema create name=quantity_type version=0.0.1 uuid=ac3d9842-80af-4a98-951c-bd79a431c613 description="A type for 'quantity' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/quantityType.avsc"
+LE
+
+schema create name=sale_ID_type version=0.0.1 uuid=cca47d74-7754-4a61-b163-ca31f66b157b description="A type for 'sale_ID' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/saleIDType.avsc"
+LE
+
+schema create name=timestamp_type version=0.0.1 uuid=fd594e88-411d-4a94-b2be-697b3a0d7adf description="A type for 'time' values" flavour=Avro schema=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/4/avsc/timestampType.avsc"
+LE
+
+task create name=MorningBoozeCheck version=0.0.1 uuid=3351b0f4-cf06-4fa2-8823-edf67bd30223 description=LS
+This task checks if the sales request is for an item that contains alcohol.
+If the local time is between 00:00:00 and 11:30:00 then the sale is not authorised. Otherwise the sale is authorised.
+In this implementation we assume that all items with item_ID values between 1000 and 2000 contain alcohol :-)
+LE
+task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1
+task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1
+task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true
+task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1
+task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1
+task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1
+task inputfield create name=MorningBoozeCheck version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=authorised schemaName=authorised_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1
+task outputfield create name=MorningBoozeCheck version=0.0.1 fieldName=message schemaName=message_type schemaVersion=0.0.1 optional=true
+
+task logic create name=MorningBoozeCheck version=0.0.1 logicFlavour=MVEL logic=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/3/MorningBoozeCheck.mvel"
+LE
+
+task create name=BoozeConcessionCheck version=0.0.1 description=LS
+This task checks if the approved sales item is eligible for concession
+In this implementation we assume that all items with quantity greater than 2 is eligible for concession :-)
+LE
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=authorised schemaName=authorised_type schemaVersion=0.0.1
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1
+task inputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=message schemaName=message_type schemaVersion=0.0.1 optional=true
+task outputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+task outputfield create name=BoozeConcessionCheck version=0.0.1 fieldName=message schemaName=message_type schemaVersion=0.0.1 optional=true
+
+task logic create name=BoozeConcessionCheck version=0.0.1 logicFlavour=MVEL logic=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/3/BoozeConcessionCheck.mvel"
+LE
+
+task create name=AlternateRecommendationCreate version=0.0.1 description=LS
+This task checks if the approved sales item is rejected for sale
+In this implementation we assume that all denied customers will be recommended to buy non alcoholic drinks :-)
+LE
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=amount schemaName=price_type schemaVersion=0.0.1
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=quantity schemaName=quantity_type schemaVersion=0.0.1
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=item_ID schemaName=item_ID_type schemaVersion=0.0.1
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=authorised schemaName=authorised_type schemaVersion=0.0.1
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=time schemaName=timestamp_type schemaVersion=0.0.1
+task inputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=message schemaName=message_type schemaVersion=0.0.1 optional=true
+task outputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+task outputfield create name=AlternateRecommendationCreate version=0.0.1 fieldName=message schemaName=message_type schemaVersion=0.0.1 optional=true
+
+task logic create name=AlternateRecommendationCreate version=0.0.1 logicFlavour=MVEL logic=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/3/AlternateRecommendationCreate.mvel"
+LE
+
+event create name=SALE_AUTH version=0.0.1 uuid=c4500941-3f98-4080-a9cc-5b9753ed050b description="An event emitted by the Policy to indicate whether the sale of an item has been authorised" nameSpace=com.hyperm source="APEX" target="POS"
+event parameter create name=SALE_AUTH version=0.0.1 parName=amount schemaName=price_type schemaVersion=0.0.1
+event parameter create name=SALE_AUTH version=0.0.1 parName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_AUTH version=0.0.1 parName=authorised schemaName=authorised_type schemaVersion=0.0.1
+event parameter create name=SALE_AUTH version=0.0.1 parName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_AUTH version=0.0.1 parName=item_ID schemaName=item_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_AUTH version=0.0.1 parName=message schemaName=message_type schemaVersion=0.0.1 optional=true
+event parameter create name=SALE_AUTH version=0.0.1 parName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true
+event parameter create name=SALE_AUTH version=0.0.1 parName=quantity schemaName=quantity_type schemaVersion=0.0.1
+event parameter create name=SALE_AUTH version=0.0.1 parName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_AUTH version=0.0.1 parName=time schemaName=timestamp_type schemaVersion=0.0.1
+
+event create name=SALE_INPUT version=0.0.1 uuid=4f04aa98-e917-4f4a-882a-c75ba5a99374 description="An event raised by the PoS system each time an item is scanned for purchase" nameSpace=com.hyperm source="POS" target="APEX"
+event parameter create name=SALE_INPUT version=0.0.1 parName=amount schemaName=price_type schemaVersion=0.0.1
+event parameter create name=SALE_INPUT version=0.0.1 parName=assistant_ID schemaName=assistant_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_INPUT version=0.0.1 parName=branch_ID schemaName=branch_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_INPUT version=0.0.1 parName=item_ID schemaName=item_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_INPUT version=0.0.1 parName=notes schemaName=notes_type schemaVersion=0.0.1 optional=true
+event parameter create name=SALE_INPUT version=0.0.1 parName=quantity schemaName=quantity_type schemaVersion=0.0.1
+event parameter create name=SALE_INPUT version=0.0.1 parName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_INPUT version=0.0.1 parName=time schemaName=timestamp_type schemaVersion=0.0.1
+
+event create name=SALE_CONCESSION version=0.0.1 description="An event raised by the PoS system each time an item is approved for sale" nameSpace=com.hyperm source="POS" target="APEX"
+event parameter create name=SALE_CONCESSION version=0.0.1 parName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_CONCESSION version=0.0.1 parName=message schemaName=message_type schemaVersion=0.0.1 optional=true
+
+event create name=SALE_RECOMMEND version=0.0.1 description="An event raised by the PoS system each time an item is not approved for sale" nameSpace=com.hyperm source="POS" target="APEX"
+event parameter create name=SALE_RECOMMEND version=0.0.1 parName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1
+event parameter create name=SALE_RECOMMEND version=0.0.1 parName=message schemaName=message_type schemaVersion=0.0.1 optional=true
+
+policy create name=MyFirstPolicy version=0.0.1 description="This is my first Apex policy. It checks if a sale should be authorised or not." template=FREEFORM firstState=BoozeAuthDecide
+policy state create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide triggerName=SALE_INPUT triggerVersion=0.0.1 defaultTaskName=MorningBoozeCheck defaultTaskVersion=0.0.1
+policy state create name=MyFirstPolicy version=0.0.1 stateName=BoozeConcessionDecide triggerName=SALE_AUTH triggerVersion=0.0.1 defaultTaskName=BoozeConcessionCheck defaultTaskVersion=0.0.1
+policy state create name=MyFirstPolicy version=0.0.1 stateName=AlternateRecommendation triggerName=SALE_AUTH triggerVersion=0.0.1 defaultTaskName=AlternateRecommendationCreate defaultTaskVersion=0.0.1
+policy state output create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide outputName=MorningBoozeCheck_Output_Approved eventName=SALE_AUTH eventVersion=0.0.1 nextState=BoozeConcessionDecide
+policy state output create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide outputName=MorningBoozeCheck_Output_Denied eventName=SALE_AUTH eventVersion=0.0.1 nextState=AlternateRecommendation
+
+policy state finalizerlogic create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide finalizerLogicName=MorningBoozeCheck_Output_logic logicFlavour=JAVASCRIPT logic=LS
+#MACROFILE:"src/main/resources/examples/models/MyFirstPolicy/3/MyFirstPolicy_SFL.js"
+LE
+policy state taskref create name=MyFirstPolicy version=0.0.1 stateName=BoozeAuthDecide taskLocalName=MorningBoozeCheck taskName=MorningBoozeCheck taskVersion=0.0.1 outputType=LOGIC outputName=MorningBoozeCheck_Output_logic
+
+policy state output create name=MyFirstPolicy version=0.0.1 stateName=BoozeConcessionDecide outputName=BoozeConcessionCheck_Output eventName=SALE_CONCESSION eventVersion=0.0.1 nextState=NULL
+policy state taskref create name=MyFirstPolicy version=0.0.1 stateName=BoozeConcessionDecide taskLocalName=BoozeConcessionCheck taskName=BoozeConcessionCheck taskVersion=0.0.1 outputType=DIRECT outputName=BoozeConcessionCheck_Output
+
+policy state output create name=MyFirstPolicy version=0.0.1 stateName=AlternateRecommendation outputName=AlternateRecommendationCreate_Output eventName=SALE_RECOMMEND eventVersion=0.0.1 nextState=NULL
+policy state taskref create name=MyFirstPolicy version=0.0.1 stateName=AlternateRecommendation taskLocalName=AlternateRecommendationCreate taskName=AlternateRecommendationCreate taskVersion=0.0.1 outputType=DIRECT outputName=AlternateRecommendationCreate_Output
+
+validate
+quit
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MyFirstPolicy_SFL.js b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/MyFirstPolicy_SFL.js
new file mode 100644 (file)
index 0000000..2088f7d
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2020 Nordix Foundation. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+executor.logger.info("finalizer execution: " + executor.subject.id);
+
+if (executor.fields.get("authorised") == true) {
+  executor.logger.info("finalizer if block ");
+  executor.setSelectedStateOutputName("MorningBoozeCheck_Output_Approved");
+} else {
+  executor.logger.info("finalizer else block ");
+  executor.setSelectedStateOutputName("MorningBoozeCheck_Output_Denied");
+}
+
+executor.logger.info("finalizer outputs ##2##: " + executor.stateOutputNames);
+executor.logger.info(
+    "finalizer outputs:##2##: ##" + executor.selectedStateOutputName + "##");
+
+true;
+
+/*
+State Finaliser logic to decide the next state on the basis if the sale is approved or denied.
+If the sale is approved, MorningBoozeCheck_Output_Approved is set as the state output.
+If the sale is rejected, MorningBoozeCheck_Output_Denied is set as the state output.
+*/
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/assistantIDType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/assistantIDType.avsc
new file mode 100644 (file)
index 0000000..2158b98
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "long",
+  "doc": "A type for 'assistant ID' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/authorisedType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/authorisedType.avsc
new file mode 100644 (file)
index 0000000..a02f28b
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "boolean",
+  "doc": "A type for 'authorised' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/branchIDType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/branchIDType.avsc
new file mode 100644 (file)
index 0000000..19a6a27
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "long",
+  "doc": "A type for 'branch ID' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/itemIDType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/itemIDType.avsc
new file mode 100644 (file)
index 0000000..ecc674b
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "long",
+  "doc": "A type for 'item ID' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/messageType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/messageType.avsc
new file mode 100644 (file)
index 0000000..0544f65
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "string",
+  "doc": "A type for 'message type' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/notesType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/notesType.avsc
new file mode 100644 (file)
index 0000000..bc09318
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "string",
+  "doc": "A type for 'notes type' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/priceType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/priceType.avsc
new file mode 100644 (file)
index 0000000..c63384b
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "long",
+  "doc": "A type for 'price' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/quantityType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/quantityType.avsc
new file mode 100644 (file)
index 0000000..e1d4b70
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "int",
+  "doc": "A type for 'quantity' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/saleIDType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/saleIDType.avsc
new file mode 100644 (file)
index 0000000..fedd0f6
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "long",
+  "doc": "A type for 'sale ID' values"
+}
\ No newline at end of file
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/timestampType.avsc b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/4/avsc/timestampType.avsc
new file mode 100644 (file)
index 0000000..42bc656
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "type": "long",
+  "doc": "A type for 'timestamp' values"
+}
\ No newline at end of file