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.vendorsoftwareproduct.types.composition;
23 import java.util.ArrayList;
24 import java.util.Collection;
26 public class CompositionEntityValidationData {
27 private CompositionEntityType entityType;
28 private String entityId;
29 private String entityName;
30 private Collection<String> errors;
31 private Collection<CompositionEntityValidationData> subEntitiesValidationData;
33 public CompositionEntityValidationData(CompositionEntityType entityType, String entityId) {
34 this.entityType = entityType;
35 this.entityId = entityId;
38 public String getEntityName() {
42 public void setEntityName(String entityName) {
43 this.entityName = entityName;
46 public CompositionEntityType getEntityType() {
50 public void setEntityType(CompositionEntityType entityType) {
51 this.entityType = entityType;
54 public String getEntityId() {
58 public void setEntityId(String entityId) {
59 this.entityId = entityId;
62 public Collection<String> getErrors() {
66 public void setErrors(Collection<String> errors) {
70 public Collection<CompositionEntityValidationData> getSubEntitiesValidationData() {
71 return subEntitiesValidationData;
74 public void setSubEntitiesValidationData(Collection<CompositionEntityValidationData> toSet) {
75 this.subEntitiesValidationData = toSet;
79 * Add sub entity validation data.
81 * @param subEntityValidationData the sub entity validation data
83 public void addSubEntityValidationData(CompositionEntityValidationData subEntityValidationData) {
84 if (subEntitiesValidationData == null) {
85 subEntitiesValidationData = new ArrayList<>();
87 subEntitiesValidationData.add(subEntityValidationData);
91 public boolean equals(Object o) {
95 if (o == null || getClass() != o.getClass()) {
99 CompositionEntityValidationData that = (CompositionEntityValidationData) o;
101 if (entityType != that.entityType) {
104 if (entityId != null ? !entityId.equals(that.entityId) : that.entityId != null) {
107 if (entityName != null ? !entityName.equals(that.entityName) : that.entityName != null) {
110 if (errors != null ? !errors.equals(that.errors) : that.errors != null) {
113 if (subEntitiesValidationData != null ? !subEntitiesValidationData
114 .equals(that.subEntitiesValidationData) : that.subEntitiesValidationData != null) {
122 public int hashCode() {
123 int result = entityType != null ? entityType.hashCode() : 0;
124 result = 31 * result + (entityId != null ? entityId.hashCode() : 0);
125 result = 31 * result + (entityName != null ? entityName.hashCode() : 0);
126 result = 31 * result + (errors != null ? errors.hashCode() : 0);
129 (subEntitiesValidationData != null ? subEntitiesValidationData.hashCode() : 0);