diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2018-08-29 07:58:53 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2018-08-29 12:34:55 -0400 |
commit | 8279af376b435e1d7dd118a1955c5681edf3b847 (patch) | |
tree | f0e9f24028b8e96908184192f9e2813a2981938a /controlloop/common/model-impl/sdc/src/main | |
parent | 17435998307f9f86ec5ebe55d6d36eceee1f1943 (diff) |
Fix remaining checkstyle
Lots of formatting, missing javadoc, distance from use,
imports must be explicit, ordering of methods.
Fixed some abbreviation problems in classes and renamed
JUnit tests to fix this.
Issue-ID: POLICY-883
Change-Id: I8494f63d88d63c0232aca97f7bcc848816228fb1
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/model-impl/sdc/src/main')
5 files changed, 214 insertions, 114 deletions
diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java index 25d0903d7..121b54e5a 100644 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Resource.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,8 +27,8 @@ public class Resource implements Serializable { private static final long serialVersionUID = -913729158733348027L; - private UUID resourceUUID; - private UUID resourceInvariantUUID; + private UUID resourceUuid; + private UUID resourceInvariantUuid; private String resourceName; private String resourceVersion; private ResourceType resourceType; @@ -37,16 +37,21 @@ public class Resource implements Serializable { //Empty Constructor } + /** + * Constructor. + * + * @param resource copy object + */ public Resource(Resource resource) { - this.resourceUUID = resource.resourceUUID; - this.resourceInvariantUUID = resource.resourceInvariantUUID; + this.resourceUuid = resource.resourceUuid; + this.resourceInvariantUuid = resource.resourceInvariantUuid; this.resourceName = resource.resourceName; this.resourceVersion = resource.resourceVersion; this.resourceType = resource.resourceType; } public Resource(UUID uuid) { - this.resourceUUID = uuid; + this.resourceUuid = uuid; } public Resource(String name, ResourceType type) { @@ -54,28 +59,37 @@ public class Resource implements Serializable { this.resourceType = type; } - public Resource(UUID uuid, UUID invariantUUID, String name, String version, ResourceType type) { - this.resourceUUID = uuid; - this.resourceInvariantUUID = invariantUUID; + /** + * Constructor. + * + * @param uuid uuid + * @param invariantUuid invariant uuid + * @param name name + * @param version version + * @param type type + */ + public Resource(UUID uuid, UUID invariantUuid, String name, String version, ResourceType type) { + this.resourceUuid = uuid; + this.resourceInvariantUuid = invariantUuid; this.resourceName = name; this.resourceVersion = version; this.resourceType = type; } - public UUID getResourceUUID() { - return resourceUUID; + public UUID getResourceUuid() { + return resourceUuid; } - public void setResourceUUID(UUID resourceUUID) { - this.resourceUUID = resourceUUID; + public void setResourceUuid(UUID resourceUuid) { + this.resourceUuid = resourceUuid; } - public UUID getResourceInvariantUUID() { - return resourceInvariantUUID; + public UUID getResourceInvariantUuid() { + return resourceInvariantUuid; } - public void setResourceInvariantUUID(UUID resourceInvariantUUID) { - this.resourceInvariantUUID = resourceInvariantUUID; + public void setResourceInvariantUuid(UUID resourceInvariantUuid) { + this.resourceInvariantUuid = resourceInvariantUuid; } public String getResourceName() { @@ -104,55 +118,70 @@ public class Resource implements Serializable { @Override public String toString() { - return "Resource [resourceUUID=" + resourceUUID + ", resourceInvariantUUID=" + resourceInvariantUUID + return "Resource [resourceUUID=" + resourceUuid + ", resourceInvariantUUID=" + resourceInvariantUuid + ", resourceName=" + resourceName + ", resourceVersion=" + resourceVersion + ", resourceType=" + resourceType + "]"; } + @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode()); + result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode()); result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); - result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode()); + result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode()); result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); return result; } + @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } Resource other = (Resource) obj; - if (resourceInvariantUUID == null) { - if (other.resourceInvariantUUID != null) + if (resourceInvariantUuid == null) { + if (other.resourceInvariantUuid != null) { return false; - } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID)) + } + } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) { return false; + } if (resourceName == null) { - if (other.resourceName != null) + if (other.resourceName != null) { return false; - } else if (!resourceName.equals(other.resourceName)) + } + } else if (!resourceName.equals(other.resourceName)) { return false; + } if (resourceType == null) { - if (other.resourceType != null) + if (other.resourceType != null) { return false; - } else if (!resourceType.equals(other.resourceType)) + } + } else if (!resourceType.equals(other.resourceType)) { return false; - if (resourceUUID == null) { - if (other.resourceUUID != null) + } + if (resourceUuid == null) { + if (other.resourceUuid != null) { return false; - } else if (!resourceUUID.equals(other.resourceUUID)) + } + } else if (!resourceUuid.equals(other.resourceUuid)) { return false; + } if (resourceVersion == null) { - if (other.resourceVersion != null) + if (other.resourceVersion != null) { return false; - } else if (!resourceVersion.equals(other.resourceVersion)) + } + } else if (!resourceVersion.equals(other.resourceVersion)) { return false; + } return true; } diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java index 7fca79fc3..eaee5a27b 100644 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceInstance.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,25 +28,30 @@ public class ResourceInstance implements Serializable { 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) { return; } this.resourceInstanceName = instance.resourceInstanceName; this.resourceName = instance.resourceName; - this.resourceInvariantUUID = instance.resourceInvariantUUID; + this.resourceInvariantUuid = instance.resourceInvariantUuid; this.resourceVersion = instance.resourceVersion; this.resourceType = instance.resourceType; - this.resourceUUID = instance.resourceUUID; + this.resourceUuid = instance.resourceUuid; } public String getResourceInstanceName() { @@ -66,11 +71,11 @@ public class ResourceInstance implements Serializable { } public UUID getResourceInvariantUUID() { - return resourceInvariantUUID; + return resourceInvariantUuid; } - public void setResourceInvariantUUID(UUID resourceInvariantUUID) { - this.resourceInvariantUUID = resourceInvariantUUID; + public void setResourceInvariantUUID(UUID resourceInvariantUuid) { + this.resourceInvariantUuid = resourceInvariantUuid; } public String getResourceVersion() { @@ -89,68 +94,84 @@ public class ResourceInstance implements Serializable { this.resourceType = resourceType; } - public UUID getResourceUUID() { - return resourceUUID; + public UUID getResourceUuid() { + return resourceUuid; } - public void setResourceUUID(UUID resourceUUID) { - this.resourceUUID = resourceUUID; + public void setResourceUuid(UUID resourceUuid) { + this.resourceUuid = resourceUuid; } @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; int result = 1; result = prime * result + ((resourceInstanceName == null) ? 0 : resourceInstanceName.hashCode()); - result = prime * result + ((resourceInvariantUUID == null) ? 0 : resourceInvariantUUID.hashCode()); + result = prime * result + ((resourceInvariantUuid == null) ? 0 : resourceInvariantUuid.hashCode()); result = prime * result + ((resourceName == null) ? 0 : resourceName.hashCode()); result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); - result = prime * result + ((resourceUUID == null) ? 0 : resourceUUID.hashCode()); + result = prime * result + ((resourceUuid == null) ? 0 : resourceUuid.hashCode()); result = prime * result + ((resourceVersion == null) ? 0 : resourceVersion.hashCode()); return result; } + @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } ResourceInstance other = (ResourceInstance) obj; if (resourceInstanceName == null) { - if (other.resourceInstanceName != null) + if (other.resourceInstanceName != null) { return false; - } else if (!resourceInstanceName.equals(other.resourceInstanceName)) + } + } else if (!resourceInstanceName.equals(other.resourceInstanceName)) { return false; - if (resourceInvariantUUID == null) { - if (other.resourceInvariantUUID != null) + } + if (resourceInvariantUuid == null) { + if (other.resourceInvariantUuid != null) { return false; - } else if (!resourceInvariantUUID.equals(other.resourceInvariantUUID)) + } + } else if (!resourceInvariantUuid.equals(other.resourceInvariantUuid)) { return false; + } if (resourceName == null) { - if (other.resourceName != null) + if (other.resourceName != null) { return false; - } else if (!resourceName.equals(other.resourceName)) + } + } else if (!resourceName.equals(other.resourceName)) { return false; - if (resourceType != other.resourceType) + } + if (resourceType != other.resourceType) { return false; - if (resourceUUID == null) { - if (other.resourceUUID != null) + } + if (resourceUuid == null) { + if (other.resourceUuid != null) { return false; - } else if (!resourceUUID.equals(other.resourceUUID)) + } + } else if (!resourceUuid.equals(other.resourceUuid)) { return false; + } if (resourceVersion == null) { - if (other.resourceVersion != null) + if (other.resourceVersion != null) { return false; - } else if (!resourceVersion.equals(other.resourceVersion)) + } + } else if (!resourceVersion.equals(other.resourceVersion)) { return false; + } return true; } diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java index c4dbfffa4..6202d64e0 100644 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ResourceType.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,21 +21,21 @@ package org.onap.policy.sdc; public enum ResourceType { - VF("VF"), - VFC("VFC"), - VL("VL"), - CP("CP") - ; - - private String type; - - private ResourceType(String type) { - this.type = type; - } + VF("VF"), + VFC("VFC"), + VL("VL"), + CP("CP") + ; + + private String type; + + private ResourceType(String type) { + this.type = type; + } + + @Override + public String toString() { + return this.type; + } - @Override - public String toString() { - return this.type; - } - } diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java index 7bfc62e67..b3ebcc238 100644 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/Service.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,14 @@ public class Service implements Serializable { this.serviceName = name; } + /** + * Constructor. + * + * @param uuid service id + * @param invariantUUID service invariant id + * @param name name + * @param version version + */ public Service(UUID uuid, UUID invariantUUID, String name, String version) { this.serviceUUID = uuid; this.serviceInvariantUUID = invariantUUID; @@ -51,6 +59,11 @@ public class Service implements Serializable { this.serviceVersion = version; } + /** + * Constructor. + * + * @param service copy object + */ public Service(Service service) { this.serviceUUID = service.serviceUUID; this.serviceInvariantUUID = service.serviceInvariantUUID; @@ -95,6 +108,7 @@ public class Service implements Serializable { return "Service [serviceUUID=" + serviceUUID + ", serviceInvariantUUID=" + serviceInvariantUUID + ", serviceName=" + serviceName + ", serviceVersion=" + serviceVersion + "]"; } + @Override public int hashCode() { final int prime = 31; @@ -105,35 +119,47 @@ public class Service implements Serializable { result = prime * result + ((serviceVersion == null) ? 0 : serviceVersion.hashCode()); return result; } + @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } Service other = (Service) obj; if (serviceInvariantUUID == null) { - if (other.serviceInvariantUUID != null) + if (other.serviceInvariantUUID != null) { return false; - } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID)) + } + } else if (!serviceInvariantUUID.equals(other.serviceInvariantUUID)) { return false; + } if (serviceName == null) { - if (other.serviceName != null) + if (other.serviceName != null) { return false; - } else if (!serviceName.equals(other.serviceName)) + } + } else if (!serviceName.equals(other.serviceName)) { return false; + } if (serviceUUID == null) { - if (other.serviceUUID != null) + if (other.serviceUUID != null) { return false; - } else if (!serviceUUID.equals(other.serviceUUID)) + } + } else if (!serviceUUID.equals(other.serviceUUID)) { return false; + } if (serviceVersion == null) { - if (other.serviceVersion != null) + if (other.serviceVersion != null) { return false; - } else if (!serviceVersion.equals(other.serviceVersion)) + } + } else if (!serviceVersion.equals(other.serviceVersion)) { return false; + } return true; } diff --git a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java index c35d7dfde..a477267a3 100644 --- a/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java +++ b/controlloop/common/model-impl/sdc/src/main/java/org/onap/policy/sdc/ServiceInstance.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * sdc * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,11 @@ public class ServiceInstance implements Serializable { //Empty Constructor } + /** + * Constructor. + * + * @param instance copy object + */ public ServiceInstance(ServiceInstance instance) { if (instance == null) { return; @@ -114,6 +119,7 @@ public class ServiceInstance implements Serializable { + ", widgetModelVersion=" + widgetModelVersion + ", serviceName=" + serviceName + ", serviceInstanceName=" + serviceInstanceName + "]"; } + @Override public int hashCode() { final int prime = 31; @@ -127,50 +133,68 @@ public class ServiceInstance implements Serializable { result = prime * result + ((widgetModelVersion == null) ? 0 : widgetModelVersion.hashCode()); return result; } + @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (obj == null) + } + if (obj == null) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } ServiceInstance other = (ServiceInstance) obj; if (personaModelUUID == null) { - if (other.personaModelUUID != null) + if (other.personaModelUUID != null) { return false; - } else if (!personaModelUUID.equals(other.personaModelUUID)) + } + } else if (!personaModelUUID.equals(other.personaModelUUID)) { return false; + } if (serviceInstanceName == null) { - if (other.serviceInstanceName != null) + if (other.serviceInstanceName != null) { return false; - } else if (!serviceInstanceName.equals(other.serviceInstanceName)) + } + } else if (!serviceInstanceName.equals(other.serviceInstanceName)) { return false; + } if (serviceInstanceUUID == null) { - if (other.serviceInstanceUUID != null) + if (other.serviceInstanceUUID != null) { return false; - } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID)) + } + } else if (!serviceInstanceUUID.equals(other.serviceInstanceUUID)) { return false; + } if (serviceName == null) { - if (other.serviceName != null) + if (other.serviceName != null) { return false; - } else if (!serviceName.equals(other.serviceName)) + } + } else if (!serviceName.equals(other.serviceName)) { return false; + } if (serviceUUID == null) { - if (other.serviceUUID != null) + if (other.serviceUUID != null) { return false; - } else if (!serviceUUID.equals(other.serviceUUID)) + } + } else if (!serviceUUID.equals(other.serviceUUID)) { return false; + } if (widgetModelUUID == null) { - if (other.widgetModelUUID != null) + if (other.widgetModelUUID != null) { return false; - } else if (!widgetModelUUID.equals(other.widgetModelUUID)) + } + } else if (!widgetModelUUID.equals(other.widgetModelUUID)) { return false; + } if (widgetModelVersion == null) { - if (other.widgetModelVersion != null) + if (other.widgetModelVersion != null) { return false; - } else if (!widgetModelVersion.equals(other.widgetModelVersion)) + } + } else if (!widgetModelVersion.equals(other.widgetModelVersion)) { return false; + } return true; } |