Merge from V3.3-BUG-FIX to HEAD

r. 22803 Merge from DEV/QUITE-RIGHT to HEAD (svn comment typo: should be to V3.3-BUG-FIX)
    r. 22802 Fix for ALF-5040 SiteService.getSite(NodeRef) does not return the correct SiteInfo.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22804 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Neil McErlean
2010-10-01 10:00:08 +00:00
parent 5de4783dee
commit b6bd5f427c
3 changed files with 16 additions and 5 deletions

View File

@@ -932,16 +932,17 @@ public class SiteServiceImpl implements SiteService, SiteModel
} }
/** /**
* Gets the site node reference for a particular node reference * This method gets the <code>st:site</code> NodeRef for the Share Site which contains the given NodeRef.
* If the given NodeRef is not contained within a Share Site, then <code>null</code> is returned.
* *
* @param nodeRef node reference * @param nodeRef the node whose containing site is to be found.
* @return NodeRef site node reference or null if node is not in a site * @return NodeRef site node reference or null if node is not in a site
*/ */
private NodeRef getSiteNodeRef(NodeRef nodeRef) private NodeRef getSiteNodeRef(NodeRef nodeRef)
{ {
NodeRef siteNodeRef = null; NodeRef siteNodeRef = null;
QName nodeRefType = nodeService.getType(nodeRef); QName nodeRefType = nodeService.getType(nodeRef);
if (dictionaryService.isSubClass(TYPE_SITE, nodeRefType) == true) if (dictionaryService.isSubClass(nodeRefType, TYPE_SITE) == true)
{ {
siteNodeRef = nodeRef; siteNodeRef = nodeRef;
} }

View File

@@ -564,6 +564,14 @@ public class SiteServiceImplTest extends BaseAlfrescoSpringTest
siteInfo = this.siteService.getSite("testGetSite"); siteInfo = this.siteService.getSite("testGetSite");
assertNotNull(siteInfo); assertNotNull(siteInfo);
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testGetSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC); checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testGetSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
// Create a path to content within the site
NodeRef container = siteService.createContainer(siteInfo.getShortName(), "folder.component", ContentModel.TYPE_FOLDER, null);
NodeRef content = nodeService.createNode(container, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS, ContentModel.TYPE_CONTENT).getChildRef();
// Get the site from the lower-level child node.
siteInfo = siteService.getSite(content);
checkSiteInfo(siteInfo, TEST_SITE_PRESET, "testGetSite", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC);
} }
public void testUpdateSite() public void testUpdateSite()

View File

@@ -116,9 +116,11 @@ public interface SiteService
SiteInfo getSite(String shortName); SiteInfo getSite(String shortName);
/** /**
* This method gets the {@link SiteInfo} for the Share Site which contains the given NodeRef.
* If the given NodeRef is not contained within a Share Site, then <code>null</code> is returned.
* *
* @param nodeRef * @param nodeRef the node whose containing site's info is to be found.
* @return * @return SiteInfo site information for the containing site or <code>null</code> if node is not in a site.
*/ */
@NotAuditable @NotAuditable
SiteInfo getSite(NodeRef nodeRef); SiteInfo getSite(NodeRef nodeRef);