I'm trying to insert object that I created in a List to display them in a table thanks to Javascript.
However the probleme is that the element of the object is registered in the list like this (display debug javascript) :
- listAnomalies: Array(18)
- 0: "779"
- 1: "2019/11/16"
- 2: "test3"
- 3: "test3"
- 4: "test3"
- 5: "2020/01/01"
- 6: "778"
- 7: "2019/09/28"
- 8: "test2"
- 9: "test2"
- 10:"test2"
This is where I created the List :
final AnomalieJira returnData = new AnomalieJira();
final List<SaisieAnomalieProjetVo> project1 = new ArrayList(Arrays.asList("777", "2019/01/01", "test", "test", "test", "2020/01/01"));
final List<SaisieAnomalieProjetVo> project2 = new ArrayList(Arrays.asList("778", "2019/09/28", "test2", "test2", "test2", "2020/01/01"));
final List<SaisieAnomalieProjetVo> project3 = new ArrayList(Arrays.asList("779", "2019/11/16", "test3", "test3", "test3", "2020/01/01"));
final List<SaisieAnomalieProjetVo> projet = new ArrayList<SaisieAnomalieProjetVo>();
projet.addAll(project3);
projet.addAll(project2);
projet.addAll(project1);
//final List<SaisieAnomalieProjetVo> listAnomalies = jiraDao.getWorkIssueSP(id, datasource, jira);
returnData.setListAnomalies(projet);
//returnData.getListAnomalies().addAll(project2);
returnData.setUrl(datasource.getUrl());
returnData.setPsw(datasource.getPassword());
returnData.setUser(datasource.getUsername());
return returnData;
}
My class AnomalieJira :
public class AnomalieJira {
/**
* Liste des différents info travaux
*/
private List<SaisieAnomalieProjetVo> listAnomalies;
private String url;
private String psw;
private String user;
}
And my List SaisieAnomalieProjetVo :
public class SaisieAnomalieProjetVo extends AbstractAudited<Integer> {
private static final long serialVersionUID = 1L;
@NotNull
private int projet;
@NotNull
private Date date;
@NotNull
@NotEmpty
private String type;
@NotNull
@NotEmpty
private String reference;
private String description;
private Date dateRea;
}
I truggled to get the display like this :
- listAnomalies: Array(18)
- 0: "779", "2019/11/16", "test3", "test3", "test3", "2020/01/01"
- 1: "778", "2019/09/28", "test2", "test2", "test2", "2020/01/01"
- 2: .....
This display have more sense than the first one but I can't get this format.