com.atlassian.crowd.importer.importers
Class CsvImporter

java.lang.Object
  extended by com.atlassian.crowd.importer.importers.CsvImporter
All Implemented Interfaces:
Importer

public class CsvImporter
extends Object
implements Importer

This class is responsible for importing users, groups and their memberships from two CSV files.


Field Summary
protected  DirectoryManager directoryManager
           
 
Constructor Summary
CsvImporter(DirectoryManager directoryManager, PasswordHelper passwordHelper)
           
 
Method Summary
 Collection<GroupTemplate> findGroups(Configuration configuration)
          Will locate and build a collection of GroupTemplate objects based on the passed in Configuration
 Collection<MembershipDTO> findGroupToGroupMemberships(Configuration configuration)
          Will locate and build a collection of MembershipDTO objects which represent membership relationships between groups and groups based on the passed in Configuration.
 Collection<UserTemplateWithCredentialAndAttributes> findUsers(Configuration configuration)
          Will locate and build a collection of UserTemplate objects based on the passed in Configuration
 Collection<MembershipDTO> findUserToGroupMemberships(Configuration configuration)
          Will locate and build a collection of MembershipDTO objects which represent membership relationships between users and groups based on the passed in Configuration.
 Class getConfigurationType()
          The type of configuration being used for this Import.
protected  Result importGroupMemberships(Iterable<MembershipDTO> memberships, Configuration configuration)
           
protected  Result importGroups(Collection<GroupTemplate> groups, Configuration configuration)
           
protected  Result importUserMemberships(Iterable<MembershipDTO> memberships, Configuration configuration)
           
protected  Result importUsers(Collection<UserTemplateWithCredentialAndAttributes> users, Configuration configuration)
           
 Result importUsersGroupsAndMemberships(Configuration configuration)
          Responsible for the import of both users and groups into Crowd using the given Configuration
 void init(Configuration configuration)
          Initialise anything required for the import process.
 Set<Directory> retrieveRemoteSourceDirectory(Configuration configuration)
          The retrieve the set of remote source directories.
 boolean supportsMultipleDirectories(Configuration configuration)
          Some sources might be capable of handling more than one directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.crowd.importer.importers.Importer
importUsersGroupsAndMemberships, retrieveRemoteSourceDirectory, supportsMultipleDirectories
 

Field Detail

directoryManager

protected final DirectoryManager directoryManager
Constructor Detail

CsvImporter

public CsvImporter(DirectoryManager directoryManager,
                   PasswordHelper passwordHelper)
Method Detail

init

public void init(Configuration configuration)
Description copied from interface: Importer
Initialise anything required for the import process.

Specified by:
init in interface Importer
Parameters:
configuration - can contain any setup params such as database settings that need init'ing

getConfigurationType

public Class getConfigurationType()
Description copied from interface: Importer
The type of configuration being used for this Import.

Specified by:
getConfigurationType in interface Importer
Returns:
Class that should be a subclass of Configuration

findUserToGroupMemberships

public Collection<MembershipDTO> findUserToGroupMemberships(Configuration configuration)
Will locate and build a collection of MembershipDTO objects which represent membership relationships between users and groups based on the passed in Configuration.

Parameters:
configuration - the Importer Configuration
Returns:
a collection of GroupMemberships to be imported or Collections.EMPTY_LIST

findGroupToGroupMemberships

public Collection<MembershipDTO> findGroupToGroupMemberships(Configuration configuration)
                                                      throws ImporterException
Will locate and build a collection of MembershipDTO objects which represent membership relationships between groups and groups based on the passed in Configuration.

Parameters:
configuration - the Importer Configuration
Returns:
a collection of GroupMemberships to be imported or Collections.EMPTY_LIST
Throws:
ImporterException - if there is an error finding group memberships

findGroups

public Collection<GroupTemplate> findGroups(Configuration configuration)
Will locate and build a collection of GroupTemplate objects based on the passed in Configuration

Parameters:
configuration - the Importer Configuration
Returns:
a collection of GroupTemplates to be imported or Collections.EMPTY_LIST

findUsers

public Collection<UserTemplateWithCredentialAndAttributes> findUsers(Configuration configuration)
Will locate and build a collection of UserTemplate objects based on the passed in Configuration

Parameters:
configuration - the Importer Configuration
Returns:
a collection of UserTemplates to be imported or Collections.EMPTY_LIST

importGroups

protected Result importGroups(Collection<GroupTemplate> groups,
                              Configuration configuration)
                       throws ImporterException
Throws:
ImporterException

importUsers

protected Result importUsers(Collection<UserTemplateWithCredentialAndAttributes> users,
                             Configuration configuration)
                      throws ImporterException
Throws:
ImporterException

importUserMemberships

protected Result importUserMemberships(Iterable<MembershipDTO> memberships,
                                       Configuration configuration)
                                throws ImporterException
Throws:
ImporterException

importGroupMemberships

protected Result importGroupMemberships(Iterable<MembershipDTO> memberships,
                                        Configuration configuration)
                                 throws ImporterException
Throws:
ImporterException

importUsersGroupsAndMemberships

public Result importUsersGroupsAndMemberships(Configuration configuration)
                                       throws ImporterException
Description copied from interface: Importer
Responsible for the import of both users and groups into Crowd using the given Configuration

Specified by:
importUsersGroupsAndMemberships in interface Importer
Parameters:
configuration - the Configuration, this could be a JDBC configuration or a CSVConfiguration
Returns:
the result of the import
Throws:
ImporterException - general exception if anything happened during the import

supportsMultipleDirectories

public boolean supportsMultipleDirectories(Configuration configuration)
Description copied from interface: Importer
Some sources might be capable of handling more than one directory.

Specified by:
supportsMultipleDirectories in interface Importer
Parameters:
configuration - the Importer Configuration
Returns:
true if the source can have multiple directories.

retrieveRemoteSourceDirectory

public Set<Directory> retrieveRemoteSourceDirectory(Configuration configuration)
Description copied from interface: Importer
The retrieve the set of remote source directories.

Specified by:
retrieveRemoteSourceDirectory in interface Importer
Parameters:
configuration - the import configuration.
Returns:
the set of source directories.


Copyright © 2012 Atlassian. All Rights Reserved.