mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Coding standards
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22726 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -176,6 +176,7 @@ public class TaggingServiceImpl implements TaggingService,
|
|||||||
OnCreateNodePolicy.QNAME,
|
OnCreateNodePolicy.QNAME,
|
||||||
ContentModel.ASPECT_TAGGABLE,
|
ContentModel.ASPECT_TAGGABLE,
|
||||||
createTagBehaviour);
|
createTagBehaviour);
|
||||||
|
|
||||||
// We need to register on content and folders, rather than
|
// We need to register on content and folders, rather than
|
||||||
// tagable, so we can pick up when things start and
|
// tagable, so we can pick up when things start and
|
||||||
// stop being tagged
|
// stop being tagged
|
||||||
@@ -243,7 +244,7 @@ public class TaggingServiceImpl implements TaggingService,
|
|||||||
nodeQueuedUpdates.remove(tag);
|
nodeQueuedUpdates.remove(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateTagScope(parentNodeRef, tagUpdates, false);
|
updateTagScope(parentNodeRef, tagUpdates, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,66 +262,72 @@ public class TaggingServiceImpl implements TaggingService,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fired once per node, before a copy overrides one node
|
* Fired once per node, before a copy overrides one node (which is possibly newly created) with the contents
|
||||||
* (which is possibly newly created) with the contents
|
* of another one.
|
||||||
* of another one.
|
* We should remove any tags from the scope, as they'll shortly be overwritten.
|
||||||
* We should remove any tags from the scope, as they'll
|
|
||||||
* shortly be overwritten.
|
|
||||||
*/
|
*/
|
||||||
public void beforeCopy(QName classRef, NodeRef sourceNodeRef,
|
public void beforeCopy(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef)
|
||||||
NodeRef targetNodeRef) {
|
{
|
||||||
if(this.nodeService.hasAspect(targetNodeRef, ContentModel.ASPECT_TAGGABLE)) {
|
if (this.nodeService.hasAspect(targetNodeRef, ContentModel.ASPECT_TAGGABLE))
|
||||||
updateAllScopeTags(targetNodeRef, Boolean.FALSE);
|
{
|
||||||
}
|
updateAllScopeTags(targetNodeRef, Boolean.FALSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fired once per node that was copied, after the copy
|
* Fired once per node that was copied, after the copy has completed.
|
||||||
* has completed.
|
|
||||||
* We need to add in all the tags to the scope.
|
* We need to add in all the tags to the scope.
|
||||||
*/
|
*/
|
||||||
public void onCopyComplete(QName classRef, NodeRef sourceNodeRef,
|
public void onCopyComplete(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef, boolean copyToNewNode,
|
||||||
NodeRef targetNodeRef, boolean copyToNewNode,
|
Map<NodeRef, NodeRef> copyMap)
|
||||||
Map<NodeRef, NodeRef> copyMap) {
|
{
|
||||||
if(this.nodeService.hasAspect(targetNodeRef, ContentModel.ASPECT_TAGGABLE)) {
|
if (this.nodeService.hasAspect(targetNodeRef, ContentModel.ASPECT_TAGGABLE))
|
||||||
updateAllScopeTags(targetNodeRef, Boolean.TRUE);
|
{
|
||||||
}
|
updateAllScopeTags(targetNodeRef, Boolean.TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMoveNode(ChildAssociationRef oldChildAssocRef,
|
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
|
||||||
ChildAssociationRef newChildAssocRef) {
|
{
|
||||||
NodeRef oldRef = oldChildAssocRef.getChildRef();
|
NodeRef oldRef = oldChildAssocRef.getChildRef();
|
||||||
NodeRef oldParent = oldChildAssocRef.getParentRef();
|
NodeRef oldParent = oldChildAssocRef.getParentRef();
|
||||||
NodeRef newRef = newChildAssocRef.getChildRef();
|
NodeRef newRef = newChildAssocRef.getChildRef();
|
||||||
NodeRef newParent = newChildAssocRef.getParentRef();
|
NodeRef newParent = newChildAssocRef.getParentRef();
|
||||||
|
|
||||||
// Do nothing if it's a "rename" not a move
|
// Do nothing if it's a "rename" not a move
|
||||||
if(oldParent.equals(newParent)) {
|
if (oldParent.equals(newParent))
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// It has moved somewhere
|
// It has moved somewhere
|
||||||
// Remove the tags from the old location
|
// Remove the tags from the old location
|
||||||
if(this.nodeService.hasAspect(oldRef, ContentModel.ASPECT_TAGGABLE)) {
|
if (this.nodeService.hasAspect(oldRef, ContentModel.ASPECT_TAGGABLE))
|
||||||
// Use the parent we were passed in, rather than re-fetching
|
{
|
||||||
// via the node, as we need to reference the old scope!
|
// Use the parent we were passed in, rather than re-fetching
|
||||||
ChildAssociationRef scopeParent;
|
// via the node, as we need to reference the old scope!
|
||||||
if(oldChildAssocRef.isPrimary()) {
|
ChildAssociationRef scopeParent;
|
||||||
scopeParent = oldChildAssocRef;
|
if (oldChildAssocRef.isPrimary())
|
||||||
} else {
|
{
|
||||||
scopeParent = this.nodeService.getPrimaryParent(oldParent);
|
scopeParent = oldChildAssocRef;
|
||||||
}
|
}
|
||||||
if(scopeParent != null) {
|
else
|
||||||
updateAllScopeTags(oldRef, scopeParent.getParentRef(), Boolean.FALSE);
|
{
|
||||||
}
|
scopeParent = this.nodeService.getPrimaryParent(oldParent);
|
||||||
}
|
}
|
||||||
// Add the tags at its new location
|
if (scopeParent != null)
|
||||||
if(this.nodeService.hasAspect(newRef, ContentModel.ASPECT_TAGGABLE)) {
|
{
|
||||||
updateAllScopeTags(newRef, Boolean.TRUE);
|
updateAllScopeTags(oldRef, scopeParent.getParentRef(), Boolean.FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Add the tags at its new location
|
||||||
|
if (this.nodeService.hasAspect(newRef, ContentModel.ASPECT_TAGGABLE))
|
||||||
|
{
|
||||||
|
updateAllScopeTags(newRef, Boolean.TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void createTags(ChildAssociationRef childAssocRef)
|
public void createTags(ChildAssociationRef childAssocRef)
|
||||||
{
|
{
|
||||||
NodeRef nodeRef = childAssocRef.getChildRef();
|
NodeRef nodeRef = childAssocRef.getChildRef();
|
||||||
Map<QName, Serializable> before = new HashMap<QName, Serializable>(0);
|
Map<QName, Serializable> before = new HashMap<QName, Serializable>(0);
|
||||||
@@ -390,9 +397,7 @@ public class TaggingServiceImpl implements TaggingService,
|
|||||||
public boolean isTag(StoreRef storeRef, String tag)
|
public boolean isTag(StoreRef storeRef, String tag)
|
||||||
{
|
{
|
||||||
// Lower the case of the tag
|
// Lower the case of the tag
|
||||||
tag = tag.toLowerCase();
|
return (getTagNodeRef(storeRef, tag.toLowerCase()) != null);
|
||||||
|
|
||||||
return (getTagNodeRef(storeRef, tag) != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user