ac7464d98bd4acea0b7b088fae67135a7f2c9860
[policy/apex-pdp.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
4  *  Modifications Copyright (C) 2020 Nordix Foundation.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 var returnValue = true;
23
24 executor.logger.info("Task Selection Execution: '"+executor.subject.id+
25     "'. Input Event: '"+executor.inFields+"'");
26
27 branchid = executor.inFields.get("branch_ID");
28 taskorig = executor.subject.getTaskKey("MorningBoozeCheck");
29 taskalt = executor.subject.getTaskKey("MorningBoozeCheckAlt1");
30 taskdef = executor.subject.getDefaultTaskKey();
31
32 if(branchid >=0 && branchid <1000){
33   taskorig.copyTo(executor.selectedTask);
34 }
35 else if (branchid >=1000 && branchid <2000){
36   taskalt.copyTo(executor.selectedTask);
37 }
38 else{
39   taskdef.copyTo(executor.selectedTask);
40 }
41
42 /*
43 This task selection logic selects task "MorningBoozeCheck" for branches with
44 0<=branch_ID<1000 and selects task "MorningBoozeCheckAlt1" for branches with
45 1000<=branch_ID<2000. Otherwise the default task is selected.
46 In this case the default task is also "MorningBoozeCheck"
47 */
48
49 returnValue;