StringWriter sw = new StringWriter();
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(new DOMSource(doc), new StreamResult(sw));
List<User> list = new ArrayList<User>();
InputNode root = NodeBuilder.read(new StringReader(sw.toString()));
InputNode root1 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle Address inside user
InputNode root2 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle old om_time_zone, level_id, status
InputNode listNode = root.getNext();
InputNode listNode1 = root1.getNext(); //HACK to handle Address inside user
InputNode listNode2 = root2.getNext(); //HACK to handle old om_time_zone
if (listNodeName.equals(listNode.getName())) {
InputNode item = listNode.getNext();
InputNode item1 = listNode1.getNext(); //HACK to handle Address inside user
InputNode item2 = listNode2.getNext(); //HACK to handle old om_time_zone, level_id, status
while (item != null) {
User u = ser.read(User.class, item, false);
boolean needToSkip1 = true;
//HACK to handle Address inside user
if (u.getAdresses() == null) {
Address a = ser.read(Address.class, item1, false);
u.setAdresses(a);
needToSkip1 = false;
}
if (needToSkip1) {
do {
item1 = listNode1.getNext(); //HACK to handle Address inside user
} while (item1 != null && !"user".equals(item1.getName()));
}
String level_id = null, status = null;
do {
if (u.getTimeZoneId() == null && "omTimeZone".equals(item2.getName())) {
String jName = item2.getValue();
u.setTimeZoneId(jName == null ? null : tzUtil.getTimezoneByInternalJName(jName).getID());
}
if ("level_id".equals(item2.getName())) {
level_id = item2.getValue();
}
if ("status".equals(item2.getName())) {
status = item2.getValue();
}
item2 = listNode2.getNext(); //HACK to handle old om_time_zone, level_id, status
} while (item2 != null && !"user".equals(item2.getName()));
if (u.getRights().isEmpty()) {
u.getRights().add(Right.Room);
if ("1".equals(status)) {
u.getRights().add(Right.Dashboard);
u.getRights().add(Right.Login);