Buenas, estoy buscando la forma de ejecutar este script, pensaba que ejecutandolo como una accion sobre un directorio por ejemplo surtiria efecto poniendo las etiquetas de servidor, pero no es asi. Como puedo ejecutar este código?, lo que hace el código es eliminar usuarios, lo he codigo del foro en ingles. este es el código:
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.");
}
}
Gracias y saludos.