1 13 package info.magnolia.module.admininterface.commands; 14 15 import info.magnolia.cms.core.ItemType; 16 import info.magnolia.cms.util.Rule; 17 import org.apache.commons.lang.StringUtils; 18 19 23 public abstract class RuleBasedCommand extends BaseRepositoryCommand { 24 25 28 public static final String ATTRIBUTE_RULE = "rule"; 29 30 33 private String itemTypes = ItemType.CONTENTNODE.getSystemName(); 34 35 private Rule rule; 36 37 protected Rule getRule() { 38 if (rule == null && isClone()) { 40 rule = new Rule(); 41 String [] nodeTypes = StringUtils.split(this.getItemTypes(), " ,"); 42 for (int i = 0; i < nodeTypes.length; i++) { 43 String nodeType = nodeTypes[i]; 44 rule.addAllowType(nodeType); 45 } 46 47 rule.addAllowType(ItemType.NT_METADATA); 49 rule.addAllowType(ItemType.NT_RESOURCE); 50 } 51 return rule; 52 } 53 54 public String getItemTypes() { 55 return itemTypes; 56 } 57 58 public void setItemTypes(String nodeTypes) { 59 this.itemTypes = nodeTypes; 60 } 61 62 65 public void setRule(Rule rule) { 66 this.rule = rule; 67 } 68 69 } 70 | Popular Tags |