summaryrefslogtreecommitdiffstats
path: root/examples/examples-myfirstpolicy/src/site-docs
diff options
context:
space:
mode:
authoraditya.puthuparambil <aditya.puthuparambil@est.tech>2020-03-19 10:52:46 +0000
committerAditya Puthuparambil <aditya.puthuparambil@est.tech>2020-03-19 12:06:50 +0000
commit8c69f0434102b0328ae4754783a01c36f7e35c97 (patch)
treed11ea0e4d806ad03080cb28c2bed6bd6232bcebe /examples/examples-myfirstpolicy/src/site-docs
parent690495d32c6033741d7a7c2413476f7ba88e2825 (diff)
Apex-pdp tutorial documentation changes
Issue-ID: POLICY-2424 Signed-off-by: aditya.puthuparambil <aditya.puthuparambil@est.tech> Change-Id: I92491c904b65a0db93c9e6eaba676c653c276175
Diffstat (limited to 'examples/examples-myfirstpolicy/src/site-docs')
-rw-r--r--examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/02-data-models.adoc9
-rw-r--r--examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/031-s1-new-model.adoc7
-rw-r--r--examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc43
-rw-r--r--examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/034-s1-test-policy.adoc5
-rw-r--r--examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/042-s2-test-policy.adoc5
5 files changed, 39 insertions, 30 deletions
diff --git a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/02-data-models.adoc b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/02-data-models.adoc
index 1ed43cc37..b07c67226 100644
--- a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/02-data-models.adoc
+++ b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/02-data-models.adoc
@@ -1,10 +1,11 @@
//
// ============LICENSE_START=======================================================
// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// Modifications Copyright (C) 2020 Nordix Foundation.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-//
+//
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
@@ -14,7 +15,7 @@
== Data Models
=== Sales Input Event
-Each time a PoS system processes a sales item an event with the following format is emitted:
+Each time a PoS system processes a sales item an event with the following format is triggered:
.Sale Input Event
[width="100%",options="header"]
@@ -34,14 +35,14 @@ The `notes` field contains arbitrary notes about the sale.
=== Sales Decision Event
-After a `SALE_INPUT` event is emitted by the PoS system _HyperM_'s policy-based controlled sales checking system emits a Sale Authorization Event indicating whether the sale is authorized or denied.
+After a `SALE_INPUT` event is triggered by the PoS system _HyperM_'s policy-based controlled sales checking system triggers a Sale Authorization Event indicating whether the sale is authorized or denied.
The PoS system can then listen for this event before continuing with the sale.
.Sale Authorisation Event
[width="100%",options="header"]
|====================
|Event| Fields | Description
-| SALE_AUTH | sale_ID, time, authorized, amount, item_ID, quantity, assistant_ID, branch_ID, notes, message... | Event indicating a sale of an item is authorized or denied
+| SALE_AUTH | sale_ID, time, authorized, amount, item_ID, quantity, assistant_ID, branch_ID, notes, message... | Event indicating if the sale of an item is authorized or denied
|====================
In each `SALE_AUTH` event the `sale_ID` field is copied from the `SALE_INPUT` event that trigger the decision request.
diff --git a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/031-s1-new-model.adoc b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/031-s1-new-model.adoc
index 7b601b9cc..182c024ae 100644
--- a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/031-s1-new-model.adoc
+++ b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/031-s1-new-model.adoc
@@ -1,21 +1,22 @@
//
// ============LICENSE_START=======================================================
// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// Modifications Copyright (C) 2020 Nordix Foundation.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-//
+//
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
//
-=== Create the an new empty Policy Model `MyFirstPolicyModel`
+=== Create an empty Policy Model `MyFirstPolicyModel`
Since an organisation like _HyperM_ may have many policies covering many different domains, policies should be grouped into policy sets. In order to edit or deploy a policy, or policy set, the definition of the policy(ies) and all required events, tasks, states, etc., are grouped together into a 'Policy Model'. An organization might define many Policy Models, each containing a different set of policies.
-So the first step is to create a new empty Policy Model called `MyFirstPolicyModel`. Using the APEX Policy Editor, click on the 'File' menus and select 'New'. Then define our new policy model called `MyFirstPolicyModel`. Use the 'Generate UUID' button to create a new unique ID for the policy model, and fill in a description for the policy model. Press the `Submit` button to save your changes.
+So the first step is to create an empty Policy Model called `MyFirstPolicyModel`. Using the APEX Policy Editor, click on the 'File' menus and select 'New'. Then define our new policy model called `MyFirstPolicyModel`. Use the 'Generate UUID' button to create a new unique ID for the policy model, and fill in a description for the policy model. Press the `Submit` button to save your changes.
.Create a new Policy Model 1/2
image::mfp/MyFirstPolicy_P1_newPolicyModel1.png[File > New to create a new Policy Model]
diff --git a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc
index 682d214ab..a8711dd3a 100644
--- a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc
+++ b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc
@@ -1,32 +1,20 @@
//
// ============LICENSE_START=======================================================
// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// Modifications Copyright (C) 2020 Nordix Foundation.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-//
+//
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
// @author Sven van der Meer (sven.van.der.meer@ericsson.com)
//
-=== Create the input event `SALE_INPUT` and the output event `SALE_AUTH`
-
-Using the APEX Policy Editor, click on the 'Events' tab. In the 'Events' pane, right click and select 'New':
-
-.Create a new Event type
-image::mfp/MyFirstPolicy_P1_newEvent1.png[Right click to create a new event]
+=== APEX Context Item Schemas
-Create a new event type called `SALE_INPUT`. Use the 'Generate UUID' button to create a new unique ID for the event type, and fill in a description for the event. Add a namespace, e.g. `com.hyperm`. We can add hard-coded strings for the `Source` and `Target`, e.g. `POS` and `APEX`. At this stage we will not add any parameter fields, we will leave this until later. Use the `Submit` button to create the event.
-
-.Populate the `SALE_INPUT` event
-image::mfp/MyFirstPolicy_P1_newEvent2.png["Fill in the necessary information for the 'SALE_INPUT' event and click 'Submit'"]
-
-Repeat the same steps for a new event type called `SALE_AUTH`.
-Just use `APEX` as source and `POS` as target, since this is the output event coming from APEX going to the sales point.
-
-Before we can add parameter fields to an event we must first define APEX Context Item Schemas that can be used by those fields.
+We must first define APEX Context Item Schemas that can be used as parameter fields to an event.
To create new item schemas, click on the 'Context Item Schemas' tab. In that 'Context Item Schemas' pane, right click and select 'Create new ContextSchema'.
@@ -54,7 +42,7 @@ Create item schemas with the following characteristics, each with its own unique
.Create new Item Schemas
image::mfp/MyFirstPolicy_P1_newItemSchema2.png["Create a new Item Schema"]
-The item schemas can now be seen on the 'Context Item Schemas' tab, and can be updated at any time by right-clicking on the item schemas on the 'Context Item Schemas' tab. Now we can go back to the event definitions for `SALE_INPUT` and `SALE_AUTH` and add some parameter fields.
+The item schemas can now be seen on the 'Context Item Schemas' tab, and can be updated at any time by right-clicking on the item schemas on the 'Context Item Schemas' tab.
[TIP]
.Field Schema types
@@ -72,7 +60,19 @@ APEX natively supports schema definitions in `Java` and `Avro`.
`Avro` schema definitions can be any valid https://avro.apache.org/docs/current/spec.html[Avro] schema. For events using fields defined with `Avro` schemas, any incoming event containing that field must contain a value that conforms to the Avro schema.
================================
-Click on the 'Events' tab, then right click the `SALE_INPUT` row and select 'Edit Event `SALE_INPUT`'. To add a new event parameter use the 'Add Event Parameter' button at the bottom of the screen. For the `SALE_INPUT` event add the following event parameters:
+=== Create the input event `SALE_INPUT` and the output event `SALE_AUTH`
+
+Using the APEX Policy Editor, click on the 'Events' tab. In the 'Events' pane, right click and select 'Create new Event':
+
+.Create a new Event type
+image::mfp/MyFirstPolicy_P1_newEvent1.png[Right click to create a new event]
+
+Create a new event type called `SALE_INPUT`. Use the 'Generate UUID' button to create a new unique ID for the event type, and fill in a description for the event. Add a namespace, e.g. `com.hyperm`. We can add hard-coded strings for the `Source` and `Target`, e.g. `POS` and `APEX`. At this stage we will not add any parameter fields, we will leave this until later. Use the `Submit` button to create the event.
+
+.Populate the `SALE_INPUT` event
+image::mfp/MyFirstPolicy_P1_newEvent2.png["Fill in the necessary information for the 'SALE_INPUT' event and click 'Submit'"]
+
+To add a new event parameter use the 'Add Event Parameter' button at the bottom of the screen. For the `SALE_INPUT` event add the following event parameters:
.Event Parameter Fields for the `SALE_INPUT` Event
[width="100%",options="header"]
@@ -99,7 +99,12 @@ Parameter fields can be _optional_ in events. If a parameter is not marked as _o
.Add typed parameter fields to an event
image::mfp/MyFirstPolicy_P1_newEvent3.png["Add new event parameters to an event"]
-Select the `SALE_AUTH` event and add the following event parameters:
+
+Repeat the same steps for a new event type called `SALE_AUTH`.
+Just use `APEX` as source and `POS` as target, since this is the output event coming from APEX going to the sales point.
+
+
+Add the following event parameters:
.Event Parameter Fields for the `SALE_AUTH` Event
[width="100%",options="header"]
diff --git a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/034-s1-test-policy.adoc b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/034-s1-test-policy.adoc
index 7cbc83cc1..a93940d85 100644
--- a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/034-s1-test-policy.adoc
+++ b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/034-s1-test-policy.adoc
@@ -1,10 +1,11 @@
//
// ============LICENSE_START=======================================================
// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// Modifications Copyright (C) 2020 Nordix Foundation.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-//
+//
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
@@ -20,7 +21,7 @@ This configuration expects incoming events to be in `JSON` format and to be pass
.JSON to load and execute _My First Policy_, read input JSON events from `stdin`, and emit output events to `stdout`
[source,json,options="nowrap"]
----
-include::{adsite-examples-myfirstpolicy-dir}/main/resources/org/onap/policy/apex/examples/myfirstpolicy/1/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json[configuration file]
+include::{adsite-examples-myfirstpolicy-dir}/main/resources/examples/config/myfirstpolicy/1/MyFirstPolicyConfigStdin2StdoutJsonEvent.json[configuration file]
----
To test the policy try paste the following events into the console as the APEX engine executes:
diff --git a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/042-s2-test-policy.adoc b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/042-s2-test-policy.adoc
index 5154596b1..285d54e80 100644
--- a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/042-s2-test-policy.adoc
+++ b/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/042-s2-test-policy.adoc
@@ -1,10 +1,11 @@
//
// ============LICENSE_START=======================================================
// Copyright (C) 2016-2018 Ericsson. All rights reserved.
+// Modifications Copyright (C) 2020 Nordix Foundation.
// ================================================================================
// This file is licensed under the CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE
// Full license text at https://creativecommons.org/licenses/by/4.0/legalcode
-//
+//
// SPDX-License-Identifier: CC-BY-4.0
// ============LICENSE_END=========================================================
//
@@ -20,7 +21,7 @@ Note, this has changed from the configuration file in Step 1 to enable the `JAVA
.JSON to load and execute _My First Policy_, read input JSON events from `stdin`, and emit output events to `stdout`
[source,json,options="nowrap"]
----
-include::{adsite-examples-myfirstpolicy-dir}/main/resources/org/onap/policy/apex/examples/myfirstpolicy/2/config/MyFirstPolicyConfigStdin2StdoutJsonEvent.json[configuration file]
+include::{adsite-examples-myfirstpolicy-dir}/main/resources/examples/config/myfirstpolicy/2/MyFirstPolicyConfigStdin2StdoutJsonEvent.json[configuration file]
----
To test the policy try paste the following events into the console as the APEX engine executes. Note, all tests from Step 1 will still work perfectly since none of those events originate from a branch with `branch_ID` between `1000` and `2000`. The 'Task Selection Logic' will therefore pick the `MorningBoozeCheck` task as expected, and will therefore give the same results.