private < T extends IEntity > IntuitMessage prepareUpload ( T entity , InputStream docContent , String boundaryId ) throws FMSException { IntuitMessage intuitMessage = new IntuitMessage ( ) ; RequestElements requestElements = intuitMessage . getRequestElements ( ) ; //set the request parameters Map < String , String > requestParameters = requestElements . getRequestParameters ( ) ; requestParameters . put ( RequestElements . REQ_PARAM_METHOD_TYPE , MethodType . POST . toString ( ) ) ; UploadRequestElements uploadRequestElements = requestElements . getUploadRequestElements ( ) ; uploadRequestElements . setDocContent ( docContent ) ; uploadRequestElements . setBoundaryId ( utilizeIf ( boundaryId ) ) ; uploadRequestElements . setElementsId ( generateId ( ) . substring ( 0 , 5 ) ) ; requestElements . setAction ( OperationType . UPLOAD . toString ( ) ) ; requestElements . setContext ( context ) ; requestElements . setEntity ( entity ) ; requestElements . setObjectToSerialize ( getSerializableObject ( entity ) ) ; return intuitMessage ; }
Common method to prepare the request params for upload operation for both sync and async calls