📄 flatsequenceexpression.java
字号:
/* * Copyright (c) 2005, John Mettraux, OpenWFE.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * . Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * . Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * . Neither the name of the "OpenWFE" nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * $Id: FlatSequenceExpression.java,v 1.11 2005/05/17 16:14:47 jmettraux Exp $ *///// FlatSequenceExpression.java//// john.mettraux@openwfe.org//// generated with // jtmpl 1.1.01 2004/05/19 (john.mettraux@openwfe.org)//package openwfe.org.engine.expressions;import openwfe.org.ApplicationContext;import openwfe.org.engine.workitem.InFlowWorkItem;import openwfe.org.engine.expressions.raw.RawExpression;/** * With this sequence expression, the children are chained together : the first * child, instead of replying to the sequence, directly applies the next * child. * * <p><font size=2>CVS Info : * <br>$Author: jmettraux $ * <br>$Id: FlatSequenceExpression.java,v 1.11 2005/05/17 16:14:47 jmettraux Exp $ </font> * * @author john.mettraux@openwfe.org */public class FlatSequenceExpression extends AbstractCompositeFlowExpression{ private final static org.apache.log4j.Logger log = org.apache.log4j.Logger .getLogger(FlatSequenceExpression.class.getName()); // // CONSTANTS & co // // FIELDS // // CONSTRUCTORS // // METHODS from FlowExpression /** * Inits the expression. */ public void init (final ApplicationContext context, final FlowExpressionId parentId, final FlowExpressionId id, final RawExpression generatingExpression, final Object raw, final InFlowWorkItem currentWi) throws BuildException { super.init (context, parentId, id, generatingExpression, raw, currentWi); // // chain the children together if (generatingExpression.getProcessDefinition() != null) return; // droflo and other editors do not need to have chained // children ... //log.debug("init() chaining children..."); //log.debug("init() fetching parent : "+parentId); final FlowExpression parentExpression = getExpressionPool().fetch(parentId); FlowExpressionId previousExpressionId = null; FlowExpression currentExpression = null; final java.util.Iterator it = getChildren().iterator(); while (it.hasNext()) { FlowExpressionId childId = (FlowExpressionId)it.next(); if (currentExpression != null) { currentExpression.setNext(childId); currentExpression.storeItself(); log.debug ("init() \n"+currentExpression.getId()+ "\n --next-->\n"+currentExpression.getNext()); } currentExpression = getExpressionPool().fetch(childId); if (currentExpression != null) { currentExpression.setPrevious(previousExpressionId); previousExpressionId = currentExpression.getId(); log.debug ("init() \n"+currentExpression.getId()+ "\n --previous-->\n"+currentExpression.getPrevious()); // // the children parent is linked to the parent of the // sequence. // this is very important for setting variables... // currentExpression.setParent(parentId); currentExpression.storeItself(); if (( ! it.hasNext()) && parentExpression != null) { parentExpression.replaceChild(getId(), childId); } } } if (parentExpression != null) { parentExpression.getVariables().putAll(this.getVariables()); parentExpression.storeItself(); // once for all children //debugVariables("FlatSequence.init()"); } } public void apply (final InFlowWorkItem wi) throws ApplyException { // // apply the first child ... if (getChildren().size() < 1) return; //log.debug("apply() applying first child "+getChildren().get(0)); getExpressionPool().apply((FlowExpressionId)getChildren().get(0), wi); // // remove self from pool (it's OK, the children are linked to // this expression's parent). getExpressionPool().removeExpression(this); } public void reply (final InFlowWorkItem wi) throws ReplyException { //log.debug("reply() end of sequence."); // // the last of the chained children will reply // so there is nothing to do here, this method will never get called. //replyToParent(wi); } // // METHODS // // STATIC METHODS}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -