Server tasks

Recovering the organizations

In the directory module, you may recover every root organizations.

public void server_getOrganizations( IDirectoryModule directoryModule, IContext context ) throws DirectoryModuleException
{
        // recovering every organizations 
        Collection organizations = directoryModule.getOrganizations( context );
        for ( Iterator iter = organizations.iterator() ; iter.hasNext() ; )
        {
                IOrganization organization = (IOrganization)iter.next();
                System.out.println( organization.getName() );
        }
}

Recovering an organization

In the directory module, you may recover one root organization by its name.

 
public void server_getOrganization( IDirectoryModule directoryModule, IContext context ) throws DirectoryModuleException
{
        // recovering an organization 
        IOrganization organization = directoryModule.getOrganization( context, "test-organization" );
        System.out.println( organization.getName() );

        // recovering a subsidiary 
        IOrganization childOrganization = directoryModule.getOrganization( context, organization, "test-child-organization" );
        System.out.println( childOrganization.getName() );
}
        

Creating an organization

In the directory module, you may create new organizations. In the following example two organizations are created.

public void server_createOrganization( IDirectoryModule directoryModule, IContext context ) throws DirectoryModuleException
{
        IOrganization organization = directoryModule.createOrganization( context, "test-organization" );
        organization.setSkin( "skin-name" );

        IOrganization childOrganization = directoryModule.createOrganization( context, organization, "test-child-organization" );
}
        

Recovering the localizations

In the directory module, you may recover every root localization.

public void server_getLocalizations( IDirectoryModule directoryModule, IContext context ) throws DirectoryModuleException
{
        // recovering every localizations 
        Collection localizations = directoryModule.getLocalizations( context );

        for ( Iterator iter = localizations.iterator() ; iter.hasNext() ; )
        {
                ILocalization localization = (ILocalization)iter.next();
                System.out.println( localization.getName() );
        }
}
        

Recovering a localization

In the directory module, you may recover one root localization by its name.

 
public void server_getLocalization( IDirectoryModule directoryModule, IContext context ) throws DirectoryModuleException
{
        // recovering a localization 
        ILocalization localization = directoryModule.getLocalization( context, "test-localization" );
        System.out.println( localization.getName() );

        // recovering a child localization 
        ILocalization childLocalization = directoryModule.getLocalization( context, localization, "test-child-localization" );
        System.out.println( childLocalization.getName() );
}

Creating a localization

In the directory module, you may create new localizations. In the following example two localizations are created.

public void server_createLocalization( IDirectoryModule directoryModule, IContext context ) throws DirectoryModuleException 
{ 
        // creating a localization 
        ILocalization localization = directoryModule.createLocalization( context, "test-localization" ); 
        
        // creating a child 
        localization ILocalization childLocalization = directoryModule.createLocalization(context, localization, "test-child-localization"); 
}