Fixed problem where URL pseudo files would occasionally not be added to the folder listing.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2341 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gary Spencer
2006-02-10 15:46:08 +00:00
parent be2837cc0f
commit 902293d12a
2 changed files with 49 additions and 33 deletions

View File

@@ -653,30 +653,41 @@ public class ContentDiskDriver implements DiskInterface, IOCtlInterface
paths = FileName.splitPath(searchPath); paths = FileName.splitPath(searchPath);
if ( paths[0] != null && paths[0].length() > 1) if ( paths[0] != null && paths[0].length() > 1)
{ {
// Find the node ref for the folder being searched
NodeRef nodeRef = getNodeForPath(tree, paths[0]);
// Get the file state for the folder being searched // Get the file state for the folder being searched
searchFolderState = getStateForPath(tree, paths[0]); searchFolderState = getStateForPath(tree, paths[0]);
if ( searchFolderState == null) if ( searchFolderState == null)
{
// Create a file state for the folder
searchFolderState = ctx.getStateTable().findFileState( paths[0], true, true); searchFolderState = ctx.getStateTable().findFileState( paths[0], true, true);
}
// Make sure the associated node is set
if ( searchFolderState.hasNodeRef() == false)
{
// Set the associated node for the folder
searchFolderState.setNodeRef( nodeRef);
}
// Add pseudo files to the folder being searched // Add pseudo files to the folder being searched
if ( hasPseudoFileInterface()) if ( hasPseudoFileInterface())
getPseudoFileInterface().addPseudoFilesToFolder( sess, tree, paths[0]); getPseudoFileInterface().addPseudoFilesToFolder( sess, tree, paths[0]);
// Find the node ref for the folder being searched // Set the search node and file spec
NodeRef nodeRef = getNodeForPath(tree, paths[0]);
if ( nodeRef != null) if ( nodeRef != null)
{ {
searchRootNodeRef = nodeRef; searchRootNodeRef = nodeRef;
searchFileSpec = paths[1]; searchFileSpec = paths[1];
// Make sure the node ref is stored in the file state
searchFolderState.setNodeRef( nodeRef);
// DEBUG // DEBUG
if ( logger.isDebugEnabled()) if ( logger.isDebugEnabled())

View File

@@ -161,34 +161,39 @@ public class ContentPseudoFileImpl implements PseudoFileInterface
// Add the URL link pseudo file, if enabled // Add the URL link pseudo file, if enabled
if ( isCIFS && ctx.hasURLFile() && fstate.getNodeRef() != null) if ( isCIFS && ctx.hasURLFile())
{ {
// Build the URL file data // Make sure the state has the associated node details
StringBuilder urlStr = new StringBuilder();
urlStr.append("[InternetShortcut]\r\n");
urlStr.append("URL=");
urlStr.append(ctx.getURLPrefix());
urlStr.append("navigate/browse/workspace/SpacesStore/");
urlStr.append( fstate.getNodeRef().getId());
urlStr.append("\r\n");
// Create the in memory pseudo file for the URL link
byte[] urlData = urlStr.toString().getBytes(); if ( fstate.getNodeRef() != null)
{
// Build the URL file data
StringBuilder urlStr = new StringBuilder();
MemoryPseudoFile urlFile = new MemoryPseudoFile( ctx.getURLFileName(), urlData); urlStr.append("[InternetShortcut]\r\n");
fstate.addPseudoFile( urlFile); urlStr.append("URL=");
urlStr.append(ctx.getURLPrefix());
// Update the count of files added urlStr.append("navigate/browse/workspace/SpacesStore/");
urlStr.append( fstate.getNodeRef().getId());
pseudoCnt++; urlStr.append("\r\n");
// DEBUG // Create the in memory pseudo file for the URL link
if ( logger.isInfoEnabled()) byte[] urlData = urlStr.toString().getBytes();
logger.info("Added URL link pseudo file for " + path);
MemoryPseudoFile urlFile = new MemoryPseudoFile( ctx.getURLFileName(), urlData);
fstate.addPseudoFile( urlFile);
// Update the count of files added
pseudoCnt++;
// DEBUG
if ( logger.isInfoEnabled())
logger.info("Added URL link pseudo file for " + path);
}
} }
// Return the count of pseudo files added // Return the count of pseudo files added