public void synchronizeGroups() {
Long since = null;
LOGGER.debug("Asking for groups synchronisation");
try {
GroupDao gDao = WOJServer.getInstance().getDataService().getGroupDao();
// First we get the last time we have updated groups
since = gDao.getLastUpdateTime();
LOGGER.debug("Synchronising with last upate time = " + TimeUtil.getDate(since.longValue()));
Group[] groups = _portalSynchronizationService.getUpdatedGroups(since);
if (groups != null) {
LOGGER.debug(groups.length + " groups to synchronize.");
for (int i = 0; i < groups.length; i++) {
Group g = groups[i];
// Space on portal is in MB but on server it's in KB
// g.setDedicatedSpace(g.getDedicatedSpace()*1024);
if (gDao.getGroup(String.valueOf(g.getId())) == null) {
gDao.insert(g);
LOGGER.debug(g + " has been inserted.");
} else {
gDao.update(g);
LOGGER.debug(g + " has been updated.");
}
}
LOGGER.debug(groups.length + " groups synchronized.");
}