private void exportRuleTemplate(Element parent, RuleTemplateBo ruleTemplate) { Element templateElement = renderer.renderElement(parent, RULE_TEMPLATE); renderer.renderTextElement(templateElement, NAME, ruleTemplate.getName()); renderer.renderTextElement(templateElement, DESCRIPTION, ruleTemplate.getDescription()); if (ruleTemplate.getDelegationTemplate() != null) { renderer.renderTextElement( templateElement, DELEGATION_TEMPLATE, ruleTemplate.getDelegationTemplate().getName()); } exportAttributes(templateElement, ruleTemplate.getActiveRuleTemplateAttributes()); exportDefaults(templateElement, ruleTemplate); }
private void assertRuleTemplateExport( RuleTemplateBo oldRuleTemplate, RuleTemplateBo newRuleTemplate) { assertFalse( "Ids should be different.", oldRuleTemplate.getId().equals(newRuleTemplate.getId())); assertEquals(oldRuleTemplate.getDescription(), newRuleTemplate.getDescription()); assertEquals(oldRuleTemplate.getName(), newRuleTemplate.getName()); if (oldRuleTemplate.getDelegationTemplate() != null) { assertRuleTemplateExport( oldRuleTemplate.getDelegationTemplate(), newRuleTemplate.getDelegationTemplate()); } else { assertNull(newRuleTemplate.getDelegationTemplate()); } assertAttributes( oldRuleTemplate.getRuleTemplateAttributes(), newRuleTemplate.getRuleTemplateAttributes(), "attribute"); assertAttributes( oldRuleTemplate.getActiveRuleTemplateAttributes(), newRuleTemplate.getActiveRuleTemplateAttributes(), "active attribute"); assertOptions( oldRuleTemplate.getRuleTemplateOptions(), newRuleTemplate.getRuleTemplateOptions()); }
protected boolean validateCreateDelegateRule(DelegateRuleForm form) { if (form.getParentRule() == null) { GlobalVariables.getMessageMap().putError(PARENT_RULE_PROPERTY, PARENT_RULE_ERROR); } else { RuleTemplateBo ruleTemplate = form.getParentRule().getRuleTemplate(); if (ruleTemplate == null || ruleTemplate.getDelegationTemplate() == null) { GlobalVariables.getMessageMap().putError(PARENT_RULE_PROPERTY, DELEGATE_RULE_INVALID_ERROR); } } if (form.getParentResponsibility() == null) { GlobalVariables.getMessageMap() .putError(PARENT_RESPONSIBILITY_PROPERTY, PARENT_RESPONSIBILITY_ERROR); } return GlobalVariables.getMessageMap().hasNoErrors(); }