2 * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.nemo.user.vnspacemanager.structurestyle.deleteintent;
\r
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
\r
11 import org.opendaylight.nemo.user.tenantmanager.TenantManage;
\r
12 import org.opendaylight.nemo.user.vnspacemanager.languagestyle.NEMOConstants;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.FlowId;
\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.UserId;
\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.user.intent.operations.Operation;
\r
18 * Created by z00293636 on 2015/9/2.
\r
20 public class DeleteFlow {
\r
21 private TenantManage tenantManage;
\r
23 public DeleteFlow(DataBroker dataBroker, TenantManage tenantManage){
\r
24 this.tenantManage = tenantManage;
\r
27 public String DeleteFlowHandling(UserId userId, FlowId flowId){
\r
28 Boolean flowExist = false;
\r
30 if (tenantManage.getFlow(userId)!=null){
\r
31 if (tenantManage.getFlow(userId).containsKey(flowId)){
\r
33 tenantManage.getFlow(userId).remove(flowId);
\r
34 tenantManage.getUserNameIdMap(userId).remove(tenantManage.getName(userId,flowId.getValue()));
\r
37 if (tenantManage.getFlowDataStore(userId)!=null){
\r
38 if (tenantManage.getFlowDataStore(userId).containsKey(flowId)){
\r
40 tenantManage.setUserDeleteIntent(userId, NEMOConstants.flow, flowId.getValue());
\r
41 tenantManage.getUserNameIdMap(userId).remove(tenantManage.getName(userId,flowId.getValue()));
\r
46 return "The flow instance " +flowId.getValue()+" is not exist.";
\r
49 if (tenantManage.getOperation(userId)!=null){
\r
50 for (Operation operation : tenantManage.getOperation(userId).values()){
\r
51 if (operation.getTargetObject().getValue().equals(flowId.getValue())){
\r
52 tenantManage.getOperation(userId).remove(operation.getOperationId());
\r
53 tenantManage.getUserNameIdMap(userId).remove(tenantManage.getName(userId,operation.getOperationId().getValue()));
\r
57 if (tenantManage.getOperationDataStore(userId)!=null){
\r
58 for (Operation operation : tenantManage.getOperationDataStore(userId).values()){
\r
59 if (operation.getTargetObject().getValue().equals(flowId.getValue())){
\r
60 tenantManage.setUserDeleteIntent(userId, NEMOConstants.operation, operation.getOperationId().getValue());
\r
61 tenantManage.getUserNameIdMap(userId).remove(tenantManage.getName(userId,operation.getOperationId().getValue()));
\r