Package ca.carleton.gcrc.couch.onUpload.conversion

Examples of ca.carleton.gcrc.couch.onUpload.conversion.ServerWorkDescriptor


      File convertedFile = File.createTempFile("oriented_", attDescription.getMediaFileName());
      imp.reorientImage(outputFile, convertedFile);
      attDescription.uploadFile(convertedFile, mimeType);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
  }
View Full Code Here


      }
     
      attDescription.setThumbnailReference(thumbnailAttachmentName);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setThumbnailLevel(UploadConstants.SERVER_THUMBNAIL_VALUE);
  }
View Full Code Here

      if( request.getOutHeight() != 0 && request.getOutWidth() != 0 ) {
        attDescription.setHeight(request.getOutHeight());
        attDescription.setWidth(request.getOutWidth());
      }
     
      ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
      serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
    }

    // Report thumbnail object
    if( request.isThumbnailCreated() ) {
      File thumbFile = request.getThumbnailFile();
      SystemFile thumbSf = SystemFile.getSystemFile(thumbFile);
     
      String thumbExtension = "";
      {
        String name = thumbFile.getName();
        int index = name.lastIndexOf('.');
        if( index > 0 ){
          thumbExtension = name.substring(index+1);
        }
      }
     
      String thumbnailAttachmentName = computeThumbnailName(attDescription.getAttachmentName(),thumbExtension);
      AttachmentDescriptor thumbnailObj = conversionContext.getAttachmentDescription(thumbnailAttachmentName);

      if( CouchNunaliitUtils.hasVetterRole(submitter, atlasName) ) {
        thumbnailObj.setStatus(UploadConstants.UPLOAD_STATUS_APPROVED);
      } else {
        thumbnailObj.setStatus(UploadConstants.UPLOAD_STATUS_WAITING_FOR_APPROVAL);
      }
      thumbnailObj.setFileClass("image");
      thumbnailObj.setOriginalName(attDescription.getOriginalName());
      thumbnailObj.setMediaFileName(thumbFile.getName());
      thumbnailObj.setSource(attDescription.getAttachmentName());

      thumbnailObj.setSize(thumbFile.length());
      thumbnailObj.setContentType(thumbSf.getMimeType());
      thumbnailObj.setEncodingType(thumbSf.getMimeEncoding());

      if( request.getThumbnailHeight() != 0 && request.getThumbnailWidth() != 0 ) {
        thumbnailObj.setHeight(request.getThumbnailHeight());
        thumbnailObj.setWidth(request.getThumbnailWidth());
      }

      attDescription.setThumbnailReference(thumbnailAttachmentName);
    }
   
    // Report original file
    if( request.isConversionPerformed() ) {
      // Original is not needed if no conversion performed
     
      String fileClass = attDescription.getFileClass();
      if( "image".equals(fileClass) && uploadOriginalImages ) {
        String originalAttachmentName = computeOriginalName(attDescription.getOriginalName());
        AttachmentDescriptor origDescription = conversionContext.getAttachmentDescription(originalAttachmentName);

        if( CouchNunaliitUtils.hasVetterRole(submitter, atlasName) ) {
          origDescription.setStatus(UploadConstants.UPLOAD_STATUS_APPROVED);
        } else {
          origDescription.setStatus(UploadConstants.UPLOAD_STATUS_WAITING_FOR_APPROVAL);
        }
        origDescription.setContentType(attDescription.getContentType());
        origDescription.setOriginalName(attDescription.getOriginalName());
        origDescription.setMediaFileName(originalFile.getName());
        origDescription.setSource(attDescription.getAttachmentName());

        origDescription.setSize(originalObj.getSize());
        origDescription.setContentType(originalObj.getContentType());
        origDescription.setEncodingType(originalObj.getEncodingType());

        origDescription.setHeight(originalObj.getHeight());
        origDescription.setWidth(originalObj.getWidth());

        ServerWorkDescriptor serverWork = origDescription.getServerWorkDescription();
        serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);

        attDescription.setOriginalAttachment(originalAttachmentName);
      }
    }
  }
View Full Code Here

    origDescription.setEncodingType(originalObj.getEncodingType());

    origDescription.setHeight(originalObj.getHeight());
    origDescription.setWidth(originalObj.getWidth());

    ServerWorkDescriptor serverWork = origDescription.getServerWorkDescription();
    serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);

    // Remember original attachment
    attDescription.setOriginalAttachment(originalAttachmentName);

    // Remember that work was performed
View Full Code Here

      File convertedFile = File.createTempFile("oriented_", attDescription.getMediaFileName());
      imp.reorientImage(outputFile, convertedFile);
      attDescription.uploadFile(convertedFile, mimeType);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
  }
