diff options
author | Marcus Williams <marcus.williams@intel.com> | 2018-08-02 18:12:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-08-02 18:12:14 +0000 |
commit | acf060932b78061e590d1aa48e726d4ab1e70420 (patch) | |
tree | 7a53b00aa58044ae5e73415d752576b2510240ac | |
parent | b46a6babf5f0ec9b869a19a392db853cf1ebcf91 (diff) | |
parent | aa3fac0c2021c54b626bbc6a13848e2af5e04c3c (diff) |
Merge "Resolve Sonar Blocking issues"
3 files changed, 18 insertions, 34 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java index a53cd0ce49..575853a21f 100644 --- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java +++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/VduArtifact.java @@ -22,6 +22,8 @@ package org.onap.so.adapters.vdu; import java.util.Arrays; import java.util.Objects; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; public class VduArtifact { @@ -35,6 +37,21 @@ public class VduArtifact { private byte[] content; private ArtifactType type; + @Override + public boolean equals(final Object other) { + if (!(other instanceof VduArtifact)) { + return false; + } + VduArtifact castOther = (VduArtifact) other; + return new EqualsBuilder().append(name, castOther.name).append(content, castOther.content) + .append(type, castOther.type).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(name).append(content).append(type).toHashCode(); + } + // Default constructor public VduArtifact() {} @@ -64,17 +81,5 @@ public class VduArtifact { this.type = type; } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - VduArtifact that = (VduArtifact) o; - return Objects.equals(name, that.name) && - Arrays.equals(content, that.content) && - type == that.type; - } + } diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java index b56a6779cc..16d80c42d9 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientI.java @@ -39,8 +39,6 @@ public interface AAIRestClientI { List<Pserver> getPhysicalServerByVnfId(String vnfId, String transactionLoggingUuid) throws UnsupportedEncodingException, JsonParseException, JsonMappingException, IOException; - void updateMaintenceFlag(String vnfId,boolean inMaint, String transactionLoggingUuid) throws Exception; - void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) throws Exception; GenericVnf getVnfByName(String vnfId, String transactionLoggingUuid) throws Exception; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java index b471a1e53d..251ca7f614 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClientImpl.java @@ -116,25 +116,6 @@ public class AAIRestClientImpl implements AAIRestClientI { } @Override - public void updateMaintenceFlag(String vnfName, boolean inMaint, String transactionLoggingUuid) throws IOException { - UUID requestId; - try { - requestId = UUID.fromString(transactionLoggingUuid); - } catch (IllegalArgumentException e) { - logger.warn("could not parse uuid: " + transactionLoggingUuid + " creating valid uuid automatically"); - requestId = UUID.randomUUID(); - } - GenericVnfs genericVnfs = new AAIResourcesClient(ENDPOINT_VERSION).get(GenericVnfs.class, - AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName)).orElse(null); - if (genericVnfs.getGenericVnf().size() > 1) { - throw new IndexOutOfBoundsException("Multiple Generic Vnfs Returned"); - } - - GenericVnf genericVnf = genericVnfs.getGenericVnf().get(0); - updateMaintenceFlagVnfId(genericVnf.getVnfId(), inMaint, transactionLoggingUuid); - } - - @Override public void updateMaintenceFlagVnfId(String vnfId, boolean inMaint, String transactionLoggingUuid) throws IOException { UUID requestId; |