01 /*
02 * Created on Aug 29, 2007
03 *
04 */
05 package com.x8ing.mc.bp.operation;
06
07 import com.x8ing.lsm4j.Condition;
08 import com.x8ing.lsm4j.StateContext;
09 import com.x8ing.mc.bp.BusinessContext;
10
11 /**
12 * This condition depends on the state of the production system, if it's up and running or down with a heavy failure.
13 *
14 * @author Patrick Heusser
15 */
16 public class OperationRunningDependentCondition implements Condition {
17
18 private boolean inverse = false;
19
20 public OperationRunningDependentCondition(boolean trueIfSystemRunning) {
21 this.inverse = !trueIfSystemRunning;
22 }
23
24 /**
25 * @see com.x8ing.lsm4j.Condition#traceInfo()
26 */
27 public String traceInfo() {
28
29 return "";
30 }
31
32 /**
33 * @see com.x8ing.lsm4j.Condition#conditionTrue(com.x8ing.lsm4j.StateContext)
34 */
35 public boolean conditionTrue(StateContext currentContext) {
36
37 BusinessContext businessContext = (BusinessContext) currentContext;
38
39 boolean ret = businessContext.isProductionSystemRunning();
40
41 return inverse ? !ret : ret;
42
43 }
44
45 }
|