📄 genericwebeventprocessor.java
字号:
return "An error occurred while inserting the new information into the data base.";
case STATUS_CANCEL:
return "Insert canceled.";
}
// --------
// UPDATE
// --------
} else if (action.equals(uiWebScreenSection.ACTION_UPDATE)) {
// Update the existing record(s) in the database.
int status = this.processUpdate(userInfo, uiWebScreenSection,
request, response, delegator, eventProcessor, dataMatrix,
uiCache);
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Finished update");
}
switch (status) {
case STATUS_ERROR:
return "An error occurred while updating the information in the data base.";
case STATUS_CANCEL:
return "Update canceled.";
}
// --------
// UPDATE_SELECT
// --------
} else if (action.equals(uiWebScreenSection.ACTION_UPDATE_SELECT)) {
// Add and/or remove records in a many-to-many table.
int status = this.processUpdateSelect(userInfo, uiWebScreenSection,
request, response, delegator, eventProcessor);
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEventsSelect] Finished update");
}
switch (status) {
case STATUS_ERROR:
return "An error occurred while updating the information in the data base.";
case STATUS_CANCEL:
return "Update canceled.";
}
// --------
// DELETE
// --------
} else if (action.equals(uiWebScreenSection.ACTION_DELETE)) {
// Delete the current record.
int status = this.processDelete(userInfo, uiWebScreenSection,
request, response, delegator, eventProcessor, uiCache);
switch (status) {
case STATUS_ERROR:
return "An error occurred while deleting the information.";
case STATUS_CANCEL:
return "Delete canceled.";
}
// Create an empty entity so the user can insert a new one.
status = this.processCreate(userInfo, uiWebScreenSection, request,
response, delegator, eventProcessor, dataMatrix);
switch (status) {
case STATUS_ERROR:
return "An error occurred while creating an empty data form.";
case STATUS_CANCEL:
return "Create canceled.";
}
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Finished delete");
}
// --------
// SHOW_INSERT
// --------
} else if (action.equals(uiWebScreenSection.ACTION_SHOW_INSERT)) {
// Create an empty entity so the user can insert a new one.
int status = this.processCreate(userInfo, uiWebScreenSection,
request, response, delegator, eventProcessor, dataMatrix);
switch (status) {
case STATUS_ERROR:
return "An error occurred while creating an empty data form.";
case STATUS_CANCEL:
return "Create canceled.";
}
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Finished show_insert");
}
// --------
// SHOW_QUERY or SHOW_QUERY_REPORT
// --------
} else if (action.equals(uiWebScreenSection.ACTION_SHOW_QUERY) ||
action.equals(uiWebScreenSection.ACTION_SHOW_QUERY_REPORT)) {
// Create an empty entity to be displayed for query mode.
int status = this.processShowQuery(userInfo, uiWebScreenSection,
request, response, delegator, eventProcessor, dataMatrix);
switch (status) {
case STATUS_ERROR:
return "An error occurred while creating an empty query form.";
case STATUS_CANCEL:
return "Create canceled.";
}
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Finished show_query");
}
// --------
// SHOW_REPORT
// --------
} else if (action.equals(uiWebScreenSection.ACTION_SHOW_REPORT)) {
// Load in the entered query criteria, and re-display them in query mode.
int status = this.processShowReport(userInfo, uiWebScreenSection,
request, response, delegator, eventProcessor, dataMatrix);
switch (status) {
case STATUS_ERROR:
return "An error occurred while displaying the report.";
case STATUS_CANCEL:
return "Report canceled.";
}
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Finished show_report");
}
// --------
// NO ACTION
// --------
} else if (action.equals(uiWebScreenSection.ACTION_NONE)) {
// No action was specified. Allow a blank screen section to be displayed.
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Finished no_action");
}
}
// --------
// RETRIEVE
// --------
if (action.equals(uiWebScreenSection.ACTION_SHOW) ||
action.equals(uiWebScreenSection.ACTION_SHOW_UPDATE) ||
action.equals(uiWebScreenSection.ACTION_SHOW_COPY) ||
action.equals(uiWebScreenSection.ACTION_QUERY) ||
action.equals(uiWebScreenSection.ACTION_QUERY_UPDATE) ||
action.equals(uiWebScreenSection.ACTION_QUERY_ALL) ||
action.equals(uiWebScreenSection.ACTION_SHOW_SELECT) ||
action.equals(uiWebScreenSection.ACTION_UPDATE_SELECT)) {
// Need to retrieve data from the data base.
// Note: ACTION_SHOW_SELECT and ACTION_UPDATE_SELECT are the only two actions that have something happen
// in the previous IF statement, and then get retrieved. In all other actions, the data matrix is either
// filled from the HTML, or does not need to be filled.
// Determine the retreive method.
int retrieveMethod = eventProcessor.RETRIEVE_METHOD_ALL;
switch (uiWebScreenSection.getLayoutTypeId()) {
case UIWebScreenSection.LAYOUT_TYPE_FREEFORM:
// Free form section should be retrieved using the primary key.
retrieveMethod = eventProcessor.RETRIEVE_METHOD_PK;
break;
case UIWebScreenSection.LAYOUT_TYPE_TABULAR:
// Tabular section can be retrieved multiple ways depending on the action
// requested by the button or link that triggered it.
if (action.equals(uiWebScreenSection.ACTION_QUERY) ||
action.equals(uiWebScreenSection.ACTION_QUERY_UPDATE)) {
retrieveMethod = eventProcessor.RETRIEVE_METHOD_CLAUSE;
} else if (action.equals(uiWebScreenSection.ACTION_QUERY_ALL)) {
retrieveMethod = eventProcessor.RETRIEVE_METHOD_ALL;
} else {
throw new GenericEntityException("Action \"" + action +
"\" is not valid for tabular layout type.");
}
break;
case UIWebScreenSection.LAYOUT_TYPE_SELECT:
// A select screen section is always retrieved as a query because it is always subordinate
// to some other entity.
retrieveMethod = eventProcessor.RETRIEVE_METHOD_CLAUSE;
break;
case UIWebScreenSection.LAYOUT_TYPE_CROSSTAB:
throw new GenericEntityException(
"Crosstab layout type not implemented yet.");
default:
throw new GenericEntityException("Invalid layout type.");
}
// handle paging of result sets.
int startRow = 0;
int rowsPerPage = uiWebScreenSection.getRowsPerPage();
if (request.getParameter("startRow") != null) {
startRow = Integer.parseInt(request.getParameter("startRow"));
}
uiWebScreenSection.setFirstVisibleRow(startRow);
eventProcessor.setRowOffset(startRow);
eventProcessor.setFetchSize(rowsPerPage);
// Retrieve the data for the screen section.
Debug.logVerbose(
"About to call GenericWebEventProcessor.processRetrieve.", module);
StringBuffer queryIdBuffer = new StringBuffer(queryId);
int status = this.processRetrieve(userInfo, uiWebScreenSection,
retrieveMethod, request, response, delegator,
eventProcessor, dataMatrix, queryIdBuffer, action);
queryId = queryIdBuffer.toString();
if ( eventProcessor.getHasMoreData() )
uiWebScreenSection.setTotalRows(eventProcessor.getTotalRows() + 1);
else
uiWebScreenSection.setTotalRows(eventProcessor.getTotalRows());
Debug.logVerbose("queryId after call to processRetrieve: " +
queryId, module);
switch (status) {
case STATUS_ERROR:
return "An error occurred while retrieving the data from the data base.";
case STATUS_CANCEL:
return "Retrieve canceled.";
}
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Finished retrieve");
}
}
// --------
// SHOW_COPY
// --------
if (action.equals(uiWebScreenSection.ACTION_SHOW_COPY)) {
// Displaying a copy of the retrieved record on the screen.
int status = this.processShowCopy(userInfo, uiWebScreenSection,
request, response, delegator, eventProcessor, dataMatrix);
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Finished showCopy");
}
switch (status) {
case STATUS_ERROR:
return "An error occurred while updating the copied record before displaying it.";
case STATUS_CANCEL:
return "Copy canceled.";
}
}
// Get values of extra parameters to send to other screen sections when buttons on this screen
// section are clicked.
evalSendQueryParameterList(uiWebScreenSection, request, dataMatrix);
if (TIMER) {
timer.timerString(
"[GenericWebEventProcessor.processEvents] Evaluated \"send\" query parameter list");
}
// ---------------------------------------------------------------------------------
// Generate the HTML to display the data on the screen, and return it to the calling method.
// ---------------------------------------------------------------------------------
Debug.logVerbose("Data matrix before display: " +
dataMatrix.getCurrentBuffer().getContents().toString(), module);
String displayHtml = uiWebScreenSection.display(dataMatrix, action,
queryId, isSubsection, tabOffset);
if (TIMER) {
timer.timerString("[GenericWebEventProcessor.processEvents] End");
}
logUiHistory(action, request, dataMatrix, delegator, userInfo,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -