import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.models.APIDictionaryResponse;
import org.openecomp.policy.models.APIPolicyConfigResponse;
-import org.openecomp.policy.utils.AAFPolicyClient.Environment;
+import org.openecomp.policy.utils.AAFEnvironment;
import org.openecomp.policy.utils.PolicyUtils;
import org.openecomp.policy.xacml.api.XACMLErrorConstants;
import org.springframework.core.io.FileSystemResource;
import org.springframework.web.client.RestTemplate;
import org.xml.sax.InputSource;
-import com.att.aft.dme2.internal.gson.Gson;
-import com.att.aft.dme2.internal.gson.GsonBuilder;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
/**
* PolicyEngine Implementation class
public Collection<PolicyConfig> getConfigImpl(ConfigRequestParameters configRequestParameters) throws PolicyConfigException{
String resource= "getConfig";
- ArrayList<PolicyConfig> response = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> response = new ArrayList<>();
String body = new String();
// Create Request.
try {
}
private ArrayList<PolicyConfig> configResult(APIPolicyConfigResponse[] response) throws PolicyConfigException {
- ArrayList<PolicyConfig> result = new ArrayList<PolicyConfig>();
+ ArrayList<PolicyConfig> result = new ArrayList<>();
if(response!=null && response.length>0){
for(APIPolicyConfigResponse policyConfigResponse: response){
StdPolicyConfig policyConfig = new StdPolicyConfig();
private void setMatches(Map<String, String> matchingConditions) {
Matches match = new Matches();
- HashMap<String, String> configAttributes = new HashMap<String,String>();
+ HashMap<String, String> configAttributes = new HashMap<>();
try{
for(String key: matchingConditions.keySet()){
if(key.equalsIgnoreCase("ECOMPName")){
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while connecting to " + pdps.get(0), e);
exception = new HttpClientErrorException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());
}
- finally{
- if(result == null){
- Collections.rotate(pdps, -1);
- Collections.rotate(encoding, -1);
- pdpsCount++;
- }else{
- break;
- }
- }
+ if(result == null){
+ Collections.rotate(pdps, -1);
+ Collections.rotate(encoding, -1);
+ pdpsCount++;
+ }else{
+ break;
+ }
}
if(exception != null && exception.getStatusCode()!=null){
if(exception.getStatusCode().equals(HttpStatus.UNAUTHORIZED)){
}
public Collection<String> listConfigImpl(ConfigRequestParameters listRequestParameters) throws PolicyConfigException{
- Collection<String> policyList = new ArrayList<String>();
+ Collection<String> policyList = new ArrayList<>();
if (junit){
policyList.add("Policy Name: listConfigTest");
return policyList;
}
private ArrayList<PolicyResponse> eventResult(StdPolicyResponse[] response) throws PolicyEventException{
- ArrayList<PolicyResponse> eventResult = new ArrayList<PolicyResponse>();
+ ArrayList<PolicyResponse> eventResult = new ArrayList<>();
if(response!=null && response.length>0){
for(StdPolicyResponse policyConfigResponse: response){
eventResult.add(policyConfigResponse);
typeDefault = new ArrayList<String>(Arrays.asList(prop.getProperty("NOTIFICATION_TYPE").split(",")));
notificationType = typeDefault;
} else {
- notificationType = new ArrayList<String>();
+ notificationType = new ArrayList<>();
notificationType.add(check_type);
}
}
if(serverList.contains(",")) {
notificationURLList = new ArrayList<String>(Arrays.asList(serverList.split(",")));
} else {
- notificationURLList = new ArrayList<String>();
+ notificationURLList = new ArrayList<>();
notificationURLList.add(serverList);
}
}
pass = clientKey.trim();
}
setClientEncoding();
- environment = prop.getProperty("ENVIRONMENT", Environment.DEVL.toString());
- if(environment.equalsIgnoreCase(Environment.TEST.toString())){
- environment = Environment.TEST.toString();
- }else if(environment.equalsIgnoreCase(Environment.PROD.toString())){
- environment = Environment.PROD.toString();
+ environment = prop.getProperty("ENVIRONMENT", AAFEnvironment.DEVL.toString());
+ if(environment.equalsIgnoreCase(AAFEnvironment.TEST.toString())){
+ environment = AAFEnvironment.TEST.toString();
+ }else if(environment.equalsIgnoreCase(AAFEnvironment.PROD.toString())){
+ environment = AAFEnvironment.PROD.toString();
}else{
- environment = Environment.DEVL.toString();
+ environment = AAFEnvironment.DEVL.toString();
}
// Initializing the values.
- pdps = new ArrayList<String>();
- encoding = new ArrayList<String>();
+ pdps = new ArrayList<>();
+ encoding = new ArrayList<>();
// Check the Keys for PDP_URLs
Collection<Object> unsorted = prop.keySet();
@SuppressWarnings({ "rawtypes", "unchecked" })