/**
* {@inheritDoc}
*/
public List<FreeActElement> queryPossibleNextActsOfFreeActivity(long processDefId, String activityDefId) {
ProcessDefine processDefine = this.procDefRep.findProcessDefine(processDefId);
ActivityElement activityXml = processDefine.getProcessObject().getActivitys().get(activityDefId);
String strategy = activityXml.getFreeRangeStrategy();
//是否尽限为人工活动
boolean isOnlyLimitedManualAct = activityXml.getIsOnlyLimitedManualActivity();
List<FreeActElement> actEls = new ArrayList<FreeActElement>();
if(Constants.Free_Act_strategy_three.equalsIgnoreCase(strategy)) {
//在后继活动范围内自由
List<TransitionElement> transitions = activityXml.getAfterTrans();
for(TransitionElement tx : transitions) {
String _actDefId = tx.getTo();
ActivityElement ax = processDefine.getProcessObject().getActivitys().get(_actDefId);
if(isOnlyLimitedManualAct && !Constants.ACT_TYPE_MANUL.equals(ax.getType())) {
continue;
}
FreeActElement freeActXml = new FreeActElement();
freeActXml.setId(ax.getId());
freeActXml.setName(ax.getName());
freeActXml.setType(ax.getType());
actEls.add(freeActXml);
}
} else if(Constants.Free_Act_strategy_two.equalsIgnoreCase(strategy)) {
//在指定活动列表范围内自由
activityXml.getFreeActs();
} else if(Constants.Free_Act_strategy_One.equalsIgnoreCase(strategy)) {
//在流程范围内任意自由
Collection<ActivityElement> collect = processDefine.getProcessObject().getActivitys().values();
for(ActivityElement ax : collect) {
if(isOnlyLimitedManualAct && !Constants.ACT_TYPE_MANUL.equals(ax.getType())) {
continue;
}
FreeActElement freeActXml = new FreeActElement();
freeActXml.setId(ax.getId());
freeActXml.setName(ax.getName());
freeActXml.setType(ax.getType());
actEls.add(freeActXml);
}
}
return actEls;