From 2152a9a43767cdd486fd8c93894f66a05083f53c Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Wed, 5 May 2021 15:31:04 +0100 Subject: Support for selection of capabilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib1a3e3e1a59fc84c62620932c408e231acf77024 Issue-ID: SDC-3580 Signed-off-by: André Schmid --- .../elements/CapabilityDataDefinition.java | 21 ++++++++----- .../sdc/be/exception/BusinessException.java | 34 ++++++++++++++++++++++ 2 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 common-be/src/main/java/org/openecomp/sdc/be/exception/BusinessException.java (limited to 'common-be/src/main') diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java index 78bfe50d5c..3345c95946 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/CapabilityDataDefinition.java @@ -21,6 +21,8 @@ package org.openecomp.sdc.be.datatypes.elements; import com.google.common.collect.Lists; +import lombok.Getter; +import lombok.Setter; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; @@ -35,6 +37,10 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { public static final String MIN_OCCURRENCES = "0"; public static final String MAX_OCCURRENCES = "UNBOUNDED"; + @Getter + @Setter + private boolean external = false; + /** * The default constructor initializing limits of the occurrences */ @@ -45,11 +51,11 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { } /** - * Deep copy constructor + * Deep copy constructor. * - * @param other + * @param other the capability data definition to copy */ - public CapabilityDataDefinition(CapabilityDataDefinition other) { + public CapabilityDataDefinition(final CapabilityDataDefinition other) { this.setUniqueId(other.getUniqueId()); this.setType(other.getType()); this.setDescription(other.getDescription()); @@ -84,6 +90,7 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { this.setSource(other.getSource()); this.setOwnerType(other.getOwnerType()); + this.setExternal(other.isExternal()); } public CapabilityDataDefinition(CapabilityTypeDataDefinition other) { @@ -422,11 +429,11 @@ public class CapabilityDataDefinition extends ToscaDataDefinition { String maxOccurrences = this.getMaxOccurrences(); String source = this.getSource(); - return "CapabilityDefinition [uniqueId=" + uniqueId + ", description=" + description + ", name=" + name - + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", capabilitySources=" - + capabilitySources + ", ownerId=" + ownerId + ", ownerName=" + ownerName - + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path + ", source=" + source + "]"; + + ", type=" + type + ", validSourceTypes=" + validSourceTypes + ", capabilitySources=" + + capabilitySources + ", ownerId=" + ownerId + ", ownerName=" + ownerName + + ", minOccurrences=" + minOccurrences + ", maxOccurrences=" + maxOccurrences + ", path=" + path + ", source=" + source + + ", external=" + external + "]"; } public enum OwnerType { diff --git a/common-be/src/main/java/org/openecomp/sdc/be/exception/BusinessException.java b/common-be/src/main/java/org/openecomp/sdc/be/exception/BusinessException.java new file mode 100644 index 0000000000..69fb00f3b5 --- /dev/null +++ b/common-be/src/main/java/org/openecomp/sdc/be/exception/BusinessException.java @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation + * ================================================================================ + * 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.openecomp.sdc.be.exception; + +public abstract class BusinessException extends RuntimeException { + + protected BusinessException() { + } + + protected BusinessException(final String message) { + super(message); + } + + protected BusinessException(final String message, final Throwable cause) { + super(message, cause); + } +} -- cgit 1.2.3-korg