Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

64429: Merged WAT1 (4.3/Cloud) to HEAD-BUG-FIX (4.3/Cloud)
      62555: ACE-493, ACE-503 and ACE-511: Modified sites service APIs to support Manage Sites feature.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@64575 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-03-15 01:43:38 +00:00
parent eac1a27791
commit d8e85072a4
5 changed files with 319 additions and 148 deletions

View File

@@ -19,6 +19,7 @@
package org.alfresco.repo.site.script;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -272,7 +273,27 @@ public class Site implements Serializable
}
/**
* Saves any outstanding updates to the site details.
* Get the site created date
*
* @return <code>Date</code> site created date
*/
public Date getCreatedDate()
{
return this.siteInfo.getCreatedDate();
}
/**
* Get the site last modified date
*
* @return <code>Date</code> site last modified date
*/
public Date getLastModifiedDate()
{
return this.siteInfo.getLastModifiedDate();
}
/**
* Saves any outstanding updates to the site details.
* <p>
* If properties of the site are changed and save is not called, those changes will be lost.
*/
@@ -280,9 +301,23 @@ public class Site implements Serializable
{
if (this.isDirty == true)
{
// Update the site details
this.siteService.updateSite(this.siteInfo);
if (siteService.isSiteAdmin(AuthenticationUtil.getFullyAuthenticatedUser()))
{
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
{
public Void doWork() throws Exception
{
// Update the site details as a site-admin
siteService.updateSite(siteInfo);
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
else
{
// Update the site details
this.siteService.updateSite(this.siteInfo);
}
// Reset the dirty flag
this.isDirty = false;
}
@@ -293,8 +328,23 @@ public class Site implements Serializable
*/
public void deleteSite()
{
// Delete the site
this.siteService.deleteSite(this.siteInfo.getShortName());
if (siteService.isSiteAdmin(AuthenticationUtil.getFullyAuthenticatedUser()))
{
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>()
{
public Void doWork() throws Exception
{
// Delete the site
siteService.deleteSite(siteInfo.getShortName());
return null;
}
}, AuthenticationUtil.getSystemUserName());
}
else
{
// Delete the site
this.siteService.deleteSite(this.siteInfo.getShortName());
}
}
/**