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=========================================================
22 package org.onap.policy.std;
25 import java.util.Properties;
27 import javax.json.JsonObject;
29 import org.onap.policy.api.PolicyConfig;
30 import org.onap.policy.api.PolicyConfigStatus;
31 import org.onap.policy.api.PolicyType;
32 import org.w3c.dom.Document;
35 * PolicyConfig Implementation.
41 public class StdPolicyConfig implements PolicyConfig{
42 private PolicyType policyType;
43 private Properties properties;
44 private JsonObject jsonObject;
45 private Document document;
47 private PolicyConfigStatus policyConfigStatus;
48 private String configStatus;
49 private String policyName;
50 private String policyVersion;
51 private Map<String,String> matchingConditions;
52 private Map<String,String> responseAttributes;
55 public PolicyType getType() {
60 public Properties toProperties() {
65 public JsonObject toJSON() {
70 public Document toXML() {
75 public String toOther() {
80 public PolicyConfigStatus getPolicyConfigStatus() {
81 return policyConfigStatus;
85 public String getPolicyConfigMessage() {
90 public String getPolicyName() {
91 if(policyName!=null && policyName.contains(".xml")){
92 return (policyName.substring(0, policyName.substring(0, policyName.lastIndexOf(".")).lastIndexOf(".")));
98 public String getPolicyVersion() {
103 public Map<String,String> getMatchingConditions(){
104 return matchingConditions;
108 public Map<String,String> getResponseAttributes(){
109 return responseAttributes;
112 public void setPolicyType(PolicyType policyType) {
113 this.policyType = policyType;
116 public void setPolicyName(String policyName) {
117 this.policyName = policyName;
120 public void setPolicyVersion(String policyVersion) {
121 this.policyVersion = policyVersion;
124 public void setProperties(Properties properties) {
125 this.properties = properties;
128 public void setJsonObject(JsonObject jsonObject) {
129 this.jsonObject = jsonObject;
132 public void setDocument(Document document) {
133 this.document = document;
136 public void setOther(String other) {
140 public void setConfigStatus(String configStatus) {
141 this.configStatus = configStatus;
144 public void setPolicyConfigStatus(PolicyConfigStatus policyConfigStatus) {
145 this.policyConfigStatus = policyConfigStatus;
148 public void setConfigStatus(String configStatus, PolicyConfigStatus policyConfigStatus) {
149 this.configStatus = configStatus;
150 this.policyConfigStatus = policyConfigStatus;
153 public void setMatchingConditions(Map<String,String> matchingConditions){
154 this.matchingConditions = matchingConditions;
157 public void setResponseAttributes(Map<String,String> responseAttributes){
158 this.responseAttributes = responseAttributes;
162 public String toString() {
163 return "PolicyConfig [ policyConfigStatus=" + policyConfigStatus + ", policyConfigMessage=" + configStatus + ", policyName=" + policyName +