01 /*
02 * Created on Aug 29, 2007
03 *
04 */
05 package com.x8ing.mc.bp.develop;
06
07 import java.util.List;
08
09 import com.x8ing.lsm4j.Condition;
10 import com.x8ing.lsm4j.StateContext;
11 import com.x8ing.mc.bp.BusinessContext;
12
13 /**
14 *
15 * @author Patrick Heusser
16 */
17 public class BugFixedCondition implements Condition {
18
19 private boolean inverse = false;
20
21 public BugFixedCondition(boolean inverse) {
22 this.inverse = inverse;
23 }
24
25 /**
26 * @see com.x8ing.lsm4j.Condition#traceInfo()
27 */
28 public String traceInfo() {
29
30 return "";
31 }
32
33 /**
34 * @see com.x8ing.lsm4j.Condition#conditionTrue(com.x8ing.lsm4j.StateContext)
35 */
36 public boolean conditionTrue(StateContext currentContext) {
37
38 BusinessContext businessContext = (BusinessContext) currentContext;
39
40 List allBugs = businessContext.getBugs().getBugsWithState(FixAllKnownBugsAction.STATES_TO_FIX);
41
42 boolean fixedWithSuccess = allBugs.isEmpty();
43
44 return inverse ? !fixedWithSuccess : fixedWithSuccess;
45
46 }
47
48 }
|