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;
23 import java.util.ArrayList;
24 import java.util.List;
26 import lombok.AccessLevel;
27 import lombok.EqualsAndHashCode;
30 import org.openecomp.sdc.datatypes.error.ErrorMessage;
31 import org.openecomp.sdc.heat.datatypes.manifest.FileData;
36 public class Artifact implements Comparable<Artifact> {
38 private String fileName;
40 @Setter(AccessLevel.NONE)
41 @EqualsAndHashCode.Exclude
42 private FileData.Type type;
44 @EqualsAndHashCode.Exclude
45 private List<ErrorMessage> errors;
47 public Artifact(String fileName, FileData.Type type) {
48 this.fileName = fileName;
53 * Add error to error list.
55 * @param error the error
57 public void addErrorToErrorList(ErrorMessage error) {
58 if (this.errors == null || this.errors.isEmpty()) {
59 this.errors = new ArrayList<>();
62 this.errors.add(error);
66 public int compareTo(Artifact artifact) {
67 return artifact.getFileName().compareTo(this.getFileName());