📄 allowstepownercondition.java
字号:
/*
* Created on 2005-8-15
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.exp.integration.osworkflow.condition;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.opensymphony.module.propertyset.PropertySet;
import com.opensymphony.workflow.Condition;
import com.opensymphony.workflow.StoreException;
import com.opensymphony.workflow.WorkflowContext;
import com.opensymphony.workflow.spi.Step;
import com.opensymphony.workflow.spi.WorkflowEntry;
import com.opensymphony.workflow.spi.WorkflowStore;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class AllowStepOwnerCondition implements Condition {
/*
* (non-Javadoc)
*
* @see com.opensymphony.workflow.Condition#passesCondition(java.util.Map,
* java.util.Map, com.opensymphony.module.propertyset.PropertySet)
*/
public boolean passesCondition(Map transientVars, Map args, PropertySet ps)
throws StoreException {
int stepId = 0;
String stepIdVal = (String) args.get("stepId");
if (stepIdVal != null) {
try {
stepId = Integer.parseInt(stepIdVal);
} catch (Exception ex) {
}
}
WorkflowContext context = (WorkflowContext) transientVars
.get("context");
WorkflowEntry entry = (WorkflowEntry) transientVars.get("entry");
WorkflowStore store = (WorkflowStore) transientVars.get("store");
List allSteps = store.findHistorySteps(entry.getId());
List curSteps = store.findCurrentSteps(entry.getId());
allSteps.addAll(curSteps);
if (stepId == 0) {
for (Iterator iterator = allSteps.iterator(); iterator.hasNext();) {
Step step = (Step) iterator.next();
if ((step.getOwner() != null)
&& context.getCaller().equals(step.getOwner())) {
return true;
}
}
} else {
for (Iterator iterator = allSteps.iterator(); iterator.hasNext();) {
Step step = (Step) iterator.next();
if (stepId == step.getStepId()) {
if ((step.getOwner() != null)
&& context.getCaller().equals(step.getOwner())) {
return true;
}
}
}
}
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -