mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Site Service CRUD API's (Java, JavaScript and REST), unit test methods added to JS API to help unit test JS API's
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8986 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -27,6 +27,7 @@ package org.alfresco.repo.site.script;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.alfresco.repo.site.SiteInfo;
|
||||
import org.alfresco.repo.site.SiteService;
|
||||
|
||||
/**
|
||||
* @author Roy Wetherall
|
||||
@@ -34,42 +35,133 @@ import org.alfresco.repo.site.SiteInfo;
|
||||
public class Site implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 8013569574120957923L;
|
||||
|
||||
|
||||
/** Site information */
|
||||
private SiteInfo siteInfo;
|
||||
|
||||
public Site(SiteInfo siteInfo)
|
||||
/** Site service */
|
||||
private SiteService siteService;
|
||||
|
||||
/** Indicates whether there are any outstanding changes that need to be saved */
|
||||
private boolean isDirty = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param siteInfo site information
|
||||
*/
|
||||
/*package*/ Site(SiteService siteService, SiteInfo siteInfo)
|
||||
{
|
||||
this.siteService = siteService;
|
||||
this.siteInfo = siteInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the site preset
|
||||
*
|
||||
* @return String the site preset
|
||||
*/
|
||||
public String getSitePreset()
|
||||
{
|
||||
return this.siteInfo.getSitePreset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the short name
|
||||
*
|
||||
* @return String the short name
|
||||
*/
|
||||
public String getShortName()
|
||||
{
|
||||
return this.siteInfo.getShortName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the title
|
||||
*
|
||||
* @return String the site title
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return this.siteInfo.getTitle();
|
||||
}
|
||||
|
||||
// TODO set title
|
||||
/**
|
||||
* Set the title
|
||||
*
|
||||
* @param title the title
|
||||
*/
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.isDirty = true;
|
||||
this.siteInfo.setTitle(title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the description
|
||||
*
|
||||
* @return String the description
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return this.siteInfo.getDescription();
|
||||
}
|
||||
|
||||
// TODO set description
|
||||
/**
|
||||
* Set the description
|
||||
*
|
||||
* @param description the description
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.isDirty = true;
|
||||
this.siteInfo.setDescription(description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether the site is public or not
|
||||
*
|
||||
* @return true is public false otherwise
|
||||
*/
|
||||
public boolean getIsPublic()
|
||||
{
|
||||
return this.siteInfo.getIsPublic();
|
||||
}
|
||||
|
||||
// TODO set isPublic
|
||||
/**
|
||||
* Set whether the site is public or not
|
||||
*
|
||||
* @param isPublic true the site is public false otherwise
|
||||
*/
|
||||
public void setIsPublic(boolean isPublic)
|
||||
{
|
||||
this.isDirty = true;
|
||||
this.siteInfo.setIsPublic(isPublic);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public void save()
|
||||
{
|
||||
if (this.isDirty == true)
|
||||
{
|
||||
// Update the site details
|
||||
this.siteService.updateSite(this.siteInfo);
|
||||
|
||||
// Reset the dirty flag
|
||||
this.isDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the site
|
||||
*/
|
||||
public void deleteSite()
|
||||
{
|
||||
// Delete the site
|
||||
this.siteService.deleteSite(this.siteInfo.getShortName());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user