From 645f53bc65ca649d0ffbdea31d720a371f20811a Mon Sep 17 00:00:00 2001 From: Hengye Date: Fri, 29 Mar 2019 15:07:38 +0000 Subject: fix code smell in model-impl Issue-ID: POLICY-1264 Change-Id: Idacb7151978373e48098790d9d86825410b65aa6 Signed-off-by: Hengye --- .../main/java/org/onap/policy/sdc/Resource.java | 28 ++++++++-------- .../java/org/onap/policy/sdc/ResourceInstance.java | 29 ++++++++-------- .../src/main/java/org/onap/policy/sdc/Service.java | 34 +++++++++---------- .../java/org/onap/policy/sdc/ServiceInstance.java | 39 +++++++++++----------- 4 files changed, 66 insertions(+), 64 deletions(-) (limited to 'models-interactions/model-impl/sdc') diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java index 9b73446b6..8bdf9d3d4 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,20 +27,20 @@ import java.util.UUID; public class Resource implements Serializable { private static final long serialVersionUID = -913729158733348027L; - + private UUID resourceUuid; private UUID resourceInvariantUuid; private String resourceName; private String resourceVersion; private ResourceType resourceType; - + public Resource() { //Empty Constructor } - + /** * Constructor. - * + * * @param resource copy object */ public Resource(Resource resource) { @@ -50,19 +50,19 @@ public class Resource implements Serializable { this.resourceVersion = resource.resourceVersion; this.resourceType = resource.resourceType; } - + public Resource(UUID uuid) { this.resourceUuid = uuid; } - + public Resource(String name, ResourceType type) { this.resourceName = name; this.resourceType = type; } - + /** * Constructor. - * + * * @param uuid uuid * @param invariantUuid invariant uuid * @param name name @@ -76,7 +76,7 @@ public class Resource implements Serializable { this.resourceVersion = version; this.resourceType = type; } - + public UUID getResourceUuid() { return resourceUuid; } @@ -123,7 +123,7 @@ public class Resource implements Serializable { + ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType=" + resourceType + "]"; } - + @Override public int hashCode() { final int prime = 31; @@ -135,7 +135,7 @@ public class Resource implements Serializable { result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); return result; } - + @Override public boolean equals(Object obj) { if (this == obj) { @@ -185,5 +185,5 @@ public class Resource implements Serializable { } return true; } - + } diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java index dce6ec0fa..9c1db8a55 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,26 +25,27 @@ import java.io.Serializable; import java.util.UUID; public class ResourceInstance implements Serializable { + private static final long serialVersionUID = -5506162340393802424L; private String resourceInstanceName; private String resourceName; - private UUID resourceInvariantUuid; + private UUID resourceInvariantUuid; private String resourceVersion; private ResourceType resourceType; - private UUID resourceUuid; - + private UUID resourceUuid; + public ResourceInstance() { //Empty Constructor } - + /** * Constructor. - * + * * @param instance copy object */ public ResourceInstance(ResourceInstance instance) { - if (instance == null) { + if (instance == null) { return; } this.resourceInstanceName = instance.resourceInstanceName; @@ -54,7 +55,7 @@ public class ResourceInstance implements Serializable { this.resourceType = instance.resourceType; this.resourceUuid = instance.resourceUuid; } - + public String getResourceInstanceName() { return resourceInstanceName; } @@ -106,10 +107,10 @@ public class ResourceInstance implements Serializable { @Override public String toString() { return "ResourceInstance [resourceInstanceName=" + resourceInstanceName + ", resourceName=" + resourceName - + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion - + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]"; + + ", resourceInvariantUuid=" + resourceInvariantUuid + ", resourceVersion=" + resourceVersion + + ", resourceType=" + resourceType + ", resourceUuid=" + resourceUuid + "]"; } - + @Override public int hashCode() { final int prime = 31; @@ -122,7 +123,7 @@ public class ResourceInstance implements Serializable { result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); return result; } - + @Override public boolean equals(Object obj) { if (this == obj) { @@ -175,5 +176,5 @@ public class ResourceInstance implements Serializable { } return true; } - + } diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java index f4f97c42e..709abf9e8 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,27 +27,27 @@ import java.util.UUID; public class Service implements Serializable { private static final long serialVersionUID = -1249276698549996806L; - - private UUID serviceUUID; - private UUID serviceInvariantUUID; - private String serviceName; - private String serviceVersion; - + + private UUID serviceUUID; + private UUID serviceInvariantUUID; + private String serviceName; + private String serviceVersion; + public Service() { //Empty Constructor } - + public Service(UUID uuid) { this.serviceUUID = uuid; } - + public Service(String name) { this.serviceName = name; } - + /** * Constructor. - * + * * @param uuid service id * @param invariantUUID service invariant id * @param name name @@ -59,10 +59,10 @@ public class Service implements Serializable { this.serviceName = name; this.serviceVersion = version; } - + /** * Constructor. - * + * * @param service copy object */ public Service(Service service) { @@ -71,7 +71,7 @@ public class Service implements Serializable { this.serviceName = service.serviceName; this.serviceVersion = service.serviceVersion; } - + public UUID getServiceUUID() { return serviceUUID; } @@ -107,9 +107,9 @@ public class Service implements Serializable { @Override public String toString() { return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID - + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]"; + + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]"; } - + @Override public int hashCode() { final int prime = 31; diff --git a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java index 49f1b8572..d5f74d4d0 100644 --- a/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java +++ b/models-interactions/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,23 +25,24 @@ import java.io.Serializable; import java.util.UUID; public class ServiceInstance implements Serializable { + private static final long serialVersionUID = 6285260780966679625L; - private UUID personaModelUUID; - private UUID serviceUUID; - private UUID serviceInstanceUUID; - private UUID widgetModelUUID; - private String widgetModelVersion; - private String serviceName; - private String serviceInstanceName; - + private UUID personaModelUUID; + private UUID serviceUUID; + private UUID serviceInstanceUUID; + private UUID widgetModelUUID; + private String widgetModelVersion; + private String serviceName; + private String serviceInstanceName; + public ServiceInstance() { //Empty Constructor } - + /** * Constructor. - * + * * @param instance copy object */ public ServiceInstance(ServiceInstance instance) { @@ -56,7 +57,7 @@ public class ServiceInstance implements Serializable { this.serviceName = instance.serviceName; this.serviceInstanceName = instance.serviceInstanceName; } - + public UUID getPersonaModelUUID() { return personaModelUUID; } @@ -116,11 +117,11 @@ public class ServiceInstance implements Serializable { @Override public String toString() { return "ServiceInstance [personaModelUUID=" + personaModelUUID + ", serviceUUID=" + serviceUUID - + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID - + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName - + ", serviceInstanceName=" + serviceInstanceName + "]"; + + ", serviceInstanceUUID=" + serviceInstanceUUID + ", widgetModelUUID=" + widgetModelUUID + + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName + + ", serviceInstanceName=" + serviceInstanceName + "]"; } - + @Override public int hashCode() { final int prime = 31; @@ -134,7 +135,7 @@ public class ServiceInstance implements Serializable { result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode()); return result; } - + @Override public boolean equals(Object obj) { if (this == obj) { @@ -198,5 +199,5 @@ public class ServiceInstance implements Serializable { } return true; } - + } -- cgit 1.2.3-korg