This repository has been archived on 2021-03-03. You can view files and clone it, but cannot push or open issues or pull requests.
tou-optout-hook/src/main/java/org/gcube/portlets/admin/RemoveUserAccountThread.java

42 lines
942 B
Java

package org.gcube.portlets.admin;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
/**
*
* @author Massimiliano Assante ISTI-CNR
*
*/
public class RemoveUserAccountThread implements Runnable {
private static Log _log = LogFactoryUtil.getLog(RemoveUserAccountThread.class);
private long userId;
public RemoveUserAccountThread(long userId) {
super();
this.userId = userId;
}
@Override
public void run() {
handleUserRemoval(userId);
}
private void handleUserRemoval(long userId) {
_log.info("trying removeUser account for userId=" + userId);
//first remove the account
try {
Thread.sleep(1000);
UserLocalServiceUtil.deleteUser(userId);
} catch (Exception e) {
e.printStackTrace();
}
_log.info("removeUser account for " + userId + " done with success, not notify the managers ... ");
}
}