diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java')
-rw-r--r-- | openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java | 103 |
1 files changed, 34 insertions, 69 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java index 95ae4e59c7..9d1fbe3cb3 100644 --- a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java +++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java @@ -7,9 +7,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. @@ -20,85 +20,50 @@ package org.openecomp.sdc.heat.datatypes.structure; +import java.util.ArrayList; +import java.util.List; +import lombok.AccessLevel; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.heat.datatypes.manifest.FileData; -import java.util.ArrayList; -import java.util.List; - +@Getter +@Setter +@EqualsAndHashCode public class Artifact implements Comparable<Artifact> { - private String fileName; - private FileData.Type type; - private List<ErrorMessage> errors; - - public Artifact(String fileName, FileData.Type type) { - this.fileName = fileName; - this.type = type; - } - - - public String getFileName() { - return fileName; - } - - public void setFileName(String name) { - this.fileName = name; - } + private String fileName; + @Setter(AccessLevel.NONE) + @EqualsAndHashCode.Exclude + private FileData.Type type; - public FileData.Type getType() { - return type; - } + @EqualsAndHashCode.Exclude + private List<ErrorMessage> errors; - public List<ErrorMessage> getErrors() { - return errors; - } - - public void setErrors(List<ErrorMessage> errors) { - this.errors = errors; - } - - /** - * Add error to error list. - * - * @param error the error - */ - public void addErrorToErrorList(ErrorMessage error) { - if (this.errors == null || this.errors.isEmpty()) { - this.errors = new ArrayList<>(); + public Artifact(String fileName, FileData.Type type) { + this.fileName = fileName; + this.type = type; } - this.errors.add(error); - } - - @Override - public int hashCode() { - int result = fileName.hashCode(); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; + /** + * Add error to error list. + * + * @param error the error + */ + public void addErrorToErrorList(ErrorMessage error) { + if (this.errors == null || this.errors.isEmpty()) { + this.errors = new ArrayList<>(); + } + + this.errors.add(error); } - if (obj == null || getClass() != obj.getClass()) { - return false; - } - - Artifact artifact = (Artifact) obj; - if (!fileName.equals(artifact.fileName)) { - return false; + @Override + public int compareTo(Artifact artifact) { + return artifact.getFileName().compareTo(this.getFileName()); } - return true; - - } - - @Override - public int compareTo(Artifact artifact) { - return artifact.getFileName().compareTo(this.getFileName()); - } } |