use of jp.ossc.nimbus.service.journal.editorfinder.EditorFinder in project nimbus by nimbus-org.
the class BeanFlowServlet method doService.
/**
* 検証BeanFlow及びアクションBeanFlowの呼び出しを制御する。<p>
*
* @param req HTTPリクエスト
* @param resp HTTPレスポンス
* @exception ServletException
* @exception IOException
*/
protected void doService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String flowName = processSelectBeanFlow(req, resp);
if (flowName == null || flowName.length() == 0) {
handleNotFound(req, resp, flowName);
return;
}
final BeanFlowInvokerFactory beanFlowInvokerFactory = (BeanFlowInvokerFactory) ServiceManagerFactory.getServiceObject(beanFlowInvokerFactoryServiceName);
if (!beanFlowInvokerFactory.containsFlow(flowName)) {
handleNotFound(req, resp, flowName);
return;
}
Journal journal = null;
EditorFinder editorFinder = null;
EditorFinder validateEditorFinder = null;
EditorFinder actionEditorFinder = null;
String requestId = null;
if (journalServiceName != null) {
journal = (Journal) ServiceManagerFactory.getServiceObject(journalServiceName);
if (editorFinderServiceName != null) {
editorFinder = (EditorFinder) ServiceManagerFactory.getServiceObject(editorFinderServiceName);
}
if (validateEditorFinderServiceName != null) {
validateEditorFinder = (EditorFinder) ServiceManagerFactory.getServiceObject(validateEditorFinderServiceName);
}
if (actionEditorFinderServiceName != null) {
actionEditorFinder = (EditorFinder) ServiceManagerFactory.getServiceObject(actionEditorFinderServiceName);
}
if (contextServiceName != null) {
Context context = (Context) ServiceManagerFactory.getServiceObject(contextServiceName);
requestId = (String) context.get(ThreadContextKey.REQUEST_ID);
}
}
try {
if (journal != null) {
journal.startJournal(JOURNAL_KEY_PROCESS, editorFinder);
if (requestId != null) {
journal.setRequestId(requestId);
}
}
final BeanFlowServletContext context = new BeanFlowServletContext(req, resp, req.getAttribute(inputAttributeName));
if (validateFlowPrefix != null && isValidate) {
final String validateFlowName = validateFlowPrefix + flowName;
if (beanFlowInvokerFactory.containsFlow(validateFlowName)) {
final BeanFlowInvoker validateFlow = beanFlowInvokerFactory.createFlow(validateFlowName);
try {
if (journal != null) {
journal.addStartStep(JOURNAL_KEY_VALIDATE, validateEditorFinder);
journal.addInfo(JOURNAL_KEY_FLOW_NAME, validateFlowName);
}
if (!processValidate(req, resp, context, validateFlow, journal)) {
if (!handleValidateError(req, resp, context, journal)) {
return;
}
}
} finally {
if (journal != null) {
journal.addEndStep();
}
}
}
}
final BeanFlowInvoker flow = beanFlowInvokerFactory.createFlow(flowName);
try {
if (journal != null) {
journal.addStartStep(JOURNAL_KEY_ACTION, actionEditorFinder);
journal.addInfo(JOURNAL_KEY_FLOW_NAME, flowName);
}
processAction(req, resp, context, flow, journal);
} finally {
if (journal != null) {
journal.addEndStep();
}
}
} finally {
if (journal != null) {
journal.endJournal();
}
}
}
Aggregations