Class ProcessUploadedFile
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.openbravo.base.HttpBaseServlet
-
- org.openbravo.base.secureApp.HttpSecureAppServlet
-
- org.openbravo.client.application.businesslogic.ProcessUploadedFile
-
- All Implemented Interfaces:
Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
,ConnectionProvider
- Direct Known Subclasses:
ImportBPSet
,ImportInventoryLines
,ImportProductInDiscount
public abstract class ProcessUploadedFile extends HttpSecureAppServlet
Generic base class to be extended to implement an import by uploading a file. The actual processing happens in a subclass which needs to override two methods. The resulting (error) messages can be returned as a file to download by the user.- Author:
- mtaal
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProcessUploadedFile.UploadResult
-
Field Summary
-
Fields inherited from class org.openbravo.base.secureApp.HttpSecureAppServlet
boolHist, classInfo
-
Fields inherited from class org.openbravo.base.HttpBaseServlet
globalParameters, log4j, myPool, strDefaultServlet, strDireccion, strReplaceWith, strReplaceWithFull, xmlEngine
-
-
Constructor Summary
Constructors Constructor Description ProcessUploadedFile()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
clearBeforeImport(String ownerId, org.codehaus.jettison.json.JSONObject paramValues)
This method is called when the parameter import mode is set to import and replace.void
doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected abstract ProcessUploadedFile.UploadResult
doProcessFile(org.codehaus.jettison.json.JSONObject paramValues, File file)
Is called to process the content of the uploaded file.void
post(VariablesSecureApp vars, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected ProcessUploadedFile.UploadResult
processFile(File file, org.codehaus.jettison.json.JSONObject paramValues)
protected void
readAndReturnResult(javax.servlet.http.HttpServletResponse response, org.codehaus.jettison.json.JSONObject paramValues)
protected void
uploadFile(VariablesSecureApp vars, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.codehaus.jettison.json.JSONObject paramValues)
-
Methods inherited from class org.openbravo.base.secureApp.HttpSecureAppServlet
advise, advisePopUp, advisePopUp, advisePopUpRefresh, bdError, bdErrorAjax, bdErrorConnection, bdErrorGeneralPopUp, bdErrorHidden, getServletInfo, hasGeneralAccess, init, invalidateSession, licenseError, logout, pageError, pageErrorCallOut, pageErrorPopUp, printPageClosePopUp, printPageClosePopUp, printPageClosePopUp, printPageClosePopUpAndRefreshParent, printPagePopUpDownload, printPagePopUpDownloadAndRefresh, readNumberFormat, readProperties, renderJR, renderJR, renderJR, renderJR, service, setClassInfo, setHistoryCommand, whitePage, whitePage
-
Methods inherited from class org.openbravo.base.HttpBaseServlet
doGet, doGetCall, doPostCall, getBaseDesignPath, getCallableStatement, getCallableStatement, getCallableStatement, getConnection, getPoolStatus, getPreparedStatement, getPreparedStatement, getPreparedStatement, getRDBMS, getStatement, getStatement, getStatement, getStatus, getTransactionConnection, initialize, releaseCallableStatement, releaseCommitConnection, releasePreparedStatement, releaseRollbackConnection, releaseStatement, releaseTransactionalPreparedStatement, releaseTransactionalStatement, serviceInitialized
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
-
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletName, init, log, log
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.openbravo.database.ConnectionProvider
destroy
-
-
-
-
Method Detail
-
doPost
public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletException
- Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Throws:
IOException
javax.servlet.ServletException
-
post
public void post(VariablesSecureApp vars, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
uploadFile
protected void uploadFile(VariablesSecureApp vars, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.codehaus.jettison.json.JSONObject paramValues) throws Exception
- Throws:
Exception
-
readAndReturnResult
protected void readAndReturnResult(javax.servlet.http.HttpServletResponse response, org.codehaus.jettison.json.JSONObject paramValues) throws Exception
- Throws:
Exception
-
processFile
protected ProcessUploadedFile.UploadResult processFile(File file, org.codehaus.jettison.json.JSONObject paramValues) throws Exception
- Throws:
Exception
-
clearBeforeImport
protected abstract void clearBeforeImport(String ownerId, org.codehaus.jettison.json.JSONObject paramValues)
This method is called when the parameter import mode is set to import and replace. In that case the current content should be removed. The ownerId is the id of the parent record.
-
doProcessFile
protected abstract ProcessUploadedFile.UploadResult doProcessFile(org.codehaus.jettison.json.JSONObject paramValues, File file) throws Exception
Is called to process the content of the uploaded file. The results should be returned in the uploadResult object.- Throws:
Exception
-
-