Package com.ptc.netmarkets.util.beans
Class NmCommandBean
java.lang.Object
com.ptc.netmarkets.util.beans.NmCommandBean
- All Implemented Interfaces:
FormDataHolder,Externalizable,Serializable,Cloneable
A new NmCommandBean is created for each request and put into request scope for reuse across the lifetime of the
request. The bean has helper APIs to access all the form data for the current request. Query parameters, form data
values (from hidden input fields, text inputs, text areas, checkboxs, radio buttons etc.) If the form fields were
rendered by a GuiComponent, the command bean will also have info on whether the value was changed and what the old
value was. There are also helper APIs to get the current context object for the page/action.
Keeps track of whether there is a dynamic refresh of a table/tree for the current request. And holds the oid information of what is getting dynamically refreshed. This dynamic refresh information is set up automatically if your FormProcessor sets up DyanmicRefreshInfo(s) on a FormResult. If needed APIs such as
Used to get query parameters or values from hidden input fields. Example set of APIs to get the values of combo boxes (each kind of input component has a set of APIs like this):
Helper APIs that can be used to get the current context object(s) for the page/action.
Supported API: true
Extendable: true
Keeps track of whether there is a dynamic refresh of a table/tree for the current request. And holds the oid information of what is getting dynamically refreshed. This dynamic refresh information is set up automatically if your FormProcessor sets up DyanmicRefreshInfo(s) on a FormResult. If needed APIs such as
setDynamic(ArrayList, NmOid, NmOid, String) could be called directly from a command class, but the best
practice is to set up a FormResult with DynamicRefreshInfo objects. Used to get query parameters or values from hidden input fields. Example set of APIs to get the values of combo boxes (each kind of input component has a set of APIs like this):
Helper APIs that can be used to get the current context object(s) for the page/action.
Supported API: true
Extendable: true
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertMain(String name) Converts a 8859 string into utf8
Supported API: trueconvertRequestParam(String text) Converts a string from ISO-8859 to UTF-8 if needed.Deprecated.Gets the object that is the target of the action.Gets the actions oids of a action that does not have a wizard.Gets the actions oids of a action that had a wizard.getAddedItemsByName(String param_name) Will return the list of NmOids which were selected for addition from the component defined by the component nameparam_name.Gets the comboboxes that have changed.Returns a hashMap of any radio buttons that have changed.Gets the textboxes that have changed.Gets the textareas that have changed.Gets the value of the attribute: comboBox; The comboboxes that are posted on this request object
Supported API: truestatic ObjectgetContextFromString(String nmoidstr, Object req) Will return the target oid of the string if the string is a NmOid string, NmCOntext string, or Object Ref string.Gets the row context object.getInitialItemsByName(String param_name) Returns the list of initial NmOids for objects which are associated to the component with the nameparam_name.Returns a hashMap of Name of Checkbox -> Optional Column Name so that if one was to make a table of principals to Access control, the name would be the user, and the optional column name would be the access control.Get the selected objects as oids.Get the selected-in-opener objects as oids.static NmOidgetOidFromObject(Object nextObj) Will return the target oid of the object if the object is a NmOid string, NmCOntext string, or a String.jakarta.servlet.jsp.JspWritergetOut()Gets the value of the attribute: out; available in the jsp engine only This is the jsp out variable
Supported API: trueGets the over-ridden context object.Gets the main context object.getRemovedItemsByName(String param_name) Will return the list of NmOids which were selected for removal from the component defined by the component nameparam_name.returns the attribute value
Supported API: truejakarta.servlet.http.HttpServletResponseGets the value of the attribute: response; available in the jsp engine only
Supported API: trueGets the value of the attribute: selected; gets the selected objects from the table in the Form Processor or NmCommand class for a NORMAL action.Same as getSelectedOidForPopup but it does not auto-convert the NmContext -> NmOid if developer needs that extra info.gets the selected objects from the table in the popup window jsp or table code if the UI needs to display something about the selected objects that were selected when the action was click to launch the window.getTextParameter(String key) Gets a HTTP request parameter value in UTF8 format.String[]Gets all the HTTP request parameter values for the given key in UTF8 format.Returns a hashMap of all the un-checked checkboxes on the page.Returns the container that the user is launching the action from.Returns the container that the user is launching the action from.voidInitialize the commandbean so that request data is available in the Method Server The request object must have been set prior to this call Will not reset if called multiple times **
Supported API: truevoidSets the value of the attribute: out; available in the jsp engine only
Supported API: truevoidsetParameter(String name, String value, String[] values) Initialize the commandBean with a specific parameter.voidsetRequest(Object a_Request) Initializes the commandbean with all the request params.voidsetResponse(Object a_Response) Sets the value of the attribute: response; available in the jsp engine only
Supported API: true
-
Method Details
-
getSelected
Gets the value of the attribute: selected; gets the selected objects from the table in the Form Processor or NmCommand class for a NORMAL action. Gets the current selected items in the window.
Supported API: true- Returns:
- ArrayList
-
getComboBox
Gets the value of the attribute: comboBox; The comboboxes that are posted on this request object
Supported API: true- Specified by:
getComboBoxin interfaceFormDataHolder- Returns:
- HashMap
-
getPrimaryOid
Gets the main context object. Usually the oid on the url from which the page was launched. last resort for knowing what the page should display info for. Use getActionOid(), getActionOidsWithWizard(), getActionOidsWithOutWizard() for determing the target of actions. Use getPageOid() for determing the object to use incase it jsp over-rode the context object on an include.
Supported API: true- Returns:
- NmOid
- Throws:
WTException
-
getPageOid
Gets the over-ridden context object. Same as primaryOid when no jsp include has occurred. Use getActionOid(), getActionOidsWithWizard(), getActionOidsWithOutWizard() for determining the target of actions. Use getPageOid() for determining the object to use in-case it jsp over-rode the context object on an include.
Supported API: true- Returns:
- NmOid
- Throws:
WTException
-
getElementOid
Gets the row context object. Use getActionOid(), getActionOidsWithWizard(), getActionOidsWithOutWizard() for determining the target of actions.
Supported API: true- Returns:
- NmOid
- Throws:
WTException
-
getNewChecked
Returns a hashMap of Name of Checkbox -> Optional Column Name so that if one was to make a table of principals to Access control, the name would be the user, and the optional column name would be the access control.
Supported API: true- Specified by:
getNewCheckedin interfaceFormDataHolder- Returns:
- HashMap
- Throws:
WTException
-
getUnChecked
Returns a hashMap of all the un-checked checkboxes on the page. Only returns values that were originally rendered with checkbox gui-components. Name of Checkbox -> Optional Column Name so that if one was to make a table of principals to Access control, the name would be the user, and the optional column name would be the access control.
Supported API: true- Specified by:
getUnCheckedin interfaceFormDataHolder- Returns:
- HashMap
- Throws:
WTException
-
getChangedRadio
Returns a hashMap of any radio buttons that have changed. Radio buttons needed to have been rendered by gui-comopnents. key,values of the hashmap are Name of radio -> Optional Column Name so that if one was to make a table of principals to Access control, the name would be the user, and the optional column name would be the access control.
Supported API: true- Specified by:
getChangedRadioin interfaceFormDataHolder- Returns:
- HashMap
- Throws:
WTException
-
getChangedText
Gets the textboxes that have changed. Name -> new value
Supported API: true- Specified by:
getChangedTextin interfaceFormDataHolder- Returns:
- HashMap
- Throws:
WTException
-
getChangedTextArea
Gets the textareas that have changed. Name -> new value
Supported API: true- Specified by:
getChangedTextAreain interfaceFormDataHolder- Returns:
- HashMap
- Throws:
WTException
-
getChangedComboBox
Gets the comboboxes that have changed. Name -> new value
Supported API: true- Specified by:
getChangedComboBoxin interfaceFormDataHolder- Returns:
- HashMap
- Throws:
WTException
-
getSelectedOidForPopup
gets the selected objects from the table in the popup window jsp or table code if the UI needs to display something about the selected objects that were selected when the action was click to launch the window. To be used during rendering (not meant for form processors which should use getActionOid, getActionOidsWithWizard, getActionOidsWithoutWizard)
Supported API: true- Returns:
- ArrayList
- Throws:
WTException
-
getAddedItemsByName
Will return the list of NmOids which were selected for addition from the component defined by the component nameparam_name.- Specified by:
getAddedItemsByNamein interfaceFormDataHolder- Parameters:
param_name- The name of the component which the items were added to. (for example: table ID)- Returns:
- a list of oids that are added from the component.
Supported API: true
-
getRemovedItemsByName
Will return the list of NmOids which were selected for removal from the component defined by the component nameparam_name.
Supported API: true- Specified by:
getRemovedItemsByNamein interfaceFormDataHolder- Parameters:
param_name- The name of the component which the items were removed from. (for example: table ID)- Returns:
- a list of oids that are removed from the component.
-
getTextParameter
Gets a HTTP request parameter value in UTF8 format. Works in both Servlet engine and Method Server code. Use this instead of getRequest().getParameter()
Available in the servlet container and in the Method Server
Supported API: true- Specified by:
getTextParameterin interfaceFormDataHolder- Parameters:
key-- Returns:
- String
-
getTextParameterValues
Gets all the HTTP request parameter values for the given key in UTF8 format.
Available in the servlet container and in the Method Server
Supported API: true- Specified by:
getTextParameterValuesin interfaceFormDataHolder- Parameters:
key-- Returns:
- String[]
-
setRequest
Initializes the commandbean with all the request params. Each request param is iterated over to set JCA state. Sets the value of the attribute: request;
Supported API: true- Parameters:
a_Request-- Throws:
WTException
-
getResponse
public jakarta.servlet.http.HttpServletResponse getResponse()Gets the value of the attribute: response; available in the jsp engine only
Supported API: true- Returns:
- HttpServletResponse
-
setResponse
Sets the value of the attribute: response; available in the jsp engine only
Supported API: true- Parameters:
a_Response-- Throws:
WTException
-
getOut
public jakarta.servlet.jsp.JspWriter getOut()Gets the value of the attribute: out; available in the jsp engine only This is the jsp out variable
Supported API: true- Returns:
- JspWriter
-
setOut
Sets the value of the attribute: out; available in the jsp engine only
Supported API: true- Parameters:
a_Out-- Throws:
WTException
-
getRequestAttribute
returns the attribute value
Supported API: true- Parameters:
key- : name of the attribute- Returns:
- value of the attribute
-
convertRequestParam
Converts a string from ISO-8859 to UTF-8 if needed. The isConvertParams global variable will be used to determine if conversion is necessary. Does not escpe any HTML in the given text and so is appropriate to use on rich text parameters.
Supported API: true -
convertRequestParamNoEscaping
Deprecated.UseconvertRequestParam(String)instead.Converts a string from ISO-8859 to UTF-8 if needed. The isConvertParams global variable will be used to determine if conversion is necessary. Does not escape any HTML in the given text and so is appropriate to use on rich text parameters.
Supported API: true -
convertMain
Converts a 8859 string into utf8
Supported API: true -
getSelectedContextsForPopup
Same as getSelectedOidForPopup but it does not auto-convert the NmContext -> NmOid if developer needs that extra info. *
Supported API: true- Throws:
WTException
-
getContextFromString
Will return the target oid of the string if the string is a NmOid string, NmCOntext string, or Object Ref string.
Supported API: true- Throws:
WTException
-
getOidFromObject
Will return the target oid of the object if the object is a NmOid string, NmCOntext string, or a String.
Supported API: true- Throws:
WTException
-
getViewingContainer
Returns the container that the user is launching the action from. When actions are launched from a object that is shared, this method will return the shared container instead of the object's true container
If the user doesn't have access to the container, returns null. Also refergetViewingContainerObject()
Supported API: true- Throws:
WTException
-
getViewingContainerObject
Returns the container that the user is launching the action from. When actions are launched from a object that is shared, this method will return the shared container instead of the object's true container
If the user doesn't have access to the container, throws exception. Also refergetViewingContainer()
Supported API: true- Throws:
WTException
-
getActionOid
Gets the object that is the target of the action. This could be the elementOid for a row based action or the primarOid for actions invoked on the details page It will not look at selected objects for toolbar actions. Please use for toolbar actions: getActionOidsWithWizard, getActionOidsWithOutWizard **
Supported API: true- Throws:
WTException
-
setParameter
Initialize the commandBean with a specific parameter.
Supported API: true- Parameters:
name- - the name of the request parametervalue- - the value to setvalues- - array of values, if null, will be defaulted to be new String {value} **- Throws:
WTException
-
initializeServerRequestData
public void initializeServerRequestData()Initialize the commandbean so that request data is available in the Method Server The request object must have been set prior to this call Will not reset if called multiple times **
Supported API: true -
getActionOidsWithWizard
Gets the actions oids of a action that had a wizard. Use this method to find which objects the action should act upon. When its in a toolbar, this will return all the selected objects when the action was launched. When launched from other locations it will return the actionOid **
Supported API: true- Throws:
WTException
-
getActionOidsWithoutWizard
Gets the actions oids of a action that does not have a wizard. Use this method to find which objects the action should act upon. When its in a toolbar, this will return all the selected objects when the action was launched. When launched from other locations it will return the actionOid **
Supported API: true- Throws:
WTException
-
getNmOidSelected
Get the selected objects as oids. getSelected() method will return NmContexts which provides more info but requires calling code to cast and and call getTargetOid() **
Supported API: true- Throws:
WTException
-
getNmOidSelectedInOpener
Get the selected-in-opener objects as oids. getSelectedInOpener() method will return NmContexts which provides more info but requires calling code to cast and and call getTargetOid() **
Supported API: true- Throws:
WTException
-
getInitialItemsByName
Returns the list of initial NmOids for objects which are associated to the component with the nameparam_name.
Supported API: true- Specified by:
getInitialItemsByNamein interfaceFormDataHolder- Parameters:
param_name- The name of the component with the initial items (for example: table ID)- Returns:
- a list of initial oids that are from the component.
- See Also:
-
convertRequestParam(String)instead.