2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.vnfmadapter.jobmanagement;
24 * Represents an operation on a VNFM.
26 public class VnfmOperation {
28 private final String vnfmId;
29 private final String operationId;
30 private NotificationStatus notificationStatus;
32 public VnfmOperation(final String vnfmId, final String operationId, final boolean waitForNotificationForSuccess) {
34 this.operationId = operationId;
35 this.notificationStatus = waitForNotificationForSuccess ? NotificationStatus.NOTIFICATION_PROCESSING_PENDING
36 : NotificationStatus.NOTIFICATION_PROCESSING_NOT_REQUIRED;
40 * Get the ID of the operation on the VNFM.
42 * @return the ID of the operation on the VNFM
44 public String getOperationId() {
49 * Get the ID of the VNFM the operation is carried out by.
51 * @return the ID of the VNFM
53 public String getVnfmId() {
58 * Set the required notification has been processed for the operation.
60 * @param notificationProcessingWasSuccessful <code>true</code> if the notification processing was successful,
61 * <code>false<code> otherwise
63 public void setNotificationProcessed(final boolean notificationProcessingWasSuccessful) {
64 this.notificationStatus =
65 notificationProcessingWasSuccessful ? NotificationStatus.NOTIFICATION_PROCEESING_SUCCESSFUL
66 : NotificationStatus.NOTIFICATION_PROCESSING_FAILED;
70 * Get the notification status for the operation.
72 * @return the notification status
74 public NotificationStatus getNotificationStatus() {
75 return notificationStatus;
78 public enum NotificationStatus {
80 * No notification handling is required to determine the status of the operation
82 NOTIFICATION_PROCESSING_NOT_REQUIRED,
84 * A notification must be processed before the notification can be considered to be completed
86 NOTIFICATION_PROCESSING_PENDING,
88 * A notification has been successfully handled for the operation
90 NOTIFICATION_PROCEESING_SUCCESSFUL,
92 * An error occurred processing a notification for the operation
94 NOTIFICATION_PROCESSING_FAILED;
98 public String toString() {
99 return "VnfmOperation [vnfmId=" + vnfmId + ", operationId=" + operationId + ", notificationStatus="
100 + notificationStatus + "]";