diff --git a/source/java/org/alfresco/web/bean/NavigationBean.java b/source/java/org/alfresco/web/bean/NavigationBean.java index 1c7297beda..964eef1a25 100644 --- a/source/java/org/alfresco/web/bean/NavigationBean.java +++ b/source/java/org/alfresco/web/bean/NavigationBean.java @@ -21,7 +21,6 @@ package org.alfresco.web.bean; import java.io.Serializable; import java.text.MessageFormat; import java.util.ArrayList; -import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,13 +31,9 @@ import javax.faces.context.FacesContext; import javax.faces.event.ActionEvent; import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.filesys.repo.ContentContext; import org.alfresco.filesys.repo.ContentDiskInterface; import org.alfresco.jlan.server.config.ServerConfigurationAccessor; -import org.alfresco.jlan.server.core.SharedDevice; -import org.alfresco.jlan.server.core.SharedDeviceList; import org.alfresco.jlan.server.filesys.DiskSharedDevice; -import org.alfresco.jlan.server.filesys.FilesystemsConfigSection; import org.alfresco.model.ContentModel; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; @@ -52,7 +47,6 @@ import org.alfresco.service.cmr.repository.FileTypeImageSize; import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.Path; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.TemplateImageResolver; import org.alfresco.service.cmr.repository.TemplateService; @@ -75,6 +69,7 @@ import org.alfresco.web.bean.spaces.SpaceDetailsDialog; import org.alfresco.web.bean.users.UserPreferencesBean; import org.alfresco.web.config.ClientConfigElement; import org.alfresco.web.ui.common.Utils; +import org.alfresco.web.ui.common.Utils.URLMode; import org.alfresco.web.ui.common.component.IBreadcrumbHandler; import org.alfresco.web.ui.common.component.UIBreadcrumb; import org.alfresco.web.ui.common.component.UIModeList; @@ -752,42 +747,9 @@ public class NavigationBean implements Serializable } String icon = (String)props.get("app:icon"); props.put("icon", icon != null ? icon : CreateSpaceWizard.DEFAULT_SPACE_ICON_NAME); - Path path = node.getNodePath(); - - // resolve CIFS network folder location for this node - FilesystemsConfigSection filesysConfig = (FilesystemsConfigSection)getServerConfiguration().getConfigSection(FilesystemsConfigSection.SectionName); - DiskSharedDevice diskShare = null; - - SharedDeviceList shares = filesysConfig.getShares(); - Enumeration shareEnum = shares.enumerateShares(); - - while (shareEnum.hasMoreElements() && diskShare == null) - { - SharedDevice curShare = shareEnum.nextElement(); - if (curShare.getContext() instanceof ContentContext) - { - diskShare = (DiskSharedDevice)curShare; - } - } - - if (diskShare != null) - { - ContentContext contentCtx = (ContentContext) diskShare.getContext(); - NodeRef rootNode = contentCtx.getRootNode(); - try - { - String cifsPath = Repository.getNamePath(this.getNodeService(), path, rootNode, "\\", "file:///" + getCIFSServerPath(diskShare)); - - node.getProperties().put("cifsPath", cifsPath); - node.getProperties().put("cifsPathLabel", cifsPath.substring(8)); // strip file:/// part - } - catch(AccessDeniedException ade) - { - node.getProperties().put("cifsPath", ""); - node.getProperties().put("cifsPathLabel",""); // strip file:/// part - } - } - + String cifsPath = Utils.generateURL(FacesContext.getCurrentInstance(), node, URLMode.CIFS); + node.getProperties().put("cifsPath", cifsPath == null ? "" : cifsPath); + node.getProperties().put("cifsPathLabel", cifsPath == null ? "" : cifsPath.substring(8)); // strip file:/// part this.currentNode = node; } diff --git a/source/java/org/alfresco/web/forms/xforms/XFormsBean.java b/source/java/org/alfresco/web/forms/xforms/XFormsBean.java index 74acc0ca56..1406483093 100644 --- a/source/java/org/alfresco/web/forms/xforms/XFormsBean.java +++ b/source/java/org/alfresco/web/forms/xforms/XFormsBean.java @@ -355,12 +355,11 @@ public class XFormsBean implements Serializable if (LOGGER.isDebugEnabled()) LOGGER.debug(this + ".setXFormsValue(" + id + ", " + value + ")"); - readLock.lock(); - final ChibaBean chibaBean = this.xformsSession.chibaBean; - readLock.unlock(); writeLock.lock(); try { + final ChibaBean chibaBean = this.xformsSession.chibaBean; + if (chibaBean.getContainer().lookup(id) instanceof Upload) { chibaBean.updateControlValue(id, null, value, value.getBytes("UTF-8")); @@ -495,7 +494,7 @@ public class XFormsBean implements Serializable if (LOGGER.isDebugEnabled()) LOGGER.debug(this + ".swapRepeatItems(" + fromItemId + ", " + toItemId + ")"); - readLock.lock(); + writeLock.lock(); try { final ChibaBean chibaBean = this.xformsSession.chibaBean; @@ -509,19 +508,13 @@ public class XFormsBean implements Serializable { throw new NullPointerException("unable to find destination repeat item " + toItemId); } - readLock.unlock(); - writeLock.lock(); + this.swapRepeatItems(from, to); final ResponseWriter out = context.getResponseWriter(); XMLUtil.print(this.getEventLog(), out); out.close(); } - catch (NullPointerException e) - { - readLock.unlock(); - throw e; - } finally { writeLock.unlock(); diff --git a/source/java/org/alfresco/web/ui/common/Utils.java b/source/java/org/alfresco/web/ui/common/Utils.java index 6cabefce9a..6c8f74368e 100644 --- a/source/java/org/alfresco/web/ui/common/Utils.java +++ b/source/java/org/alfresco/web/ui/common/Utils.java @@ -54,6 +54,7 @@ import org.alfresco.repo.search.impl.lucene.AbstractLuceneQueryParser; import org.alfresco.repo.security.permissions.AccessDeniedException; import org.alfresco.repo.webdav.WebDAVHelper; import org.alfresco.repo.webdav.WebDAVServlet; +import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.model.FileInfo; @@ -388,13 +389,15 @@ public final class Utils extends StringUtils // calculate a CIFS path for the given node // get hold of the node service, cifsServer and navigation bean - NodeService nodeService = Repository.getServiceRegistry(context).getNodeService(); + ServiceRegistry serviceRegistry = Repository.getServiceRegistry(context); + NodeService nodeService = serviceRegistry.getNodeService(); + FileFolderService fileFolderService = serviceRegistry.getFileFolderService(); NavigationBean navBean = (NavigationBean)context.getExternalContext(). getSessionMap().get(NavigationBean.BEAN_NAME); ServerConfigurationAccessor serverConfiguration = (ServerConfigurationAccessor)FacesContextUtils.getRequiredWebApplicationContext( context).getBean("fileServerConfiguration"); - if (nodeService != null && navBean != null && serverConfiguration != null) + if (nodeService != null && fileFolderService != null && navBean != null && serverConfiguration != null) { // Resolve CIFS network folder location for this node FilesystemsConfigSection filesysConfig = (FilesystemsConfigSection)serverConfiguration.getConfigSection(FilesystemsConfigSection.SectionName); @@ -403,13 +406,39 @@ public final class Utils extends StringUtils SharedDeviceList shares = filesysConfig.getShares(); Enumeration shareEnum = shares.enumerateShares(); - while (shareEnum.hasMoreElements() && diskShare == null) - { - SharedDevice curShare = shareEnum.nextElement(); - if (curShare.getContext() instanceof ContentContext) - { - diskShare = (DiskSharedDevice)curShare; - } + while (shareEnum.hasMoreElements() && diskShare == null) + { + SharedDevice curShare = shareEnum.nextElement(); + if (curShare.getContext() instanceof ContentContext) + { + // ALF-6863: Check if the node has a path beneath contentContext.getRootNode() + ContentContext contentContext = (ContentContext) curShare.getContext(); + NodeRef rootNode = contentContext.getRootNode(); + if (node.getNodeRef().equals(rootNode)) + { + diskShare = (DiskSharedDevice) curShare; + break; + } + try + { + fileFolderService.getNamePath(rootNode, node.getNodeRef()); + if (logger.isDebugEnabled()) + { + logger.debug(" Node " + node.getName() + " HAS been found on " + contentContext.getDeviceName()); + } + diskShare = (DiskSharedDevice) curShare; + break; + } + catch (FileNotFoundException ex) + { + if (logger.isDebugEnabled()) + { + logger.debug(" Node " + node.getName() + " HAS NOT been found on " + contentContext.getDeviceName()); + } + // There is no such node on this SharedDevice, continue + continue; + } + } } if (diskShare != null)