Package fr.ippon.tatami.domain

Examples of fr.ippon.tatami.domain.DomainConfiguration


    private Environment env;

    public String createAttachment(Attachment attachment) throws StorageSizeException {

        User currentUser = authenticationService.getCurrentUser();
        DomainConfiguration domainConfiguration =
                domainConfigurationRepository.findDomainConfigurationByDomain(currentUser.getDomain());

        long newAttachmentsSize = currentUser.getAttachmentsSize() + attachment.getSize();
        if (newAttachmentsSize > domainConfiguration.getStorageSizeAsLong()) {
            log.info("User " + currentUser.getLogin() +
                    " has tried to exceed his storage capacity. current storage=" +
                    currentUser.getAttachmentsSize() +
                    ", storage capacity=" +
                    domainConfiguration.getStorageSizeAsLong());

            throw new StorageSizeException("User storage exceeded for user " + currentUser.getLogin());
        }
       
        attachment.setThumbnail(computeThumbnail(attachment));
View Full Code Here


        }
    }

    public Collection<Long> getDomainQuota() {
        User currentUser = authenticationService.getCurrentUser();
        DomainConfiguration domainConfiguration =
                domainConfigurationRepository.findDomainConfigurationByDomain(currentUser.getDomain());

        Long domainQuota = domainConfiguration.getStorageSizeAsLong();
        Long userQuota = currentUser.getAttachmentsSize();

        Long quota = (userQuota * 100) / domainQuota;

        Collection<Long> taux = new ArrayList<Long>();
View Full Code Here

        em.persist(domainConfiguration);
    }

    @Override
    public DomainConfiguration findDomainConfigurationByDomain(String domain) {
        DomainConfiguration domainConfiguration;
        try {
            domainConfiguration = em.find(DomainConfiguration.class, domain);
        } catch (Exception e) {

            log.debug("Exception while looking for domain {} : {}", domain, e.toString());

            return null;
        }
        if (domainConfiguration == null) {
            domainConfiguration = new DomainConfiguration();
            domainConfiguration.setDomain(domain);
            setDefaultValues(domainConfiguration);
            em.persist(domainConfiguration);
        }
        if (domain.equals("ippon.fr")) {
            domainConfiguration.setSubscriptionLevel(DomainConfiguration.SubscriptionAndStorageSizeOptions.IPPONSUSCRIPTION);
            domainConfiguration.setStorageSize(DomainConfiguration.SubscriptionAndStorageSizeOptions.IPPONSIZE);
        }
        return domainConfiguration;
    }
View Full Code Here

TOP

Related Classes of fr.ippon.tatami.domain.DomainConfiguration

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.