public void affectLicense(Long userId, Long licId) throws LicenseException {
LicenseDao lDao = WOJServer.getInstance().getDataService().getLicenseDao();
try {
if(getAvailableLicenses(licId) > 0) {
lDao.affectLicense(userId, licId);
} else {
throw new LicenseException("No more free license for:"+get(licId));
}
} catch (DataAccessException dae) {
LOGGER.warn("db error while affecting license:" + licId + " to user: " + userId);