private Document createDocument(final InputStream inputStream,final FormDataContentDisposition formDataContentDisposition){
  final Document document=new Document();
  final List<File> files=new ArrayList<File>(0);
  final List<String> contentTypes=new ArrayList<String>(0);
  final List<String> fileNames=new ArrayList<String>(0);
  File file=null;
  if (inputStream != null && formDataContentDisposition != null) {
    fileNames.add(formDataContentDisposition.getFileName());
    document.setUploadsFileName(fileNames);
    file=writeToFile(inputStream,formDataContentDisposition.getFileName());
    files.add(file);
    document.setUploads(files);
    contentTypes.add(MessageFormat.format(THIRD_PARTY_CONTENT_TYPE,FilenameUtils.getExtension(file.getPath())));
    document.setUploadsContentType(contentTypes);
  }
  return document;
}

private Document createDocument ( final InputStream inputStream , final FormDataContentDisposition formDataContentDisposition ) { final Document document = new Document ( ) ; final List < File > files = new ArrayList < File > ( 0 ) ; final List < String > contentTypes = new ArrayList < String > ( 0 ) ; final List < String > fileNames = new ArrayList < String > ( 0 ) ; File file = null ; if ( inputStream != null && formDataContentDisposition != null ) { fileNames . add ( formDataContentDisposition . getFileName ( ) ) ; document . setUploadsFileName ( fileNames ) ; file = writeToFile ( inputStream , formDataContentDisposition . getFileName ( ) ) ; files . add ( file ) ; document . setUploads ( files ) ; contentTypes . add ( MessageFormat . format ( THIRD_PARTY_CONTENT_TYPE , FilenameUtils . getExtension ( file . getPath ( ) ) ) ) ; document . setUploadsContentType ( contentTypes ) ; } return document ; }
this method is used to create document object to upload the files .
