summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorTait,Trevor(rt0435) <rtait@amdocs.com>2018-10-30 13:22:36 -0400
committerTait,Trevor(rt0435) <rtait@amdocs.com>2018-11-02 14:12:49 -0400
commit23b36e3c69f25d8322afb79d5e6bace519db7cd3 (patch)
tree5223fe7c12d0b81877759e0c19653c6249c8cf29 /src/main/java
parenta088960969f4d54e39cd83c8e24565301b6c7d67 (diff)
Address Bugs and Vulnerabilities in Sonar Report
Addressing Bugs and Vulnerabilities in Sonar Report. https://sonar.onap.org/dashboard?id=org.onap.logging-analytics.pomba%3Apomba-sdnc-context-builder Issue-ID: LOG-791 Change-Id: I11b984cac77c8a5674103672fa0e1332ed0aa4f7 Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/Application.java3
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/JerseyConfiguration.java23
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java57
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java18
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java9
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java10
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java10
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java18
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java12
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java18
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java20
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java9
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java16
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java24
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java26
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java14
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java8
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java22
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java14
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java12
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java15
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java22
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java52
36 files changed, 243 insertions, 215 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/Application.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/Application.java
index 93dd886..318fef9 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/Application.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/Application.java
@@ -64,7 +64,6 @@ public class Application extends SpringBootServletInitializer {
KieBuilder kb = kServices.newKieBuilder(kfs);
kb.buildAll();
- KieContainer kContainer = kServices.newKieContainer(kr.getDefaultReleaseId());
- return kContainer;
+ return kServices.newKieContainer(kr.getDefaultReleaseId());
}
} \ No newline at end of file
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/JerseyConfiguration.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/JerseyConfiguration.java
index 3f73644..7c94bf9 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/JerseyConfiguration.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/JerseyConfiguration.java
@@ -45,17 +45,6 @@ import com.fasterxml.jackson.databind.SerializationFeature;
public class JerseyConfiguration extends ResourceConfig {
private static final Logger log = Logger.getLogger(JerseyConfiguration.class.getName());
- @Bean
- @Primary
- public ObjectMapper objectMapper() {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
- objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
- objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
- return objectMapper;
- }
-
@Autowired
public JerseyConfiguration() {
register(RestServiceImpl.class);
@@ -68,4 +57,16 @@ public class JerseyConfiguration extends ResourceConfig {
return ClientBuilder.newClient(
new ClientConfig());
}
+
+ @Bean
+ @Primary
+ public ObjectMapper objectMapper() {
+ ObjectMapper objectMapper = new ObjectMapper();
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+ objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+ objectMapper.enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES);
+ objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
+ return objectMapper;
+ }
+
} \ No newline at end of file
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java
index 7180c0b..bc2ca64 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/SdncConfiguration.java
@@ -57,40 +57,24 @@ public class SdncConfiguration {
@Value("${sdnc.vnfPath}")
private String vnfPath;
- @Bean(name="sdncBaseUrl")
- public String getURL() {
- return httpProtocol + "://" + serviceName + ":" + servicePort;
- }
-
- @Bean(name="sdncGenericResourcePath")
- public String getGenericResourcePath() {
- return genericResourcePath;
- }
-
- @Bean(name="sdncVnfPath")
- public String getVnfPath() {
- return vnfPath;
- }
-
- @Bean(name = "sdncBasicAuthorization")
- public String getSdncBasicAuth() {
- String auth = this.user + ":"+ Password.deobfuscate(this.password);
- return ("Basic " + Base64.getEncoder().encodeToString(auth.getBytes()));
- }
-
- /* AAI related interfaces */
@Value("${aai.serviceName}")
private String aaiHost;
+
@Value("${aai.servicePort}")
private String aaiPort;
+
@Value("${aai.username}")
private String aaiUsername;
+
@Value("${aai.password}")
private String aaiPassword;
+
@Value("${aai.httpProtocol}")
private String aaiHttpProtocol;
+
@Value("${aai.connectionTimeout}")
private Integer aaiConnectionTimeout;
+
@Value("${aai.readTimeout}")
private Integer aaiReadTimeout;
@@ -109,20 +93,42 @@ public class SdncConfiguration {
@Value("${aai.serviceInstancePath}")
private String serviceInstancePath;
+ private final static String BASIC = "Basic ";
+
+ @Bean(name="sdncBaseUrl")
+ public String getURL() {
+ return httpProtocol + "://" + serviceName + ":" + servicePort;
+ }
+
+ @Bean(name="sdncGenericResourcePath")
+ public String getGenericResourcePath() {
+ return genericResourcePath;
+ }
+
+ @Bean(name="sdncVnfPath")
+ public String getVnfPath() {
+ return vnfPath;
+ }
+
+ @Bean(name = "sdncBasicAuthorization")
+ public String getSdncBasicAuth() {
+ String auth = this.user + ":"+ Password.deobfuscate(this.password);
+ return (BASIC + Base64.getEncoder().encodeToString(auth.getBytes()));
+ }
+
@Bean(name="aaiHttpBasicAuthorization")
public String getHttpBasicAuth() {
String auth = new String(this.aaiHttpUserId + ":" + Password.deobfuscate(this.aaiHttpPassword));
-
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());
- return ("Basic " + encodedAuth);
+ return (BASIC + encodedAuth);
}
@Bean(name="aaiBasicAuthorization")
public String getAAIBasicAuth() {
String auth = new String(this.aaiUsername + ":" + Password.deobfuscate(this.aaiPassword));
String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes());
- return ("Basic " + encodedAuth);
+ return (BASIC + encodedAuth);
}
@Bean(name="aaiClient")
@@ -137,7 +143,6 @@ public class SdncConfiguration {
@Bean(name="aaiBaseUrl")
public String getAaiURL() {
return httpProtocol + "://" + aaiHost + ":" + aaiPort;
-
}
@Bean(name="aaiPathToSearchNodeQuery")
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java
index 09e1d6b..f9655b0 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/GenericResourceApiHandler.java
@@ -45,7 +45,7 @@ public class GenericResourceApiHandler {
private String specPath = "config/sdncgenericresource.spec";
- public ModelContext process(Exchange exchange) throws Exception {
+ public ModelContext process(Exchange exchange) throws AuditException {
ModelContext context = new ModelContext();
log.info("in GENERIC-RESOURCE-API HANDLER: ");
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java
index bdc08d0..e16ec40 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/handlers/VnfApiHandler.java
@@ -73,7 +73,6 @@ public class VnfApiHandler {
public ModelContext process(Exchange exchange) throws Exception {
log.info("in VNF-API HANDLER: ");
- ModelContext context = new ModelContext();
Service service = new Service();
ServiceEntity serviceEntity = (ServiceEntity)exchange.getIn().getBody();
service.setUuid(serviceEntity.getServiceInstanceId());
@@ -81,7 +80,7 @@ public class VnfApiHandler {
// GET the list of VNF related-to links from AAI
String url= aaiBaseUrl+generateServiceInstanceURL(aaiServiceInstancePath, serviceEntity.getCustomerId(), serviceEntity.getServiceType(), serviceEntity.getServiceInstanceId());
- String serviceInstancePayload = RestUtil.getAaiResource(aaiClient, url, aaiBasicAuthorization, serviceEntity.getTransactionId(), MediaType.valueOf(MediaType.APPLICATION_JSON));
+ String serviceInstancePayload = RestUtil.getAaiResource(aaiClient, url, aaiBasicAuthorization, serviceEntity.getTransactionId());
List<String> genericVnfLinks = extractGenericVnfRelatedLink(serviceInstancePayload);
// GET the VNF list (module-id) from AAI
@@ -93,7 +92,7 @@ public class VnfApiHandler {
sdncBasicAuthorization, vnfList);
// Transform the AAI and SDNC models to the audit common model
- context = RestUtil.transformVnfList(vnfList, sdncVnfMap);
+ ModelContext context = RestUtil.transformVnfList(vnfList, sdncVnfMap);
context.setService(service);
@@ -104,15 +103,8 @@ public class VnfApiHandler {
return MessageFormat.format(siPath, customerId, serviceType, serviceInstanceId);
}
- /*
- * Extract the generic-vnf related-linkfrom Json payload. For example
- * {
- * "related-to": "generic-vnf",
- * "related-link": "/aai/v11/network/generic-vnfs/generic-vnf/d94daff6-7d5b-4d2e-bc99-c9af0754b59d",
- * }
- */
private static List<String> extractGenericVnfRelatedLink(String serviceInstancePayload) throws AuditException {
- List<String> genericVnfLinks = new ArrayList<String>();;
+ List<String> genericVnfLinks = new ArrayList<>();;
try {
JSONObject relationshipList = new JSONObject(serviceInstancePayload).getJSONObject(JSON_RELATIONSHIP_LIST);
@@ -133,10 +125,10 @@ public class VnfApiHandler {
}
private static List<VnfInstance> retrieveAaiVnfList(RestClient aaiClient, String aaiBaseUrl, String aaiBasicAuthorization, String transactionId, List <String>genericVnfLinks) throws AuditException {
- List<VnfInstance> vnfList = new ArrayList<VnfInstance>();
+ List<VnfInstance> vnfList = new ArrayList<>();
for (String genericVnfLink : genericVnfLinks) {
String genericVnfUrl = RestUtil.generateAaiUrl(aaiBaseUrl, genericVnfLink, null);
- String genericVnfPayload = RestUtil.getAaiResource(aaiClient, genericVnfUrl, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ String genericVnfPayload = RestUtil.getAaiResource(aaiClient, genericVnfUrl, aaiBasicAuthorization, transactionId);
if (genericVnfPayload.equals(EMPTY_JSON_STRING)) {
log.info("retrieveAaiVnfList "+ genericVnfPayload +" is not found, " + "return empty Json ");
} else {
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java
index 6cd70e6..9264882 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/AvailabilityZone.java
@@ -79,7 +79,7 @@ public class AvailabilityZone {
if (other == this) {
return true;
}
- if ((other instanceof AvailabilityZone) == false) {
+ if (!(other instanceof AvailabilityZone)) {
return false;
}
AvailabilityZone rhs = ((AvailabilityZone) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java
index dca49f6..005a4cd 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIp.java
@@ -79,7 +79,7 @@ public class NetworkIp {
if (other == this) {
return true;
}
- if ((other instanceof NetworkIp) == false) {
+ if (!(other instanceof NetworkIp)) {
return false;
}
NetworkIp rhs = ((NetworkIp) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java
index bb0245a..8d70f13 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/NetworkIpV6.java
@@ -79,7 +79,7 @@ public class NetworkIpV6 {
if (other == this) {
return true;
}
- if ((other instanceof NetworkIpV6) == false) {
+ if (!(other instanceof NetworkIpV6)) {
return false;
}
NetworkIpV6 rhs = ((NetworkIpV6) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java
index 127b521..8133841 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/OperStatus.java
@@ -33,6 +33,7 @@ public class OperStatus {
@Expose
private String lastOrderStatus;
+ private static final String NULL_STR = "<null>";
/**
* No args constructor for use in serialization
*
@@ -83,15 +84,15 @@ public class OperStatus {
sb.append(OperStatus.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("lastAction");
sb.append('=');
- sb.append(((this.lastAction == null)?"<null>":this.lastAction));
+ sb.append(((this.lastAction == null)?NULL_STR:this.lastAction));
sb.append(',');
sb.append("orderStatus");
sb.append('=');
- sb.append(((this.orderStatus == null)?"<null>":this.orderStatus));
+ sb.append(((this.orderStatus == null)?NULL_STR:this.orderStatus));
sb.append(',');
sb.append("lastOrderStatus");
sb.append('=');
- sb.append(((this.lastOrderStatus == null)?"<null>":this.lastOrderStatus));
+ sb.append(((this.lastOrderStatus == null)?NULL_STR:this.lastOrderStatus));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -115,7 +116,7 @@ public class OperStatus {
if (other == this) {
return true;
}
- if ((other instanceof OperStatus) == false) {
+ if (!(other instanceof OperStatus)) {
return false;
}
OperStatus rhs = ((OperStatus) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java
index f64d2a3..17816ad 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelatedToProperty.java
@@ -82,7 +82,7 @@ public class RelatedToProperty {
if (other == this) {
return true;
}
- if ((other instanceof RelatedToProperty) == false) {
+ if (!(other instanceof RelatedToProperty)) {
return false;
}
RelatedToProperty rhs = ((RelatedToProperty) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java
index 74637b5..80be3ef 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Relationship.java
@@ -112,7 +112,7 @@ public class Relationship {
if (other == this) {
return true;
}
- if ((other instanceof Relationship) == false) {
+ if (!(other instanceof Relationship)) {
return false;
}
Relationship rhs = ((Relationship) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java
index 5a0756d..712614d 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipDatum.java
@@ -82,7 +82,7 @@ public class RelationshipDatum {
if (other == this) {
return true;
}
- if ((other instanceof RelationshipDatum) == false) {
+ if (!(other instanceof RelationshipDatum)) {
return false;
}
RelationshipDatum rhs = ((RelationshipDatum) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java
index a57e02c..6f6fb71 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RelationshipList.java
@@ -72,7 +72,7 @@ public class RelationshipList {
if (other == this) {
return true;
}
- if ((other instanceof RelationshipList) == false) {
+ if (!(other instanceof RelationshipList)) {
return false;
}
RelationshipList rhs = ((RelationshipList) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java
index f556845..fe5c831 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/RequestInformation.java
@@ -33,6 +33,8 @@ public class RequestInformation {
@Expose
private String requestAction;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -83,15 +85,15 @@ public class RequestInformation {
sb.append(RequestInformation.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("requestId");
sb.append('=');
- sb.append(((this.requestId == null)?"<null>":this.requestId));
+ sb.append(((this.requestId == null)?NULL_STR:this.requestId));
sb.append(',');
sb.append("source");
sb.append('=');
- sb.append(((this.source == null)?"<null>":this.source));
+ sb.append(((this.source == null)?NULL_STR:this.source));
sb.append(',');
sb.append("requestAction");
sb.append('=');
- sb.append(((this.requestAction == null)?"<null>":this.requestAction));
+ sb.append(((this.requestAction == null)?NULL_STR:this.requestAction));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -115,7 +117,7 @@ public class RequestInformation {
if (other == this) {
return true;
}
- if ((other instanceof RequestInformation) == false) {
+ if (!(other instanceof RequestInformation)) {
return false;
}
RequestInformation rhs = ((RequestInformation) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java
index b483da4..f9ffa0a 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/SdncRequestHeader.java
@@ -33,6 +33,8 @@ public class SdncRequestHeader {
@Expose
private String svcAction;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -83,15 +85,15 @@ public class SdncRequestHeader {
sb.append(SdncRequestHeader.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("svcNotificationUrl");
sb.append('=');
- sb.append(((this.svcNotificationUrl == null)?"<null>":this.svcNotificationUrl));
+ sb.append(((this.svcNotificationUrl == null)?NULL_STR:this.svcNotificationUrl));
sb.append(',');
sb.append("svcRequestId");
sb.append('=');
- sb.append(((this.svcRequestId == null)?"<null>":this.svcRequestId));
+ sb.append(((this.svcRequestId == null)?NULL_STR:this.svcRequestId));
sb.append(',');
sb.append("svcAction");
sb.append('=');
- sb.append(((this.svcAction == null)?"<null>":this.svcAction));
+ sb.append(((this.svcAction == null)?NULL_STR:this.svcAction));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -115,7 +117,7 @@ public class SdncRequestHeader {
if (other == this) {
return true;
}
- if ((other instanceof SdncRequestHeader) == false) {
+ if (!(other instanceof SdncRequestHeader)) {
return false;
}
SdncRequestHeader rhs = ((SdncRequestHeader) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java
index 0f745fc..8e7860d 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceData.java
@@ -45,6 +45,8 @@ public class ServiceData {
@Expose
private VnfTopologyInformation vnfTopologyInformation;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -135,31 +137,31 @@ public class ServiceData {
sb.append(ServiceData.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("requestInformation");
sb.append('=');
- sb.append(((this.requestInformation == null)?"<null>":this.requestInformation));
+ sb.append(((this.requestInformation == null)?NULL_STR:this.requestInformation));
sb.append(',');
sb.append("erviceInformation");
sb.append('=');
- sb.append(((this.serviceInformation == null)?"<null>":this.serviceInformation));
+ sb.append(((this.serviceInformation == null)?NULL_STR:this.serviceInformation));
sb.append(',');
sb.append("vnfId");
sb.append('=');
- sb.append(((this.vnfId == null)?"<null>":this.vnfId));
+ sb.append(((this.vnfId == null)?NULL_STR:this.vnfId));
sb.append(',');
sb.append("sdncRequestHeader");
sb.append('=');
- sb.append(((this.sdncRequestHeader == null)?"<null>":this.sdncRequestHeader));
+ sb.append(((this.sdncRequestHeader == null)?NULL_STR:this.sdncRequestHeader));
sb.append(',');
sb.append("vnfRequestInformation");
sb.append('=');
- sb.append(((this.vnfRequestInformation == null)?"<null>":this.vnfRequestInformation));
+ sb.append(((this.vnfRequestInformation == null)?NULL_STR:this.vnfRequestInformation));
sb.append(',');
sb.append("operStatus");
sb.append('=');
- sb.append(((this.operStatus == null)?"<null>":this.operStatus));
+ sb.append(((this.operStatus == null)?NULL_STR:this.operStatus));
sb.append(',');
sb.append("vnfTopologyInformation");
sb.append('=');
- sb.append(((this.vnfTopologyInformation == null)?"<null>":this.vnfTopologyInformation));
+ sb.append(((this.vnfTopologyInformation == null)?NULL_STR:this.vnfTopologyInformation));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -187,7 +189,7 @@ public class ServiceData {
if (other == this) {
return true;
}
- if ((other instanceof ServiceData) == false) {
+ if (!(other instanceof ServiceData)) {
return false;
}
ServiceData rhs = ((ServiceData) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java
index f289f76..259ba35 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInformation.java
@@ -36,6 +36,8 @@ public class ServiceInformation {
@Expose
private String serviceInstanceId;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -96,19 +98,19 @@ public class ServiceInformation {
sb.append(ServiceInformation.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("serviceId");
sb.append('=');
- sb.append(((this.serviceId == null)?"<null>":this.serviceId));
+ sb.append(((this.serviceId == null)?NULL_STR:this.serviceId));
sb.append(',');
sb.append("serviceType");
sb.append('=');
- sb.append(((this.serviceType == null)?"<null>":this.serviceType));
+ sb.append(((this.serviceType == null)?NULL_STR:this.serviceType));
sb.append(',');
sb.append("subscriberName");
sb.append('=');
- sb.append(((this.subscriberName == null)?"<null>":this.subscriberName));
+ sb.append(((this.subscriberName == null)?NULL_STR:this.subscriberName));
sb.append(',');
sb.append("serviceInstanceId");
sb.append('=');
- sb.append(((this.serviceInstanceId == null)?"<null>":this.serviceInstanceId));
+ sb.append(((this.serviceInstanceId == null)?NULL_STR:this.serviceInstanceId));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -133,7 +135,7 @@ public class ServiceInformation {
if (other == this) {
return true;
}
- if ((other instanceof ServiceInformation) == false) {
+ if (!(other instanceof ServiceInformation)) {
return false;
}
ServiceInformation rhs = ((ServiceInformation) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java
index 2844814..2a00a34 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceInstance.java
@@ -202,7 +202,7 @@ public class ServiceInstance {
if (other == this) {
return true;
}
- if ((other instanceof ServiceInstance) == false) {
+ if (!(other instanceof ServiceInstance)) {
return false;
}
ServiceInstance rhs = ((ServiceInstance) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java
index a60dd61..f05b191 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/ServiceStatus.java
@@ -45,6 +45,8 @@ public class ServiceStatus {
@Expose
private String requestStatus;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -135,31 +137,31 @@ public class ServiceStatus {
sb.append(ServiceStatus.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("responseTimestamp");
sb.append('=');
- sb.append(((this.responseTimestamp == null)?"<null>":this.responseTimestamp));
+ sb.append(((this.responseTimestamp == null)?NULL_STR:this.responseTimestamp));
sb.append(',');
sb.append("vnfsdnAction");
sb.append('=');
- sb.append(((this.vnfsdnAction == null)?"<null>":this.vnfsdnAction));
+ sb.append(((this.vnfsdnAction == null)?NULL_STR:this.vnfsdnAction));
sb.append(',');
sb.append("rpcAction");
sb.append('=');
- sb.append(((this.rpcAction == null)?"<null>":this.rpcAction));
+ sb.append(((this.rpcAction == null)?NULL_STR:this.rpcAction));
sb.append(',');
sb.append("rpcName");
sb.append('=');
- sb.append(((this.rpcName == null)?"<null>":this.rpcName));
+ sb.append(((this.rpcName == null)?NULL_STR:this.rpcName));
sb.append(',');
sb.append("responseCode");
sb.append('=');
- sb.append(((this.responseCode == null)?"<null>":this.responseCode));
+ sb.append(((this.responseCode == null)?NULL_STR:this.responseCode));
sb.append(',');
sb.append("finalIndicator");
sb.append('=');
- sb.append(((this.finalIndicator == null)?"<null>":this.finalIndicator));
+ sb.append(((this.finalIndicator == null)?NULL_STR:this.finalIndicator));
sb.append(',');
sb.append("requestStatus");
sb.append('=');
- sb.append(((this.requestStatus == null)?"<null>":this.requestStatus));
+ sb.append(((this.requestStatus == null)?NULL_STR:this.requestStatus));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -187,7 +189,7 @@ public class ServiceStatus {
if (other == this) {
return true;
}
- if ((other instanceof ServiceStatus) == false) {
+ if (!(other instanceof ServiceStatus)) {
return false;
}
ServiceStatus rhs = ((ServiceStatus) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java
index 8cb614e..54d4c68 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModule.java
@@ -201,7 +201,7 @@ public class VfModule {
if (other == this) {
return true;
}
- if ((other instanceof VfModule) == false) {
+ if (!(other instanceof VfModule)) {
return false;
}
VfModule rhs = ((VfModule) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java
index 904da55..5817f24 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VfModules.java
@@ -72,7 +72,7 @@ public class VfModules {
if (other == this) {
return true;
}
- if ((other instanceof VfModules) == false) {
+ if (!(other instanceof VfModules)) {
return false;
}
VfModules rhs = ((VfModules) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java
index 5336dbe..748656a 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmName.java
@@ -79,7 +79,7 @@ public class VmName {
if (other == this) {
return true;
}
- if ((other instanceof VmName) == false) {
+ if (!(other instanceof VmName)) {
return false;
}
VmName rhs = ((VmName) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java
index cb12c26..27ddbdf 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VmNetwork.java
@@ -30,7 +30,7 @@ public class VmNetwork {
private String networkRole;
@SerializedName("network-ips-v6")
@Expose
- private List<NetworkIpV6> networkIpsV6 = new ArrayList<NetworkIpV6>();
+ private List<NetworkIpV6> networkIpsV6 = new ArrayList<>();
@SerializedName("floating-ip")
@Expose
private String floatingIp;
@@ -39,11 +39,13 @@ public class VmNetwork {
private String useDhcp;
@SerializedName("network-ips")
@Expose
- private List<NetworkIp> networkIps = new ArrayList<NetworkIp>();
+ private List<NetworkIp> networkIps = new ArrayList<>();
@SerializedName("floating-ip-v6")
@Expose
private String floatingIpV6;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -124,27 +126,27 @@ public class VmNetwork {
sb.append(VmNetwork.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("networkRole");
sb.append('=');
- sb.append(((this.networkRole == null)?"<null>":this.networkRole));
+ sb.append(((this.networkRole == null)?NULL_STR:this.networkRole));
sb.append(',');
sb.append("networkIpsV6");
sb.append('=');
- sb.append(((this.networkIpsV6 == null)?"<null>":this.networkIpsV6));
+ sb.append(((this.networkIpsV6 == null)?NULL_STR:this.networkIpsV6));
sb.append(',');
sb.append("floatingIp");
sb.append('=');
- sb.append(((this.floatingIp == null)?"<null>":this.floatingIp));
+ sb.append(((this.floatingIp == null)?NULL_STR:this.floatingIp));
sb.append(',');
sb.append("useDhcp");
sb.append('=');
- sb.append(((this.useDhcp == null)?"<null>":this.useDhcp));
+ sb.append(((this.useDhcp == null)?NULL_STR:this.useDhcp));
sb.append(',');
sb.append("networkIps");
sb.append('=');
- sb.append(((this.networkIps == null)?"<null>":this.networkIps));
+ sb.append(((this.networkIps == null)?NULL_STR:this.networkIps));
sb.append(',');
sb.append("floatingIpV6");
sb.append('=');
- sb.append(((this.floatingIpV6 == null)?"<null>":this.floatingIpV6));
+ sb.append(((this.floatingIpV6 == null)?NULL_STR:this.floatingIpV6));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -171,7 +173,7 @@ public class VmNetwork {
if (other == this) {
return true;
}
- if ((other instanceof VmNetwork) == false) {
+ if (!(other instanceof VmNetwork)) {
return false;
}
VmNetwork rhs = ((VmNetwork) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java
index 36842a3..54b0f1f 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/Vnf.java
@@ -33,6 +33,7 @@ public class Vnf {
@Expose
private ServiceData serviceData;
+ private final static String NULL_STR = "<null>";
/**
* No args constructor for use in serialization
@@ -84,15 +85,15 @@ public class Vnf {
sb.append(Vnf.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("vnfId");
sb.append('=');
- sb.append(((this.vnfId == null)?"<null>":this.vnfId));
+ sb.append(((this.vnfId == null)?NULL_STR:this.vnfId));
sb.append(',');
sb.append("serviceStatus");
sb.append('=');
- sb.append(((this.serviceStatus == null)?"<null>":this.serviceStatus));
+ sb.append(((this.serviceStatus == null)?NULL_STR:this.serviceStatus));
sb.append(',');
sb.append("serviceData");
sb.append('=');
- sb.append(((this.serviceData == null)?"<null>":this.serviceData));
+ sb.append(((this.serviceData == null)?NULL_STR:this.serviceData));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -116,7 +117,7 @@ public class Vnf {
if (other == this) {
return true;
}
- if ((other instanceof Vnf) == false) {
+ if (!(other instanceof Vnf)) {
return false;
}
Vnf rhs = ((Vnf) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java
index 2abfb31..e04e98f 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfAssignments.java
@@ -27,13 +27,15 @@ public class VnfAssignments {
@SerializedName("vnf-networks")
@Expose
- private List<VnfNetwork> vnfNetworks = new ArrayList<VnfNetwork>();
+ private List<VnfNetwork> vnfNetworks = new ArrayList<>();
@SerializedName("availability-zones")
@Expose
- private List<AvailabilityZone> availabilityZones = new ArrayList<AvailabilityZone>();
+ private List<AvailabilityZone> availabilityZones = new ArrayList<>();
@SerializedName("vnf-vms")
@Expose
- private List<VnfVm> vnfVms = new ArrayList<VnfVm>();
+ private List<VnfVm> vnfVms = new ArrayList<>();
+
+ private final static String NULL_STR = "<null>";
/**
* No args constructor for use in serialization
@@ -85,15 +87,15 @@ public class VnfAssignments {
sb.append(VnfAssignments.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("vnfNetworks");
sb.append('=');
- sb.append(((this.vnfNetworks == null)?"<null>":this.vnfNetworks));
+ sb.append(((this.vnfNetworks == null)?NULL_STR:this.vnfNetworks));
sb.append(',');
sb.append("availabilityZones");
sb.append('=');
- sb.append(((this.availabilityZones == null)?"<null>":this.availabilityZones));
+ sb.append(((this.availabilityZones == null)?NULL_STR:this.availabilityZones));
sb.append(',');
sb.append("vnfVms");
sb.append('=');
- sb.append(((this.vnfVms == null)?"<null>":this.vnfVms));
+ sb.append(((this.vnfVms == null)?NULL_STR:this.vnfVms));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -117,7 +119,7 @@ public class VnfAssignments {
if (other == this) {
return true;
}
- if ((other instanceof VnfAssignments) == false) {
+ if (!(other instanceof VnfAssignments)) {
return false;
}
VnfAssignments rhs = ((VnfAssignments) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java
index e3fb756..0deaa63 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfInstance.java
@@ -118,16 +118,6 @@ public class VnfInstance {
private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
- public static VnfInstance fromJson(String payload) throws AuditException {
- try {
- if (payload == null || payload.isEmpty()) {
- throw new Exception(AuditError.JSON_EMPTY_RESPONSE);
- }
- return gson.fromJson(payload, VnfInstance.class);
- } catch (Exception ex) {
- throw new AuditException(AuditError.JSON_PARSE_ERROR, ex);
- }
- }
/**
* No args constructor for use in serialization
@@ -197,6 +187,18 @@ public class VnfInstance {
this.vfModules = vfModules;
}
+ public static VnfInstance fromJson(String payload) throws AuditException {
+ try {
+ if (payload == null || payload.isEmpty()) {
+ throw new AuditException(AuditError.JSON_EMPTY_RESPONSE);
+ }
+ return gson.fromJson(payload, VnfInstance.class);
+ } catch (Exception ex) {
+ throw new AuditException(AuditError.JSON_PARSE_ERROR, ex);
+ }
+ }
+
+
public String getVnfId() {
return vnfId;
}
@@ -428,7 +430,7 @@ public class VnfInstance {
if (other == this) {
return true;
}
- if ((other instanceof VnfInstance) == false) {
+ if (!(other instanceof VnfInstance)) {
return false;
}
VnfInstance rhs = ((VnfInstance) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java
index e6360fb..5610414 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfList.java
@@ -32,21 +32,10 @@ public class VnfList {
@SerializedName("vnf-list")
@Expose
- private List<Vnf> vnfList = new ArrayList<Vnf>();
+ private List<Vnf> vnfList = new ArrayList<>();
private static final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
- public static VnfList fromJson(String payload) throws AuditException {
- try {
- if (payload == null || payload.isEmpty()) {
- throw new Exception(AuditError.JSON_EMPTY_RESPONSE);
- }
- return gson.fromJson(payload, VnfList.class);
- } catch (Exception ex) {
- throw new AuditException(AuditError.JSON_PARSE_ERROR, ex);
- }
- }
-
/**
* No args constructor for use in serialization
@@ -64,6 +53,17 @@ public class VnfList {
this.vnfList = vnfList;
}
+ public static VnfList fromJson(String payload) throws AuditException {
+ try {
+ if (payload == null || payload.isEmpty()) {
+ throw new AuditException(AuditError.JSON_EMPTY_RESPONSE);
+ }
+ return gson.fromJson(payload, VnfList.class);
+ } catch (Exception ex) {
+ throw new AuditException(AuditError.JSON_PARSE_ERROR, ex);
+ }
+ }
+
public List<Vnf> getVnfList() {
return vnfList;
}
@@ -100,7 +100,7 @@ public class VnfList {
if (other == this) {
return true;
}
- if ((other instanceof VnfList) == false) {
+ if (!(other instanceof VnfList)) {
return false;
}
VnfList rhs = ((VnfList) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java
index 084e4e0..0f99d24 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfNetwork.java
@@ -39,6 +39,8 @@ public class VnfNetwork {
@Expose
private String neutronId;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -109,23 +111,23 @@ public class VnfNetwork {
sb.append(VnfNetwork.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("networkRole");
sb.append('=');
- sb.append(((this.networkRole == null)?"<null>":this.networkRole));
+ sb.append(((this.networkRole == null)?NULL_STR:this.networkRole));
sb.append(',');
sb.append("contrailNetworkFqdn");
sb.append('=');
- sb.append(((this.contrailNetworkFqdn == null)?"<null>":this.contrailNetworkFqdn));
+ sb.append(((this.contrailNetworkFqdn == null)?NULL_STR:this.contrailNetworkFqdn));
sb.append(',');
sb.append("networkName");
sb.append('=');
- sb.append(((this.networkName == null)?"<null>":this.networkName));
+ sb.append(((this.networkName == null)?NULL_STR:this.networkName));
sb.append(',');
sb.append("networkId");
sb.append('=');
- sb.append(((this.networkId == null)?"<null>":this.networkId));
+ sb.append(((this.networkId == null)?NULL_STR:this.networkId));
sb.append(',');
sb.append("neutronId");
sb.append('=');
- sb.append(((this.neutronId == null)?"<null>":this.neutronId));
+ sb.append(((this.neutronId == null)?NULL_STR:this.neutronId));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -151,7 +153,7 @@ public class VnfNetwork {
if (other == this) {
return true;
}
- if ((other instanceof VnfNetwork) == false) {
+ if (!(other instanceof VnfNetwork)) {
return false;
}
VnfNetwork rhs = ((VnfNetwork) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java
index 4ac602f..5336e32 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfParameter.java
@@ -30,6 +30,8 @@ public class VnfParameter {
@Expose
private String vnfParameterValue;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -70,11 +72,11 @@ public class VnfParameter {
sb.append(VnfParameter.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("vnfParameterName");
sb.append('=');
- sb.append(((this.vnfParameterName == null)?"<null>":this.vnfParameterName));
+ sb.append(((this.vnfParameterName == null)?NULL_STR:this.vnfParameterName));
sb.append(',');
sb.append("vnfParameterValue");
sb.append('=');
- sb.append(((this.vnfParameterValue == null)?"<null>":this.vnfParameterValue));
+ sb.append(((this.vnfParameterValue == null)?NULL_STR:this.vnfParameterValue));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -97,7 +99,7 @@ public class VnfParameter {
if (other == this) {
return true;
}
- if ((other instanceof VnfParameter) == false) {
+ if (!(other instanceof VnfParameter)) {
return false;
}
VnfParameter rhs = ((VnfParameter) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java
index 8cd4b99..a87785f 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfRequestInformation.java
@@ -51,6 +51,8 @@ public class VnfRequestInformation {
@Expose
private String genericVnfId;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -161,39 +163,39 @@ public class VnfRequestInformation {
sb.append(VnfRequestInformation.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("vnfName");
sb.append('=');
- sb.append(((this.vnfName == null)?"<null>":this.vnfName));
+ sb.append(((this.vnfName == null)?NULL_STR:this.vnfName));
sb.append(',');
sb.append("tenant");
sb.append('=');
- sb.append(((this.tenant == null)?"<null>":this.tenant));
+ sb.append(((this.tenant == null)?NULL_STR:this.tenant));
sb.append(',');
sb.append("aicCloudRegion");
sb.append('=');
- sb.append(((this.aicCloudRegion == null)?"<null>":this.aicCloudRegion));
+ sb.append(((this.aicCloudRegion == null)?NULL_STR:this.aicCloudRegion));
sb.append(',');
sb.append("usePreload");
sb.append('=');
- sb.append(((this.usePreload == null)?"<null>":this.usePreload));
+ sb.append(((this.usePreload == null)?NULL_STR:this.usePreload));
sb.append(',');
sb.append("vnfType");
sb.append('=');
- sb.append(((this.vnfType == null)?"<null>":this.vnfType));
+ sb.append(((this.vnfType == null)?NULL_STR:this.vnfType));
sb.append(',');
sb.append("vnfId");
sb.append('=');
- sb.append(((this.vnfId == null)?"<null>":this.vnfId));
+ sb.append(((this.vnfId == null)?NULL_STR:this.vnfId));
sb.append(',');
sb.append("genericVnfType");
sb.append('=');
- sb.append(((this.genericVnfType == null)?"<null>":this.genericVnfType));
+ sb.append(((this.genericVnfType == null)?NULL_STR:this.genericVnfType));
sb.append(',');
sb.append("genericVnfName");
sb.append('=');
- sb.append(((this.genericVnfName == null)?"<null>":this.genericVnfName));
+ sb.append(((this.genericVnfName == null)?NULL_STR:this.genericVnfName));
sb.append(',');
sb.append("genericVnfId");
sb.append('=');
- sb.append(((this.genericVnfId == null)?"<null>":this.genericVnfId));
+ sb.append(((this.genericVnfId == null)?NULL_STR:this.genericVnfId));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -223,7 +225,7 @@ public class VnfRequestInformation {
if (other == this) {
return true;
}
- if ((other instanceof VnfRequestInformation) == false) {
+ if (!(other instanceof VnfRequestInformation)) {
return false;
}
VnfRequestInformation rhs = ((VnfRequestInformation) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java
index 507ae1d..8dbf0c8 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyIdentifier.java
@@ -39,6 +39,8 @@ public class VnfTopologyIdentifier {
@Expose
private String vnfType;
+ private final static String NULL_STR = "<null>";
+
/**
* No args constructor for use in serialization
*
@@ -109,23 +111,23 @@ public class VnfTopologyIdentifier {
sb.append(VnfTopologyIdentifier.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("genericVnfType");
sb.append('=');
- sb.append(((this.genericVnfType == null)?"<null>":this.genericVnfType));
+ sb.append(((this.genericVnfType == null)?NULL_STR:this.genericVnfType));
sb.append(',');
sb.append("serviceType");
sb.append('=');
- sb.append(((this.serviceType == null)?"<null>":this.serviceType));
+ sb.append(((this.serviceType == null)?NULL_STR:this.serviceType));
sb.append(',');
sb.append("vnfName");
sb.append('=');
- sb.append(((this.vnfName == null)?"<null>":this.vnfName));
+ sb.append(((this.vnfName == null)?NULL_STR:this.vnfName));
sb.append(',');
sb.append("genericVnfName");
sb.append('=');
- sb.append(((this.genericVnfName == null)?"<null>":this.genericVnfName));
+ sb.append(((this.genericVnfName == null)?NULL_STR:this.genericVnfName));
sb.append(',');
sb.append("vnfType");
sb.append('=');
- sb.append(((this.vnfType == null)?"<null>":this.vnfType));
+ sb.append(((this.vnfType == null)?NULL_STR:this.vnfType));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -151,7 +153,7 @@ public class VnfTopologyIdentifier {
if (other == this) {
return true;
}
- if ((other instanceof VnfTopologyIdentifier) == false) {
+ if (!(other instanceof VnfTopologyIdentifier)) {
return false;
}
VnfTopologyIdentifier rhs = ((VnfTopologyIdentifier) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java
index 26ebb66..a5e5f22 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfTopologyInformation.java
@@ -33,7 +33,9 @@ public class VnfTopologyInformation {
private VnfAssignments vnfAssignments;
@SerializedName("vnf-parameters")
@Expose
- private List<VnfParameter> vnfParameters = new ArrayList<VnfParameter>();
+ private List<VnfParameter> vnfParameters = new ArrayList<>();
+
+ private final static String NULL_STR = "<null>";
/**
* No args constructor for use in serialization
@@ -85,15 +87,15 @@ public class VnfTopologyInformation {
sb.append(VnfTopologyInformation.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("vnfTopologyIdentifier");
sb.append('=');
- sb.append(((this.vnfTopologyIdentifier == null)?"<null>":this.vnfTopologyIdentifier));
+ sb.append(((this.vnfTopologyIdentifier == null)?NULL_STR:this.vnfTopologyIdentifier));
sb.append(',');
sb.append("vnfAssignments");
sb.append('=');
- sb.append(((this.vnfAssignments == null)?"<null>":this.vnfAssignments));
+ sb.append(((this.vnfAssignments == null)?NULL_STR:this.vnfAssignments));
sb.append(',');
sb.append("vnfParameters");
sb.append('=');
- sb.append(((this.vnfParameters == null)?"<null>":this.vnfParameters));
+ sb.append(((this.vnfParameters == null)?NULL_STR:this.vnfParameters));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -117,7 +119,7 @@ public class VnfTopologyInformation {
if (other == this) {
return true;
}
- if ((other instanceof VnfTopologyInformation) == false) {
+ if (!(other instanceof VnfTopologyInformation)) {
return false;
}
VnfTopologyInformation rhs = ((VnfTopologyInformation) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java
index ab39105..c312ec0 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/model/VnfVm.java
@@ -30,14 +30,15 @@ public class VnfVm {
private String vmType;
@SerializedName("vm-networks")
@Expose
- private List<VmNetwork> vmNetworks = new ArrayList<VmNetwork>();
+ private List<VmNetwork> vmNetworks = new ArrayList<>();
@SerializedName("vm-count")
@Expose
private Integer vmCount;
@SerializedName("vm-names")
@Expose
- private List<VmName> vmNames = new ArrayList<VmName>();
+ private List<VmName> vmNames = new ArrayList<>();
+ private final static String NULL_STR = "<null>";
/**
* No args constructor for use in serialization
@@ -99,19 +100,19 @@ public class VnfVm {
sb.append(VnfVm.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("vmType");
sb.append('=');
- sb.append(((this.vmType == null)?"<null>":this.vmType));
+ sb.append(((this.vmType == null)?NULL_STR:this.vmType));
sb.append(',');
sb.append("vmNetworks");
sb.append('=');
- sb.append(((this.vmNetworks == null)?"<null>":this.vmNetworks));
+ sb.append(((this.vmNetworks == null)?NULL_STR:this.vmNetworks));
sb.append(',');
sb.append("vmCount");
sb.append('=');
- sb.append(((this.vmCount == null)?"<null>":this.vmCount));
+ sb.append(((this.vmCount == null)?NULL_STR:this.vmCount));
sb.append(',');
sb.append("vmNames");
sb.append('=');
- sb.append(((this.vmNames == null)?"<null>":this.vmNames));
+ sb.append(((this.vmNames == null)?NULL_STR:this.vmNames));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
@@ -136,7 +137,7 @@ public class VnfVm {
if (other == this) {
return true;
}
- if ((other instanceof VnfVm) == false) {
+ if (!(other instanceof VnfVm)) {
return false;
}
VnfVm rhs = ((VnfVm) other);
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java
index b21a76b..52ee416 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/SpringServiceImpl.java
@@ -58,14 +58,6 @@ public class SpringServiceImpl implements SpringService {
private String aaiPathToSearchNodeQuery;
@Autowired
private String aaiPathToCustomerQuery;
- @Autowired
- public SpringServiceImpl(KieContainer kieContainer) {
- this.kieContainer = kieContainer;
- }
-
- public SpringServiceImpl() {
- // needed for instantiation
- }
public static final String APP_NAME = "SdncContextBuilder";
public static final String MDC_REQUEST_ID = "RequestId";
@@ -82,6 +74,15 @@ public class SpringServiceImpl implements SpringService {
private static UUID instanceUUID = UUID.randomUUID();
+ public SpringServiceImpl() {
+ // needed for instantiation
+ }
+
+ @Autowired
+ public SpringServiceImpl(KieContainer kieContainer) {
+ this.kieContainer = kieContainer;
+ }
+
@Override
public ModelContext getContext(HttpServletRequest request, String serviceInstanceId, String transactionId, String partnerName) throws AuditException {
@@ -120,9 +121,8 @@ public class SpringServiceImpl implements SpringService {
MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getCanonicalHostName());
} catch (Exception e) {
// If, for some reason we are unable to get the canonical host name,
- // we
- // just want to leave the field null.
- log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null");
+ // we just want to leave the field null.
+ log.info("Could not get canonical host name for " + MDC_SERVER_FQDN + ", leaving field null", e);
}
}
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java
index a70012f..b3d21bf 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/service/rs/RestServiceImpl.java
@@ -40,7 +40,7 @@ public class RestServiceImpl implements RestService {
private SpringService service;
- public RestServiceImpl() throws UnsupportedOperationException{
+ public RestServiceImpl() {
}
@Override
diff --git a/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
index c29374b..4575230 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/sdnc/util/RestUtil.java
@@ -86,7 +86,7 @@ public class RestUtil {
private static final String FORWARD_SLASH = "/";
// SDNC vnf Json Path
- private static final String specPath = "config/vnflist.spec";
+ private static final String SPEC_PATH = "config/vnflist.spec";
// Parameters for Query SDNC Model Data REST API URL
private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
@@ -176,7 +176,7 @@ public class RestUtil {
String authorization, List<VnfInstance> vnfList) throws AuditException {
// define map [key: vnf-id, value: list of SDNC vnfs, which in fact are vf_modules]
- Map<String,List<Vnf>> sdncVnfMap = new HashMap<String,List<Vnf>>();
+ Map<String,List<Vnf>> sdncVnfMap = new HashMap<>();
for (VnfInstance vnfInstance: vnfList) {
if (vnfInstance.getVfModules() != null) {
List<Vnf> sdncVnfList = new ArrayList<>();
@@ -314,7 +314,7 @@ public class RestUtil {
String transactionId) throws AuditException {
String getResourceLinkUrl = generateAaiUrl(aaiBaseUrl, aaiPathToSearchNodeQuery, serviceInstanceId);
- String aaiResourceData = getAaiResource(aaiClient, getResourceLinkUrl, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ String aaiResourceData = getAaiResource(aaiClient, getResourceLinkUrl, aaiBasicAuthorization, transactionId);
// Handle the case if the service instance is not found in AAI
if (isEmptyJson(aaiResourceData)) {
@@ -332,7 +332,7 @@ public class RestUtil {
String customerId = serviceEntityObj.getCustomerId();
// Obtain customerType and customerName
String getCustomerUrl = generateAaiUrl (aaiBaseUrl, aaiPathToCustomerQuery, customerId);
- String aaiCustomerData = getAaiResource(aaiClient, getCustomerUrl, aaiBasicAuthorization, transactionId, MediaType.valueOf(MediaType.APPLICATION_JSON));
+ String aaiCustomerData = getAaiResource(aaiClient, getCustomerUrl, aaiBasicAuthorization, transactionId);
if (isEmptyJson(aaiCustomerData)) {
log.info(" Customer name {} is not found from AAI", customerId);
// Only return the empty Json on the root level. i.e service instance
@@ -361,7 +361,7 @@ public class RestUtil {
return headers;
}
- public static String getAaiResource(RestClient client, String url, String aaiBasicAuthorization, String transactionId, MediaType mediaType)
+ public static String getAaiResource(RestClient client, String url, String aaiBasicAuthorization, String transactionId)
throws AuditException {
OperationResult result = client.get(url, buildHeaders(aaiBasicAuthorization, transactionId), MediaType.valueOf(MediaType.APPLICATION_JSON));
@@ -377,26 +377,27 @@ public class RestUtil {
}
}
+
/*
- * Extract the resource-Link from Json payload. For example
- * {
- * "result-data": [
- * {
- * "resource-type": "service-instance",
- * "resource-link": "/aai/v11/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb"
- * }
- * ]
- * }
- */
+ * Extract the resource-Link from Json payload. For example
+ * {
+ * "result-data": [
+ * {
+ * "resource-type": "service-instance",
+ * "resource-link": "/aai/v11/business/customers/customer/DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2/service-subscriptions/service-subscription/vFW/service-instances/service-instance/adc3cc2a-c73e-414f-8ddb-367de81300cb"
+ * }
+ * ]
+ * }
+ */
private static String extractResourceLink(String payload, String catalog) throws AuditException {
String resourceLink = null;
log.info("Fetching the resource-link based on resource-type=" + catalog);
try {
- JSONArray result_data_list = new JSONObject(payload).getJSONArray(RESULT_DATA);
- if (result_data_list != null) {
- for (int i = 0; i < result_data_list.length(); i++) {
- JSONObject obj = result_data_list.optJSONObject(i);
+ JSONArray resultDataList = new JSONObject(payload).getJSONArray(RESULT_DATA);
+ if (resultDataList != null) {
+ for (int i = 0; i < resultDataList.length(); i++) {
+ JSONObject obj = resultDataList.optJSONObject(i);
if (obj.has(JSON_RESOURCE_TYPE) && (obj.getString(JSON_RESOURCE_TYPE).equals(catalog) )) {
resourceLink = obj.getString(JSON_RESOURCE_LINK);
log.info(resourceLink);
@@ -414,7 +415,6 @@ public class RestUtil {
return resourceLink;
}
-
/*
* Extract the "subscriber-name" and "subscriber-type" from Json payload. For example
* {
@@ -455,12 +455,14 @@ public class RestUtil {
* customerId = DemoCust_651800ed-2a3c-45f5-b920-85c1ed155fc2
* serviceType = vFW
* */
-
private static ServiceEntity createServiceEntityObj (String resourceLink) {
- int customer_id_idx = resourceLink.indexOf(CUSTOMER_ID_STRING);
- int service_type_idx = resourceLink.indexOf(SERVICE_TYPE_STRING);
+ if ((null == resourceLink) || resourceLink.isEmpty()) {
+ return null;
+ }
+ int customerIdIdx = resourceLink.indexOf(CUSTOMER_ID_STRING);
+ int serviceTypeIdx = resourceLink.indexOf(SERVICE_TYPE_STRING);
- if (( customer_id_idx < 0 ) || ( service_type_idx < 0 )) {
+ if (( customerIdIdx < 0 ) || ( serviceTypeIdx < 0 )) {
return null;
}
@@ -475,7 +477,7 @@ public class RestUtil {
* Extract the vnf-list from the Json payload.
*/
private static List<Vnf> extractVnfList(String payload) throws AuditException {
- List<Object> jsonSpec = JsonUtils.filepathToList(specPath);
+ List<Object> jsonSpec = JsonUtils.filepathToList(SPEC_PATH);
Object jsonInput = JsonUtils.jsonToObject(payload);
Chainr chainr = Chainr.fromSpec(jsonSpec);
Object transObject = chainr.transform(jsonInput);