diff options
author | Jim Hahn <jrh3@att.com> | 2020-10-16 14:17:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-10-16 14:17:43 +0000 |
commit | 5190c58837149c4599182d211d8ae5bd83003d34 (patch) | |
tree | 6186091f088a43623a2b9ebf9b203fc33e90825a /examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc | |
parent | c293413c1c46d3c59ff8a855d683f4614bbe644a (diff) | |
parent | 0cf967c0239a8ab9c8b8831b700b72d9a08f7b03 (diff) |
Merge "Remove apex asciidoc documents"
Diffstat (limited to 'examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc')
-rw-r--r-- | examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc | 127 |
1 files changed, 0 insertions, 127 deletions
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 deleted file mode 100644 index a8711dd3a..000000000 --- a/examples/examples-myfirstpolicy/src/site-docs/adoc/fragments/032-s1-new-events.adoc +++ /dev/null @@ -1,127 +0,0 @@ -// -// ============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) -// - -=== APEX Context Item Schemas - -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'. - -.Create new Data Types -image::mfp/MyFirstPolicy_P1_newItemSchema1.png["Right click to create a new Item Schema"] - -Create item schemas with the following characteristics, each with its own unique UUID: - -.Item Schemas -[width="100%",options="header"] -|==================== -| Name | Schema Flavour | Schema Definition | Description -| timestamp_type | Java | java.lang.Long | A type for `time` values -| sale_ID_type | Java | java.lang.Long | A type for `sale_ID` values -| price_type | Java | java.lang.Long | A type for `amount`/`price` values -| item_ID_type | Java | java.lang.Long | A type for `item_ID` values -| assistant_ID_type | Java | java.lang.Long | A type for `assistant_ID` values -| quantity_type | Java | java.lang.Integer | A type for `quantity` values -| branch_ID_type | Java | java.lang.Long | A type for `branch_ID` values -| notes_type | Java | java.lang.String | A type for `notes` values -| authorised_type | Java | java.lang.Boolean | A type for `authorised` values -| message_type | Java | java.lang.String | A type for `message` values -|==================== - -.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. - -[TIP] -.Field Schema types -================================ -APEX natively supports schema definitions in `Java` and `Avro`. - -`Java` schema definitions are simply the name of a Java Class. There are some restrictions: - -* the class must be instantiatable, i.e. not an Java interface or abstract class - -* primitive types are not supported, i.e. use `java.lang.Integer` instead of `int`, etc. - -* it must be possible to find the class, i.e. the class must be contained in the Java classpath. - -`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. -================================ - -=== 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"] -|==================== -| Parameter Name | Parameter Type | Optional -| time | timestamp_type | no -| sale_ID | sale_ID_type | no -| amount | price_type | no -| item_ID | item_ID_type | no -| quantity | quantity_type | no -| assistant_ID | assistant_ID_type | no -| branch_ID | branch_ID_type | no -| notes | notes_type | _yes_ -|==================== - -Remember to click the 'Submit' button at the bottom of the event definition pane. - -[TIP] -.Optional Fields in APEX Events -================================ -Parameter fields can be _optional_ in events. If a parameter is not marked as _optional_ then by default it is _mandatory_, so it must appear in any input event passed to APEX. If an _optional_ field is not set for an output event then value will be set to `null`. -================================ - -.Add typed parameter fields to an event -image::mfp/MyFirstPolicy_P1_newEvent3.png["Add new event parameters to an event"] - - -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"] -|==================== -| Parameter Name | Parameter Type | no -| sale_ID | sale_ID_type | no -| time | timestamp_type | no -| authorised | authorised_type | no -| message | message_type | _yes_ -| amount | price_type | no -| item_ID | item_ID_type | no -| assistant_ID | assistant_ID_type | no -| quantity | quantity_type | no -| branch_ID | branch_ID_type | no -| notes | notes_type | _yes_ -|==================== -Remember to click the 'Submit' button at the bottom of the event definition pane. - -The events for our policy are now defined. - |