diff --git a/criticality-prebuilt/pom.xml b/criticality-prebuilt/pom.xml index 04cb80a..9b1b4b7 100644 --- a/criticality-prebuilt/pom.xml +++ b/criticality-prebuilt/pom.xml @@ -10,6 +10,8 @@ 17 2.10.0 + 17 + 17 diff --git a/incidents-app-java/app/incidents/annotations.cds b/incidents-app-java/app/incidents/annotations.cds index 84de5c9..3b1e57f 100644 --- a/incidents-app-java/app/incidents/annotations.cds +++ b/incidents-app-java/app/incidents/annotations.cds @@ -33,6 +33,7 @@ annotate service.Incidents with @( $Type : 'UI.DataField', Value : urgency.descr, Label : '{i18n>Urgency}', + Criticality : urgency.criticality, }, { $Type : 'UI.DataField', @@ -86,7 +87,7 @@ annotate service.Incidents with @( Label : 'Conversations', ID : 'Conversations', Target : 'conversation/@UI.LineItem#Conversations', - }, + } ] ); annotate service.Incidents with @( diff --git a/incidents-app-java/db/criticality.cds b/incidents-app-java/db/criticality.cds new file mode 100644 index 0000000..6c7862c --- /dev/null +++ b/incidents-app-java/db/criticality.cds @@ -0,0 +1,23 @@ +using {sap.capire.incidents as my} from './schema'; + +annotate my.Status with { + code @criticality { + new @criticality.Neutral; + assigned @criticality.Critical; + in_process @criticality.Critical; + on_hold @criticality.Negative; + resolved @criticality.Positive; + closed @criticality.Positive; + }; +}; + +extend my.Urgency { + criticality : Integer; +}; + +annotate my.Urgency with { + code @criticality { + high @criticality.Negative; + medium @criticality.Critical; + }; +}; \ No newline at end of file diff --git a/incidents-app-java/srv/pom.xml b/incidents-app-java/srv/pom.xml index 21f4ecc..526f526 100644 --- a/incidents-app-java/srv/pom.xml +++ b/incidents-app-java/srv/pom.xml @@ -35,6 +35,12 @@ runtime + + com.sap.capire + criticality + 1.0-SNAPSHOT + + org.springframework.boot spring-boot-devtools diff --git a/readme.md b/readme.md index 67b545e..5d8c3c9 100644 --- a/readme.md +++ b/readme.md @@ -135,6 +135,12 @@ annotate my.Urgency with { }; ``` +In order to have Criticality properly displayed in the Fiori Elements UI you also need to add the following CDS line to the `app/incidents/annotations.cds` below line 35: + +``` + Criticality : urgency.criticality, +``` + Add the dependency of the just created plugin to your `srv/pom.xml`: ```xml @@ -159,4 +165,6 @@ Get the Incidents entities with expanded `urgency` association. ```http GET http://localhost:8080/odata/v4/ProcessorService/Incidents?$expand=urgency Authorization: basic YWxpY2U6 -``` \ No newline at end of file +``` + +The results should now include an integer value for some Urgency elements (according to the annotations you made). You can also see the Incidents coloured and annotated with little symbols on the UI now: http://localhost:8080/incidents/webapp/index.html \ No newline at end of file