LicenseDao licenseDao = DaoFactory.getLicenseDao();
GroupDao groupDao = DaoFactory.getGroupDao();
LOGGER.info("adding trial to user " + userLogged.getLogin() + " registring for a group: " + groupId);
try {
ClufImpl cluf = ServiceFactory.getLicenseService().getActiveCluf();
License l = licenseDao.createTrial();
Group group = (Group) groupDao.find(groupId);
// l.setHostId(hostId); No Host
UserImpl user = (UserImpl)userDao.findUser(userLogged.getLogin());
userDao.fetch(user);
if ((user.getLastAcceptedCluf() == null) ||
cluf.getVersion().equals(user.getLastAcceptedCluf().getVersion())) {
user.setLastAcceptedCluf(cluf);
}
user.getBuyedLicenses().add(l);
l.setValidUntil(user.getLicenseUsed().getValidUntil());
l.setBuyer(user);