Package org.openbravo.client.kernel
Class BaseActionHandler
- java.lang.Object
-
- org.openbravo.client.kernel.BaseActionHandler
-
- All Implemented Interfaces:
ActionHandler
- Direct Known Subclasses:
AddPaymentDisplayLogicActionHandler
,AddPaymentDocumentNoActionHandler
,AddPaymentOnProcessActionHandler
,AddPaymentOrganizationActionHandler
,AddPaymentReloadLabelsActionHandler
,AddTransactionOnChangePaymentActionHandler
,AgingGeneralLedgerByOrganizationActionHandler
,AlertActionHandler
,AlertManagementActionHandler
,APRMActionHandler
,AttachmentAH
,BaseProcessActionHandler
,CancelAndReplaceGetCancelledOrderLine
,CancelCostAdjustment
,CheckAvailableCreditActionHandler
,CheckExistsOverissueBinForRFCShipmentWH
,CheckRecordChangedActionHandler
,CloneOrderActionHandler
,ComputeSelectedRecordActionHandler
,ComputeTranslatedNameActionHandler
,ComputeWindowActionHandler
,CostAdjustmentProcessHandler
,CostingRuleProcessOnProcessHandler
,DefaultsAttachmentActionHandler
,DefaultsUploadDataActionHandler
,DeleteImageActionHandler
,EnableOrDisableMultipleRecords
,FindTransactionsToMatchActionHandler
,FormInitializationComponent
,FundsTransferOnChangeDepositToActionHandler
,GetConvertedQtyActionHandler
,GetLabelActionHandler
,GetNameGeneralLedger
,GetTabMessageActionHandler
,GLItemTransactionActionHandler
,GridExampleActionHandler
,ImagesActionHandler
,InventoryAmountUpdateProcess
,LandedCostProcessHandler
,LCMatchingCancelHandler
,LCMatchingProcessHandler
,LogOutActionHandler
,ManualCostAdjustmentProcessHandler
,MatchStatementOnLoadActionHandler
,MatchStatementOnLoadGetPreferenceActionHandler
,MatchStatementOnLoadPreferenceActionHandler
,MultipleDeleteActionHandler
,MyOpenbravoActionHandler
,OpenClosePeriodHandler
,ParametersActionHandler
,PaymentMethodMulticurrencyActionHandler
,PersonalizationActionHandler
,ReactivateLandedCost
,RecalculatePermissionsHandler
,ReceivedFromPaymentMethodActionHandler
,RFCServiceReturnableActionHandler
,SelectorDefaultFilterActionHandler
,ServiceRelatedLinePriceActionHandler
,StorePropertyActionHandler
,TestActionHandler
,UnMatchSelectedTransactionsActionHandler
,UnMatchTransactionActionHandler
,UpdateInvariantCharacteristicsHandler
,UpdateMultiVariantPurchaseOrderLines
,UserInfoWidgetActionHandler
,WindowSettingsActionHandler
public abstract class BaseActionHandler extends Object implements ActionHandler
Implements the ActionHandler and provides utility methods to sub classes.- Author:
- mtaal
-
-
Constructor Summary
Constructors Constructor Description BaseActionHandler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
execute()
protected abstract org.codehaus.jettison.json.JSONObject
execute(Map<String,Object> parameters, String content)
Needs to be implemented by a subclass.protected Map<String,Object>
extractParametersFromRequest(javax.servlet.http.HttpServletRequest request)
Utility function used by execute() that lets us extend the part where we extract the list of parameters of the request and returns it as a Map<String, Object>protected String
extractRequestContent(javax.servlet.http.HttpServletRequest request, Map<String,Object> requestParameters)
Utility function used by execute() that lets us extend the part where the request contents are extracted from the request payload.protected Map<String,String>
fixRequestMap(Map<String,Object> parameters, org.codehaus.jettison.json.JSONObject context)
Fixes the request map adding an "context" key to include context info in order to make it available to be evaluated by FilterExpressionprotected void
writeResponse(Map<String,Object> parameters, org.codehaus.jettison.json.JSONObject result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Utility function used by execute() that, given the request, the response of the execute(parameters, content) execution and the parameters, writes the response object to be sent back to the client.
-
-
-
Method Detail
-
execute
public void execute()
- Specified by:
execute
in interfaceActionHandler
-
extractParametersFromRequest
protected Map<String,Object> extractParametersFromRequest(javax.servlet.http.HttpServletRequest request)
Utility function used by execute() that lets us extend the part where we extract the list of parameters of the request and returns it as a Map<String, Object>- Parameters:
request
- The request- Returns:
- A map with key the name of the parameter and an Object as the value
-
extractRequestContent
protected String extractRequestContent(javax.servlet.http.HttpServletRequest request, Map<String,Object> requestParameters) throws IOException
Utility function used by execute() that lets us extend the part where the request contents are extracted from the request payload.- Parameters:
request
- The requestrequestParameters
- The map of parameters extracted from the request- Returns:
- The request content as an String
- Throws:
IOException
- when there is an error reading the request InputStream
-
writeResponse
protected void writeResponse(Map<String,Object> parameters, org.codehaus.jettison.json.JSONObject result, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
Utility function used by execute() that, given the request, the response of the execute(parameters, content) execution and the parameters, writes the response object to be sent back to the client.- Parameters:
parameters
- The list of parameters of the request generated by extractParametersFromRequest()result
- The result returned by execute(parameters, content)request
- The requestresponse
- The response object to be sent back to the client- Throws:
IOException
- if there is an error writing the response object
-
fixRequestMap
protected Map<String,String> fixRequestMap(Map<String,Object> parameters, org.codehaus.jettison.json.JSONObject context)
Fixes the request map adding an "context" key to include context info in order to make it available to be evaluated by FilterExpression
-
execute
protected abstract org.codehaus.jettison.json.JSONObject execute(Map<String,Object> parameters, String content)
Needs to be implemented by a subclass.- Parameters:
parameters
- the parameters obtained from the request. Note that the request object and the session object are also present in this map, resp. as the constantsKernelConstants.HTTP_REQUEST
andKernelConstants.HTTP_SESSION
.content
- the request content (if any)- Returns:
- the return should be a JSONObject, this is passed back to the caller on the client.
-
-