Modified scm section.
[unimgr.git] / impl / src / main / java / org / opendaylight / unimgr / command / TransactionInvoker.java
1 /*
2  * Copyright (c) 2015 CableLabs and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.unimgr.command;
9
10 import java.util.List;
11
12 public class TransactionInvoker {
13
14     private Command command;
15     private List<Command> commands;
16
17     public void setCommand(Command command) {
18         this.command = command;
19     }
20
21     public void setCommands(List<Command> commands) {
22         this.commands = commands;
23     }
24
25     public void invoke() {
26         if (command != null) {
27             command.execute();
28         }
29         if (!commands.isEmpty()) {
30             for (Command invokableCommand: commands) {
31                 invokableCommand.execute();
32             }
33         }
34     }
35
36 }