diff options
Diffstat (limited to 'examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex')
-rw-r--r-- | examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex index 1599ff20b..e512a1341 100644 --- a/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex +++ b/examples/examples-myfirstpolicy/src/main/resources/examples/models/MyFirstPolicy/2/MyFirstPolicyModel_0.0.1.apex @@ -1,19 +1,20 @@ #------------------------------------------------------------------------------- # ============LICENSE_START======================================================= # Copyright (C) 2016-2018 Ericsson. All rights reserved. +# Modifications Copyright (C) 2020 Nordix Foundation. # ================================================================================ # 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========================================================= #------------------------------------------------------------------------------- @@ -41,8 +42,8 @@ schema create name=sale_ID_type version=0.0.1 uuid=cca47d74-7754-4a61-b163-ca31f schema create name=timestamp_type version=0.0.1 uuid=fd594e88-411d-4a94-b2be-697b3a0d7adf description="A type for 'time' values" flavour=Java schema=java.lang.Long 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. +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 @@ -67,19 +68,20 @@ task logic create name=MorningBoozeCheck version=0.0.1 logicFlavour=MVEL logic=L /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -140,16 +142,16 @@ else{ /* 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 +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 :-) */ LE task create name=MorningBoozeCheckAlt1 version=0.0.1 uuid=bc6d90c9-c902-4686-afd3-925b30e39990 description=LS -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 CET and 13:00:00 CET then the sale is not authorised. -Also alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. +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 CET and 13:00:00 CET then the sale is not authorised. +Also alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. In this implementation we assume that items with item_ID between 1000 and 2000 are all alcoholic drinks LE task inputfield create name=MorningBoozeCheckAlt1 version=0.0.1 fieldName=sale_ID schemaName=sale_ID_type schemaVersion=0.0.1 @@ -174,19 +176,20 @@ task logic create name=MorningBoozeCheckAlt1 version=0.0.1 logicFlavour=MVEL log /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ @@ -248,9 +251,9 @@ else{ } /* -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 CET and 13:00:00 CET then the sale is not authorised. -Also alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. +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 CET and 13:00:00 CET then the sale is not authorised. +Also alcohol sales are not allowed on Sundays. Otherwise the sale is authorised. In this implementation we assume that items with item_ID between 1000 and 2000 are all alcoholic drinks :-) */ LE @@ -287,25 +290,25 @@ policy state selecttasklogic create name=MyFirstPolicy version=0.0.1 stateName=B /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. + * Modifications Copyright (C) 2020 Nordix Foundation. * ================================================================================ * 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========================================================= */ -var returnValueType = Java.type("java.lang.Boolean"); -var returnValue = new returnValueType(true); +var returnValue = true; executor.logger.info("Task Selection Execution: '"+executor.subject.id+"'. Input Event: '"+executor.inFields+"'"); @@ -327,6 +330,8 @@ else{ /* This task selection logic selects task "MorningBoozeCheck" for branches with 0<=branch_ID<1000 and selects task "MorningBoozeCheckAlt1" for branches with 1000<=branch_ID<2000. Otherwise the default task is selected. In this case the default task is also "MorningBoozeCheck" */ + +returnValue; LE |