mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merge DEV/BELARUS/HEAD-2010_02_22 to HEAD
18814 : Implementation of sub-tasks SAIL-326, SAIL-327 and SAIL-329 is complete. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18831 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
<webscript>
|
||||
<shortname>Get Inherited Rules Collection</shortname>
|
||||
<description>Gets a list of all inherited rules for a given node. The node can be specified either using a node reference or a query path.</description>
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/ruleset/inheritedrules?ruleType={rule_type?}</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
<transaction allow="readonly">required</transaction>
|
||||
</webscript>
|
@@ -0,0 +1,10 @@
|
||||
<#import "rule.lib.ftl" as ruleLib/>
|
||||
{
|
||||
"data" :
|
||||
[
|
||||
<#list inheritedRuleRefs as inheritedRuleRef>
|
||||
<@ruleLib.ruleRefOwningSummaryJSON ruleRef=inheritedRuleRef />
|
||||
<#if inheritedRuleRef_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
||||
}
|
@@ -1,3 +1,3 @@
|
||||
<#import "rule.lib.ftl" as ruleLib/>
|
||||
|
||||
<@ruleLib.ruleJSON rule=rule />
|
||||
<@ruleLib.ruleRefJSON ruleRef=ruleRef />
|
@@ -40,7 +40,7 @@
|
||||
<@parameterValuesJSON parameterValues=actionCondition.parameterValues />
|
||||
},
|
||||
</#if>
|
||||
"url" : "${"/api/node/" + storeType + "/" + storeId + "/" + id + "/ruleset/rules/" + rule.nodeRef.id + "/action/conditions/" + actionCondition.id}"
|
||||
"url" : "${"/api/node/" + ruleRef.owningFileInfo.nodeRef.storeRef.protocol + "/" + ruleRef.owningFileInfo.nodeRef.storeRef.identifier + "/" + ruleRef.owningFileInfo.nodeRef.id + "/ruleset/rules/" + ruleRef.rule.nodeRef.id + "/action/conditions/" + actionCondition.id}"
|
||||
}<#if (actionCondition_has_next)>,</#if>
|
||||
</#list>
|
||||
],
|
||||
@@ -48,42 +48,68 @@
|
||||
<#if action.compensatingAction??>
|
||||
"compensatingAction" : <@actionJSON action=action.compensatingAction />,
|
||||
</#if>
|
||||
"url" : "${"/api/node/" + storeType + "/" + storeId + "/" + id + "/ruleset/rules/" + rule.nodeRef.id + "/action/actions/" + action.id}"
|
||||
"url" : "${"/api/node/" + ruleRef.owningFileInfo.nodeRef.storeRef.protocol + "/" + ruleRef.owningFileInfo.nodeRef.storeRef.identifier + "/" + ruleRef.owningFileInfo.nodeRef.id + "/ruleset/rules/" + ruleRef.rule.nodeRef.id + "/action/actions/" + action.id}"
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
||||
|
||||
<#-- renders a complete rule object -->
|
||||
<#macro ruleJSON rule>
|
||||
<#macro ruleRefJSON ruleRef>
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"id" : "${rule.nodeRef.id}",
|
||||
"title" : "${rule.title}",
|
||||
<#if rule.description??>
|
||||
"description" : "${rule.description}",
|
||||
"id" : "${ruleRef.rule.nodeRef.id}",
|
||||
"title" : "${ruleRef.rule.title}",
|
||||
<#if ruleRef.rule.description??>
|
||||
"description" : "${ruleRef.rule.description}",
|
||||
</#if>
|
||||
"ruleType" : [<#list rule.ruleTypes as ruleType>"${ruleType}"<#if (ruleType_has_next)>, </#if></#list>],
|
||||
"applyToChildren" : ${rule.appliedToChildren?string},
|
||||
"executeAsynchronously" : ${rule.executeAsynchronously?string},
|
||||
"disabled" : ${rule.ruleDisabled?string},
|
||||
"action" : <@actionJSON action=rule.action />,
|
||||
"url" : "${"/api/node/" + storeType + "/" + storeId + "/" + id + "/ruleset/rules/" + rule.nodeRef.id}"
|
||||
"ruleType" : [<#list ruleRef.rule.ruleTypes as ruleType>"${ruleType}"<#if (ruleType_has_next)>, </#if></#list>],
|
||||
"applyToChildren" : ${ruleRef.rule.appliedToChildren?string},
|
||||
"executeAsynchronously" : ${ruleRef.rule.executeAsynchronously?string},
|
||||
"disabled" : ${ruleRef.rule.ruleDisabled?string},
|
||||
"action" : <@actionJSON action=ruleRef.rule.action />,
|
||||
"owningNode" :
|
||||
{
|
||||
"nodeRef" : "${ruleRef.owningFileInfo.nodeRef}",
|
||||
"name" : "${ruleRef.owningFileInfo.name}"
|
||||
},
|
||||
"url" : "${"/api/node/" + ruleRef.owningFileInfo.nodeRef.storeRef.protocol + "/" + ruleRef.owningFileInfo.nodeRef.storeRef.identifier + "/" + ruleRef.owningFileInfo.nodeRef.id + "/ruleset/rules/" + ruleRef.rule.nodeRef.id}"
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
||||
|
||||
<#-- renders a summary rule object -->
|
||||
<#macro rulesummaryJSON rule>
|
||||
<#-- renders a summary rule object with owning nodeRef -->
|
||||
<#macro ruleRefOwningSummaryJSON ruleRef>
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"id" : "${rule.nodeRef.id}",
|
||||
"title" : "${rule.title}",
|
||||
<#if rule.description??>
|
||||
"description" : "${rule.description}",
|
||||
"id" : "${ruleRef.rule.nodeRef.id}",
|
||||
"title" : "${ruleRef.rule.title}",
|
||||
<#if ruleRef.rule.description??>
|
||||
"description" : "${ruleRef.rule.description}",
|
||||
</#if>
|
||||
"ruleType" : [<#list rule.ruleTypes as ruleType>"${ruleType}"<#if (ruleType_has_next)>, </#if></#list>],
|
||||
"disabled" : ${rule.ruleDisabled?string},
|
||||
"url" : "${"/api/node/" + storeType + "/" + storeId + "/" + id + "/ruleset/rules/" + rule.nodeRef.id}"
|
||||
"ruleType" : [<#list ruleRef.rule.ruleTypes as ruleType>"${ruleType}"<#if (ruleType_has_next)>, </#if></#list>],
|
||||
"disabled" : ${ruleRef.rule.ruleDisabled?string},
|
||||
"owningNode" :
|
||||
{
|
||||
"nodeRef" : "${ruleRef.owningFileInfo.nodeRef}",
|
||||
"name" : "${ruleRef.owningFileInfo.name}"
|
||||
},
|
||||
"url" : "${"/api/node/" + ruleRef.owningFileInfo.nodeRef.storeRef.protocol + "/" + ruleRef.owningFileInfo.nodeRef.storeRef.identifier + "/" + ruleRef.owningFileInfo.nodeRef.id + "/ruleset/rules/" + ruleRef.rule.nodeRef.id}"
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
||||
|
||||
<#-- renders a summary rule object without owning nodeRef -->
|
||||
<#macro ruleRefSummaryJSON ruleRef>
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"id" : "${ruleRef.rule.nodeRef.id}",
|
||||
"title" : "${ruleRef.rule.title}",
|
||||
<#if ruleRef.rule.description??>
|
||||
"description" : "${ruleRef.rule.description}",
|
||||
</#if>
|
||||
"ruleType" : [<#list ruleRef.rule.ruleTypes as ruleType>"${ruleType}"<#if (ruleType_has_next)>, </#if></#list>],
|
||||
"disabled" : ${ruleRef.rule.ruleDisabled?string},
|
||||
"url" : "${"/api/node/" + ruleRef.owningFileInfo.nodeRef.storeRef.protocol + "/" + ruleRef.owningFileInfo.nodeRef.storeRef.identifier + "/" + ruleRef.owningFileInfo.nodeRef.id + "/ruleset/rules/" + ruleRef.rule.nodeRef.id}"
|
||||
}
|
||||
</#escape>
|
||||
</#macro>
|
||||
@@ -97,8 +123,14 @@
|
||||
${val?string}
|
||||
<#elseif val?is_date == true>
|
||||
"${val?string("EEE MMM dd HH:mm:ss zzz yyyy")}"
|
||||
<#elseif val?is_sequence>
|
||||
[
|
||||
<#list val as element>
|
||||
"${jsonUtils.encodeJSONString(element?string)}"<#if (element_has_next)>,</#if>
|
||||
</#list>
|
||||
]
|
||||
<#else>
|
||||
"${jsonUtils.encodeJSONString(val?string)}"
|
||||
"${jsonUtils.encodeJSONString(shortQName(val?string))}"
|
||||
</#if>
|
||||
<#if (parameterValue_has_next)>,</#if>
|
||||
</#list>
|
||||
|
@@ -2,5 +2,5 @@
|
||||
|
||||
{
|
||||
"data" :
|
||||
<@ruleLib.rulesummaryJSON rule=rule />
|
||||
<@ruleLib.ruleRefSummaryJSON ruleRef=ruleRef />
|
||||
}
|
@@ -1,3 +1,3 @@
|
||||
<#import "rule.lib.ftl" as ruleLib/>
|
||||
|
||||
<@ruleLib.ruleJSON rule=rule />
|
||||
<@ruleLib.ruleRefJSON ruleRef=ruleRef />
|
@@ -1,6 +1,6 @@
|
||||
<webscript>
|
||||
<shortname>Get Rules Collection</shortname>
|
||||
<description>Gets a list of all the rules for a given node. The node can be specified either using a node reference or a query path.</description>
|
||||
<description>Gets a list of all owned rules for a given node. The node can be specified either using a node reference or a query path.</description>
|
||||
<url>/api/node/{store_type}/{store_id}/{id}/ruleset/rules?ruleType={rule_type?}</url>
|
||||
<format default="json">argument</format>
|
||||
<authentication>user</authentication>
|
||||
|
@@ -2,9 +2,9 @@
|
||||
{
|
||||
"data" :
|
||||
[
|
||||
<#list rules as rule>
|
||||
<@ruleLib.rulesummaryJSON rule=rule />
|
||||
<#if rule_has_next>,</#if>
|
||||
<#list ruleRefs as ruleRef>
|
||||
<@ruleLib.ruleRefOwningSummaryJSON ruleRef=ruleRef />
|
||||
<#if ruleRef_has_next>,</#if>
|
||||
</#list>
|
||||
]
|
||||
}
|
@@ -7,16 +7,8 @@
|
||||
"rules" :
|
||||
[
|
||||
<#list ruleset.rules as ruleRef>
|
||||
{
|
||||
"id" : "${ruleRef.rule.nodeRef.id}",
|
||||
"title" : "${ruleRef.rule.title}",
|
||||
<#if ruleRef.rule.description??>
|
||||
"description" : "${ruleRef.rule.description}",
|
||||
</#if>
|
||||
"ruleType" : [<#list ruleRef.rule.ruleTypes as ruleType>"${ruleType}"<#if (ruleType_has_next)>, </#if></#list>],
|
||||
"disabled" : ${ruleRef.rule.ruleDisabled?string},
|
||||
"url" : "${"/api/node/" + ruleRef.owningNodeRef.storeRef.protocol + "/" + ruleRef.owningNodeRef.storeRef.identifier + "/" + ruleRef.owningNodeRef.id + "/ruleset/rules/" + ruleRef.rule.nodeRef.id}"
|
||||
}<#if ruleRef_has_next>,</#if>
|
||||
<@ruleLib.ruleRefOwningSummaryJSON ruleRef=ruleRef />
|
||||
<#if ruleRef_has_next>,</#if>
|
||||
</#list>
|
||||
],
|
||||
</#if>
|
||||
@@ -24,27 +16,19 @@
|
||||
"inheritedRules" :
|
||||
[
|
||||
<#list ruleset.inheritedRules as inheritedRuleRef>
|
||||
{
|
||||
"id" : "${inheritedRuleRef.rule.nodeRef.id}",
|
||||
"title" : "${inheritedRuleRef.rule.title}",
|
||||
<#if inheritedRuleRef.rule.description??>
|
||||
"description" : "${inheritedRuleRef.rule.description}",
|
||||
</#if>
|
||||
"ruleType" : [<#list inheritedRuleRef.rule.ruleTypes as ruleType>"${ruleType}"<#if (ruleType_has_next)>, </#if></#list>],
|
||||
"disabled" : ${inheritedRuleRef.rule.ruleDisabled?string},
|
||||
"url" : "${"/api/node/" + inheritedRuleRef.owningNodeRef.storeRef.protocol + "/" + inheritedRuleRef.owningNodeRef.storeRef.identifier + "/" + inheritedRuleRef.owningNodeRef.id + "/ruleset/rules/" + inheritedRuleRef.rule.nodeRef.id}"
|
||||
}<#if inheritedRuleRef_has_next>,</#if>
|
||||
<@ruleLib.ruleRefOwningSummaryJSON ruleRef=inheritedRuleRef />
|
||||
<#if inheritedRuleRef_has_next>,</#if>
|
||||
</#list>
|
||||
],
|
||||
</#if>
|
||||
<#if ruleset.linkedToRuleSet??>
|
||||
"linkedToRuleSet" : "${ruleset.linkedToRuleSet}",
|
||||
"linkedToRuleSet" : "${"/api/node/" + ruleset.linkedToRuleSet.storeRef.protocol + "/" + ruleset.linkedToRuleSet.storeRef.identifier + "/" + ruleset.linkedToRuleSet.id + "/ruleset"}",
|
||||
</#if>
|
||||
<#if ruleset.linkedFromRuleSets?? && ruleset.linkedFromRuleSets?size > 0>
|
||||
"linkedFromRuleSets" :
|
||||
[
|
||||
<#list ruleset.linkedFromRuleSets as linkedFromRuleSet>
|
||||
"${linkedFromRuleSet}"<#if linkedFromRuleSet_has_next>,</#if>
|
||||
"${"/api/node/" + linkedFromRuleSet.storeRef.protocol + "/" + linkedFromRuleSet.storeRef.identifier + "/" + linkedFromRuleSet.id + "/ruleset"}"<#if linkedFromRuleSet_has_next>,</#if>
|
||||
</#list>
|
||||
],
|
||||
</#if>
|
||||
|
@@ -597,6 +597,7 @@
|
||||
<property name="ruleService" ref="RuleService"/>
|
||||
<property name="actionService" ref="ActionService"/>
|
||||
<property name="dictionaryService" ref="DictionaryService"/>
|
||||
<property name="fileFolderService" ref="FileFolderService"/>
|
||||
<property name="namespaceService" ref="NamespaceService" />
|
||||
</bean>
|
||||
|
||||
@@ -626,10 +627,14 @@
|
||||
<bean id="webscript.org.alfresco.repository.rule.rule.put" class="org.alfresco.repo.web.scripts.rule.RulePut" parent="abstractRuleWebScript">
|
||||
</bean>
|
||||
|
||||
<!-- get all rules for node web script -->
|
||||
<!-- get all owned rules for node web script -->
|
||||
<bean id="webscript.org.alfresco.repository.rule.rules.get" class="org.alfresco.repo.web.scripts.rule.RulesGet" parent="abstractRuleWebScript">
|
||||
</bean>
|
||||
|
||||
<!-- get all inherited rules for node web script -->
|
||||
<bean id="webscript.org.alfresco.repository.rule.inheritedrules.get" class="org.alfresco.repo.web.scripts.rule.InheritedRulesGet" parent="abstractRuleWebScript">
|
||||
</bean>
|
||||
|
||||
<!-- get ruleset for node web script -->
|
||||
<bean id="webscript.org.alfresco.repository.rule.ruleset.get" class="org.alfresco.repo.web.scripts.rule.RulesetGet" parent="abstractRuleWebScript">
|
||||
</bean>
|
||||
|
@@ -46,6 +46,7 @@ import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.action.ParameterDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
@@ -76,11 +77,12 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
protected RuleService ruleService;
|
||||
protected DictionaryService dictionaryService;
|
||||
protected ActionService actionService;
|
||||
protected FileFolderService fileFolderService;
|
||||
protected NamespaceService namespaceService;
|
||||
|
||||
private static final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||
|
||||
private static Map<String, QName> propertyTypes = null;
|
||||
private static Map<String, Map<String, QName>> propertyTypes = null;
|
||||
|
||||
/**
|
||||
* Sets the node service instance
|
||||
@@ -122,6 +124,16 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
this.actionService = actionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file folder service instance
|
||||
*
|
||||
* @param fileFolderService the fileFolderService to set
|
||||
*/
|
||||
public void setFileFolderService(FileFolderService fileFolderService)
|
||||
{
|
||||
this.fileFolderService = fileFolderService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set namespace service instance
|
||||
*
|
||||
@@ -154,55 +166,66 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
|
||||
if (!this.nodeService.exists(nodeRef))
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: " +
|
||||
nodeRef.toString());
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: " + nodeRef.toString());
|
||||
}
|
||||
|
||||
return nodeRef;
|
||||
}
|
||||
|
||||
protected QName getPropertyType(String propertyName)
|
||||
protected QName getPropertyType(String name, boolean isAction, String propertyName)
|
||||
{
|
||||
QName result = null;
|
||||
|
||||
if (propertyTypes == null)
|
||||
{
|
||||
// no parameter types was cached
|
||||
propertyTypes = new HashMap<String, QName>();
|
||||
propertyTypes = new HashMap<String, Map<String, QName>>();
|
||||
|
||||
// get parameters for all action definitions
|
||||
List<ActionDefinition> actionDefinitions = actionService.getActionDefinitions();
|
||||
|
||||
for (ActionDefinition actionDefinition : actionDefinitions)
|
||||
{
|
||||
List<ParameterDefinition> parameterDefinitions = actionDefinition.getParameterDefinitions();
|
||||
Map<String, QName> parameters = new HashMap<String, QName>();
|
||||
|
||||
for (ParameterDefinition parameterDefinition : parameterDefinitions)
|
||||
{
|
||||
String parameterName = parameterDefinition.getName();
|
||||
QName parameterType = parameterDefinition.getType();
|
||||
parameters.put(parameterName, parameterType);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// cache parameter
|
||||
lock.writeLock().lock();
|
||||
propertyTypes.put(parameterDefinition.getName(), parameterDefinition.getType());
|
||||
propertyTypes.put(actionDefinition.getName(), parameters);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get parameters for all action condition definitions
|
||||
List<ActionConditionDefinition> actionConditionDefinitions = actionService.getActionConditionDefinitions();
|
||||
|
||||
for (ActionConditionDefinition actionConditionDefinition : actionConditionDefinitions)
|
||||
{
|
||||
List<ParameterDefinition> parameterDefinitions = actionConditionDefinition.getParameterDefinitions();
|
||||
|
||||
Map<String, QName> parameters = new HashMap<String, QName>();
|
||||
|
||||
for (ParameterDefinition parameterDefinition : parameterDefinitions)
|
||||
{
|
||||
String parameterName = parameterDefinition.getName();
|
||||
QName parameterType = parameterDefinition.getType();
|
||||
parameters.put(parameterName, parameterType);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// cache parameter
|
||||
lock.writeLock().lock();
|
||||
propertyTypes.put(parameterDefinition.getName(), parameterDefinition.getType());
|
||||
propertyTypes.put(actionConditionDefinition.getName(), parameters);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -210,19 +233,82 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QName result = null;
|
||||
if (propertyTypes.containsKey(name))
|
||||
{
|
||||
Map<String, QName> parameters;
|
||||
try
|
||||
{
|
||||
// getting cached parameter type
|
||||
lock.readLock().lock();
|
||||
result = propertyTypes.get(propertyName);
|
||||
parameters = propertyTypes.get(name);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock.readLock().unlock();
|
||||
}
|
||||
result = parameters.get(propertyName);
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isAction)
|
||||
{
|
||||
ActionDefinition actionDefinition = actionService.getActionDefinition(name);
|
||||
List<ParameterDefinition> parameterDefinitions = actionDefinition.getParameterDefinitions();
|
||||
Map<String, QName> parameters = new HashMap<String, QName>();
|
||||
|
||||
for (ParameterDefinition parameterDefinition : parameterDefinitions)
|
||||
{
|
||||
String parameterName = parameterDefinition.getName();
|
||||
QName parameterType = parameterDefinition.getType();
|
||||
parameters.put(parameterName, parameterType);
|
||||
|
||||
if (parameterName.equals(propertyName))
|
||||
{
|
||||
result = parameterType;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// cache parameter
|
||||
lock.writeLock().lock();
|
||||
propertyTypes.put(name, parameters);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ActionConditionDefinition actionConditionDefinition = actionService.getActionConditionDefinition(name);
|
||||
List<ParameterDefinition> parameterDefinitions = actionConditionDefinition.getParameterDefinitions();
|
||||
Map<String, QName> parameters = new HashMap<String, QName>();
|
||||
|
||||
for (ParameterDefinition parameterDefinition : parameterDefinitions)
|
||||
{
|
||||
String parameterName = parameterDefinition.getName();
|
||||
QName parameterType = parameterDefinition.getType();
|
||||
parameters.put(parameterName, parameterType);
|
||||
|
||||
if (parameterName.equals(propertyName))
|
||||
{
|
||||
result = parameterType;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lock.writeLock().lock();
|
||||
propertyTypes.put(name, parameters);
|
||||
}
|
||||
finally
|
||||
{
|
||||
lock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -233,8 +319,7 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
|
||||
if (jsonRule.has("title") == false || jsonRule.getString("title").length() == 0)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Title missing when creating rule");
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Title missing when creating rule");
|
||||
}
|
||||
|
||||
result.setTitle(jsonRule.getString("title"));
|
||||
@@ -243,8 +328,7 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
|
||||
if (jsonRule.has("ruleType") == false || jsonRule.getJSONArray("ruleType").length() == 0)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Rule type missing when creating rule");
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Rule type missing when creating rule");
|
||||
}
|
||||
|
||||
JSONArray types = jsonRule.getJSONArray("ruleType");
|
||||
@@ -308,7 +392,7 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
if (jsonAction.has("parameterValues"))
|
||||
{
|
||||
JSONObject jsonParameterValues = jsonAction.getJSONObject("parameterValues");
|
||||
result.setParameterValues(parseJsonParameterValues(jsonParameterValues));
|
||||
result.setParameterValues(parseJsonParameterValues(jsonParameterValues, result.getActionDefinitionName(), true));
|
||||
}
|
||||
|
||||
if (jsonAction.has("executeAsync"))
|
||||
@@ -332,7 +416,7 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
Action innerAction = parseJsonAction(innerJsonAction);
|
||||
|
||||
// we assume that only composite-action contains actions json array, so should be no cast exception
|
||||
((CompositeActionImpl)result).addAction(innerAction);
|
||||
((CompositeActionImpl) result).addAction(innerAction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,7 +446,7 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
|
||||
protected ActionConditionImpl parseJsonActionCondition(JSONObject jsonActionCondition) throws JSONException
|
||||
{
|
||||
String id = jsonActionCondition.has("id") ? jsonActionCondition.getString("id"): GUID.generate();
|
||||
String id = jsonActionCondition.has("id") ? jsonActionCondition.getString("id") : GUID.generate();
|
||||
|
||||
ActionConditionImpl result = new ActionConditionImpl(id, jsonActionCondition.getString("conditionDefinitionName"));
|
||||
|
||||
@@ -375,28 +459,32 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
{
|
||||
JSONObject jsonParameterValues = jsonActionCondition.getJSONObject("parameterValues");
|
||||
|
||||
result.setParameterValues(parseJsonParameterValues(jsonParameterValues));
|
||||
result.setParameterValues(parseJsonParameterValues(jsonParameterValues, result.getActionConditionDefinitionName(), false));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected Map<String, Serializable> parseJsonParameterValues(JSONObject jsonParameterValues) throws JSONException
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Serializable> parseJsonParameterValues(JSONObject jsonParameterValues, String name, boolean isAction) throws JSONException
|
||||
{
|
||||
Map<String, Serializable> parameterValues = new HashMap<String, Serializable>();
|
||||
|
||||
// get parameters names
|
||||
JSONArray names = jsonParameterValues.names();
|
||||
|
||||
if (names != null)
|
||||
if (names == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < names.length(); i++)
|
||||
{
|
||||
String propertyName = names.getString(i);
|
||||
Object propertyValue = jsonParameterValues.get(propertyName);
|
||||
|
||||
// get parameter repository type
|
||||
QName typeQName = getPropertyType(propertyName);
|
||||
QName typeQName = getPropertyType(name, isAction, propertyName);
|
||||
|
||||
if (typeQName == null)
|
||||
{
|
||||
@@ -412,6 +500,11 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
|
||||
Serializable value = null;
|
||||
|
||||
if (typeQName.equals(DataTypeDefinition.QNAME))
|
||||
{
|
||||
value = QName.createQName(propertyValue.toString(), namespaceService);
|
||||
}
|
||||
|
||||
if (typeQName.equals(DataTypeDefinition.ANY))
|
||||
{
|
||||
try
|
||||
@@ -426,7 +519,15 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
}
|
||||
catch (NumberFormatException e1)
|
||||
{
|
||||
// do nothing
|
||||
if (propertyValue instanceof JSONArray)
|
||||
{
|
||||
value = new ArrayList<String>();
|
||||
JSONArray array = (JSONArray) propertyValue;
|
||||
for (int j = 0; j < array.length(); j++)
|
||||
{
|
||||
((List<String>) value).add(array.getString(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -434,12 +535,11 @@ public abstract class AbstractRuleWebScript extends DeclarativeWebScript
|
||||
if (value == null)
|
||||
{
|
||||
// convert to correct repository type
|
||||
value = (Serializable)DefaultTypeConverter.INSTANCE.convert(dictionaryService.getDataType(typeQName), propertyValue);
|
||||
value = (Serializable) DefaultTypeConverter.INSTANCE.convert(dictionaryService.getDataType(typeQName), propertyValue);
|
||||
}
|
||||
|
||||
parameterValues.put(propertyName, value);
|
||||
}
|
||||
}
|
||||
|
||||
return parameterValues;
|
||||
}
|
||||
|
@@ -61,8 +61,7 @@ public class ActionConstraintGet extends AbstractRuleWebScript
|
||||
|
||||
if (parameterConstraint == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find parameter constraint with name: " +
|
||||
name);
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find parameter constraint with name: " + name);
|
||||
}
|
||||
|
||||
model.put("actionConstraint", parameterConstraint);
|
||||
|
@@ -46,7 +46,6 @@ public class ActionConstraintsGet extends AbstractRuleWebScript
|
||||
@SuppressWarnings("unused")
|
||||
private static Log logger = LogFactory.getLog(ActionConstraintsGet.class);
|
||||
|
||||
|
||||
@Override
|
||||
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
|
||||
{
|
||||
|
@@ -91,7 +91,7 @@ public class ActionQueuePost extends AbstractRuleWebScript
|
||||
{
|
||||
actionService.executeAction(action, actionedUponNode, true, async);
|
||||
}
|
||||
catch(Throwable e)
|
||||
catch (Throwable e)
|
||||
{
|
||||
model.put(STATUS, STATUS_FAIL);
|
||||
model.put("exception", e);
|
||||
@@ -102,13 +102,11 @@ public class ActionQueuePost extends AbstractRuleWebScript
|
||||
}
|
||||
catch (IOException iox)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Could not read content from req.", iox);
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not read content from req.", iox);
|
||||
}
|
||||
catch (JSONException je)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Could not parse JSON from req.", je);
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", je);
|
||||
}
|
||||
|
||||
return model;
|
||||
|
87
source/java/org/alfresco/repo/web/scripts/rule/InheritedRulesGet.java
Executable file
87
source/java/org/alfresco/repo/web/scripts/rule/InheritedRulesGet.java
Executable file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 Alfresco Software Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
* As a special exception to the terms and conditions of version 2.0 of
|
||||
* the GPL, you may redistribute this Program in connection with Free/Libre
|
||||
* and Open Source Software ("FLOSS") applications as described in Alfresco's
|
||||
* FLOSS exception. You should have recieved a copy of the text describing
|
||||
* the FLOSS exception, and it is also available here:
|
||||
* http://www.alfresco.com/legal/licensing"
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.rule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.web.scripts.rule.ruleset.RuleRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.alfresco.service.cmr.rule.RuleType;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
/**
|
||||
* @author unknown
|
||||
*
|
||||
*/
|
||||
public class InheritedRulesGet extends AbstractRuleWebScript
|
||||
{
|
||||
@SuppressWarnings("unused")
|
||||
private static Log logger = LogFactory.getLog(InheritedRulesGet.class);
|
||||
|
||||
@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 (including inherited) filtered by rule type
|
||||
List<Rule> inheritedRules = ruleService.getRules(nodeRef, true, ruleType);
|
||||
|
||||
// get owned rules (excluding inherited) filtered by rule type
|
||||
List<Rule> ownedRules = ruleService.getRules(nodeRef, false, ruleType);
|
||||
|
||||
// remove owned rules
|
||||
inheritedRules.removeAll(ownedRules);
|
||||
|
||||
List<RuleRef> inheritedRuleRefs = new ArrayList<RuleRef>();
|
||||
|
||||
for (Rule rule : inheritedRules)
|
||||
{
|
||||
inheritedRuleRefs.add(new RuleRef(rule, fileFolderService.getFileInfo(ruleService.getOwningNodeRef(rule))));
|
||||
}
|
||||
|
||||
model.put("inheritedRuleRefs", inheritedRuleRefs);
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
@@ -62,7 +62,7 @@ public class RuleDelete extends AbstractRuleWebScript
|
||||
Rule ruleToDelete = null;
|
||||
|
||||
// get all rules for given nodeRef
|
||||
List<Rule> rules = ruleService.getRules(nodeRef);
|
||||
List<Rule> rules = ruleService.getRules(nodeRef, false);
|
||||
|
||||
// filter by rule id
|
||||
for (Rule rule : rules)
|
||||
@@ -76,8 +76,7 @@ public class RuleDelete extends AbstractRuleWebScript
|
||||
|
||||
if (ruleToDelete == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rule with id: " +
|
||||
ruleId);
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rule with id: " + ruleId);
|
||||
}
|
||||
|
||||
// delete rule
|
||||
|
@@ -30,6 +30,7 @@ import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.alfresco.repo.web.scripts.rule.ruleset.RuleRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -76,14 +77,12 @@ public class RuleGet extends AbstractRuleWebScript
|
||||
|
||||
if (ruleToReturn == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rule with id: " +
|
||||
ruleId);
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rule with id: " + ruleId);
|
||||
}
|
||||
|
||||
model.put("rule", ruleToReturn);
|
||||
model.put("storeType", nodeRef.getStoreRef().getProtocol());
|
||||
model.put("storeId", nodeRef.getStoreRef().getIdentifier());
|
||||
model.put("id", nodeRef.getId());
|
||||
RuleRef ruleRefToReturn = new RuleRef(ruleToReturn, fileFolderService.getFileInfo(ruleService.getOwningNodeRef(ruleToReturn)));
|
||||
|
||||
model.put("ruleRef", ruleRefToReturn);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.web.scripts.rule.ruleset.RuleRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.apache.commons.logging.Log;
|
||||
@@ -71,20 +72,17 @@ public class RulePost extends AbstractRuleWebScript
|
||||
// create rule
|
||||
ruleService.saveRule(nodeRef, rule);
|
||||
|
||||
model.put("rule", rule);
|
||||
model.put("storeType", nodeRef.getStoreRef().getProtocol());
|
||||
model.put("storeId", nodeRef.getStoreRef().getIdentifier());
|
||||
model.put("id", nodeRef.getId());
|
||||
RuleRef ruleRef = new RuleRef(rule, fileFolderService.getFileInfo(ruleService.getOwningNodeRef(rule)));
|
||||
|
||||
model.put("ruleRef", ruleRef);
|
||||
}
|
||||
catch (IOException iox)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Could not read content from req.", iox);
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not read content from req.", iox);
|
||||
}
|
||||
catch (JSONException je)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Could not parse JSON from req.", je);
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", je);
|
||||
}
|
||||
|
||||
return model;
|
||||
|
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import org.alfresco.repo.action.ActionConditionImpl;
|
||||
import org.alfresco.repo.action.ActionImpl;
|
||||
import org.alfresco.repo.action.CompositeActionImpl;
|
||||
import org.alfresco.repo.web.scripts.rule.ruleset.RuleRef;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.action.ActionCondition;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
@@ -87,8 +88,7 @@ public class RulePut extends RulePost
|
||||
|
||||
if (ruleToUpdate == null)
|
||||
{
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rule with id: " +
|
||||
ruleId);
|
||||
throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find rule with id: " + ruleId);
|
||||
}
|
||||
|
||||
JSONObject json = null;
|
||||
@@ -104,20 +104,17 @@ public class RulePut extends RulePost
|
||||
// save changes
|
||||
ruleService.saveRule(nodeRef, ruleToUpdate);
|
||||
|
||||
model.put("rule", ruleToUpdate);
|
||||
model.put("storeType", nodeRef.getStoreRef().getProtocol());
|
||||
model.put("storeId", nodeRef.getStoreRef().getIdentifier());
|
||||
model.put("id", nodeRef.getId());
|
||||
RuleRef updatedRuleRef = new RuleRef(ruleToUpdate, fileFolderService.getFileInfo(ruleService.getOwningNodeRef(ruleToUpdate)));
|
||||
|
||||
model.put("ruleRef", updatedRuleRef);
|
||||
}
|
||||
catch (IOException iox)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Could not read content from req.", iox);
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not read content from req.", iox);
|
||||
}
|
||||
catch (JSONException je)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST,
|
||||
"Could not parse JSON from req.", je);
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", je);
|
||||
}
|
||||
|
||||
return model;
|
||||
@@ -167,7 +164,7 @@ public class RulePut extends RulePost
|
||||
JSONObject jsonAction = jsonRule.getJSONObject("action");
|
||||
|
||||
// update rule action
|
||||
Action action = updateActionFromJson(jsonAction, (ActionImpl)ruleToUpdate.getAction());
|
||||
Action action = updateActionFromJson(jsonAction, (ActionImpl) ruleToUpdate.getAction());
|
||||
|
||||
ruleToUpdate.setAction(action);
|
||||
}
|
||||
@@ -202,7 +199,7 @@ public class RulePut extends RulePost
|
||||
if (jsonAction.has("parameterValues"))
|
||||
{
|
||||
JSONObject jsonParameterValues = jsonAction.getJSONObject("parameterValues");
|
||||
result.setParameterValues(parseJsonParameterValues(jsonParameterValues));
|
||||
result.setParameterValues(parseJsonParameterValues(jsonParameterValues, result.getActionDefinitionName(), true));
|
||||
}
|
||||
|
||||
if (jsonAction.has("executeAsync"))
|
||||
@@ -221,11 +218,11 @@ public class RulePut extends RulePost
|
||||
if (jsonActions.length() == 0)
|
||||
{
|
||||
// empty array was sent -> clear list
|
||||
((CompositeActionImpl)result).getActions().clear();
|
||||
((CompositeActionImpl) result).getActions().clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Action> existingActions = ((CompositeActionImpl)result).getActions();
|
||||
List<Action> existingActions = ((CompositeActionImpl) result).getActions();
|
||||
List<Action> newActions = new ArrayList<Action>();
|
||||
|
||||
for (int i = 0; i < jsonActions.length(); i++)
|
||||
@@ -240,7 +237,7 @@ public class RulePut extends RulePost
|
||||
Action existingAction = getAction(existingActions, actionId);
|
||||
existingActions.remove(existingAction);
|
||||
|
||||
Action updatedAction = updateActionFromJson(innerJsonAction, (ActionImpl)existingAction);
|
||||
Action updatedAction = updateActionFromJson(innerJsonAction, (ActionImpl) existingAction);
|
||||
newActions.add(updatedAction);
|
||||
}
|
||||
else
|
||||
@@ -284,7 +281,7 @@ public class RulePut extends RulePost
|
||||
ActionCondition existingCondition = getCondition(existingConditions, conditionId);
|
||||
existingConditions.remove(existingCondition);
|
||||
|
||||
ActionCondition updatedActionCondition = updateActionConditionFromJson(jsonCondition, (ActionConditionImpl)existingCondition);
|
||||
ActionCondition updatedActionCondition = updateActionConditionFromJson(jsonCondition, (ActionConditionImpl) existingCondition);
|
||||
newConditions.add(updatedActionCondition);
|
||||
}
|
||||
else
|
||||
@@ -306,7 +303,7 @@ public class RulePut extends RulePost
|
||||
if (jsonAction.has("compensatingAction"))
|
||||
{
|
||||
JSONObject jsonCompensatingAction = jsonAction.getJSONObject("compensatingAction");
|
||||
Action compensatingAction = updateActionFromJson(jsonCompensatingAction, (ActionImpl)actionToUpdate.getCompensatingAction());
|
||||
Action compensatingAction = updateActionFromJson(jsonCompensatingAction, (ActionImpl) actionToUpdate.getCompensatingAction());
|
||||
|
||||
actionToUpdate.setCompensatingAction(compensatingAction);
|
||||
}
|
||||
@@ -337,7 +334,7 @@ public class RulePut extends RulePost
|
||||
if (jsonCondition.has("parameterValues"))
|
||||
{
|
||||
JSONObject jsonParameterValues = jsonCondition.getJSONObject("parameterValues");
|
||||
result.setParameterValues(parseJsonParameterValues(jsonParameterValues));
|
||||
result.setParameterValues(parseJsonParameterValues(jsonParameterValues, result.getActionConditionDefinitionName(), false));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@@ -28,18 +28,16 @@ import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.rule.RuleModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.action.ActionService;
|
||||
import org.alfresco.service.cmr.action.ParameterConstraint;
|
||||
import org.alfresco.service.cmr.model.FileFolderService;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.alfresco.service.cmr.rule.RuleService;
|
||||
import org.alfresco.service.cmr.search.SearchService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
@@ -69,74 +67,71 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
private static final String URL_QUEUE_ACTION = "/api/actionQueue?async={0}";
|
||||
|
||||
private static final String URL_RULES = "/api/node/{0}/{1}/{2}/ruleset/rules";
|
||||
private static final String URL_INHERITED_RULES = "/api/node/{0}/{1}/{2}/ruleset/inheritedrules";
|
||||
private static final String URL_RULESET = "/api/node/{0}/{1}/{2}/ruleset";
|
||||
private static final String URL_RULE = "/api/node/{0}/{1}/{2}/ruleset/rules/{3}";
|
||||
|
||||
private static final String TEST_STORE_IDENTIFIER = "test_store-" + System.currentTimeMillis();
|
||||
private static final String TEST_FOLDER = "test_folder-" + System.currentTimeMillis();
|
||||
|
||||
private static final String COMPANY_HOME_PATH = "/app:company_home";
|
||||
private static final String TEST_FOLDER_2 = "test_folder-2-" + System.currentTimeMillis();
|
||||
|
||||
private NodeService nodeService;
|
||||
private FileFolderService fileFolderService;
|
||||
private NamespaceService namespaceService;
|
||||
private SearchService searchService;
|
||||
private AuthenticationComponent authenticationComponent;
|
||||
private RuleService ruleService;
|
||||
private ActionService actionService;
|
||||
|
||||
private NodeRef testNodeRef;
|
||||
private NodeRef companyHome;
|
||||
private NodeRef testNodeRef2;
|
||||
private NodeRef testWorkNodeRef;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
this.nodeService = (NodeService)getServer().getApplicationContext().getBean("NodeService");
|
||||
this.fileFolderService = (FileFolderService)getServer().getApplicationContext().getBean("FileFolderService");
|
||||
this.namespaceService = (NamespaceService)getServer().getApplicationContext().getBean("NamespaceService");
|
||||
this.searchService = (SearchService)getServer().getApplicationContext().getBean("SearchService");
|
||||
this.ruleService = (RuleService)getServer().getApplicationContext().getBean("RuleService");
|
||||
this.authenticationComponent = (AuthenticationComponent)getServer().getApplicationContext().getBean("authenticationComponent");
|
||||
this.nodeService = (NodeService) getServer().getApplicationContext().getBean("NodeService");
|
||||
this.fileFolderService = (FileFolderService) getServer().getApplicationContext().getBean("FileFolderService");
|
||||
this.ruleService = (RuleService) getServer().getApplicationContext().getBean("RuleService");
|
||||
this.actionService = (ActionService) getServer().getApplicationContext().getBean("ActionService");
|
||||
this.authenticationComponent = (AuthenticationComponent) getServer().getApplicationContext().getBean("authenticationComponent");
|
||||
|
||||
this.authenticationComponent.setSystemUserAsCurrentUser();
|
||||
|
||||
createTestFolder();
|
||||
createTestFolders();
|
||||
|
||||
assertNotNull(testWorkNodeRef);
|
||||
assertNotNull(testNodeRef);
|
||||
assertNotNull(companyHome);
|
||||
assertNotNull(testNodeRef2);
|
||||
}
|
||||
|
||||
private void createTestFolder()
|
||||
private void createTestFolders()
|
||||
{
|
||||
NodeRef storeRootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
|
||||
StoreRef testStore = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, TEST_STORE_IDENTIFIER);
|
||||
|
||||
NodeRef companyHomeNodeRef;
|
||||
|
||||
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, COMPANY_HOME_PATH, null, namespaceService, false);
|
||||
|
||||
if (nodeRefs.size() > 1)
|
||||
if (!nodeService.exists(testStore))
|
||||
{
|
||||
throw new RuntimeException("Multiple possible roots for : \n" + " root path: " + COMPANY_HOME_PATH + "\n" + " results: " + nodeRefs);
|
||||
testStore = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, TEST_STORE_IDENTIFIER);
|
||||
}
|
||||
else if (nodeRefs.size() == 0)
|
||||
|
||||
NodeRef rootNodeRef = nodeService.getRootNode(testStore);
|
||||
|
||||
testWorkNodeRef = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{test}testnode"), ContentModel.TYPE_FOLDER).getChildRef();
|
||||
|
||||
testNodeRef = fileFolderService.create(testWorkNodeRef, TEST_FOLDER, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||
testNodeRef2 = fileFolderService.create(testWorkNodeRef, TEST_FOLDER_2, ContentModel.TYPE_FOLDER).getNodeRef();
|
||||
}
|
||||
|
||||
private String formatRulesUrl(NodeRef nodeRef, boolean inherited)
|
||||
{
|
||||
throw new RuntimeException("No root found for : \n" + " root path: " + COMPANY_HOME_PATH);
|
||||
if (inherited)
|
||||
{
|
||||
return MessageFormat.format(URL_INHERITED_RULES, nodeRef.getStoreRef().getProtocol(), nodeRef.getStoreRef().getIdentifier(), nodeRef.getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
companyHomeNodeRef = nodeRefs.get(0);
|
||||
companyHome = companyHomeNodeRef;
|
||||
}
|
||||
FileInfo fileInfo = fileFolderService.create(companyHomeNodeRef, TEST_FOLDER, ContentModel.TYPE_FOLDER);
|
||||
|
||||
testNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
this.nodeService.addAspect(testNodeRef, RuleModel.ASPECT_RULES, null);
|
||||
}
|
||||
|
||||
private String formatRulesUrl(NodeRef nodeRef)
|
||||
{
|
||||
return MessageFormat.format(URL_RULES, nodeRef.getStoreRef().getProtocol(), nodeRef.getStoreRef().getIdentifier(), nodeRef.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private String formatRulesetUrl(NodeRef nodeRef)
|
||||
{
|
||||
@@ -162,25 +157,26 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
protected void tearDown() throws Exception
|
||||
{
|
||||
super.tearDown();
|
||||
|
||||
fileFolderService.delete(testNodeRef);
|
||||
nodeService.deleteNode(testNodeRef2);
|
||||
nodeService.deleteNode(testNodeRef);
|
||||
nodeService.deleteNode(testWorkNodeRef);
|
||||
this.authenticationComponent.clearCurrentSecurityContext();
|
||||
}
|
||||
|
||||
private JSONObject createRule() throws Exception
|
||||
private JSONObject createRule(NodeRef ruleOwnerNodeRef) throws Exception
|
||||
{
|
||||
JSONObject jsonRule = buildTestRule();
|
||||
|
||||
Response response = sendRequest(new PostRequest(formatRulesUrl(testNodeRef), jsonRule.toString(), "application/json"), 200);
|
||||
Response response = sendRequest(new PostRequest(formatRulesUrl(ruleOwnerNodeRef, false), jsonRule.toString(), "application/json"), 200);
|
||||
|
||||
JSONObject result = new JSONObject(response.getContentAsString());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private JSONArray getNodeRules() throws Exception
|
||||
private JSONArray getNodeRules(NodeRef nodeRef, boolean inherited) throws Exception
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(formatRulesUrl(testNodeRef)), 200);
|
||||
Response response = sendRequest(new GetRequest(formatRulesUrl(nodeRef, inherited)), 200);
|
||||
JSONObject result = new JSONObject(response.getContentAsString());
|
||||
|
||||
assertNotNull(result);
|
||||
@@ -207,9 +203,13 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
assertEquals(1, ruleType.length());
|
||||
assertEquals("outbound", ruleType.getString(0));
|
||||
|
||||
assertFalse(result.getBoolean("applyToChildren"));
|
||||
assertTrue(result.getBoolean("applyToChildren"));
|
||||
assertFalse(result.getBoolean("executeAsynchronously"));
|
||||
assertFalse(result.getBoolean("disabled"));
|
||||
assertTrue(result.has("owningNode"));
|
||||
JSONObject owningNode = result.getJSONObject("owningNode");
|
||||
assertTrue(owningNode.has("nodeRef"));
|
||||
assertTrue(owningNode.has("name"));
|
||||
assertTrue(result.has("url"));
|
||||
|
||||
JSONObject jsonAction = result.getJSONObject("action");
|
||||
@@ -281,7 +281,7 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
assertEquals(before.has("url"), after.has("url"));
|
||||
}
|
||||
|
||||
private void checkRuleset(JSONObject result, String ruleId) throws Exception
|
||||
private void checkRuleset(JSONObject result, int rulesCount, String[] ruleIds, int inhRulesCount, String[] parentRuleIds) throws Exception
|
||||
{
|
||||
assertNotNull("Response is null.", result);
|
||||
|
||||
@@ -289,21 +289,51 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
|
||||
assertTrue(data.has("rules"));
|
||||
if (data.has("rules"))
|
||||
{
|
||||
JSONArray rulesArray = data.getJSONArray("rules");
|
||||
|
||||
assertEquals(1, data.getJSONArray("rules").length());
|
||||
assertEquals(rulesCount, rulesArray.length());
|
||||
|
||||
JSONObject ruleSummary = data.getJSONArray("rules").getJSONObject(0);
|
||||
for (int i = 0; i < rulesArray.length(); i++)
|
||||
{
|
||||
JSONObject ruleSum = rulesArray.getJSONObject(i);
|
||||
assertTrue(ruleSum.has("id"));
|
||||
assertEquals(ruleIds[i], ruleSum.getString("id"));
|
||||
assertTrue(ruleSum.has("title"));
|
||||
assertTrue(ruleSum.has("ruleType"));
|
||||
assertTrue(ruleSum.has("disabled"));
|
||||
assertTrue(ruleSum.has("owningNode"));
|
||||
JSONObject owningNode = ruleSum.getJSONObject("owningNode");
|
||||
assertTrue(owningNode.has("nodeRef"));
|
||||
assertTrue(owningNode.has("name"));
|
||||
assertTrue(ruleSum.has("url"));
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals(ruleId, ruleSummary.getString("id"));
|
||||
if (data.has("inheritedRules"))
|
||||
{
|
||||
JSONArray inheritedRulesArray = data.getJSONArray("inheritedRules");
|
||||
|
||||
assertTrue(ruleSummary.has("title"));
|
||||
assertTrue(ruleSummary.has("ruleType"));
|
||||
assertTrue(ruleSummary.has("disabled"));
|
||||
assertTrue(ruleSummary.has("url"));
|
||||
assertEquals(inhRulesCount, inheritedRulesArray.length());
|
||||
|
||||
assertFalse(data.has("inheritedRules"));
|
||||
for (int i = 0; i < inheritedRulesArray.length(); i++)
|
||||
{
|
||||
JSONObject ruleSum = inheritedRulesArray.getJSONObject(i);
|
||||
assertTrue(ruleSum.has("id"));
|
||||
assertEquals(parentRuleIds[i], ruleSum.getString("id"));
|
||||
assertTrue(ruleSum.has("title"));
|
||||
assertTrue(ruleSum.has("ruleType"));
|
||||
assertTrue(ruleSum.has("disabled"));
|
||||
assertTrue(ruleSum.has("owningNode"));
|
||||
JSONObject owningNode = ruleSum.getJSONObject("owningNode");
|
||||
assertTrue(owningNode.has("nodeRef"));
|
||||
assertTrue(owningNode.has("name"));
|
||||
assertTrue(ruleSum.has("url"));
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(data.has("url"));
|
||||
}
|
||||
|
||||
public void testGetRuleTypes() throws Exception
|
||||
@@ -406,7 +436,17 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
|
||||
public void testGetActionConstraint() throws Exception
|
||||
{
|
||||
Response response = sendRequest(new GetRequest(formateActionConstraintUrl("ac-compare-operations")), 200);
|
||||
|
||||
List<ParameterConstraint> constraints = actionService.getParameterConstraints();
|
||||
|
||||
if (constraints.size() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String name = constraints.get(0).getName();
|
||||
|
||||
Response response = sendRequest(new GetRequest(formateActionConstraintUrl(name)), 200);
|
||||
JSONObject result = new JSONObject(response.getContentAsString());
|
||||
|
||||
assertNotNull(result);
|
||||
@@ -433,7 +473,7 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
{
|
||||
String url = formateQueueActionUrl(false);
|
||||
|
||||
JSONObject copyAction = buildCopyAction(companyHome);
|
||||
JSONObject copyAction = buildCopyAction(testWorkNodeRef);
|
||||
|
||||
copyAction.put("actionedUponNode", testNodeRef);
|
||||
|
||||
@@ -498,7 +538,7 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
|
||||
public void testCreateRule() throws Exception
|
||||
{
|
||||
JSONObject result = createRule();
|
||||
JSONObject result = createRule(testNodeRef);
|
||||
|
||||
checkRuleSummary(result);
|
||||
|
||||
@@ -510,32 +550,75 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
|
||||
public void testGetRulesCollection() throws Exception
|
||||
{
|
||||
JSONArray data = getNodeRules();
|
||||
JSONArray data = getNodeRules(testNodeRef, false);
|
||||
|
||||
assertEquals(0, data.length());
|
||||
|
||||
createRule();
|
||||
createRule(testNodeRef);
|
||||
|
||||
data = getNodeRules();
|
||||
data = getNodeRules(testNodeRef, false);
|
||||
|
||||
assertEquals(1, data.length());
|
||||
|
||||
for (int i = 0; i < data.length(); i++)
|
||||
{
|
||||
JSONObject ruleSum = data.getJSONObject(i);
|
||||
assertTrue(ruleSum.has("id"));
|
||||
assertTrue(ruleSum.has("title"));
|
||||
assertTrue(ruleSum.has("ruleType"));
|
||||
assertTrue(ruleSum.has("disabled"));
|
||||
assertTrue(ruleSum.has("owningNode"));
|
||||
JSONObject owningNode = ruleSum.getJSONObject("owningNode");
|
||||
assertTrue(owningNode.has("nodeRef"));
|
||||
assertTrue(owningNode.has("name"));
|
||||
assertTrue(ruleSum.has("url"));
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetInheritedRulesCollection() throws Exception
|
||||
{
|
||||
JSONArray data = getNodeRules(testNodeRef, true);
|
||||
|
||||
assertEquals(0, data.length());
|
||||
|
||||
createRule(testWorkNodeRef);
|
||||
|
||||
data = getNodeRules(testNodeRef, true);
|
||||
|
||||
assertEquals(1, data.length());
|
||||
|
||||
for (int i = 0; i < data.length(); i++)
|
||||
{
|
||||
JSONObject ruleSum = data.getJSONObject(i);
|
||||
assertTrue(ruleSum.has("id"));
|
||||
assertTrue(ruleSum.has("title"));
|
||||
assertTrue(ruleSum.has("ruleType"));
|
||||
assertTrue(ruleSum.has("disabled"));
|
||||
assertTrue(ruleSum.has("owningNode"));
|
||||
JSONObject owningNode = ruleSum.getJSONObject("owningNode");
|
||||
assertTrue(owningNode.has("nodeRef"));
|
||||
assertTrue(owningNode.has("name"));
|
||||
assertTrue(ruleSum.has("url"));
|
||||
}
|
||||
}
|
||||
|
||||
public void testGetRuleset() throws Exception
|
||||
{
|
||||
JSONObject jsonRule = createRule();
|
||||
JSONObject parentRule = createRule(testWorkNodeRef);
|
||||
String[] parentRuleIds = new String[] { parentRule.getJSONObject("data").getString("id") };
|
||||
|
||||
String ruleId = jsonRule.getJSONObject("data").getString("id");
|
||||
JSONObject jsonRule = createRule(testNodeRef);
|
||||
String[] ruleIds = new String[] { jsonRule.getJSONObject("data").getString("id") };
|
||||
|
||||
Response response = sendRequest(new GetRequest(formatRulesetUrl(testNodeRef)), 200);
|
||||
JSONObject result = new JSONObject(response.getContentAsString());
|
||||
|
||||
checkRuleset(result, ruleId);
|
||||
checkRuleset(result, 1, ruleIds, 1, parentRuleIds);
|
||||
}
|
||||
|
||||
public void testGetRuleDetails() throws Exception
|
||||
{
|
||||
JSONObject jsonRule = createRule();
|
||||
JSONObject jsonRule = createRule(testNodeRef);
|
||||
|
||||
String ruleId = jsonRule.getJSONObject("data").getString("id");
|
||||
|
||||
@@ -547,7 +630,7 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
|
||||
public void testUpdateRule() throws Exception
|
||||
{
|
||||
JSONObject jsonRule = createRule();
|
||||
JSONObject jsonRule = createRule(testNodeRef);
|
||||
|
||||
String ruleId = jsonRule.getJSONObject("data").getString("id");
|
||||
|
||||
@@ -576,7 +659,7 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
|
||||
public void testDeleteRule() throws Exception
|
||||
{
|
||||
JSONObject jsonRule = createRule();
|
||||
JSONObject jsonRule = createRule(testNodeRef);
|
||||
|
||||
assertEquals(1, ruleService.getRules(testNodeRef).size());
|
||||
|
||||
@@ -607,8 +690,8 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
// build parameterValues
|
||||
JSONObject parameterValues = new JSONObject();
|
||||
parameterValues.put("destination-folder", destination);
|
||||
parameterValues.put("assoc-name", QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
|
||||
parameterValues.put("assoc-type", ContentModel.ASSOC_CONTAINS);
|
||||
parameterValues.put("assoc-name", "cm:copy");
|
||||
parameterValues.put("assoc-type", "cm:contains");
|
||||
|
||||
// add parameterValues
|
||||
result.put("parameterValues", parameterValues);
|
||||
@@ -631,7 +714,7 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
|
||||
result.put("ruleType", ruleType);
|
||||
|
||||
result.put("applyToChildren", false);
|
||||
result.put("applyToChildren", true);
|
||||
|
||||
result.put("executeAsynchronously", false);
|
||||
|
||||
@@ -674,7 +757,7 @@ public class RuleServiceTest extends BaseWebScriptTest
|
||||
|
||||
if (addCompensatingAction)
|
||||
{
|
||||
result.put("compensatingAction", buildTestAction("executeScript", false, false));
|
||||
result.put("compensatingAction", buildTestAction("script", false, false));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@@ -24,10 +24,12 @@
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.rule;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.repo.web.scripts.rule.ruleset.RuleRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
import org.alfresco.service.cmr.rule.RuleType;
|
||||
@@ -62,13 +64,17 @@ public class RulesGet extends AbstractRuleWebScript
|
||||
ruleType = null;
|
||||
}
|
||||
|
||||
// get all rules (including inherited) filtered by rule type
|
||||
List<Rule> rules = ruleService.getRules(nodeRef, true, ruleType);
|
||||
// get all rules (excluding inherited) filtered by rule type
|
||||
List<Rule> rules = ruleService.getRules(nodeRef, false, ruleType);
|
||||
|
||||
model.put("rules", rules);
|
||||
model.put("storeType", nodeRef.getStoreRef().getProtocol());
|
||||
model.put("storeId", nodeRef.getStoreRef().getIdentifier());
|
||||
model.put("id", nodeRef.getId());
|
||||
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;
|
||||
}
|
||||
|
@@ -80,19 +80,22 @@ public class RulesetGet extends AbstractRuleWebScript
|
||||
|
||||
for (Rule rule : ownedRules)
|
||||
{
|
||||
rulesToSet.add(new RuleRef(rule, ruleService.getOwningNodeRef(rule)));
|
||||
rulesToSet.add(new RuleRef(rule, fileFolderService.getFileInfo(ruleService.getOwningNodeRef(rule))));
|
||||
}
|
||||
ruleset.setRules(rulesToSet);
|
||||
|
||||
|
||||
List<RuleRef> inheritedRulesToSet = new ArrayList<RuleRef>();
|
||||
|
||||
for (Rule rule : inheritedRules)
|
||||
{
|
||||
inheritedRulesToSet.add(new RuleRef(rule, ruleService.getOwningNodeRef(rule)));
|
||||
inheritedRulesToSet.add(new RuleRef(rule, fileFolderService.getFileInfo(ruleService.getOwningNodeRef(rule))));
|
||||
}
|
||||
ruleset.setInheritedRules(inheritedRulesToSet);
|
||||
|
||||
ruleset.setLinkedToRuleSet(ruleService.getLinkedToRuleNode(nodeRef));
|
||||
|
||||
ruleset.setLinkedFromRuleSets(ruleService.getLinkedFromRuleNodes(nodeRef));
|
||||
|
||||
ruleset.setRulesetNodeRef(nodeRef);
|
||||
|
||||
model.put("ruleset", ruleset);
|
||||
|
@@ -24,11 +24,9 @@
|
||||
*/
|
||||
package org.alfresco.repo.web.scripts.rule.ruleset;
|
||||
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.rule.Rule;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Rule object for REST API
|
||||
*
|
||||
@@ -41,14 +39,14 @@ public class RuleRef
|
||||
/** Serial version UID */
|
||||
private static final long serialVersionUID = -923276130307938661L;
|
||||
|
||||
private NodeRef owningNodeRef;
|
||||
private FileInfo owningFileInfo;
|
||||
|
||||
private Rule rule;
|
||||
|
||||
public RuleRef(Rule rule, NodeRef owningNodeRef)
|
||||
public RuleRef(Rule rule, FileInfo owningFileInfo)
|
||||
{
|
||||
this.rule = rule;
|
||||
this.owningNodeRef = owningNodeRef;
|
||||
this.owningFileInfo = owningFileInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,22 +70,22 @@ public class RuleRef
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the owning node reference for rule
|
||||
* Set the owning file info reference for rule
|
||||
*
|
||||
* @param owningNodeRef the owning node reference to set
|
||||
* @param owningNodeRef the owning file info reference to set
|
||||
*/
|
||||
public void setOwningNodeRef(NodeRef owningNodeRef)
|
||||
public void setOwningFileInfo(FileInfo owningFileInfo)
|
||||
{
|
||||
this.owningNodeRef = owningNodeRef;
|
||||
this.owningFileInfo = owningFileInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the owning node reference for a rule.
|
||||
* Returns the owning file info reference for a rule.
|
||||
*
|
||||
* @return the owning node reference
|
||||
* @return the owning file info reference
|
||||
*/
|
||||
public NodeRef getOwningNodeRef()
|
||||
public FileInfo getOwningFileInfo()
|
||||
{
|
||||
return owningNodeRef;
|
||||
return owningFileInfo;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user