2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.policy.pypdp;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.UUID;
27 import org.openecomp.policy.api.ConfigRequestParameters;
28 import org.openecomp.policy.api.PolicyConfigStatus;
29 import org.openecomp.policy.std.StdPolicyConfig;
30 import org.openecomp.policy.std.StdPolicyEngine;
32 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
34 public class ListConfigRequest {
36 private StdPolicyEngine pe;
37 public ListConfigRequest(StdPolicyEngine pe){
41 public Collection<String> run(ConfigRequestParameters pep, String requestID, String userID, String passcode) {
43 StdPolicyConfig policyConfig = new StdPolicyConfig();
44 Collection<String> configList = new ArrayList<String>();
46 // construct a UUID from the request string
47 UUID requestUUID = null;
48 if (requestID != null && !requestID.isEmpty()) {
50 requestUUID = UUID.fromString(requestID);
52 catch (IllegalArgumentException e) {
53 requestUUID = UUID.randomUUID();
54 PolicyLogger.info("Generated Random UUID: " + requestUUID.toString());
57 pep.setRequestID(requestUUID);
59 PolicyLogger.debug("\n\n calling PEP.. ");
60 configList = pe.listConfigRequest(pep, userID, passcode);
63 policyConfig.setConfigStatus(e.getMessage(), PolicyConfigStatus.CONFIG_NOT_FOUND);
64 configList.add(policyConfig.getPolicyConfigStatus().toString());