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=========================================================
19 * Modifications copyright (c) 2019 Nokia
20 * ================================================================================
23 package org.openecomp.sdc.vendorsoftwareproduct.types.composition;
25 import com.google.common.annotations.VisibleForTesting;
27 import java.util.ArrayList;
28 import java.util.Collection;
30 public class CompositionEntityValidationData {
31 private CompositionEntityType entityType;
32 private String entityId;
33 private String entityName;
34 private Collection<String> errors;
35 private Collection<CompositionEntityValidationData> subEntitiesValidationData;
38 CompositionEntityValidationData() {}
40 public CompositionEntityValidationData(CompositionEntityType entityType, String entityId) {
41 this.entityType = entityType;
42 this.entityId = entityId;
45 public String getEntityName() {
49 public void setEntityName(String entityName) {
50 this.entityName = entityName;
53 public CompositionEntityType getEntityType() {
57 public void setEntityType(CompositionEntityType entityType) {
58 this.entityType = entityType;
61 public String getEntityId() {
65 public void setEntityId(String entityId) {
66 this.entityId = entityId;
69 public Collection<String> getErrors() {
73 public void setErrors(Collection<String> errors) {
77 public Collection<CompositionEntityValidationData> getSubEntitiesValidationData() {
78 return subEntitiesValidationData;
81 public void setSubEntitiesValidationData(Collection<CompositionEntityValidationData> toSet) {
82 this.subEntitiesValidationData = toSet;
86 * Add sub entity validation data.
88 * @param subEntityValidationData the sub entity validation data
90 public void addSubEntityValidationData(CompositionEntityValidationData subEntityValidationData) {
91 if (subEntitiesValidationData == null) {
92 subEntitiesValidationData = new ArrayList<>();
94 subEntitiesValidationData.add(subEntityValidationData);
98 public boolean equals(Object o) {
102 if (o == null || getClass() != o.getClass()) {
106 CompositionEntityValidationData that = (CompositionEntityValidationData) o;
108 if (entityType != that.entityType) {
111 if (entityId != null ? !entityId.equals(that.entityId) : that.entityId != null) {
114 if (entityName != null ? !entityName.equals(that.entityName) : that.entityName != null) {
117 if (errors != null ? !errors.equals(that.errors) : that.errors != null) {
120 if (subEntitiesValidationData != null ? !subEntitiesValidationData
121 .equals(that.subEntitiesValidationData) : that.subEntitiesValidationData != null) {
129 public int hashCode() {
130 int result = entityType != null ? entityType.hashCode() : 0;
131 result = 31 * result + (entityId != null ? entityId.hashCode() : 0);
132 result = 31 * result + (entityName != null ? entityName.hashCode() : 0);
133 result = 31 * result + (errors != null ? errors.hashCode() : 0);
136 (subEntitiesValidationData != null ? subEntitiesValidationData.hashCode() : 0);