001 /**
002 * Copyright 2005-2012 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.krms.framework.engine;
017
018 import java.util.Arrays;
019 import java.util.List;
020
021 import org.kuali.rice.krms.api.engine.ExecutionEnvironment;
022
023 /**
024 * An implementation of {@link AgendaTree} that executes a {@link ExecutionEnvironment} over its list of {@link AgendaTreeEntry}s.
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028 public final class BasicAgendaTree implements AgendaTree {
029
030 private final List<AgendaTreeEntry> entries;
031
032 /**
033 * Create a BasicAgendaTree with the given {@link AgendaTreeEntry}s
034 * @param entries - {@link AgendaTreeEntry}s to create a BasicAgendaTree with
035 */
036 public BasicAgendaTree(AgendaTreeEntry... entries) {
037 this.entries = Arrays.asList(entries);
038 }
039
040 /**
041 * Create a BasicAgendaTree with the given {@link AgendaTreeEntry}s
042 * @param entries - {@link AgendaTreeEntry}s to create a BasicAgendaTree with
043 * @throws IllegalArgumentException if the entries list is null
044 */
045 public BasicAgendaTree(List<AgendaTreeEntry> entries) {
046 if (entries == null) {
047 throw new IllegalArgumentException("entries list was null");
048 }
049 this.entries = entries;
050 }
051
052 @Override
053 public void execute(ExecutionEnvironment environment) {
054 for (AgendaTreeEntry entry : entries) {
055 entry.execute(environment);
056 }
057 }
058
059 }