Server tasks

Creating a site

A website may be created only inside an organization. Nevertheless, the « createSite » method builds and assigns to the website a document space that groups every images and files.

public void server_createSite( ISiteModule siteModule, IContext context ) throws SiteModuleException
{
        // site creation
        IOrganization organization = null;
        ISite site = siteModule.createSite( context, organization, "test-site" );

        // creation of a site by specifying the library to use
        ILibrary library = null;
        site = siteModule.createSite( context, library, "test-site" );
}

Recovering a site

The site is recovered by using its system name.

public void server_getSite( ISiteModule siteModule, IContext context ) throws SiteModuleException
{
        // site recovering
        ISite site = siteModule.getSiteByName( context, "test-site" );
        System.out.println( site.getName() );
}
 

Deleting a site

The site may be deleted in two ways:

  • deletion of a complete site with the assigned document space;
  • deletion of the site only.
    public void server_deleteSite( ISiteModule siteModule, IContext context ) throws SiteModuleException
    {
            // site recovering
            ISite site = siteModule.getSiteByName( context, "test-site" );
    
            // 1st case: definitive deletion of the complete site
            site.delete( context );
    
            // 2nd case: deletion of the site but keeping of the assigned document space
            site.delete( context, false );
    }