From e67348a174fd226c3400522a48e65a0f287eb661 Mon Sep 17 00:00:00 2001 From: ajay priyadarshi Date: Fri, 6 Apr 2018 11:33:44 +0530 Subject: Sonar: Code smells Sfc entity/MsbRegisterEntity.java file name: PortChainReq.java Change-Id: I06754705324248be60dad6567d23a1604125cf31 Issue-ID: VFC-856 Signed-off-by: ajay priyadarshi --- .../java/org/onap/sfc/entity/ChainParameter.java | 8 ++++---- .../org/onap/sfc/entity/FlowClassfierReq4N.java | 2 +- .../org/onap/sfc/entity/FlowClassifierReq4S.java | 14 +++++++------- .../java/org/onap/sfc/entity/MsbRegisterEntity.java | 7 ++++--- .../main/java/org/onap/sfc/entity/PortChainReq.java | 21 ++++++++++----------- .../java/org/onap/sfc/entity/PortChainReq4N.java | 14 ++++++++------ .../java/org/onap/sfc/entity/PortChainReq4S.java | 11 ++++++----- .../src/main/java/org/onap/sfc/entity/Result.java | 12 +++++++----- .../java/org/onap/sfc/wrapper/N2sReqWrapper.java | 3 ++- 9 files changed, 49 insertions(+), 43 deletions(-) (limited to 'zte') diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java index 4b17a41..eb8c650 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/ChainParameter.java @@ -19,16 +19,16 @@ import com.google.gson.annotations.SerializedName; public class ChainParameter { @SerializedName("chain-parameter") - private String chainParameter; + private String chainParam;//A field should not duplicate the name of its containing class @SerializedName("chain-parameter-value") private String chainParamValue; public String getChainParameter() { - return chainParameter; + return chainParam; } - public void setChainParameter(String chainParameter) { - this.chainParameter = chainParameter; + public void setChainParameter(String inChainParameter) { + this.chainParam = inChainParameter; } public String getChainParamValue() { diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java index 31bc773..cc65b27 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassfierReq4N.java @@ -1,4 +1,4 @@ -/* +/** * Copyright 2016 ZTE Corporation. * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java index 4685009..58d8dcc 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/FlowClassifierReq4S.java @@ -18,18 +18,18 @@ package org.onap.sfc.entity; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; +import java.util.List; public class FlowClassifierReq4S { - public ArrayList getSfcFlowClassifier() { + + @SerializedName("sfc-flow-classifier") + List sfcFlowClassifier; + + public List getSfcFlowClassifier() { return sfcFlowClassifier; } - public void setSfcFlowClassifier(ArrayList sfcFlowClassifier) { + public void setSfcFlowClassifier(List sfcFlowClassifier) { this.sfcFlowClassifier = sfcFlowClassifier; } - - @SerializedName("sfc-flow-classifier") - ArrayList sfcFlowClassifier; - - } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java index 9dcd00e..3bef7d4 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/MsbRegisterEntity.java @@ -18,6 +18,7 @@ package org.onap.sfc.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.ArrayList; +import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) public class MsbRegisterEntity { @@ -26,7 +27,7 @@ public class MsbRegisterEntity { private String url; private String protocol; private String visualRange; - private ArrayList nodes; + private List nodes; public String getServiceName() { return serviceName; @@ -68,11 +69,11 @@ public class MsbRegisterEntity { this.visualRange = visualRange; } - public ArrayList getNodes() { + public List getNodes() { return nodes; } - public void setNodes(ArrayList nodes) { + public void setNodes(List nodes) { this.nodes = nodes; } } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java index 1727008..8fa13cd 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq.java @@ -18,23 +18,24 @@ package org.onap.sfc.entity; import com.google.gson.annotations.SerializedName; import java.util.ArrayList; +import java.util.List; import java.util.Map; public class PortChainReq { @SerializedName("port-pair-groups") - private ArrayList portPairGroups; + private List portPairGroups; @SerializedName("flow-classifiers") - private ArrayList flowClassifiers; + private List flowClassifiers; private String uuid; @SerializedName("chain-parameters") - private ArrayList chainParams; + private List chainParams; - public ArrayList getChainParams() { + public List getChainParams() { return chainParams; } - public void setChainParams(ArrayList chainParams) { + public void setChainParams(List chainParams) { this.chainParams = chainParams; } @@ -47,21 +48,19 @@ public class PortChainReq { this.uuid = uuid; } - private Map chainParameters; - - public ArrayList getPortPairGroups() { + public List getPortPairGroups() { return portPairGroups; } - public void setPortPairGroups(ArrayList portPairGroups) { + public void setPortPairGroups(List portPairGroups) { this.portPairGroups = portPairGroups; } - public ArrayList getFlowClassifiers() { + public List getFlowClassifiers() { return flowClassifiers; } - public void setFlowClassifiers(ArrayList flowClassifiers) { + public void setFlowClassifiers(List flowClassifiers) { this.flowClassifiers = flowClassifiers; } } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java index 447de12..30fd697 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4N.java @@ -13,17 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.onap.sfc.entity; import java.util.ArrayList; +import java.util.List; public class PortChainReq4N { private String sdnControllerId; private String url; private String name; private String description; - private ArrayList flowClassifiers; - private ArrayList portPairGroups; + private List flowClassifiers; + private List portPairGroups; private boolean symmetric; public String getUrl() { @@ -58,19 +60,19 @@ public class PortChainReq4N { this.description = description; } - public ArrayList getFlowClassifiers() { + public List getFlowClassifiers() { return flowClassifiers; } - public void setFlowClassifiers(ArrayList flowClassifiers) { + public void setFlowClassifiers(List flowClassifiers) { this.flowClassifiers = flowClassifiers; } - public ArrayList getPortPairGroups() { + public List getPortPairGroups() { return portPairGroups; } - public void setPortPairGroups(ArrayList portPairGroups) { + public void setPortPairGroups(List portPairGroups) { this.portPairGroups = portPairGroups; } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java index 8b40b27..fe880dc 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/PortChainReq4S.java @@ -17,18 +17,19 @@ package org.onap.sfc.entity; import com.google.gson.annotations.SerializedName; -import java.util.ArrayList; +import java.util.List; public class PortChainReq4S { - public ArrayList getPortChainReqs() { + @SerializedName("port-chain") + List portChainReqs; + + public List getPortChainReqs() { return portChainReqs; } - public void setPortChainReqs(ArrayList portChainReqs) { + public void setPortChainReqs(List portChainReqs) { this.portChainReqs = portChainReqs; } - @SerializedName("port-chain") - ArrayList portChainReqs; } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java index 14cb73b..9d5922b 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/entity/Result.java @@ -16,6 +16,13 @@ package org.onap.sfc.entity; public class Result { + + private String id; + + public Result(String uuid) { + this.id = uuid; + } + public String getId() { return id; } @@ -24,9 +31,4 @@ public class Result { this.id = id; } - private String id; - - public Result(String uuid) { - this.id = uuid; - } } diff --git a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java index 8c9ccbd..97b311a 100644 --- a/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java +++ b/zte/sfc-driver/sfc-driver/src/main/java/org/onap/sfc/wrapper/N2sReqWrapper.java @@ -33,6 +33,7 @@ import org.onap.sfc.entity.portpair.PortPairReq4S; import org.onap.sfc.entity.portpair.ServiceFunctionParameter; import java.util.ArrayList; +import java.util.List; public class N2sReqWrapper { @@ -64,7 +65,7 @@ public class N2sReqWrapper { } public static FlowClassifierReq4S convertFlowClassfier(FlowClassfierReq4N flowClassfierReq4N) { - ArrayList flowClassifiers = new ArrayList(); + List flowClassifiers = new ArrayList(); FlowClassfierReq flowClassfierReq = new FlowClassfierReq(); flowClassfierReq.setProtocol(flowClassfierReq4N.getIpProto()); // flowClassfierReq.setSourcePortRangeMin(Integer.parseInt(flowClassfierReq4N. -- cgit 1.2.3-korg