+ * Can optionally remove the hidden and index control aspects if the name of a node no longer matches the filter. * * @param fileInfo * @param both if true, will check if the node should not be hidden and remove hidden and index control @@ -467,9 +515,9 @@ public class HiddenAspect * Hides the node by applying the hidden and not indexed aspects. The node will be hidden from clients * according to the visibility mask. * - * @param client - * @param fileInfo - * @return + * @see getClientVisibilityMask() + * @param fileInfo, file to make hidden + * @param visibilityMask */ public void hideNode(FileInfoImpl fileInfo, int visibilityMask) { @@ -478,16 +526,30 @@ public class HiddenAspect } /** - * Checks whether the file should be hidden and applies the hidden and not indexed aspects if so. + * Checks whether the file should be hidden based upon whether its name maches a set of filters and applies the hidden + * and not indexed aspects if so. + *
+ * Can optionally remove the hidden and index control aspects if the name of a node no longer matches the filter.
*
* @param nodeRef
* @param both if true, will check both if the node should not be hidden and remove hidden and index control
* aspects if they are present, and if the node should be hidden and add hidden and index control
* aspects if they are not present.
- * @return
+ * @return HiddenFileInfo
*/
public HiddenFileInfo checkHidden(NodeRef nodeRef, boolean both)
- {
+ {
+ if(nodeService.hasAspect(nodeRef, ContentModel.ASPECT_HIDDEN))
+ {
+ Boolean isHiddenFlag = (Boolean)nodeService.getProperty(nodeRef, ContentModel.PROP_HIDDEN_FLAG);
+ if(isHiddenFlag != null && isHiddenFlag)
+ {
+ logger.debug("node has hidden flag set");
+ // node has hidden flag - we are not going to change anything.
+ return null;
+ }
+ }
+
HiddenFileInfo filter = findMatch(nodeRef);
if(filter != null)
{
@@ -496,7 +558,7 @@ public class HiddenAspect
if(!hasHiddenAspect(nodeRef))
{
// the file matches a pattern, apply the hidden and aspect control aspects
- addHiddenAspect(nodeRef, visibilityMask);
+ addHiddenAspect(nodeRef, visibilityMask, false);
}
if(!hasIndexControlAspect(nodeRef))
diff --git a/source/java/org/alfresco/repo/model/filefolder/HiddenAspectTest.java b/source/java/org/alfresco/repo/model/filefolder/HiddenAspectTest.java
index bf7a1e0205..bfeae3a550 100644
--- a/source/java/org/alfresco/repo/model/filefolder/HiddenAspectTest.java
+++ b/source/java/org/alfresco/repo/model/filefolder/HiddenAspectTest.java
@@ -546,6 +546,64 @@ public class HiddenAspectTest
interceptor.setEnabled(true);
}
}
+
+
+ @Test
+ public void testHideNodeExplicit() throws Exception
+ {
+ FileFilterMode.setClient(Client.cifs);
+ try
+ {
+ // check temporary file
+ NodeRef parent = fileFolderService.create(topNodeRef, "New Folder", ContentModel.TYPE_FOLDER).getNodeRef();
+ NodeRef childA = fileFolderService.create(parent, "fileA", ContentModel.TYPE_CONTENT).getNodeRef();
+ NodeRef childB = fileFolderService.create(parent, "Thumbs.db", ContentModel.TYPE_CONTENT).getNodeRef();
+ hiddenAspect.hideNodeExplicit(childA);
+
+ // Nodes A and B should be hidden, one by pattern, one explicit
+ assertTrue("node a should be hidden", nodeService.hasAspect(childA, ContentModel.ASPECT_HIDDEN));
+// assertFalse("node b should be hidden", nodeService.hasAspect(childB, ContentModel.ASPECT_HIDDEN));
+
+ {
+ List