mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
. First pass of a new style for the header area in the web-client UI
- Reclaims a large ammount of unused vertical space at the top of the application git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2474 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2005 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.rule;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
|
||||||
import org.alfresco.service.cmr.rule.Rule;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rule cache interface
|
|
||||||
*
|
|
||||||
* @author Roy Wetherall
|
|
||||||
*/
|
|
||||||
public interface RuleCache
|
|
||||||
{
|
|
||||||
List<Rule> getRules(NodeRef nodeRef);
|
|
||||||
|
|
||||||
List<Rule> getInheritedRules(NodeRef nodeRef);
|
|
||||||
|
|
||||||
void setRules(NodeRef nodeRef, List<Rule> rules);
|
|
||||||
|
|
||||||
void setInheritedRules(NodeRef nodeRef, List<Rule> rules);
|
|
||||||
|
|
||||||
void dirtyRules(NodeRef nodeRef);
|
|
||||||
}
|
|
@@ -103,11 +103,6 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
|
|||||||
* The action service implementation which we need for some things.
|
* The action service implementation which we need for some things.
|
||||||
*/
|
*/
|
||||||
RuntimeActionService runtimeActionService;
|
RuntimeActionService runtimeActionService;
|
||||||
|
|
||||||
/**
|
|
||||||
* The rule cahce (set by default to an inactive rule cache)
|
|
||||||
*/
|
|
||||||
private RuleCache ruleCache = new InactiveRuleCache();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of disabled node refs. The rules associated with these nodes will node be added to the pending list, and
|
* List of disabled node refs. The rules associated with these nodes will node be added to the pending list, and
|
||||||
@@ -181,16 +176,6 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
|
|||||||
this.searchService = searchService;
|
this.searchService = searchService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the rule cache
|
|
||||||
*
|
|
||||||
* @param ruleCache the rule cache
|
|
||||||
*/
|
|
||||||
public void setRuleCache(RuleCache ruleCache)
|
|
||||||
{
|
|
||||||
this.ruleCache = ruleCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the dictionary service
|
* Set the dictionary service
|
||||||
*
|
*
|
||||||
@@ -314,64 +299,83 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
|
|||||||
*/
|
*/
|
||||||
public List<Rule> getRules(NodeRef nodeRef, boolean includeInherited, String ruleTypeName)
|
public List<Rule> getRules(NodeRef nodeRef, boolean includeInherited, String ruleTypeName)
|
||||||
{
|
{
|
||||||
List<Rule> rules = new ArrayList<Rule>();
|
List<Rule> rules = new ArrayList<Rule>();
|
||||||
|
|
||||||
if (this.runtimeNodeService.exists(nodeRef) == true && checkNodeType(nodeRef) == true)
|
if (this.runtimeNodeService.exists(nodeRef) == true && checkNodeType(nodeRef) == true)
|
||||||
{
|
{
|
||||||
if (includeInherited == true)
|
if (includeInherited == true)
|
||||||
{
|
{
|
||||||
// Get any inherited rules
|
// Get any inherited rules
|
||||||
for (Rule rule : getInheritedRules(nodeRef, ruleTypeName, null))
|
for (Rule rule : getInheritedRules(nodeRef, ruleTypeName, null))
|
||||||
{
|
{
|
||||||
// Ensure rules are not duplicated in the list
|
// Ensure rules are not duplicated in the list
|
||||||
if (rules.contains(rule) == false)
|
if (rules.contains(rule) == false)
|
||||||
{
|
{
|
||||||
rules.add(rule);
|
rules.add(rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.runtimeNodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true)
|
if (this.runtimeNodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true)
|
||||||
{
|
{
|
||||||
NodeRef ruleFolder = getSavedRuleFolderRef(nodeRef);
|
NodeRef ruleFolder = getSavedRuleFolderRef(nodeRef);
|
||||||
if (ruleFolder != null)
|
if (ruleFolder != null)
|
||||||
{
|
{
|
||||||
List<Rule> allRules = this.ruleCache.getRules(nodeRef);
|
List<Rule> allRules = new ArrayList<Rule>();
|
||||||
if (allRules == null)
|
|
||||||
{
|
// Get the rules for this node
|
||||||
allRules = new ArrayList<Rule>();
|
List<ChildAssociationRef> ruleChildAssocRefs =
|
||||||
|
this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES);
|
||||||
// Get the rules for this node
|
for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs)
|
||||||
List<ChildAssociationRef> ruleChildAssocRefs =
|
{
|
||||||
this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES);
|
// Create the rule and add to the list
|
||||||
for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs)
|
NodeRef ruleNodeRef = ruleChildAssocRef.getChildRef();
|
||||||
{
|
Rule rule = createRule(nodeRef, ruleNodeRef);
|
||||||
// Create the rule and add to the list
|
allRules.add(rule);
|
||||||
NodeRef ruleNodeRef = ruleChildAssocRef.getChildRef();
|
}
|
||||||
Rule rule = createRule(nodeRef, ruleNodeRef);
|
|
||||||
allRules.add(rule);
|
// Build the list of rules that is returned to the client
|
||||||
}
|
for (Rule rule : allRules)
|
||||||
|
{
|
||||||
// Add the list to the cache
|
if ((rules.contains(rule) == false) &&
|
||||||
this.ruleCache.setRules(nodeRef, allRules);
|
(ruleTypeName == null || ruleTypeName.equals(rule.getRuleTypeName()) == true))
|
||||||
}
|
{
|
||||||
|
rules.add(rule);
|
||||||
// Build the list of rules that is returned to the client
|
}
|
||||||
for (Rule rule : allRules)
|
}
|
||||||
{
|
|
||||||
if ((rules.contains(rule) == false) &&
|
|
||||||
(ruleTypeName == null || ruleTypeName.equals(rule.getRuleTypeName()) == true))
|
|
||||||
{
|
|
||||||
rules.add(rule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return rules;
|
return rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.service.cmr.rule.RuleService#countRules(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
|
*/
|
||||||
|
public int countRules(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
int ruleCount = 0;
|
||||||
|
|
||||||
|
if (this.runtimeNodeService.exists(nodeRef) == true && checkNodeType(nodeRef) == true)
|
||||||
|
{
|
||||||
|
if (this.runtimeNodeService.hasAspect(nodeRef, RuleModel.ASPECT_RULES) == true)
|
||||||
|
{
|
||||||
|
NodeRef ruleFolder = getSavedRuleFolderRef(nodeRef);
|
||||||
|
if (ruleFolder != null)
|
||||||
|
{
|
||||||
|
// Get the rules for this node
|
||||||
|
List<ChildAssociationRef> ruleChildAssocRefs =
|
||||||
|
this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES);
|
||||||
|
|
||||||
|
ruleCount = ruleChildAssocRefs.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ruleCount;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks at the type of the node and indicates whether the node can have rules associated with it
|
* Looks at the type of the node and indicates whether the node can have rules associated with it
|
||||||
*
|
*
|
||||||
@@ -421,35 +425,28 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
|
|||||||
{
|
{
|
||||||
visitedNodeRefs.add(nodeRef);
|
visitedNodeRefs.add(nodeRef);
|
||||||
|
|
||||||
List<Rule> allInheritedRules = this.ruleCache.getInheritedRules(nodeRef);
|
List<Rule> allInheritedRules = new ArrayList<Rule>();
|
||||||
if (allInheritedRules == null)
|
List<ChildAssociationRef> parents = this.runtimeNodeService.getParentAssocs(nodeRef);
|
||||||
|
for (ChildAssociationRef parent : parents)
|
||||||
{
|
{
|
||||||
allInheritedRules = new ArrayList<Rule>();
|
List<Rule> rules = getRules(parent.getParentRef(), false);
|
||||||
List<ChildAssociationRef> parents = this.runtimeNodeService.getParentAssocs(nodeRef);
|
for (Rule rule : rules)
|
||||||
for (ChildAssociationRef parent : parents)
|
|
||||||
{
|
{
|
||||||
List<Rule> rules = getRules(parent.getParentRef(), false);
|
// Add is we hanvn't already added and it should be applied to the children
|
||||||
for (Rule rule : rules)
|
if (rule.isAppliedToChildren() == true && allInheritedRules.contains(rule) == false)
|
||||||
{
|
{
|
||||||
// Add is we hanvn't already added and it should be applied to the children
|
allInheritedRules.add(rule);
|
||||||
if (rule.isAppliedToChildren() == true && allInheritedRules.contains(rule) == false)
|
|
||||||
{
|
|
||||||
allInheritedRules.add(rule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Rule rule : getInheritedRules(parent.getParentRef(), ruleTypeName, visitedNodeRefs))
|
|
||||||
{
|
|
||||||
// Ensure that we don't get any rule duplication (don't use a set cos we want to preserve order)
|
|
||||||
if (allInheritedRules.contains(rule) == false)
|
|
||||||
{
|
|
||||||
allInheritedRules.add(rule);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the list of inherited rules to the cache
|
for (Rule rule : getInheritedRules(parent.getParentRef(), ruleTypeName, visitedNodeRefs))
|
||||||
this.ruleCache.setInheritedRules(nodeRef, allInheritedRules);
|
{
|
||||||
|
// Ensure that we don't get any rule duplication (don't use a set cos we want to preserve order)
|
||||||
|
if (allInheritedRules.contains(rule) == false)
|
||||||
|
{
|
||||||
|
allInheritedRules.add(rule);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ruleTypeName == null)
|
if (ruleTypeName == null)
|
||||||
@@ -902,55 +899,5 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inactive rule cache
|
|
||||||
*
|
|
||||||
* @author Roy Wetherall
|
|
||||||
*/
|
|
||||||
private class InactiveRuleCache implements RuleCache
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.rule.RuleCache#getRules(org.alfresco.service.cmr.repository.NodeRef)
|
|
||||||
*/
|
|
||||||
public List<Rule> getRules(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.rule.RuleCache#setRules(org.alfresco.service.cmr.repository.NodeRef, List<Rule>)
|
|
||||||
*/
|
|
||||||
public void setRules(NodeRef nodeRef, List<Rule> rules)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.rule.RuleCache#dirtyRules(org.alfresco.service.cmr.repository.NodeRef)
|
|
||||||
*/
|
|
||||||
public void dirtyRules(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.rule.RuleCache#getInheritedRules(org.alfresco.service.cmr.repository.NodeRef)
|
|
||||||
*/
|
|
||||||
public List<Rule> getInheritedRules(NodeRef nodeRef)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.rule.RuleCache#setInheritedRules(org.alfresco.service.cmr.repository.NodeRef, List<Rule>)
|
|
||||||
*/
|
|
||||||
public void setInheritedRules(NodeRef nodeRef, List<Rule> rules)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -117,7 +117,7 @@ public interface RuleService
|
|||||||
public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertied);
|
public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertied);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the rules associatied with an actionable node that are of a specific rule type.
|
* Get the rules associated with an actionable node that are of a specific rule type.
|
||||||
*
|
*
|
||||||
* @param nodeRef the node reference
|
* @param nodeRef the node reference
|
||||||
* @param includeInhertiedRuleType indicates whether the inherited rules should be included in
|
* @param includeInhertiedRuleType indicates whether the inherited rules should be included in
|
||||||
@@ -128,6 +128,14 @@ public interface RuleService
|
|||||||
*/
|
*/
|
||||||
public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertiedRuleType, String ruleTypeName);
|
public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertiedRuleType, String ruleTypeName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count the number of rules associated with an actionable node.
|
||||||
|
*
|
||||||
|
* @param nodeRef the node reference
|
||||||
|
* @return a list of the rules associated with the node
|
||||||
|
*/
|
||||||
|
public int countRules(NodeRef nodeRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the rule given its id.
|
* Get the rule given its id.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user