2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix. All rights reserved.
4 * Modifications Copyright (C) 2022 Bell Canada. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
21 var uuidType = java.util.UUID;
22 var HashMapType = java.util.HashMap;
25 //albumID will be used to fetch info from our album later
26 var albumID = uuidType.fromString("d0050623-18e5-46c9-9298-9a567990cd7c");
27 var pmSubscriptionInfo = new java.util.HashMap();
28 var returnValue = true;;
30 if (executor.inFields.get("policyName") != null) {
31 var changeType = executor.inFields.get("changeType")
32 var nfName = executor.inFields.get("nfName")
33 var policyName = executor.inFields.get("policyName")
34 var closedLoopControlName = executor.inFields.get("closedLoopControlName")
35 var subscription = executor.inFields.get("subscription")
38 obj["nfName"] = executor.inFields.get("nfName")
39 executor.logger.info("nfName" + executor.stringify2Json(obj))
41 var ticketInfo = new HashMapType();
42 populate_creator_info(ticketInfo);
43 executor.logger.info("ticketInfo" + executor.stringify2Json(ticketInfo))
45 pmSubscriptionInfo.put("nfName", executor.inFields.get("nfName"));
46 pmSubscriptionInfo.put("changeType", executor.inFields.get("changeType"))
47 pmSubscriptionInfo.put("policyName", executor.inFields.get("policyName"))
48 pmSubscriptionInfo.put("closedLoopControlName", executor.inFields.get("closedLoopControlName"))
49 pmSubscriptionInfo.put("subscription", subscription)
51 executor.getContextAlbum("PMSubscriptionAlbum").put(albumID.toString(), pmSubscriptionInfo);
53 executor.outFields.put("albumID", albumID)
55 executor.message = "Received invalid event"
59 function populate_creator_info(ticketInfo){
60 populate_field(ticketInfo, "appId", "NSO");
61 populate_field(ticketInfo, "creatorId", "fidLab");
62 populate_field(ticketInfo, "creatorFirstName", "PSO");
63 populate_field(ticketInfo, "creatorLastName", "team7");
64 populate_field(ticketInfo, "creatorGroup", "PSO-team7");
65 populate_field(ticketInfo, "creatorPEIN", "0000000");
66 populate_field(ticketInfo, "creatorPhoneNumber", "800-450-7771");
67 populate_field(ticketInfo, "fid", "fidLab");
68 populate_field(ticketInfo, "organizationCode", "PSO");
69 populate_field(ticketInfo, "source", create_caEn_value("SURV/ALARM FROM/PSO"));
70 populate_field(ticketInfo, "customerName", "XYZ");
71 populate_field(ticketInfo, "authorization", "Basic dGVzdHVzZXI=");
74 function populate_field(mapname, name, value){
76 mapname.put(name, "none");
78 mapname.put(name, value);
83 function create_caEn_value(value){
85 attr["caEn"] = String(value);