/*- * ============LICENSE_START======================================================= * Copyright (C) 2019-2020 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * 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. * See the License for the specific language governing permissions and * limitations under the License. * * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ package org.onap.policy.models.base; import java.lang.reflect.ParameterizedType; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.NavigableMap; import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import java.util.function.Function; import javax.persistence.CascadeType; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.MappedSuperclass; import javax.persistence.Table; import javax.ws.rs.core.Response; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NonNull; import org.apache.commons.lang3.StringUtils; import org.onap.policy.models.base.PfValidationResult.ValidationResult; // @formatter:off /** * This class is a concept container and holds a map of concepts. The {@link PfConceptContainer} class implements the * helper methods of the {@link PfConceptGetter} interface to allow {@link PfConceptContainer} instances to be retrieved * by calling methods directly on this class without referencing the contained map. * *
Validation checks that a container key is not null. An error is issued if no concepts are defined in a container.
* Each concept entry is checked to ensure that its key and value are not null and that the key matches the key in the
* map value. Each concept entry is then validated individually.
*
* @param C the concept being contained
*/
//@formatter:on
@MappedSuperclass
@Entity
@Table(name = "PfConceptContainer")
@Data
@EqualsAndHashCode(callSuper = false)
public class PfConceptContainer>> {
private static final long serialVersionUID = -324211738823208318L;
@EmbeddedId
private PfConceptKey key;
@ManyToMany(cascade = CascadeType.ALL)
// @formatter:off
@JoinTable(
joinColumns = {
@JoinColumn(name = "conceptContainerMapName", referencedColumnName = "name"),
@JoinColumn(name = "concpetContainerMapVersion", referencedColumnName = "version")
},
inverseJoinColumns = {
@JoinColumn(name = "conceptContainerName", referencedColumnName = "name"),
@JoinColumn(name = "conceptContainerVersion", referencedColumnName = "version")
}
)
// @formatter:on
private Map