| 1 | |
package org.kuali.rice.krms.impl.repository |
| 2 | |
|
| 3 | |
import org.kuali.rice.kns.bo.PersistableBusinessObjectBase |
| 4 | |
|
| 5 | |
import org.kuali.rice.krms.api.repository.Rule |
| 6 | |
import org.kuali.rice.krms.api.repository.RuleContract |
| 7 | |
import org.kuali.rice.krms.api.repository.RuleAttribute |
| 8 | |
|
| 9 | |
|
| 10 | |
public class RuleBo extends PersistableBusinessObjectBase implements RuleContract { |
| 11 | |
|
| 12 | |
def String ruleId |
| 13 | |
def String namespace |
| 14 | |
def String name |
| 15 | |
def String typeId |
| 16 | |
def String propId |
| 17 | |
def String actionId |
| 18 | |
|
| 19 | |
def PropositionBo proposition; |
| 20 | |
def List<RuleAttributeBo> attributes |
| 21 | |
def ActionBo action |
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
|
| 28 | |
|
| 29 | |
static Rule to(RuleBo bo) { |
| 30 | 0 | if (bo == null) { return null } |
| 31 | 0 | return org.kuali.rice.krms.api.repository.Rule.Builder.create(bo).build() |
| 32 | |
} |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
static RuleBo from(Rule im) { |
| 40 | 0 | if (im == null) { return null } |
| 41 | |
|
| 42 | 0 | RuleBo bo = new RuleBo() |
| 43 | 0 | bo.ruleId = im.ruleId |
| 44 | 0 | bo.namespace = im.namespace |
| 45 | 0 | bo.name = im.name |
| 46 | 0 | bo.typeId = im.typeId |
| 47 | 0 | bo.actionId = im.actionId |
| 48 | 0 | bo.propId = im.propId |
| 49 | 0 | bo.attributes = new ArrayList<RuleAttributeBo>() |
| 50 | 0 | for (attr in im.attributes){ |
| 51 | 0 | bo.attributes.add ( RuleAttributeBo.from(attr) ) |
| 52 | |
} |
| 53 | |
bo. |
| 54 | 0 | bo.action = ActionBo.from(im.action) |
| 55 | 0 | return bo |
| 56 | |
} |
| 57 | |
|
| 58 | |
public PropositionBo getProposition(){ |
| 59 | 0 | return proposition |
| 60 | |
} |
| 61 | |
|
| 62 | |
public ActionBo getAction(){ |
| 63 | 0 | return action |
| 64 | |
} |
| 65 | |
} |