T
- the types of objects that this crud can handle.public abstract class AbstractCrudAction<T> extends AbstractPageAction
A generic PageAction offering CRUD functionality, independently on the underlying data source.
Out of the box, instances of this class are capable of the following:
SelectionProviderSupport
which must be provided by the concrete
subclasses;This PageAction can handle a varying number of URL path parameters. Each parameter is assumed to be part of an object identifier - for example, a database primary key (single or multi-valued). When no parameter is specified, the page is in search mode. When the correct number of parameters is provided, the action attempts to load an object with the appropriate identifier (for example, by loading a row from a database table with the corresponding primary key). As any other page, crud pages can have children, and they always prevail over the object key: a crud page with a child named "child" will never attempt to load an object with key "child".
AbstractPageAction.TerminalResource
CONF_FORM_PREFIX, DEFAULT_LAYOUT_CONTAINER, PAGE_CONFIGURATION_FIELDS, PAGE_CONFIGURATION_FIELDS_NO_DETAIL, pageConfigurationForm, pageInstance, pageTemplate, PORTOFINO_PAGEACTION_EXCEPTION, portofinoConfiguration, returnUrl, script, serverInfo, templates
context
Constructor and Description |
---|
AbstractCrudAction() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptsPathParameter() |
protected void |
addSuccessfulSaveInfoMessage()
Adds an information message (using
SessionMessages ) after successful creation of a new record. |
protected String |
appendSearchStringParamIfNecessary(String s)
If a search has been executed, appends a URL-encoded String representation of the search criteria
to the given string, as a GET parameter.
|
protected StringBuilder |
appendSearchStringParamIfNecessary(StringBuilder sb)
If a search has been executed, appends a URL-encoded String representation of the search criteria
to the given StringBuilder, as a GET parameter.
|
protected void |
buildConfigurationForm() |
protected Form |
buildForm(FormBuilder formBuilder) |
protected SearchForm |
buildSearchForm(SearchFormBuilder searchFormBuilder) |
protected TableForm |
buildTableForm(TableFormBuilder tableFormBuilder) |
Resolution |
bulkDelete() |
Resolution |
bulkEdit() |
Resolution |
bulkUpdate()
Handles a bulk update operation (typically invoked by the user submitting a bulk edit form).
|
protected String |
calculateBaseSearchUrl()
Computes the search URL from the current URL.
|
Resolution |
cancel() |
protected List<Field> |
collectVisibleFields(FieldSet fieldSet,
List<Field> fields)
Deprecated.
|
protected List<Field> |
collectVisibleFields(Form form,
List<Field> fields)
Deprecated.
|
protected void |
commitTransaction()
Executes any pending updates on persistent objects.
|
Resolution |
configure() |
protected void |
configureDetailLink(TableFormBuilder tableFormBuilder) |
protected FormBuilder |
configureFormBuilder(FormBuilder formBuilder,
Mode mode)
Configures the builder for the detail form (view, create, edit).
|
protected void |
configureFormSelectionProviders(FormBuilder formBuilder) |
protected SearchFormBuilder |
configureSearchFormBuilder(SearchFormBuilder searchFormBuilder) |
protected void |
configureSortLinks(TableFormBuilder tableFormBuilder) |
protected TableFormBuilder |
configureTableFormBuilder(TableFormBuilder tableFormBuilder,
Mode mode,
int nRows)
Configures the builder for the search results form.
|
protected void |
configureTableFormSelectionProviders(TableFormBuilder tableFormBuilder) |
Resolution |
create() |
protected FormBuilder |
createFormBuilder() |
protected void |
createPostProcess(T object)
Hook method called just before a new object is actually saved to persistent storage.
|
protected SearchFormBuilder |
createSearchFormBuilder() |
protected void |
createSetup(T object)
Hook method called just after a new object has been created.
|
protected TableFormBuilder |
createTableFormBuilder() |
protected boolean |
createValidate(T object)
Hook method called after values from the create form have been propagated to the new object.
|
Resolution |
delete() |
Response |
deleteBlob(String propertyName) |
protected void |
deleteBlobs(T object)
Removes all the file blobs associated with the object from the file system.
|
protected void |
deleteOldBlobs(List<Blob> blobsBefore,
List<Blob> blobsAfter) |
protected void |
deletePostProcess(T object)
Hook method called just before an object is deleted from persistent storage, but after the doDelete
method has been called.
|
protected boolean |
deleteValidate(T object)
Hook method called before an object is deleted.
|
String |
describeClassAccessor()
Returns a description of this CRUD's ClassAccessor.
|
protected void |
disableBlobFields() |
protected abstract void |
doDelete(T object)
Deletes an object from the persistent storage.
|
protected abstract void |
doSave(T object)
Saves a new object to the persistent storage.
|
protected Resolution |
doSearch()
Executes a search and forwards to the appropriate view.
|
protected abstract void |
doUpdate(T object)
Saves an existing object to the persistent storage.
|
Resolution |
downloadBlob() |
Resolution |
downloadBlob(String propertyName) |
Resolution |
edit() |
protected void |
editPostProcess(T object)
Hook method called just before an existing object is actually saved to persistent storage.
|
protected void |
editSetup(T object)
Hook method called just before an object is used to populate the edit form.
|
protected boolean |
editValidate(T object)
Hook method called after values from the edit form have been propagated to the object.
|
Resolution |
execute() |
protected void |
executeSearch() |
protected void |
fieldsToJson(org.json.JSONStringer js,
Collection<Field> fields)
Deprecated.
|
protected CrudProperty |
findProperty(String name,
List<CrudProperty> properties)
Searches in a list of properties for a property with a given name.
|
protected String |
generateObjectUrl(String baseUrl,
int index) |
protected String |
generateObjectUrl(String baseUrl,
Object o) |
Resolution |
getAsJson(String searchString,
Integer firstResult,
Integer maxResults,
String sortProperty,
String sortDirection)
Handles search and detail via REST.
|
String |
getBlobDownloadUrl(AbstractBlobField field) |
protected List<FileBlobField> |
getBlobFields() |
protected BlobManager |
getBlobManager() |
protected List<Blob> |
getBlobsFromForm() |
protected List<Blob> |
getBlobsFromObject(T object) |
protected Resolution |
getBulkEditView()
Returns the Resolution used to show the Bulk Edit page.
|
ClassAccessor |
getClassAccessor() |
protected abstract Resolution |
getConfigurationView()
Returns the Resolution used to show the configuration page.
|
String |
getCreateTitle() |
protected Resolution |
getCreateView()
Returns the Resolution used to show the Create page.
|
CrudConfiguration |
getCrudConfiguration() |
Form |
getCrudConfigurationForm() |
List<CrudSelectionProvider> |
getCrudSelectionProviders() |
List<TextField> |
getEditableRichTextFields()
Deprecated.
|
String |
getEditTitle() |
protected Resolution |
getEditView()
Returns the Resolution used to show the Edit page.
|
protected Resolution |
getEmbeddedReadView()
Returns the Resolution used to show the Search page when this page is embedded in its parent.
|
protected Resolution |
getEmbeddedSearchView()
Returns the Resolution used to show the Search page when this page is embedded in its parent.
|
protected String |
getEncodedSearchStringParam()
Encodes the current search string (a representation of the current search criteria as a series of GET
parameters) to an URL-encoded GET parameter.
|
Integer |
getFirstResult() |
Form |
getForm() |
String |
getLabelSearch() |
String |
getLinkToPage(int page) |
Integer |
getMaxResults() |
T |
getObject() |
List<? extends T> |
getObjects() |
protected String |
getPkForUrl(String[] pk)
Encodes the exploded object indentifier to include it in a URL.
|
PkHelper |
getPkHelper() |
String |
getPopupCloseCallback() |
TableForm |
getPropertiesTableForm() |
String |
getPropertyName() |
protected String |
getReadLinkExpression()
Returns an OGNL expression that, when evaluated against a persistent object, produces a
URL path suitable to be used as a link to that object.
|
String |
getReadTitle() |
protected OgnlTextFormat |
getReadURLFormat()
Computes an OgnlTextFormat from the result of getReadLinkExpression(), with the correct URL encoding.
|
protected Resolution |
getReadView()
Returns the Resolution used to show the Read page.
|
String |
getRelName() |
ResultSetNavigation |
getResultSetNavigation() |
SearchForm |
getSearchForm() |
Resolution |
getSearchResultsPage()
Executes a search and returns the results table.
|
protected Resolution |
getSearchResultsPageView()
Returns the Resolution used to display the search results when paginating or sorting via AJAX.
|
String |
getSearchString() |
String |
getSearchTitle() |
protected Resolution |
getSearchView()
Returns the Resolution used to show the Search page.
|
String[] |
getSelection() |
int |
getSelectionProviderIndex() |
TableForm |
getSelectionProvidersForm() |
String |
getSortDirection() |
String |
getSortProperty() |
protected Resolution |
getSuccessfulDeleteView()
Returns the Resolution used to show the effect of a successful delete action.
|
protected Resolution |
getSuccessfulSaveView()
Returns the Resolution used to show the effect of a successful save action.
|
protected Resolution |
getSuccessfulUpdateView()
Returns the Resolution used to show the effect of a successful update action.
|
String |
getSuccessReturnUrl() |
TableForm |
getTableForm() |
BlobManager |
getTemporaryBlobManager() |
abstract long |
getTotalSearchRecords()
Returns the number of objects matching the current search criteria, not considering set limits
(first and max results).
|
protected String |
getUrlEncoding() |
protected org.jsoup.safety.Whitelist |
getWhitelist()
Returns the JSoup whitelist used to clean user-provided HTML in rich-text fields.
|
void |
httpDelete()
Handles object deletion via REST.
|
Response |
httpPostJson(String jsonObject)
Handles object creation via REST.
|
Response |
httpPostMultipart()
Handles object creation with attachments via REST.
|
Response |
httpPutJson(String jsonObject)
Handles object update via REST.
|
Response |
httpPutMultipart()
Handles object update with attachments via REST.
|
boolean |
isBulkOperationsEnabled() |
boolean |
isConfigured() |
boolean |
isCreateEnabled() |
boolean |
isDeleteEnabled() |
boolean |
isEditEnabled() |
boolean |
isFormWithRichTextFields() |
boolean |
isMultipartRequest() |
boolean |
isPopup() |
boolean |
isRequiredFieldsPresent() |
boolean |
isSearchVisible() |
Boolean |
isTableFormSelectable() |
Resolution |
jsonAutocompleteOptions() |
Resolution |
jsonAutocompleteSearchOptions() |
Resolution |
jsonOptions(String selectionProviderName,
int selectionProviderIndex,
String prefix,
boolean includeSelectPrompt)
Returns values to update multiple related select fields or a single autocomplete
text field, in JSON form.
|
Resolution |
jsonOptions(String selectionProviderName,
String prefix,
boolean includeSelectPrompt)
Returns values to update multiple a single select or autocomplete field, in JSON form.
|
Resolution |
jsonReadData() |
Resolution |
jsonSearchData() |
Resolution |
jsonSelectFieldOptions() |
Resolution |
jsonSelectFieldSearchOptions() |
protected void |
loadObject(String... identifier)
|
protected abstract T |
loadObjectByPrimaryKey(Serializable pkObject)
Loads an object by its identifier and returns it.
|
abstract void |
loadObjects()
Loads a list of objects filtered using the current search criteria and limited by the current
first and max results parameters.
|
protected Resolution |
notInUseCase(ActionBeanContext context,
List<String> parameters) |
protected Response |
objectCreated() |
protected void |
persistNewBlobs(List<Blob> blobsBefore,
List<Blob> blobsAfter) |
protected void |
preCreate() |
protected void |
preEdit() |
protected abstract ClassAccessor |
prepare(PageInstance pageInstance)
Builds the ClassAccessor used to create, manipulate and introspect persistent objects.
|
protected void |
prepareConfigurationForms()
Sets up the Elements form(s)
|
Resolution |
preparePage()
A lifecycle method invoked during the dispatch phase, where a http request is translated to a dispatch
(a path in the page tree) ultimately leading to an action invocation.
|
Resolution |
read() |
protected void |
readFormFromMultipartRequest() |
protected void |
readSearchFormFromRequest()
Populates the search form from request parameters.
|
protected void |
refreshBlobDownloadHref() |
protected void |
refreshTableBlobDownloadHref() |
Resolution |
resetSearch() |
Resolution |
returnToSearch() |
Resolution |
save() |
protected void |
saveTemporaryBlobs() |
Resolution |
search() |
List |
selectionProviders() |
void |
setClassAccessor(ClassAccessor classAccessor) |
void |
setCrudConfiguration(CrudConfiguration crudConfiguration) |
void |
setCrudConfigurationForm(Form crudConfigurationForm) |
void |
setFirstResult(Integer firstResult) |
void |
setForm(Form form) |
void |
setLabelSearch(String labelSearch) |
void |
setMaxResults(Integer maxResults) |
void |
setPageInstance(PageInstance pageInstance)
Sets the PageInstance of this element.
|
void |
setPkHelper(PkHelper pkHelper) |
void |
setPopupCloseCallback(String popupCloseCallback) |
void |
setPropertyName(String propertyName) |
void |
setRelName(String relName) |
void |
setResultSetNavigation(ResultSetNavigation resultSetNavigation) |
void |
setSearchForm(SearchForm searchForm) |
void |
setSearchString(String searchString) |
void |
setSearchVisible(boolean searchVisible) |
void |
setSelection(String[] selection) |
void |
setSelectionProviderIndex(int selectionProviderIndex) |
void |
setSortDirection(String sortDirection) |
void |
setSortProperty(String sortProperty) |
void |
setSuccessReturnUrl(String successReturnUrl) |
void |
setTableForm(TableForm tableForm) |
protected void |
setupConfigurationForm(FormBuilder formBuilder) |
protected void |
setupForm(Mode mode)
Creates and configures the
Form used to display, edit and save a single object. |
protected void |
setupPagination()
Deprecated.
|
protected void |
setupPropertyEdits() |
protected void |
setupResultSetNavigation() |
protected void |
setupResultSetNavigation(int position,
int size) |
protected void |
setupSearchForm()
Creates, configures and populates the form used to gather search parameters.
|
protected void |
setupSelectionProviderEdits() |
protected void |
setupSelectionProvidersForm(Map<List<String>,Collection<String>> selectionProviderNames) |
protected void |
setupTableForm(Mode mode) |
Resolution |
update() |
Resolution |
updateConfiguration() |
protected void |
updateProperties() |
protected void |
updateSelectionProviders() |
Response |
uploadBlob(String propertyName,
String filename) |
protected void |
writeFormToObject()
Writes the contents of the create or edit form into the persistent object.
|
consumePathFragment, createTemplateSelectionProvider, forwardTo, forwardToPageActionError, forwardToPageActionNotConfigured, getActionAPIPath, getActionPath, getButtons, getConfiguration, getDefaultReturnUrl, getEmbeddedPageActions, getOgnlContext, getPage, getPageConfigurationForm, getPageDescription, getPageInstance, getPages, getPageTemplate, getParent, getPortofinoConfiguration, getResourcePath, getReturnUrl, getScript, getSubResource, initEmbeddedPageActions, prepareScript, readPageConfigurationFromRequest, saveConfiguration, setPageConfigurationForm, setPageTemplate, setReturnUrl, setScript, updatePageConfiguration, updateScript, updateTemplate, validatePageConfiguration
getContext, setContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContext
setContext
public static final String copyright
public static final String SEARCH_STRING_PARAM
public static final String prefix
public static final String searchPrefix
public static final String PERMISSION_CREATE
public static final String PERMISSION_EDIT
public static final String PERMISSION_DELETE
public static final org.slf4j.Logger logger
public String[] pk
public String propertyName
public String[] selection
public String searchString
public String successReturnUrl
public Integer firstResult
public Integer maxResults
public String sortProperty
public String sortDirection
public boolean searchVisible
protected String popupCloseCallback
public SearchForm searchForm
public TableForm tableForm
public Form form
protected SelectionProviderSupport selectionProviderSupport
protected String relName
protected int selectionProviderIndex
protected String labelSearch
public ClassAccessor classAccessor
public PkHelper pkHelper
public T object
protected BlobManager blobManager
protected BlobManager temporaryBlobManager
public CrudConfiguration crudConfiguration
public Form crudConfigurationForm
public TableForm propertiesTableForm
public CrudPropertyEdit[] propertyEdits
public TableForm selectionProvidersForm
public CrudSelectionProviderEdit[] selectionProviderEdits
protected ResultSetNavigation resultSetNavigation
public abstract void loadObjects()
objects
field.protected abstract T loadObjectByPrimaryKey(Serializable pkObject)
pkObject
- the object used as an identifier; the actual implementation is regulated by subclasses.
The only constraint is that it is serializable.protected abstract void doSave(T object)
object
- the object to save.RuntimeException
- if the object could not be saved.protected abstract void doUpdate(T object)
object
- the object to update.RuntimeException
- if the object could not be saved.protected abstract void doDelete(T object)
object
- the object to delete.RuntimeException
- if the object could not be deleted.@DefaultHandler public Resolution execute()
protected void loadObject(String... identifier)
identifier
- the object identifier in String formpublic Resolution search()
protected Resolution doSearch()
getSearchView()
public Resolution getSearchResultsPage()
getSearchResultsPageView()
protected void executeSearch()
public Resolution jsonSearchData() throws org.json.JSONException
org.json.JSONException
public abstract long getTotalSearchRecords()
public Resolution resetSearch()
public Resolution read()
public Resolution jsonReadData() throws org.json.JSONException
org.json.JSONException
protected void writeFormToObject()
whitelist
.protected org.jsoup.safety.Whitelist getWhitelist()
Whitelist.basic()
).protected void preCreate()
public Resolution create()
public Resolution save()
protected void saveTemporaryBlobs()
protected void preEdit()
public Resolution edit()
public Resolution update()
protected void persistNewBlobs(List<Blob> blobsBefore, List<Blob> blobsAfter) throws IOException
IOException
public boolean isBulkOperationsEnabled()
public Resolution bulkEdit()
public Resolution bulkUpdate()
public Resolution delete()
public Resolution bulkDelete()
public boolean isCreateEnabled()
protected void createSetup(T object)
object
- the new object.protected boolean createValidate(T object)
object
- the new object.protected void createPostProcess(T object)
object
- the new object.protected void commitTransaction()
public boolean isEditEnabled()
protected void editSetup(T object)
object
- the object.protected boolean editValidate(T object)
object
- the object.protected void editPostProcess(T object)
object
- the object just edited.public boolean isDeleteEnabled()
protected boolean deleteValidate(T object)
object
- the object.protected void deletePostProcess(T object)
object
- the object.protected Resolution getBulkEditView()
protected Resolution getCreateView()
protected Resolution getSuccessfulSaveView()
protected Resolution getSuccessfulUpdateView()
protected Resolution getSuccessfulDeleteView()
protected void addSuccessfulSaveInfoMessage()
SessionMessages
) after successful creation of a new record.
By default, the message contains a link to the created object as well as a link for creating a new one.protected Resolution getEditView()
protected Resolution getReadView()
protected Resolution getEmbeddedReadView()
protected Resolution getSearchView()
protected Resolution getEmbeddedSearchView()
protected Resolution getSearchResultsPageView()
protected boolean acceptsPathParameter()
acceptsPathParameter
in class AbstractPageAction
public void setPageInstance(PageInstance pageInstance)
DispatchElement
setPageInstance
in interface DispatchElement
setPageInstance
in class AbstractPageAction
public Resolution preparePage()
PageAction
protected Resolution notInUseCase(ActionBeanContext context, List<String> parameters)
protected abstract ClassAccessor prepare(PageInstance pageInstance)
Builds the ClassAccessor used to create, manipulate and introspect persistent objects.
This method is called during the prepare phase.
pageInstance
- the PageInstance corresponding to this action in the current dispatch.public boolean isConfigured()
@Deprecated protected void setupPagination()
protected void setupResultSetNavigation()
protected void setupResultSetNavigation(int position, int size)
protected String calculateBaseSearchUrl()
protected void setupSearchForm()
protected void readSearchFormFromRequest()
searchString
is blank, then the form is read from the request
(by AbstractCompositeElement.readFromRequest(javax.servlet.http.HttpServletRequest)
) and searchString
is generated accordingly.searchString
is interpreted as a query string and the form is populated from it.protected SearchFormBuilder createSearchFormBuilder()
protected SearchFormBuilder configureSearchFormBuilder(SearchFormBuilder searchFormBuilder)
protected SearchForm buildSearchForm(SearchFormBuilder searchFormBuilder)
protected void setupTableForm(Mode mode)
protected void configureTableFormSelectionProviders(TableFormBuilder tableFormBuilder)
protected void configureDetailLink(TableFormBuilder tableFormBuilder)
protected void configureSortLinks(TableFormBuilder tableFormBuilder)
public String getLinkToPage(int page)
protected TableForm buildTableForm(TableFormBuilder tableFormBuilder)
public Boolean isTableFormSelectable()
protected TableFormBuilder createTableFormBuilder()
protected TableFormBuilder configureTableFormBuilder(TableFormBuilder tableFormBuilder, Mode mode, int nRows)
tableFormBuilder
- the table form builder.mode
- the mode of the form.nRows
- number of rows to display.protected void setupForm(Mode mode)
Form
used to display, edit and save a single object. As a side effect, assigns
that form to the field form
.mode
- the Mode
of the form.protected void configureFormSelectionProviders(FormBuilder formBuilder)
protected Form buildForm(FormBuilder formBuilder)
protected void disableBlobFields()
protected FormBuilder createFormBuilder()
protected FormBuilder configureFormBuilder(FormBuilder formBuilder, Mode mode)
formBuilder
- the form builder.mode
- the mode of the form.public Resolution returnToSearch() throws Exception
Exception
public Resolution cancel()
cancel
in class AbstractPageAction
protected void refreshBlobDownloadHref()
protected void refreshTableBlobDownloadHref()
public String getBlobDownloadUrl(AbstractBlobField field)
public Resolution downloadBlob() throws IOException, NoSuchFieldException
IOException
NoSuchFieldException
@GET @Path(value=":blob/{propertyName}") public Resolution downloadBlob(@PathParam(value="propertyName") String propertyName) throws IOException, NoSuchFieldException
IOException
NoSuchFieldException
@PUT @Path(value=":blob/{propertyName}") public Response uploadBlob(@PathParam(value="propertyName") String propertyName, @QueryParam(value="filename") String filename) throws IOException, NoSuchFieldException
IOException
NoSuchFieldException
@DELETE @Path(value=":blob/{propertyName}") public Response deleteBlob(@PathParam(value="propertyName") String propertyName) throws IOException, NoSuchFieldException
IOException
NoSuchFieldException
protected BlobManager getBlobManager()
public BlobManager getTemporaryBlobManager()
protected void deleteBlobs(T object)
object
- the persistent object.protected List<FileBlobField> getBlobFields()
public Resolution configure()
protected abstract Resolution getConfigurationView()
protected void prepareConfigurationForms()
AbstractPageAction
prepareConfigurationForms
in class AbstractPageAction
protected void buildConfigurationForm()
protected void setupConfigurationForm(FormBuilder formBuilder)
protected void setupSelectionProvidersForm(Map<List<String>,Collection<String>> selectionProviderNames)
protected void setupPropertyEdits()
protected void setupSelectionProviderEdits()
public Resolution updateConfiguration()
protected void updateSelectionProviders()
protected void updateProperties()
public boolean isRequiredFieldsPresent()
public Resolution jsonSelectFieldOptions()
public Resolution jsonSelectFieldSearchOptions()
public Resolution jsonAutocompleteOptions()
public Resolution jsonAutocompleteSearchOptions()
@GET @Path(value=":selectionProvider/{selectionProviderName}") @Produces(value="application/json") public Resolution jsonOptions(@PathParam(value="selectionProviderName") String selectionProviderName, @QueryParam(value="prefix") String prefix, @QueryParam(value="includeSelectPrompt") boolean includeSelectPrompt)
jsonOptions(String, int, String, boolean)
.selectionProviderName
- name of the selection provider. See selectionProviders()
.prefix
- form prefix, to read values from the request.includeSelectPrompt
- controls if the first option is a label with no value indicating
what field is being selected. For combo boxes you would generally pass true as the value of
this parameter; for autocomplete fields, you would likely pass false.@GET @Path(value=":selectionProvider/{selectionProviderName}/{selectionProviderIndex : (\\d+)}") @Produces(value="application/json") public Resolution jsonOptions(@PathParam(value="selectionProviderName") String selectionProviderName, @PathParam(value="selectionProviderIndex") int selectionProviderIndex, @QueryParam(value="prefix") String prefix, @QueryParam(value="includeSelectPrompt") boolean includeSelectPrompt)
selectionProviderName
- name of the selection provider. See selectionProviders()
.selectionProviderIndex
- index of the selection field (in case of multiple-valued selection providers,
otherwise it is always 0 and you can use
jsonOptions(String, String, boolean)
).prefix
- form prefix, to read values from the request.includeSelectPrompt
- controls if the first option is a label with no value indicating
what field is being selected. For combo boxes you would generally pass true as the value of
this parameter; for autocomplete fields, you would likely pass false.@GET @Path(value=":selectionProviders") @Produces(value="application/json") public List selectionProviders()
protected String getUrlEncoding()
protected CrudProperty findProperty(String name, List<CrudProperty> properties)
name
- the name of the properties.properties
- the list to search.protected String getPkForUrl(String[] pk)
pk
- the object identifier as a String array.protected String getReadLinkExpression()
protected OgnlTextFormat getReadURLFormat()
protected String appendSearchStringParamIfNecessary(String s)
s
- the base string.protected StringBuilder appendSearchStringParamIfNecessary(StringBuilder sb)
sb
- the base string.protected String getEncodedSearchStringParam()
@Deprecated protected void fieldsToJson(org.json.JSONStringer js, Collection<Field> fields) throws org.json.JSONException
org.json.JSONException
@Deprecated protected List<Field> collectVisibleFields(Form form, List<Field> fields)
@Deprecated protected List<Field> collectVisibleFields(FieldSet fieldSet, List<Field> fields)
@GET @Produces(value="application/json;charset=UTF-8") public Resolution getAsJson(@QueryParam(value="searchString") String searchString, @QueryParam(value="firstResult") Integer firstResult, @QueryParam(value="maxResults") Integer maxResults, @QueryParam(value="sortProperty") String sortProperty, @QueryParam(value="sortDirection") String sortDirection)
searchString
- the search string@POST @Produces(value="application/json;charset=UTF-8") @Consumes(value="application/json;charset=UTF-8") public Response httpPostJson(String jsonObject) throws Exception
jsonObject
- the object (in serialized JSON form)Exception
- only to make the compiler happy. Nothing should be thrown in normal operation. If this method throws, it is probably a bug.@POST @Produces(value="application/json;charset=UTF-8") @Consumes(value="multipart/form-data") public Response httpPostMultipart() throws Exception
Exception
- only to make the compiler happy. Nothing should be thrown in normal operation. If this method throws, it is probably a bug.protected void readFormFromMultipartRequest() throws StripesServletException
StripesServletException
protected Response objectCreated() throws URISyntaxException
URISyntaxException
@PUT @Produces(value="application/json;charset=UTF-8") @Consumes(value="application/json;charset=UTF-8") public Response httpPutJson(String jsonObject) throws Exception
jsonObject
- the object (in serialized JSON form)Exception
- only to make the compiler happy. Nothing should be thrown in normal operation. If this method throws, it is probably a bug.@PUT @Produces(value="application/json;charset=UTF-8") @Consumes(value="multipart/form-data") public Response httpPutMultipart() throws Throwable
Throwable
@DELETE public void httpDelete() throws Exception
Exception
@Path(value=":classAccessor") @GET @Produces(value="application/json;charset=UTF-8") public String describeClassAccessor()
public String getReadTitle()
public String getSearchTitle()
public String getEditTitle()
public String getCreateTitle()
public CrudConfiguration getCrudConfiguration()
public void setCrudConfiguration(CrudConfiguration crudConfiguration)
public ClassAccessor getClassAccessor()
public void setClassAccessor(ClassAccessor classAccessor)
public PkHelper getPkHelper()
public void setPkHelper(PkHelper pkHelper)
public List<CrudSelectionProvider> getCrudSelectionProviders()
public String[] getSelection()
public void setSelection(String[] selection)
public String getSearchString()
public void setSearchString(String searchString)
public String getSuccessReturnUrl()
public void setSuccessReturnUrl(String successReturnUrl)
public SearchForm getSearchForm()
public void setSearchForm(SearchForm searchForm)
public T getObject()
public boolean isMultipartRequest()
isMultipartRequest
in class AbstractPageAction
@Deprecated public List<TextField> getEditableRichTextFields()
public boolean isFormWithRichTextFields()
public Form getCrudConfigurationForm()
public void setCrudConfigurationForm(Form crudConfigurationForm)
public TableForm getPropertiesTableForm()
public Form getForm()
public void setForm(Form form)
public TableForm getTableForm()
public void setTableForm(TableForm tableForm)
public TableForm getSelectionProvidersForm()
public Integer getFirstResult()
public void setFirstResult(Integer firstResult)
public Integer getMaxResults()
public void setMaxResults(Integer maxResults)
public String getSortProperty()
public void setSortProperty(String sortProperty)
public String getSortDirection()
public void setSortDirection(String sortDirection)
public String getPropertyName()
public void setPropertyName(String propertyName)
public boolean isSearchVisible()
public void setSearchVisible(boolean searchVisible)
public String getRelName()
public void setRelName(String relName)
public int getSelectionProviderIndex()
public void setSelectionProviderIndex(int selectionProviderIndex)
public String getLabelSearch()
public void setLabelSearch(String labelSearch)
public boolean isPopup()
public String getPopupCloseCallback()
public void setPopupCloseCallback(String popupCloseCallback)
public ResultSetNavigation getResultSetNavigation()
public void setResultSetNavigation(ResultSetNavigation resultSetNavigation)