Hi everybody, I am working on a web application that uses Alfresco andd I have some trouble adding an user specifing the group which the user belongs to.I'm calling the webscript using Java in this way:
String url="http://localhost:8080/alfresco/service/api/people?alf_ticket='+this.TICKET;
DettagliUtente du=new DettagliUtente(nome, cnome, email, uname, pwd, da, quota, array_groups, titolo, orga, jobtitolo);
HttpClient client = HttpClientBuilder.create().build();
HttpPost post=new HttpPost(url);
StringEntity entity=new StringEntity( gson.toJson(du) );
post.setEntity(entity);
post.setHeader("Content-type", "application/json");
HttpResponse risposta=client.execute(post);
DettagliUtente
is a simple POJO class I made to store some information about the user. This information are retrieved from a jsp page.In this class I store the groups in which the user belongs to, but I can't understand which Java object type I have to use to correctly send the groups in JSON format. You can see I convert my POJO class in JSON object using Gson.I used an array of String that contains the name (shortName) of the group but it didn't work. I tried again a Vector of class Gruppo, which is this:
public class Gruppo {
private String displayName;
private String itemName;
}
but again I hadn't success. The user is created correctly but the groups are completly ignored.So this is my question: How can I pass the groups to this webscript? I mean, which object I have to use to store groups information and pass them.I hope I explain myself in a good way, if not tell me what is not clear.Thank youAndrea