* ============LICENSE_START=======================================================
* ONAP Policy Model
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-
import javax.persistence.CascadeType;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
-
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
-
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.common.utils.validation.Assertions;
import org.onap.policy.common.utils.validation.ParameterValidationUtils;
import org.onap.policy.models.base.PfAuthorative;
import org.onap.policy.models.base.PfConcept;
*/
public JpaPdpGroup(@NonNull final JpaPdpGroup copyConcept) {
super(copyConcept);
+ this.key = new PfConceptKey(copyConcept.key);
+ this.description = copyConcept.description;
+ this.pdpGroupState = copyConcept.pdpGroupState;
+ this.properties = (copyConcept.properties == null ? null : new LinkedHashMap<>(copyConcept.properties));
+ this.pdpSubGroups = PfUtils.mapList(copyConcept.pdpSubGroups, JpaPdpSubGroup::new, new ArrayList<>(0));
}
/**
}
if (properties != null) {
- result = validateProperties(result);
+ validateProperties(result);
}
if (pdpSubGroups == null) {
/**
* Validate the properties.
*
- * @param resultIn the incoming validation results so far
- * @return the revalidation results including the property validation results
+ * @param result where to place any new validation results
*/
- private PfValidationResult validateProperties(PfValidationResult resultIn) {
- PfValidationResult result = resultIn;
+ private void validateProperties(PfValidationResult result) {
for (Entry<String, String> propertyEntry : properties.entrySet()) {
if (!ParameterValidationUtils.validateStringParameter(propertyEntry.getKey())) {
"a property value may not be null or blank"));
}
}
-
- return result;
}
@Override
return 0;
}
if (getClass() != otherConcept.getClass()) {
- return this.getClass().getCanonicalName().compareTo(otherConcept.getClass().getCanonicalName());
+ return this.getClass().getName().compareTo(otherConcept.getClass().getName());
}
final JpaPdpGroup other = (JpaPdpGroup) otherConcept;
return PfUtils.compareObjects(pdpSubGroups, other.pdpSubGroups);
}
-
- @Override
- public PfConcept copyTo(@NonNull final PfConcept target) {
- Assertions.instanceOf(target, JpaPdpGroup.class);
-
- final JpaPdpGroup copy = ((JpaPdpGroup) target);
- copy.setKey(new PfConceptKey(key));
-
- copy.setDescription(description);
- copy.setPdpGroupState(pdpGroupState);
- copy.setProperties(properties == null ? null : new LinkedHashMap<>(properties));
- copy.setPdpSubGroups(PfUtils.mapList(pdpSubGroups, JpaPdpSubGroup::new));
-
- return copy;
- }
}