Package org.zanata.model

Examples of org.zanata.model.HDocumentUploadPart


    private void saveUploadPart(DocumentFileUploadForm uploadForm,
            HDocumentUpload upload) {
        InputStream contentStream = uploadForm.getFileStream();
        int contentLength = uploadForm.getSize().intValue();
        HDocumentUploadPart newPart =
                uploadPartPersistService.newUploadPartFromStream(contentStream,
                        contentLength);
        upload.getParts().add(newPart);
        session.saveOrUpdate(upload);
        session.flush();
View Full Code Here


    @In
    private Session session;

    public HDocumentUploadPart newUploadPartFromStream(
            InputStream partContentStream, int contentLength) {
        HDocumentUploadPart newPart = new HDocumentUploadPart();
        Blob partContent =
                session.getLobHelper().createBlob(partContentStream,
                        contentLength);
        newPart.setContent(partContent);
        return newPart;
    }
View Full Code Here

    private HDocumentUpload mockTwoPartUploadUsingHash(String hash)
            throws SQLException {
        HDocumentUpload upload = new HDocumentUpload();
        upload.setContentHash(hash);

        HDocumentUploadPart part0 = new HDocumentUploadPart();
        when(partBlob0.getBinaryStream()).thenReturn(
                new ByteArrayInputStream("abc".getBytes()));
        part0.setContent(partBlob0);
        upload.getParts().add(part0);

        HDocumentUploadPart part1 = new HDocumentUploadPart();
        when(partBlob1.getBinaryStream()).thenReturn(
                new ByteArrayInputStream("def".getBytes()));
        part1.setContent(partBlob1);
        upload.getParts().add(part1);
        return upload;
    }
View Full Code Here

TOP

Related Classes of org.zanata.model.HDocumentUploadPart

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.