* ONAP Policy Model
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.policy.models.tosca.simple.concepts;
import java.util.List;
-
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
-
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
-
import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.utils.validation.Assertions;
import org.onap.policy.models.base.PfConcept;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfKey;
*/
public JpaToscaEventFilter(final JpaToscaEventFilter copyConcept) {
super(copyConcept);
+ this.key = new PfReferenceKey(copyConcept.key);
+ this.node = new PfConceptKey(copyConcept.node);
+ this.requirement = copyConcept.requirement;
+ this.capability = copyConcept.capability;
}
@Override
}
final JpaToscaEventFilter other = (JpaToscaEventFilter) otherConcept;
- if (!key.equals(other.key)) {
- return key.compareTo(other.key);
+ int result = key.compareTo(other.key);
+ if (result != 0) {
+ return result;
}
- if (!node.equals(other.node)) {
- return node.compareTo(other.node);
+ result = node.compareTo(other.node);
+ if (result != 0) {
+ return result;
}
- int result = ObjectUtils.compare(requirement, other.requirement);
+ result = ObjectUtils.compare(requirement, other.requirement);
if (result != 0) {
return result;
}
return ObjectUtils.compare(capability, other.capability);
}
-
- @Override
- public PfConcept copyTo(@NonNull final PfConcept target) {
- final Object copyObject = target;
- Assertions.instanceOf(copyObject, JpaToscaEventFilter.class);
-
- final JpaToscaEventFilter copy = ((JpaToscaEventFilter) copyObject);
- copy.setKey(new PfReferenceKey(key));
- copy.setNode(new PfConceptKey(node));
- copy.setRequirement(requirement);
- copy.setCapability(capability);
-
- return copy;
- }
-}
\ No newline at end of file
+}