Merged 5.2.N (5.2.1) to HEAD (5.2)

131224 mward: REPO-1348: initial check-in for "update site" API implementation.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@132224 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-11-03 13:32:15 +00:00
parent a9655d73e9
commit 80daf219db
6 changed files with 340 additions and 1 deletions

View File

@@ -1137,6 +1137,41 @@ public class SitesImpl implements Sites
return getSite(siteInfo, true);
}
@Override
public Site updateSite(String siteId, Site update, Parameters parameters)
{
if (logger.isDebugEnabled())
{
logger.debug("Updating site, ID: "+siteId+", site data: "+update+", parameters: "+parameters);
}
SiteInfo siteInfo = validateSite(siteId);
if (siteInfo == null)
{
// site does not exist
throw new EntityNotFoundException(siteId);
}
// Although this method will not update the site ID even if it is provided, we sanity
// check that no attempt is being made to alter it.
if (update.getId() != null && (!update.getId().equals(siteId)))
{
throw new InvalidArgumentException("Site updates cannot change the site ID");
}
siteInfo.setTitle(update.getTitle());
siteInfo.setDescription(update.getDescription());
siteInfo.setVisibility(update.getVisibility());
// Validate the new details
validateSite(new Site(siteInfo, null));
// Perform the actual update.
siteService.updateSite(siteInfo);
return getSite(siteId);
}
private Site validateSite(Site site)
{
// site title - mandatory