2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2020 Nordix. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
20 var uuidType = java.util.UUID;
21 var HashMapType = java.util.HashMap;
24 //albumID will be used to fetch info from our album later
25 var albumID = uuidType.fromString("d0050623-18e5-46c9-9298-9a567990cd7c");
26 var pmSubscriptionInfo = executor.getContextAlbum("PMSubscriptionAlbum").getSchemaHelper().createNewInstance();
27 var returnValue = true;;
29 if (executor.inFields.get("policyName") != null) {
30 var changeType = executor.inFields.get("changeType")
31 var nfName = executor.inFields.get("nfName")
32 var policyName = executor.inFields.get("policyName")
33 var closedLoopControlName = executor.inFields.get("closedLoopControlName")
34 var subscription = executor.inFields.get("subscription")
37 obj["nfName"] = executor.inFields.get("nfName")
38 executor.logger.info("nfName" + executor.stringify2Json(obj))
40 var ticketInfo = new HashMapType();
41 populate_creator_info(ticketInfo);
42 executor.logger.info("ticketInfo" + executor.stringify2Json(ticketInfo))
44 pmSubscriptionInfo.put("nfName", executor.inFields.get("nfName"));
45 pmSubscriptionInfo.put("changeType", executor.inFields.get("changeType"))
46 pmSubscriptionInfo.put("policyName", executor.inFields.get("policyName"))
47 pmSubscriptionInfo.put("closedLoopControlName", executor.inFields.get("closedLoopControlName"))
48 pmSubscriptionInfo.put("subscription", subscription)
50 executor.getContextAlbum("PMSubscriptionAlbum").put(albumID.toString(), pmSubscriptionInfo);
52 executor.outFields.put("albumID", albumID)
54 executor.message = "Received invalid event"
58 function populate_creator_info(ticketInfo){
59 populate_field(ticketInfo, "appId", "NSO");
60 populate_field(ticketInfo, "creatorId", "fidLab");
61 populate_field(ticketInfo, "creatorFirstName", "PSO");
62 populate_field(ticketInfo, "creatorLastName", "team7");
63 populate_field(ticketInfo, "creatorGroup", "PSO-team7");
64 populate_field(ticketInfo, "creatorPEIN", "0000000");
65 populate_field(ticketInfo, "creatorPhoneNumber", "800-450-7771");
66 populate_field(ticketInfo, "fid", "fidLab");
67 populate_field(ticketInfo, "organizationCode", "PSO");
68 populate_field(ticketInfo, "source", create_caEn_value("SURV/ALARM FROM/PSO"));
69 populate_field(ticketInfo, "customerName", "XYZ");
70 populate_field(ticketInfo, "authorization", "Basic dGVzdHVzZXI=");
73 function populate_field(mapname, name, value){
75 mapname.put(name, "none");
77 mapname.put(name, value);
82 function create_caEn_value(value){
84 attr["caEn"] = String(value);