View Javadoc

1   /**
2    * Copyright 2010-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.util.execute;
17  
18  import java.util.List;
19  
20  import org.kuali.common.util.CollectionUtils;
21  import org.slf4j.Logger;
22  import org.slf4j.LoggerFactory;
23  
24  /**
25   * Execute the list of <code>executables</code> supplied to this bean
26   */
27  public class ExecutablesExecutable implements Executable {
28  
29  	private static final Logger logger = LoggerFactory.getLogger(ExecutablesExecutable.class);
30  
31  	List<Executable> executables;
32  	boolean skip;
33  
34  	@Override
35  	public void execute() {
36  		if (skip) {
37  			logger.info("Skipping execution of {} executables", CollectionUtils.toEmptyList(executables).size());
38  			return;
39  		}
40  		for (Executable executable : executables) {
41  			executable.execute();
42  		}
43  	}
44  
45  	public List<Executable> getExecutables() {
46  		return executables;
47  	}
48  
49  	public void setExecutables(List<Executable> executables) {
50  		this.executables = executables;
51  	}
52  
53  	public boolean isSkip() {
54  		return skip;
55  	}
56  
57  	public void setSkip(boolean skip) {
58  		this.skip = skip;
59  	}
60  
61  }