private void performSubmittedInlineWork ( Work work ) throws Exception { String attachmentName = work . getAttachmentName ( ) ; FileConversionContext conversionContext = new FileConversionContextImpl ( work , documentDbDesign , mediaDir ) ; DocumentDescriptor docDescriptor = conversionContext . getDocument ( ) ; AttachmentDescriptor attDescription = null ; if ( docDescriptor . isAttachmentDescriptionAvailable ( attachmentName ) ) { attDescription = docDescriptor . getAttachmentDescription ( attachmentName ) ; } if ( null == attDescription ) { logger . info ( "Submission can not be found" ) ; } else if ( false == UploadConstants . UPLOAD_STATUS_SUBMITTED_INLINE . equals ( attDescription . getStatus ( ) ) ) { logger . info ( "File not in submit inline state" ) ; } else { // Verify that a file is attached to the document if ( false == attDescription . isFilePresent ( ) ) { // Invalid state throw new Exception ( "Invalid state. A file must be present for submitted_inline" ) ; } // Download file File outputFile = File . createTempFile ( "inline" , "" , mediaDir ) ; conversionContext . downloadFile ( attachmentName , outputFile ) ; // Create an original structure to point to the file in the // media dir. This way, when we go to "submitted" state, we will // be ready. OriginalFileDescriptor originalDescription = attDescription . getOriginalFileDescription ( ) ; originalDescription . setMediaFileName ( outputFile . getName ( ) ) ; // Delete current attachment attDescription . removeFile ( ) ; // Update status attDescription . setStatus ( UploadConstants . UPLOAD_STATUS_SUBMITTED ) ; conversionContext . saveDocument ( ) ; } }
This function is called when a media file was added on a different node such as a mobile device . In that case the media is marked as submitted_inline since the media is already attached to the document but as not yet gone through the process that the robot implements .