Search in sources :

Example 6 with RuleRef

use of org.alfresco.repo.web.scripts.rule.ruleset.RuleRef in project alfresco-remote-api by Alfresco.

the class RulesGet method executeImpl.

@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) {
    Map<String, Object> model = new HashMap<String, Object>();
    // get request parameters
    NodeRef nodeRef = parseRequestForNodeRef(req);
    String ruleType = req.getParameter("ruleType");
    RuleType type = ruleService.getRuleType(ruleType);
    if (type == null) {
        ruleType = null;
    }
    // get all rules (excluding inherited) filtered by rule type
    List<Rule> rules = ruleService.getRules(nodeRef, false, ruleType);
    List<RuleRef> ruleRefs = new ArrayList<RuleRef>();
    for (Rule rule : rules) {
        ruleRefs.add(new RuleRef(rule, fileFolderService.getFileInfo(ruleService.getOwningNodeRef(rule))));
    }
    model.put("ruleRefs", ruleRefs);
    return model;
}
Also used : RuleRef(org.alfresco.repo.web.scripts.rule.ruleset.RuleRef) NodeRef(org.alfresco.service.cmr.repository.NodeRef) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) RuleType(org.alfresco.service.cmr.rule.RuleType) Rule(org.alfresco.service.cmr.rule.Rule)

Aggregations

HashMap (java.util.HashMap)6 RuleRef (org.alfresco.repo.web.scripts.rule.ruleset.RuleRef)6 NodeRef (org.alfresco.service.cmr.repository.NodeRef)6 Rule (org.alfresco.service.cmr.rule.Rule)6 ArrayList (java.util.ArrayList)3 RuleType (org.alfresco.service.cmr.rule.RuleType)3 WebScriptException (org.springframework.extensions.webscripts.WebScriptException)3 IOException (java.io.IOException)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 JSONTokener (org.json.JSONTokener)2 RuleSet (org.alfresco.repo.web.scripts.rule.ruleset.RuleSet)1