…
NewUserDetails[] newUsers = new NewUserDetails[] { new NewUserDetails(
usuario, password, createPersonProperties(
"workspace://SpacesStore/046fc85b-8fda-11dd-baf9-d1d8da1d6f05",
"Simpatico", "saludando", "siempre", "buenos@dias.com", "saludador")) };
WebServiceFactory.getAdministrationService().createUsers(newUsers);
System.out.println("Usuario creado");
…
private static NamedValue[] createPersonProperties(String homeFolder,
String firstName, String middleName, String lastName, String email,
String orgId) {
// Create the new user objects
return new NamedValue[] {
new NamedValue(Constants.PROP_USER_HOMEFOLDER, false,
homeFolder, null),
new NamedValue(Constants.PROP_USER_FIRSTNAME, false, firstName,
null),
new NamedValue(Constants.PROP_USER_MIDDLENAME, false,
middleName, null),
new NamedValue(Constants.PROP_USER_LASTNAME, false, lastName,
null),
new NamedValue(Constants.PROP_USER_EMAIL, false, email, null),
new NamedValue(Constants.PROP_USER_ORGID, false, orgId, null) };
}
Por lo que he comprobado, parece ser que si especificas una referencia en homefolder que no existe, arranca el proveedor por defecto. Y si la referencia es válida, asigna ese homfolder.String path = "/app:company_home/cm:para_x0020_Jaime";
// Montamos la query para encontrar el id de nodo
String texto_query = "+PATH:\"" + path + "\"";
System.out.println("Query para obtener id de nodo: " + texto_query);
Query query = new Query(Constants.QUERY_LANG_LUCENE, texto_query);
try {
// Ejecutamos la consulta para encontrar la bustia del usuario
QueryResult queryResult = repositoryService.query(STORE, query,
false);
// Mostramos los resultados…
ResultSet resultSet = queryResult.getResultSet();
ResultSetRow[] rows = resultSet.getRows();
if (rows != null) {
// Obtenemos los registros de la query…en principio sólo 1…
for (ResultSetRow row : rows) {
String id = row.getNode().getId();
System.out.println("Encontrado store de usuarios con id: " + id);
Reference reference = new Reference(STORE, id, null);
NewUserDetails[] newUsers = new NewUserDetails[] { new NewUserDetails(
usuario, password, createPersonProperties(
"workspace://SpacesStore/" + reference.getUuid(),
nombre, apellido1, apellido2, email, nombre)) };
WebServiceFactory.getAdministrationService().createUsers(newUsers);
System.out.println("Usuario creado");
}
}
} catch (java.rmi.RemoteException exp) {
System.out.println("ERROR al realizar la consulta");
exp.printStackTrace();
}
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.