From 56f6c38b22eb952acacf838aceac133c94ca0a0c Mon Sep 17 00:00:00 2001 From: Gary Spencer Date: Fri, 9 Apr 2010 08:41:54 +0000 Subject: [PATCH] Fix for working copy checked out via CIFS is not accessible until FileStateReaper expires file state. ALF-962. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19783 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/desk/CheckInOutDesktopAction.java | 59 ++++++++++++------- 1 file changed, 37 insertions(+), 22 deletions(-) diff --git a/source/java/org/alfresco/filesys/repo/desk/CheckInOutDesktopAction.java b/source/java/org/alfresco/filesys/repo/desk/CheckInOutDesktopAction.java index 4cac2d1e33..ba9149603d 100644 --- a/source/java/org/alfresco/filesys/repo/desk/CheckInOutDesktopAction.java +++ b/source/java/org/alfresco/filesys/repo/desk/CheckInOutDesktopAction.java @@ -1,20 +1,21 @@ /* - * Copyright (C) 2005-2010 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . */ + * Copyright (C) 2005-2010 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ package org.alfresco.filesys.repo.desk; import java.io.Serializable; @@ -25,13 +26,15 @@ import org.alfresco.filesys.alfresco.DesktopAction; import org.alfresco.filesys.alfresco.DesktopParams; import org.alfresco.filesys.alfresco.DesktopResponse; import org.alfresco.filesys.alfresco.DesktopTarget; +import org.alfresco.filesys.state.FileState; +import org.alfresco.filesys.state.FileStateTable; import org.alfresco.jlan.server.filesys.FileName; +import org.alfresco.jlan.server.filesys.FileStatus; import org.alfresco.jlan.server.filesys.NotifyChange; import org.alfresco.model.ContentModel; import org.alfresco.service.cmr.coci.CheckOutCheckInService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.transaction.TransactionService; /** * Check In/Out Desktop Action Class @@ -102,7 +105,7 @@ public class CheckInOutDesktopAction extends DesktopAction { { try { - // Check in the file, pass an empty version properties so that veriosnable nodes create a new version + // Check in the file, pass an empty version properties so that versionable nodes create a new version Map versionProperties = new HashMap(); getCheckInOutService().checkin( target.getNode(), versionProperties, null, false); @@ -174,14 +177,26 @@ public class CheckInOutDesktopAction extends DesktopAction { response.setStatus(StsSuccess, "Checked out working copy " + workingCopyName); + // Build the relative path to the checked out file + + String fileName = FileName.buildPath( params.getFolder().getFullName(), null, workingCopyName, FileName.DOS_SEPERATOR); + + // Update cached state for the working copy to indicate the file exists + + FileStateTable stateTable = getContext().getStateTable(); + if ( stateTable != null) { + + // Update any cached state for the working copy file + + FileState fstate = stateTable.findFileState( fileName); + if ( fstate != null) + fstate.setFileStatus( FileStatus.FileExists); + } + // Check if there are any file/directory change notify requests active if ( getContext().hasChangeHandler()) { - // Build the relative path to the checked in file - - String fileName = FileName.buildPath( params.getFolder().getFullName(), null, workingCopyName, FileName.DOS_SEPERATOR); - // Queue a file added change notification getContext().getChangeHandler().notifyFileChanged(NotifyChange.ActionAdded, fileName);