04-27-2009 06:22 AM
public static void userDel( String userLogin, boolean userDeleteRepo ) throws Exception {
repositoryService = WebServiceFactory.getRepositoryService();
contentService = WebServiceFactory.getContentService();
administrationService = WebServiceFactory.getAdministrationService();
// check the user
try {
// test before the user
administrationService.getUser(userLogin);
} catch (Exception e){
throw new Exception("User " + userLogin + " does not exists.");
}
administrationService.deleteUsers(new String[]{userLogin});
System.out.println("The user "+userLogin+" has been deleted.");
if (userDeleteRepo){
Store store = new Store(Constants.WORKSPACE_STORE,"SpacesStore");
Reference folderReference = new Reference(store,null,"/app:company_home/app:user_homes/cm:"+userLogin);
// get the reference for the folder
try {
repositoryService.get(new Predicate(new Reference[]{folderReference},store,null));
} catch (Exception e) {
e.printStackTrace();
throw new Exception("Unable to get the folder for user "+userLogin+".");
}
try {
CML cml = new CML();
CMLDelete cmlDelete = new CMLDelete();
cmlDelete.setWhere(new Predicate(new Reference[]{folderReference},store,null));
cml.setDelete(new CMLDelete[]{cmlDelete});
UpdateResult[] results = repositoryService.update(cml);
}
catch (Exception e) {
e.printStackTrace();
}
System.out.println("the folder "+userLogin+" has been deleted.");
}
}
04-27-2009 07:33 AM
04-27-2009 08:17 AM
04-27-2009 08:17 AM
04-28-2009 10:44 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.