2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.be.components.upgrade;
23 import org.openecomp.sdc.be.dao.api.ActionStatus;
24 import org.openecomp.sdc.be.model.Component;
25 import org.openecomp.sdc.exception.ResponseFormat;
27 import java.util.ArrayList;
28 import java.util.List;
30 public class UpgradeStatus {
35 List<ServiceInfo> componentToUpgradeStatus;
37 public ActionStatus getStatus() {
41 public void setStatus(ActionStatus status) {
45 public List<ServiceInfo> getComponentToUpgradeStatus() {
46 return componentToUpgradeStatus;
49 public void setComponentToUpgradeStatus(List<ServiceInfo> componentToUpgradeStatus) {
50 this.componentToUpgradeStatus = componentToUpgradeStatus;
53 public void addServiceStatus(ServiceInfo info) {
55 componentToUpgradeStatus.add(info);
57 public void addServiceStatus(String serviceId, ActionStatus status) {
59 ServiceInfo info = new ServiceInfo(serviceId, status );
60 componentToUpgradeStatus.add(info);
62 public void addServiceStatus(Component component, ActionStatus status) {
64 ServiceInfo info = new ServiceInfo(component.getUniqueId(), status );
65 info.setName(component.getName());
66 info.setVersion(component.getVersion());
67 componentToUpgradeStatus.add(info);
70 private void checkAndCreate() {
71 if (componentToUpgradeStatus == null) {
72 componentToUpgradeStatus = new ArrayList<>();
76 public ResponseFormat getError() {
80 public void setError(ResponseFormat error) {