mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merging from EC-MC: Project compile
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5742 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -7,8 +7,8 @@
|
|||||||
<view:acl view:inherit="false">
|
<view:acl view:inherit="false">
|
||||||
<view:ace view:access="ALLOWED">
|
<view:ace view:access="ALLOWED">
|
||||||
<view:authority>GROUP_EVERYONE</view:authority>
|
<view:authority>GROUP_EVERYONE</view:authority>
|
||||||
<view:permission>Coordinator</view:permission>
|
<view:permission>Consumer</view:permission>
|
||||||
</view:ace>
|
</view:ace>
|
||||||
</view:acl>
|
</view:acl>
|
||||||
</cm:mlRoot>
|
</cm:mlRoot>
|
||||||
|
|
||||||
|
@@ -99,24 +99,24 @@
|
|||||||
</constructor-arg>
|
</constructor-arg>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="contentFilterLanguagesConfigService" class="org.alfresco.config.xml.XMLConfigService" init-method="init">
|
<bean id="contentFilterLanguagesConfigService" class="org.alfresco.config.xml.XMLConfigService" init-method="init">
|
||||||
<constructor-arg>
|
|
||||||
<bean class="org.alfresco.config.source.UrlConfigSource">
|
|
||||||
<constructor-arg>
|
|
||||||
<list>
|
|
||||||
<value>classpath:alfresco/ml/content-filter-lang.xml</value>
|
|
||||||
</list>
|
|
||||||
</constructor-arg>
|
|
||||||
</bean>
|
|
||||||
</constructor-arg>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
|
|
||||||
<bean id="contentFilterLanguagesService" class="org.alfresco.repo.model.ml.ContentFilterLanguagesMap" init-method="init" >
|
|
||||||
<constructor-arg>
|
<constructor-arg>
|
||||||
<ref bean="contentFilterLanguagesConfigService" />
|
<bean class="org.alfresco.config.source.UrlConfigSource">
|
||||||
|
<constructor-arg>
|
||||||
|
<list>
|
||||||
|
<value>classpath:alfresco/ml/content-filter-lang.xml</value>
|
||||||
|
</list>
|
||||||
|
</constructor-arg>
|
||||||
|
</bean>
|
||||||
</constructor-arg>
|
</constructor-arg>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="contentFilterLanguagesService" class="org.alfresco.repo.model.ml.ContentFilterLanguagesMap" init-method="init" >
|
||||||
|
<property name="configService">
|
||||||
|
<ref bean="contentFilterLanguagesConfigService" />
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection" />
|
<bean id="openOfficeConnection" class="net.sf.jooreports.openoffice.connection.SocketOpenOfficeConnection" />
|
||||||
<bean id="openOfficeConnectionTester" class="org.alfresco.util.OpenOfficeConnectionTester" init-method="checkConnection" >
|
<bean id="openOfficeConnectionTester" class="org.alfresco.util.OpenOfficeConnectionTester" init-method="checkConnection" >
|
||||||
<property name="connection">
|
<property name="connection">
|
||||||
|
@@ -43,19 +43,19 @@
|
|||||||
<!-- Multilingual specific service -->
|
<!-- Multilingual specific service -->
|
||||||
<bean name="multilingualContentService" class="org.alfresco.repo.model.ml.MultilingualContentServiceImpl" >
|
<bean name="multilingualContentService" class="org.alfresco.repo.model.ml.MultilingualContentServiceImpl" >
|
||||||
<property name="nodeService">
|
<property name="nodeService">
|
||||||
<ref bean="NodeService" />
|
<ref bean="nodeService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="searchService">
|
<property name="searchService">
|
||||||
<ref bean="SearchService" />
|
<ref bean="searchService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="versionService">
|
<property name="versionService">
|
||||||
<ref bean="VersionService" />
|
<ref bean="versionService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="contentFilterLanguagesService">
|
<property name="contentFilterLanguagesService">
|
||||||
<ref bean="ContentFilterLanguagesService" />
|
<ref bean="contentFilterLanguagesService" />
|
||||||
</property>
|
</property>
|
||||||
<property name="fileFolderService">
|
<property name="fileFolderService">
|
||||||
<ref bean="FileFolderService" />
|
<ref bean="fileFolderService" />
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
@@ -13,6 +13,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="mlTranslationInterceptor" class="org.alfresco.repo.node.MLTranslationInterceptor">
|
||||||
|
<property name="nodeService">
|
||||||
|
<ref bean="nodeService"/>
|
||||||
|
</property>
|
||||||
|
<property name="multilingualContentService">
|
||||||
|
<ref bean="multilingualContentService"/>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
<bean id="nodeService" class="org.springframework.aop.framework.ProxyFactoryBean" >
|
<bean id="nodeService" class="org.springframework.aop.framework.ProxyFactoryBean" >
|
||||||
<property name="targetName">
|
<property name="targetName">
|
||||||
<value>mlAwareNodeService</value>
|
<value>mlAwareNodeService</value>
|
||||||
@@ -24,6 +34,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="interceptorNames">
|
<property name="interceptorNames">
|
||||||
<list>
|
<list>
|
||||||
|
<value>mlTranslationInterceptor</value>
|
||||||
<value>mlPropertyInterceptor</value>
|
<value>mlPropertyInterceptor</value>
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -927,6 +927,14 @@ public class AVMNodeService extends AbstractNodeServiceImpl implements NodeServi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Implement
|
||||||
|
*/
|
||||||
|
public boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeRef
|
* @param nodeRef
|
||||||
* @return Returns all properties keyed by their qualified name
|
* @return Returns all properties keyed by their qualified name
|
||||||
|
@@ -74,12 +74,11 @@ public class ContentFilterLanguagesMap implements ContentFilterLanguagesService
|
|||||||
/**
|
/**
|
||||||
* @param configService the config service to use to read languages
|
* @param configService the config service to use to read languages
|
||||||
*/
|
*/
|
||||||
public ContentFilterLanguagesMap(ConfigService configService)
|
public void setConfigService(ConfigService configService)
|
||||||
{
|
{
|
||||||
this.configService = configService;
|
this.configService = configService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.alfresco.service.cmr.ml.ContentFilterLanguagesService#getFilterLanguages()
|
* @see org.alfresco.service.cmr.ml.ContentFilterLanguagesService#getFilterLanguages()
|
||||||
*/
|
*/
|
||||||
|
@@ -875,11 +875,12 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
|
|||||||
|
|
||||||
public void testRemoveSpecificChild() throws Exception
|
public void testRemoveSpecificChild() throws Exception
|
||||||
{
|
{
|
||||||
NodeRef parentRef = nodeService.createNode(
|
ChildAssociationRef pathPrimaryRef = nodeService.createNode(
|
||||||
rootNodeRef,
|
rootNodeRef,
|
||||||
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
||||||
QName.createQName("parent_child"),
|
QName.createQName("parent_child"),
|
||||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
ContentModel.TYPE_CONTAINER);
|
||||||
|
NodeRef parentRef = pathPrimaryRef.getParentRef();
|
||||||
ChildAssociationRef pathARef = nodeService.createNode(
|
ChildAssociationRef pathARef = nodeService.createNode(
|
||||||
parentRef,
|
parentRef,
|
||||||
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
||||||
@@ -890,12 +891,34 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
|
|||||||
pathARef.getChildRef(),
|
pathARef.getChildRef(),
|
||||||
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
||||||
QName.createQName("pathB"));
|
QName.createQName("pathB"));
|
||||||
|
ChildAssociationRef pathCRef = nodeService.addChild(
|
||||||
|
parentRef,
|
||||||
|
pathARef.getChildRef(),
|
||||||
|
ASSOC_TYPE_QNAME_TEST_CHILDREN,
|
||||||
|
QName.createQName("pathC"));
|
||||||
|
|
||||||
// now remove the second association
|
// remove the path B association
|
||||||
boolean removed = nodeService.removeChildAssociation(pathBRef);
|
boolean removedB = nodeService.removeChildAssociation(pathBRef);
|
||||||
assertTrue("Association was not removed", removed);
|
assertTrue("Association was not removed", removedB);
|
||||||
removed = nodeService.removeChildAssociation(pathBRef);
|
removedB = nodeService.removeChildAssociation(pathBRef);
|
||||||
assertFalse("Non-existent association was apparently removed", removed);
|
assertFalse("Non-existent association was apparently removed", removedB);
|
||||||
|
|
||||||
|
// remove the path C association
|
||||||
|
boolean removedC = nodeService.removeChildAssociation(pathCRef);
|
||||||
|
assertTrue("Association was not removed", removedC);
|
||||||
|
removedC = nodeService.removeSeconaryChildAssociation(pathCRef);
|
||||||
|
assertFalse("Non-existent association was apparently removed", removedC);
|
||||||
|
|
||||||
|
// Now verify that primary associations are caught
|
||||||
|
try
|
||||||
|
{
|
||||||
|
nodeService.removeSeconaryChildAssociation(pathPrimaryRef);
|
||||||
|
fail("Primary association not detected");
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException e)
|
||||||
|
{
|
||||||
|
// Expected
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testRemoveChildByRef() throws Exception
|
public void testRemoveChildByRef() throws Exception
|
||||||
|
@@ -150,7 +150,8 @@ public class MLTranslationInterceptor implements MethodInterceptor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
ret = invocation.proceed();
|
ret = invocation.proceed();
|
||||||
}
|
}
|
||||||
|
@@ -296,11 +296,11 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
// Copy the incomming property map since we may need to modify it later
|
// Copy the incomming property map since we may need to modify it later
|
||||||
properties = new HashMap<QName, Serializable>(properties);
|
properties = new HashMap<QName, Serializable>(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke policy behaviour
|
// Invoke policy behaviour
|
||||||
invokeBeforeUpdateNode(parentRef);
|
invokeBeforeUpdateNode(parentRef);
|
||||||
invokeBeforeCreateNode(parentRef, assocTypeQName, assocQName, nodeTypeQName);
|
invokeBeforeCreateNode(parentRef, assocTypeQName, assocQName, nodeTypeQName);
|
||||||
invokeBeforeCreateNodeAssociation(parentRef, assocTypeQName, assocQName);
|
invokeBeforeCreateNodeAssociation(parentRef, assocTypeQName, assocQName);
|
||||||
|
|
||||||
// get the store that the parent belongs to
|
// get the store that the parent belongs to
|
||||||
StoreRef storeRef = parentRef.getStoreRef();
|
StoreRef storeRef = parentRef.getStoreRef();
|
||||||
@@ -352,16 +352,16 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
ChildAssociationRef childAssocRef = childAssoc.getChildAssocRef();
|
ChildAssociationRef childAssocRef = childAssoc.getChildAssocRef();
|
||||||
|
|
||||||
// Invoke policy behaviour
|
// Invoke policy behaviour
|
||||||
invokeOnCreateNode(childAssocRef);
|
invokeOnCreateNode(childAssocRef);
|
||||||
invokeOnCreateNodeAssociation(childAssocRef);
|
invokeOnCreateNodeAssociation(childAssocRef);
|
||||||
invokeOnUpdateNode(parentRef);
|
invokeOnUpdateNode(parentRef);
|
||||||
if (propertiesAfter != null)
|
if (propertiesAfter != null)
|
||||||
{
|
{
|
||||||
invokeOnUpdateProperties(childAssocRef.getChildRef(), propertiesBefore, propertiesAfter);
|
invokeOnUpdateProperties(childAssocRef.getChildRef(), propertiesBefore, propertiesAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
// done
|
// done
|
||||||
return childAssocRef;
|
return childAssocRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -464,8 +464,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
// invoke policy behaviour
|
// invoke policy behaviour
|
||||||
if (movingStore)
|
if (movingStore)
|
||||||
{
|
{
|
||||||
// TODO for now indicate that the node has been archived to prevent the version history from being removed
|
// TODO for now indicate that the node has been archived to prevent the version history from being removed
|
||||||
// in the future a onMove policy could be added and remove the need for onDelete and onCreate to be fired here
|
// in the future a onMove policy could be added and remove the need for onDelete and onCreate to be fired here
|
||||||
invokeOnDeleteNode(oldAssocRef, nodeToMoveTypeQName, nodeToMoveAspects, true);
|
invokeOnDeleteNode(oldAssocRef, nodeToMoveTypeQName, nodeToMoveAspects, true);
|
||||||
invokeOnCreateNode(newAssoc.getChildAssocRef());
|
invokeOnCreateNode(newAssoc.getChildAssocRef());
|
||||||
}
|
}
|
||||||
@@ -584,9 +584,9 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
// physically attach the aspect to the node
|
// physically attach the aspect to the node
|
||||||
if (node.getAspects().add(aspectTypeQName) == true)
|
if (node.getAspects().add(aspectTypeQName) == true)
|
||||||
{
|
{
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnUpdateNode(nodeRef);
|
invokeOnUpdateNode(nodeRef);
|
||||||
invokeOnAddAspect(nodeRef, aspectTypeQName);
|
invokeOnAddAspect(nodeRef, aspectTypeQName);
|
||||||
|
|
||||||
// update the node status
|
// update the node status
|
||||||
@@ -600,10 +600,10 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName)
|
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName)
|
||||||
throws InvalidNodeRefException, InvalidAspectException
|
throws InvalidNodeRefException, InvalidAspectException
|
||||||
{
|
{
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeBeforeUpdateNode(nodeRef);
|
invokeBeforeUpdateNode(nodeRef);
|
||||||
invokeBeforeRemoveAspect(nodeRef, aspectTypeQName);
|
invokeBeforeRemoveAspect(nodeRef, aspectTypeQName);
|
||||||
|
|
||||||
// get the aspect
|
// get the aspect
|
||||||
AspectDefinition aspectDef = dictionaryService.getAspect(aspectTypeQName);
|
AspectDefinition aspectDef = dictionaryService.getAspect(aspectTypeQName);
|
||||||
if (aspectDef == null)
|
if (aspectDef == null)
|
||||||
@@ -691,12 +691,12 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
public void deleteNode(NodeRef nodeRef)
|
public void deleteNode(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
boolean isArchivedNode = false;
|
boolean isArchivedNode = false;
|
||||||
boolean requiresDelete = false;
|
boolean requiresDelete = false;
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeBeforeDeleteNode(nodeRef);
|
invokeBeforeDeleteNode(nodeRef);
|
||||||
|
|
||||||
// get the node
|
// get the node
|
||||||
Node node = getNodeNotNull(nodeRef);
|
Node node = getNodeNotNull(nodeRef);
|
||||||
// get the primary parent-child relationship before it is gone
|
// get the primary parent-child relationship before it is gone
|
||||||
@@ -738,17 +738,17 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
archiveNode(nodeRef, archiveStoreRef);
|
archiveNode(nodeRef, archiveStoreRef);
|
||||||
isArchivedNode = true;
|
isArchivedNode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnDeleteNode(childAssocRef, nodeTypeQName, nodeAspectQNames, isArchivedNode);
|
invokeOnDeleteNode(childAssocRef, nodeTypeQName, nodeAspectQNames, isArchivedNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChildAssociationRef addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName assocQName)
|
public ChildAssociationRef addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName assocQName)
|
||||||
{
|
{
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeBeforeUpdateNode(parentRef);
|
invokeBeforeUpdateNode(parentRef);
|
||||||
invokeBeforeCreateChildAssociation(parentRef, childRef, assocTypeQName, assocQName);
|
invokeBeforeCreateChildAssociation(parentRef, childRef, assocTypeQName, assocQName);
|
||||||
|
|
||||||
// get the parent node and ensure that it is a container node
|
// get the parent node and ensure that it is a container node
|
||||||
Node parentNode = getNodeNotNull(parentRef);
|
Node parentNode = getNodeNotNull(parentRef);
|
||||||
// get the child node
|
// get the child node
|
||||||
@@ -769,10 +769,10 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
// this functionality is provided for free in getPath
|
// this functionality is provided for free in getPath
|
||||||
getPaths(childNodeRef, false);
|
getPaths(childNodeRef, false);
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnCreateChildAssociation(assocRef);
|
invokeOnCreateChildAssociation(assocRef);
|
||||||
invokeOnUpdateNode(parentRef);
|
invokeOnUpdateNode(parentRef);
|
||||||
|
|
||||||
return assoc.getChildAssocRef();
|
return assoc.getChildAssocRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -813,9 +813,9 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
deleteNode(primaryAssocRef.getChildRef());
|
deleteNode(primaryAssocRef.getChildRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnUpdateNode(parentRef);
|
invokeOnUpdateNode(parentRef);
|
||||||
|
|
||||||
// done
|
// done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,6 +836,31 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
return deleted;
|
return deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
|
||||||
|
{
|
||||||
|
Node parentNode = getNodeNotNull(childAssocRef.getParentRef());
|
||||||
|
Node childNode = getNodeNotNull(childAssocRef.getChildRef());
|
||||||
|
QName typeQName = childAssocRef.getTypeQName();
|
||||||
|
QName qname = childAssocRef.getQName();
|
||||||
|
ChildAssoc assoc = nodeDaoService.getChildAssoc(parentNode, childNode, typeQName, qname);
|
||||||
|
if (assoc == null)
|
||||||
|
{
|
||||||
|
// No association exists
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (assoc.getIsPrimary())
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"removeSeconaryChildAssociation can not be applied to a primary association: \n" +
|
||||||
|
" Child Assoc: " + assoc);
|
||||||
|
}
|
||||||
|
// Delete the secondary association
|
||||||
|
nodeDaoService.deleteChildAssoc(assoc, false);
|
||||||
|
invokeOnDeleteChildAssociation(childAssocRef);
|
||||||
|
// Done
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove properties that should not be persisted as general properties. Where necessary, the
|
* Remove properties that should not be persisted as general properties. Where necessary, the
|
||||||
* properties are set on the node.
|
* properties are set on the node.
|
||||||
@@ -965,7 +990,7 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
Node node = getNodeNotNull(nodeRef);
|
Node node = getNodeNotNull(nodeRef);
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeBeforeUpdateNode(nodeRef);
|
invokeBeforeUpdateNode(nodeRef);
|
||||||
|
|
||||||
// Do the set properties
|
// Do the set properties
|
||||||
Map<QName, Serializable> propertiesBefore = getPropertiesImpl(node);
|
Map<QName, Serializable> propertiesBefore = getPropertiesImpl(node);
|
||||||
@@ -973,8 +998,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
setChildUniqueName(node); // ensure uniqueness
|
setChildUniqueName(node); // ensure uniqueness
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnUpdateNode(nodeRef);
|
invokeOnUpdateNode(nodeRef);
|
||||||
invokeOnUpdateProperties(nodeRef, propertiesBefore, propertiesAfter);
|
invokeOnUpdateProperties(nodeRef, propertiesBefore, propertiesAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1027,8 +1052,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
Assert.notNull(qname);
|
Assert.notNull(qname);
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeBeforeUpdateNode(nodeRef);
|
invokeBeforeUpdateNode(nodeRef);
|
||||||
|
|
||||||
// get the node
|
// get the node
|
||||||
Node node = getNodeNotNull(nodeRef);
|
Node node = getNodeNotNull(nodeRef);
|
||||||
|
|
||||||
@@ -1041,8 +1066,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
setChildUniqueName(node); // ensure uniqueness
|
setChildUniqueName(node); // ensure uniqueness
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnUpdateNode(nodeRef);
|
invokeOnUpdateNode(nodeRef);
|
||||||
invokeOnUpdateProperties(nodeRef, propertiesBefore, propertiesAfter);
|
invokeOnUpdateProperties(nodeRef, propertiesBefore, propertiesAfter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1245,8 +1270,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
throws InvalidNodeRefException, AssociationExistsException
|
throws InvalidNodeRefException, AssociationExistsException
|
||||||
{
|
{
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeBeforeUpdateNode(sourceRef);
|
invokeBeforeUpdateNode(sourceRef);
|
||||||
|
|
||||||
Node sourceNode = getNodeNotNull(sourceRef);
|
Node sourceNode = getNodeNotNull(sourceRef);
|
||||||
Node targetNode = getNodeNotNull(targetRef);
|
Node targetNode = getNodeNotNull(targetRef);
|
||||||
// see if it exists
|
// see if it exists
|
||||||
@@ -1259,10 +1284,10 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
assoc = nodeDaoService.newNodeAssoc(sourceNode, targetNode, assocTypeQName);
|
assoc = nodeDaoService.newNodeAssoc(sourceNode, targetNode, assocTypeQName);
|
||||||
AssociationRef assocRef = assoc.getNodeAssocRef();
|
AssociationRef assocRef = assoc.getNodeAssocRef();
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnUpdateNode(sourceRef);
|
invokeOnUpdateNode(sourceRef);
|
||||||
invokeOnCreateAssociation(assocRef);
|
invokeOnCreateAssociation(assocRef);
|
||||||
|
|
||||||
return assocRef;
|
return assocRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1281,13 +1306,13 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
AssociationRef assocRef = assoc.getNodeAssocRef();
|
AssociationRef assocRef = assoc.getNodeAssocRef();
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeBeforeUpdateNode(sourceRef);
|
invokeBeforeUpdateNode(sourceRef);
|
||||||
|
|
||||||
// delete it
|
// delete it
|
||||||
nodeDaoService.deleteNodeAssoc(assoc);
|
nodeDaoService.deleteNodeAssoc(assoc);
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnUpdateNode(sourceRef);
|
invokeOnUpdateNode(sourceRef);
|
||||||
invokeOnDeleteAssociation(assocRef);
|
invokeOnDeleteAssociation(assocRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,55 +35,55 @@ import org.alfresco.service.namespace.QName;
|
|||||||
|
|
||||||
public class SingleNodeRefPolicyRuleTrigger extends RuleTriggerAbstractBase
|
public class SingleNodeRefPolicyRuleTrigger extends RuleTriggerAbstractBase
|
||||||
{
|
{
|
||||||
private static final String ERR_POLICY_NAME_NOT_SET = "Unable to register rule trigger since policy name has not been set.";
|
private static final String ERR_POLICY_NAME_NOT_SET = "Unable to register rule trigger since policy name has not been set.";
|
||||||
|
|
||||||
private String policyNamespace = NamespaceService.ALFRESCO_URI;
|
private String policyNamespace = NamespaceService.ALFRESCO_URI;
|
||||||
|
|
||||||
private String policyName;
|
private String policyName;
|
||||||
|
|
||||||
private boolean triggerParentRules = true;
|
private boolean triggerParentRules = true;
|
||||||
|
|
||||||
public void setPolicyNamespace(String policyNamespace)
|
public void setPolicyNamespace(String policyNamespace)
|
||||||
{
|
{
|
||||||
this.policyNamespace = policyNamespace;
|
this.policyNamespace = policyNamespace;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPolicyName(String policyName)
|
public void setPolicyName(String policyName)
|
||||||
{
|
{
|
||||||
this.policyName = policyName;
|
this.policyName = policyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTriggerParentRules(boolean triggerParentRules)
|
public void setTriggerParentRules(boolean triggerParentRules)
|
||||||
{
|
{
|
||||||
this.triggerParentRules = triggerParentRules;
|
this.triggerParentRules = triggerParentRules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerRuleTrigger()
|
public void registerRuleTrigger()
|
||||||
{
|
{
|
||||||
if (policyName == null)
|
if (policyName == null)
|
||||||
{
|
{
|
||||||
throw new RuleServiceException(ERR_POLICY_NAME_NOT_SET);
|
throw new RuleServiceException(ERR_POLICY_NAME_NOT_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
QName.createQName(this.policyNamespace, this.policyName),
|
QName.createQName(this.policyNamespace, this.policyName),
|
||||||
this,
|
this,
|
||||||
new JavaBehaviour(this, "policyBehaviour"));
|
new JavaBehaviour(this, "policyBehaviour"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void policyBehaviour(NodeRef nodeRef)
|
public void policyBehaviour(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
if (triggerParentRules == true)
|
if (triggerParentRules == true)
|
||||||
{
|
{
|
||||||
List<ChildAssociationRef> parentsAssocRefs = this.nodeService.getParentAssocs(nodeRef);
|
List<ChildAssociationRef> parentsAssocRefs = this.nodeService.getParentAssocs(nodeRef);
|
||||||
for (ChildAssociationRef parentAssocRef : parentsAssocRefs)
|
for (ChildAssociationRef parentAssocRef : parentsAssocRefs)
|
||||||
{
|
{
|
||||||
triggerRules(parentAssocRef.getParentRef(), nodeRef);
|
triggerRules(parentAssocRef.getParentRef(), nodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
triggerRules(nodeRef, nodeRef);
|
triggerRules(nodeRef, nodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -245,6 +245,14 @@ public class NodeServiceImpl implements NodeService, VersionModel
|
|||||||
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
|
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws UnsupportedOperationException always
|
||||||
|
*/
|
||||||
|
public boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef)
|
||||||
|
{
|
||||||
|
throw new UnsupportedOperationException(MSG_UNSUPPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws UnsupportedOperationException always
|
* @throws UnsupportedOperationException always
|
||||||
*/
|
*/
|
||||||
|
@@ -339,6 +339,16 @@ public interface NodeService
|
|||||||
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"childAssocRef"})
|
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"childAssocRef"})
|
||||||
public boolean removeChildAssociation(ChildAssociationRef childAssocRef);
|
public boolean removeChildAssociation(ChildAssociationRef childAssocRef);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a specific secondary child association.
|
||||||
|
*
|
||||||
|
* @param childAssocRef the association to remove
|
||||||
|
* @return Returns <tt>true</tt> if the association existed, otherwise <tt>false</tt>.
|
||||||
|
* @throws IllegalArgumentException if the association is primary
|
||||||
|
*/
|
||||||
|
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"childAssocRef"})
|
||||||
|
public boolean removeSeconaryChildAssociation(ChildAssociationRef childAssocRef);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeRef
|
* @param nodeRef
|
||||||
* @return Returns all properties keyed by their qualified name
|
* @return Returns all properties keyed by their qualified name
|
||||||
|
Reference in New Issue
Block a user