Package org.zanata.common

Examples of org.zanata.common.DocumentType


        identity.checkPermission("import-template", getVersion());

        if (sourceFileUpload.getFileName().endsWith(".pot")) {
            uploadPotFile();
        } else {
            DocumentType type =
                    translationFileServiceImpl.getDocumentType(sourceFileUpload
                            .getFileName());
            if (translationFileServiceImpl.hasAdapterFor(type)) {
                uploadAdapterFile();
            } else {
View Full Code Here


                && identity.hasPermission("import-template", projectIteration);
    }

    private void failIfFileTypeNotValid(DocumentFileUploadForm uploadForm)
            throws ChunkUploadException {
        DocumentType type = DocumentType.typeFor(uploadForm.getFileType());
        if (!isSourceDocumentType(type)) {
            throw new ChunkUploadException(Status.BAD_REQUEST, "The type \""
                    + uploadForm.getFileType()
                    + "\" specified in form parameter 'type' "
                    + "is not valid for a source file on this server.");
View Full Code Here

            throw new ChunkUploadException(Status.INTERNAL_SERVER_ERROR,
                    e.getMessage(), e);
        }

        String contentHash = uploadForm.getHash();
        DocumentType documentType =
                DocumentType.typeFor(uploadForm.getFileType());

        persistRawDocument(document, tempFile, contentHash, documentType,
                params);
View Full Code Here

    private boolean hasAdapterFor(String fileNameOrExtension) {
        String extension = extractExtension(fileNameOrExtension);
        if (extension == null) {
            return false;
        }
        DocumentType documentType = DocumentType.typeFor(extension);
        if (documentType == null) {
            return false;
        }
        return hasAdapterFor(documentType);
    }
View Full Code Here

        String extension = extractExtension(fileNameOrExtension);
        if (extension == null) {
            throw new RuntimeException(
                    "Cannot find adapter for null filename or extension.");
        }
        DocumentType documentType = DocumentType.typeFor(extension);
        if (documentType == null) {
            throw new RuntimeException(
                    "Cannot choose an adapter because the provided string '"
                            + fileNameOrExtension
                            + "' does not match any known document type.");
View Full Code Here

                // document is stored
                return true;
            }

            // additional check in case we do start storing raw documents for po
            DocumentType docType = doc.getRawDocument().getType();
            return docType == GETTEXT_PORTABLE_OBJECT
                    || docType == GETTEXT_PORTABLE_OBJECT_TEMPLATE;
        }
        return false;
    }
View Full Code Here

TOP

Related Classes of org.zanata.common.DocumentType

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.