View Full Code Here

      }
     
      attDescription.setThumbnailReference(thumbnailAttachmentName);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setThumbnailLevel(UploadConstants.SERVER_THUMBNAIL_VALUE);
  }
View Full Code Here

      if( request.getOutHeight() != 0 && request.getOutWidth() != 0 ) {
        attDescription.setHeight(request.getOutHeight());
        attDescription.setWidth(request.getOutWidth());
      }
     
      ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
      serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
    }

    // Report thumbnail object
    if( request.isThumbnailCreated() ) {
      File thumbFile = request.getThumbnailFile();
      SystemFile thumbSf = SystemFile.getSystemFile(thumbFile);
     
      String thumbExtension = "";
      {
        String name = thumbFile.getName();
        int index = name.lastIndexOf('.');
        if( index > 0 ){
          thumbExtension = name.substring(index+1);
        }
      }
     
      String thumbnailAttachmentName = computeThumbnailName(attDescription.getAttachmentName(),thumbExtension);
      AttachmentDescriptor thumbnailObj = docDescriptor.getAttachmentDescription(thumbnailAttachmentName);

      if( CouchNunaliitUtils.hasVetterRole(submitter, atlasName) ) {
        thumbnailObj.setStatus(UploadConstants.UPLOAD_STATUS_APPROVED);
      } else {
        thumbnailObj.setStatus(UploadConstants.UPLOAD_STATUS_WAITING_FOR_APPROVAL);
      }
      thumbnailObj.setFileClass("image");
      thumbnailObj.setOriginalName(attDescription.getOriginalName());
      thumbnailObj.setMediaFileName(thumbFile.getName());
      thumbnailObj.setSource(attDescription.getAttachmentName());

      thumbnailObj.setSize(thumbFile.length());
      thumbnailObj.setContentType(thumbSf.getMimeType());
      thumbnailObj.setEncodingType(thumbSf.getMimeEncoding());

      if( request.getThumbnailHeight() != 0 && request.getThumbnailWidth() != 0 ) {
        thumbnailObj.setHeight(request.getThumbnailHeight());
        thumbnailObj.setWidth(request.getThumbnailWidth());
      }

      attDescription.setThumbnailReference(thumbnailAttachmentName);
    }
   
    // Report original file
    if( request.isConversionPerformed() ) {
      // Original is not needed if no conversion performed
     
      String fileClass = attDescription.getFileClass();
      if( "image".equals(fileClass) && uploadOriginalImages ) {
        String originalAttachmentName = computeOriginalName(attDescription.getOriginalName());
        AttachmentDescriptor origDescription = docDescriptor.getAttachmentDescription(originalAttachmentName);

        if( CouchNunaliitUtils.hasVetterRole(submitter, atlasName) ) {
          origDescription.setStatus(UploadConstants.UPLOAD_STATUS_APPROVED);
        } else {
          origDescription.setStatus(UploadConstants.UPLOAD_STATUS_WAITING_FOR_APPROVAL);
        }
        origDescription.setFileClass("image");
        origDescription.setContentType(attDescription.getContentType());
        origDescription.setOriginalName(attDescription.getOriginalName());
        origDescription.setMediaFileName(originalFile.getName());
        origDescription.setSource(attDescription.getAttachmentName());

        origDescription.setSize(originalObj.getSize());
        origDescription.setContentType(originalObj.getContentType());
        origDescription.setEncodingType(originalObj.getEncodingType());

        origDescription.setHeight(originalObj.getHeight());
        origDescription.setWidth(originalObj.getWidth());

        ServerWorkDescriptor serverWork = origDescription.getServerWorkDescription();
        serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);

        attDescription.setOriginalAttachment(originalAttachmentName);
      }
    }
  }
View Full Code Here

    origDescription.setEncodingType(originalObj.getEncodingType());

    origDescription.setHeight(originalObj.getHeight());
    origDescription.setWidth(originalObj.getWidth());

    ServerWorkDescriptor serverWork = origDescription.getServerWorkDescription();
    serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);

    // Remember original attachment
    attDescription.setOriginalAttachment(originalAttachmentName);

    // Remember that work was performed
View Full Code Here

      File convertedFile = File.createTempFile("oriented_", attDescription.getMediaFileName());
      imp.reorientImage(outputFile, convertedFile);
      attDescription.uploadFile(convertedFile, mimeType);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setOrientationLevel(UploadConstants.SERVER_ORIENTATION_VALUE);
  }
View Full Code Here

      }
     
      attDescription.setThumbnailReference(thumbnailAttachmentName);
    }

    ServerWorkDescriptor serverWork = attDescription.getServerWorkDescription();
    serverWork.setThumbnailLevel(UploadConstants.SERVER_THUMBNAIL_VALUE);
  }
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.couch.onUpload.conversion.ServerWorkDescriptor

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.