001
014
015 package com.liferay.portal.security.exportimport;
016
017 import com.liferay.portal.model.User;
018 import com.liferay.registry.Registry;
019 import com.liferay.registry.RegistryUtil;
020 import com.liferay.registry.ServiceTracker;
021
022
028 public class UserImporterUtil {
029
030 public static long getLastImportTime() throws Exception {
031 return _getInstance().getLastImportTime();
032 }
033
034 public static User importUser(
035 long ldapServerId, long companyId, String emailAddress,
036 String screenName)
037 throws Exception {
038
039 return _getInstance().importUser(
040 ldapServerId, companyId, emailAddress, screenName);
041 }
042
043 public static User importUser(
044 long companyId, String emailAddress, String screenName)
045 throws Exception {
046
047 return _getInstance().importUser(companyId, emailAddress, screenName);
048 }
049
050 public static User importUserByScreenName(long companyId, String screenName)
051 throws Exception {
052
053 return _getInstance().importUserByScreenName(companyId, screenName);
054 }
055
056 public static void importUsers() throws Exception {
057 _getInstance().importUsers();
058 }
059
060 public static void importUsers(long companyId) throws Exception {
061 _getInstance().importUsers(companyId);
062 }
063
064 public static void importUsers(long ldapServerId, long companyId)
065 throws Exception {
066
067 _getInstance().importUsers(ldapServerId, companyId);
068 }
069
070 private static UserImporter _getInstance() {
071 return _instance._serviceTracker.getService();
072 }
073
074 private UserImporterUtil() {
075 Registry registry = RegistryUtil.getRegistry();
076
077 _serviceTracker = registry.trackServices(UserImporter.class);
078
079 _serviceTracker.open();
080 }
081
082 private static final UserImporterUtil _instance = new UserImporterUtil();
083
084 private final ServiceTracker<UserImporter, UserImporter> _serviceTracker;
085
086 }