01: /*
02: * Created on Jul 14, 2003
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: package org.xdev.base.xssl.bpm.compare;
08:
09: import java.util.ArrayList;
10: import java.util.HashMap;
11:
12: import org.xdev.base.xssl.*;
13:
14: /**
15: * @author AYegorov
16: *
17: * To change the template for this generated type comment go to
18: * Window>Preferences>Java>Code Generation>Code and Comments
19: */
20: public abstract class AbstractComparison extends XSSLReturn {
21: private boolean compareFlag = false;
22:
23: /**
24: * @param id
25: */
26: public AbstractComparison(String id) {
27: super (id);
28: // TODO Auto-generated constructor stub
29: }
30:
31: /**
32: * @param id
33: * @param properties
34: */
35: public AbstractComparison(String id, HashMap properties) {
36: super (id, properties);
37: // TODO Auto-generated constructor stub
38: }
39:
40: /* (non-Javadoc)
41: * @see org.xdev.base.transaction.TemplateAbstractAction#process()
42: */
43: protected void set() throws Exception {
44: XSSLReturn source = (XSSLReturn) this .getElement(0);
45: XSSLReturn target = (XSSLReturn) this .getElement(1);
46: if (source.execute(this ) && target.execute(this )) {
47: if (!(this .compareFlag = this .compare(source
48: .getObjectValue(), target.getObjectValue()))) {
49: this .setException(new ComparisonFailedException(source,
50: target, this ));
51: this .setExecutionStatus(false);
52: }
53: } else {
54: this .setException(new ComparisonFailedException(source,
55: target, this ));
56: this .setExecutionStatus(false);
57: }
58: }
59:
60: public Object getObjectValue() {
61: return new Boolean(this .compareFlag);
62: }
63:
64: abstract protected boolean compare(Object source, Object target);
65: }
|