Package org.zanata.file

Examples of org.zanata.file.UserFileUploadTracker


    private Optional<String> getCannotUploadReason() {
        Optional<Long> accountId = getAccountId();
        boolean loggedIn = accountId.isPresent();

        if (loggedIn) {
            UserFileUploadTracker tracker = ServiceLocator.instance().getInstance(
                    UserFileUploadTracker.class);
            boolean alreadyUploading = tracker.isUserUploading(accountId.get());
            if (alreadyUploading) {
                return Optional.of("already uploading");
            }
        } else {
            return Optional.of("not logged in");
View Full Code Here


        // TODO at this point the server will expect a response per-file. The simplistic error responses may not be handled well

        Optional<Long> accountId = getAccountId();

        if (accountId.isPresent()) {
            UserFileUploadTracker tracker = ServiceLocator.instance().getInstance(
                    UserFileUploadTracker.class);
            boolean registeredForUpload = tracker.tryToRegisterUserForFileUpload(accountId.get());
            if (!registeredForUpload) {
                log.error("User with id {} is already uploading something.", accountId.get());
                respondWithError(response, "already uploading");
            } else {
                try {
                    processMultipartPost(request, response);
                } finally {
                    tracker.deRegisterUserForFileUpload(accountId.get());
                }
            }
        } else {
            log.error("User attempted upload when not logged in.");
            respondWithError(response, "not logged in");
View Full Code Here

TOP

Related Classes of org.zanata.file.UserFileUploadTracker

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.