2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.heat.datatypes.structure;
24 import org.openecomp.sdc.datatypes.error.ErrorMessage;
25 import org.openecomp.sdc.heat.datatypes.manifest.FileData;
27 import java.util.ArrayList;
28 import java.util.List;
30 public class Artifact implements Comparable<Artifact> {
32 private String fileName;
33 private FileData.Type type;
34 private List<ErrorMessage> errors;
36 public Artifact(String fileName, FileData.Type type) {
37 this.fileName = fileName;
42 public String getFileName() {
46 public void setFileName(String name) {
51 public FileData.Type getType() {
55 public List<ErrorMessage> getErrors() {
59 public void setErrors(List<ErrorMessage> errors) {
64 * Add error to error list.
66 * @param error the error
68 public void addErrorToErrorList(ErrorMessage error) {
69 if (this.errors == null || this.errors.isEmpty()) {
70 this.errors = new ArrayList<>();
73 this.errors.add(error);
78 public boolean equals(Object obj) {
82 if (obj == null || getClass() != obj.getClass()) {
86 Artifact artifact = (Artifact) obj;
88 if (!fileName.equals(artifact.fileName)) {
96 public int hashCode() {
97 int result = fileName.hashCode();
102 public int compareTo(Artifact artifact) {
103 return artifact.getFileName().compareTo(this.getFileName());