02-15-2008 05:29 AM
public FileFolderService createFileFolderService(){
System.out.println("Creando FileFolderService");
System.out.println("Registry"+registry);
fileFolderService = this.getServiceRegistry().getFileFolderService();
return fileFolderService;
}
public NodeRef createPerson(Map<QName, Serializable> properties) throws FileExistsException
{
try {
System.out.println("User"+AuthenticationUtil.getCurrentUserName());
AuthenticationUtils.startSession("admin", "admin");
AuthenticationUtil.setCurrentUser("admin");
AuthenticationUtil.setSystemUserAsCurrentUser();
System.out.println("User"+AuthenticationUtil.getCurrentUserName());
String userName = DefaultTypeConverter.INSTANCE.convert(String.class, properties.get(ContentModel.PROP_USERNAME));
properties.put(ContentModel.PROP_USERNAME, userName);
NodeRef nodo = null;
this.setFileFolderService(createFileFolderService());
nodo = nodeService.createNode(getPeopleContainer(), ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_PERSON, ContentModel.TYPE_PERSON, properties).getChildRef();
NodeRef padre=null;
try{
padre = new NodeRef(APP+"company_home/"+CM+"config/"+CM+"usuarios");
}catch(Exception ex){
System.err.println("MIKI ERROR:"+ex.getMessage());
ex.printStackTrace(System.err);
}
fileFolderService.create(padre, userName, ContentModel.TYPE_FOLDER);
NodeRef archivoACopiar = new NodeRef(APP+"company_home/"+CM+"template");
NodeRef destinoCopia = new NodeRef(APP+"company_home/"+CM+"config/"+CM+"usuarios/"+CM+userName);
fileFolderService.copy(archivoACopiar, destinoCopia, SPLIT);
NodeRef segundoAC = new NodeRef(APP+"company_home/"+CM+"template/"+CM+"conf");
NodeRef segundoDC = new NodeRef(APP+"company_home/"+CM+"config/"+CM+"user/"+CM+userName);
fileFolderService.copy(segundoAC, segundoDC, SPLIT);
NodeRef tercerAC = new NodeRef(APP+"company_home/"+CM+"template/"+CM+"files");
fileFolderService.copy(tercerAC, segundoDC, SPLIT);
NodeRef cuartoAC = new NodeRef(APP+"company_home/"+CM+"template/"+CM+"trash");
fileFolderService.copy(cuartoAC, segundoDC, SPLIT);
return nodo;
}catch (Exception ex) {
Logger.getLogger(PersonServiceImplFidesol.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
05-20-2010 07:05 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.