01: /**
02: * Objective Database Abstraction Layer (ODAL)
03: * Copyright (c) 2004, The ODAL Development Group
04: * All rights reserved.
05: * For definition of the ODAL Development Group please refer to LICENCE.txt file
06: *
07: * Distributable under LGPL license.
08: * See terms of license at gnu.org.
09: */package com.completex.objective.components.persistency.rule.impl;
10:
11: import com.completex.objective.components.persistency.PersistentObject;
12: import com.completex.objective.components.persistency.Rule;
13:
14: import java.util.ArrayList;
15: import java.util.List;
16:
17: /**
18: * @author Gennady Krizhevsky
19: */
20: public class AbstractRowRuleEngine implements Rule {
21:
22: private ArrayList rules = new ArrayList();
23:
24: protected void addRule(Rule rule) {
25: rules.add(rule);
26: }
27:
28: protected List getRules() {
29: return rules;
30: }
31:
32: public Object executeRule(PersistentObject persistentObject)
33: throws Exception {
34: for (int i = 0; i < getRules().size(); i++) {
35: ((Rule) getRules().get(i)).executeRule(persistentObject);
36: }
37: return persistentObject;
38: }
39:
40: }
|