Package org.jayasoft.woj.server.services

Examples of org.jayasoft.woj.server.services.LicenseException


        License[] licenses = getAll();
        LicenseDao lDao = WOJServer.getInstance().getDataService().getLicenseDao();

        int licensesByKey = lDao.getLicenseCountByKey();
        if (licensesByKey > licenses.length) {
            throw new LicenseException("similar licenses found in DB");
        }
        for (int i = 0; i < licenses.length; i++) {
            License l = licenses[i];
            int usedLicenses = lDao.getUsedLicense(new Long(l.getId()));
            if (usedLicenses>l.getLicenseCount()) {
                LOGGER.warn("too many licenses in use for license: " + l.getKey());
                throw new LicenseException("too many licenses in use for license: " + l.getKey());
            }
        }
    }
View Full Code Here


        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);
            throw new LicenseException("cannot affect license:" + licId + " to user: " + userId);
        }
    }
View Full Code Here

        LicenseDao lDao = WOJServer.getInstance().getDataService().getLicenseDao();
        try {
            lDao.freeLicense(userId);
        } catch (DataAccessException dae) {
            LOGGER.warn("db error while freeing license for user:" + userId);
            throw new LicenseException("cannot free license of user:" + userId);
        }
    }
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.server.services.LicenseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.