Directory tasks

Retrieving the data attributes

Example of retrieving the data attributes.

public void data_getDataAttributes( IDocumentManagementModule module, IContext context, IDataUnit dataUnit ) throws Exception 
{ 
        _PropertyCollection properties = module.GetPropertiesBySimpleDataForm( dataUnit.getParentDataForm() ); 
        for ( int index = 0 ; index < properties.getCount() ; 
        index++ ) 
        { 
                IProperty property = properties.getItem( index ); 
                if ( property.getType() == property.getPropertyType().getSTRING() ) 
                LOGGER.info( "attribute '" + property.getname() + "' = " + dataUnit.getResource().GetValueAsString( property.getname() ) ); 
        } 
}

Retrieving a user from the document management

Example of recovering a user.

public void directory_getUser( IDocumentManagementModule module, IContext context ) throws Exception 
{ 
        IUser user = module.GetUserByLogin( "zorgly" ); 
}

Retrieving a user as operator

Example of recovering a user as step operator.

public void directory_getUserAsOperator( IDocumentManagementModule module, IContext context ) throws Exception 
{ 
        IUser user = module.GetUserByLogin( "sboirol" ); 
        // transformation of a user in operator 
        IOperator operator = user.getAsOperator(); 
}

Retrieving all the users

Example of recovering users from document management.

public void directory_getUsers( IDocumentManagementModule module, IContext context ) throws Exception
{ 
        // thanks to François Edom! 
        _UserCollection users = module.getUsers(); 
        for ( int index = 0 ; index < users.getCount() ; 
        index++ ) 
        { 
                IUser user = users.getItem( index ); 
                LOGGER.info( "user:" + user.getId().getAsString() + ", login:" + user.getlogin() + ", first name:" + user.getFirstName() + ", last name:" + user.getLastName() + ", email:" + user.getEMail() ); 
        } 
}

Retrieving a group from the document management

Example of recovering a group.

public void directory_getGroup( IDocumentManagementModule module, IContext context ) throws Exception 
{ 
        IGroup group = module.GetGroupById( 123 ); 
}

Retrieving a group as operator

Example of recovering a group as step operator.

public void directory_getGroupAsOperator( IDocumentManagementModule module, IContext context ) throws Exception 
{ 
        IGroup group = module.GetGroupById( 123 ); 
        // transformation of a group in operator 
        IOperator operator = group.getAsOperator(); 
}