========================
CODE SNIPPETS
========================
TITLE: Build and Start Application with Maven Jetty
DESCRIPTION: Command to build and start the Nablarch JAX-RS application using the Jetty Maven Plugin. The `compile` goal is implicitly executed.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_WebService.rst#_snippet_4
LANGUAGE: text
CODE:
```
mvn jetty:run
```
----------------------------------------
TITLE: Sample JSON Service Response
DESCRIPTION: Example of the JSON data returned by the `/find/json` service endpoint, showing a list of user objects.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_WebService.rst#_snippet_7
LANGUAGE: text
CODE:
```
[{"userId":1,"kanjiName":"名部楽太郎","kanaName":"なぶらくたろう"},{"userId":2,"kanjiName":"名部楽次郎","kanaName":"なぶらくじろう"}]
```
----------------------------------------
TITLE: Start H2 Console Batch File
DESCRIPTION: Command to execute the H2 console batch file to start the H2 database console. It is recommended to use the h2.bat included in the project whose data needs to be checked.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/firstStep_appendix/firststep_complement.rst#_snippet_0
LANGUAGE: Batch
CODE:
```
h2/bin/h2.bat
```
----------------------------------------
TITLE: Sample XML Service Response
DESCRIPTION: Example of the XML data returned by the `/find/xml` service endpoint, showing a list of user objects.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_WebService.rst#_snippet_9
LANGUAGE: xml
CODE:
```
なぶらくたろう
名部楽太郎
1
なぶらくじろう
名部楽次郎
2
```
----------------------------------------
TITLE: Jetty Application Launch Success Log
DESCRIPTION: Console output indicating that the Nablarch application has successfully initialized and started via Jetty.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_WebService.rst#_snippet_5
LANGUAGE: text
CODE:
```
(omitted)
2020-04-28 08:46:53.366 -INFO- nablarch.fw.web.servlet.NablarchServletContextListener [null] boot_proc = [] proc_sys = [jaxrs] req_id = [null] usr_id = [null] [nablarch.fw.web.servlet.NablarchServletContextListener#contextInitialized] initialization completed.
```
----------------------------------------
TITLE: H2 Console Connection Configuration
DESCRIPTION: Configuration details for connecting to the H2 database console. This includes the JDBC URL, username, and password required to establish a connection after the console has started. The JDBC URL specifies the relative path to the data file.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/firstStep_appendix/firststep_complement.rst#_snippet_1
LANGUAGE: Configuration
CODE:
```
Item Value Supplementary notes
============= ========================= ============================================================================
JDBC URL jdbc:h2:../db/SAMPLE Specify the data file location with a relative path from h2.bat.
User Name SAMPLE
Password SAMPLE
```
----------------------------------------
TITLE: Nablarch BOM Dependency Management Definition Example
DESCRIPTION: This XML snippet illustrates how the nablarch-bom defines the versions for various Nablarch framework modules within its dependencyManagement section. It shows specific versions for nablarch-core and nablarch-core-applog.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/beforeFirstStep.rst#_snippet_0
LANGUAGE: XML
CODE:
```
com.nablarch.framework
nablarch-core
1.2.2
com.nablarch.framework
nablarch-core-applog
1.0.1
```
----------------------------------------
TITLE: Build and Run Nablarch Application with Maven Jetty
DESCRIPTION: This command uses the Maven Jetty Plugin to build the application and start an embedded Jetty server. The 'jetty:run' goal automatically handles the compilation of the application, making a separate 'compile' step unnecessary. This allows for quick deployment and testing of the web application.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_Web.rst#_snippet_4
LANGUAGE: text
CODE:
```
mvn jetty:run
```
----------------------------------------
TITLE: Nablarch batchlet application successful execution log
DESCRIPTION: This log output confirms the successful execution of the `sample-batchlet` batch application, detailing the start and completion of the job and its steps.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_Jbatch.rst#_snippet_9
LANGUAGE: text
CODE:
```
2020-04-28 10:35:27.002 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] start job. job name: [sample-batchlet]
2020-04-28 10:35:27.011 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] start step. job name: [sample-batchlet] step name: [step1]
2020-04-28 10:35:27.247 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] finish step. job name: [sample-batchlet] step name: [step1] step status: [SUCCESS]
2020-04-28 10:35:27.255 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] finish job. job name: [sample-batchlet]
```
----------------------------------------
TITLE: Download Nablarch Testing Tool JARs with Maven
DESCRIPTION: After configuring the Maven dependencies in your pom.xml, execute this command in your project directory to download the required JAR files. The -DoutputDirectory=lib option ensures the JARs are placed in a 'lib' folder.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/development_tools/testing_framework/guide/development_guide/08_TestTools/01_HttpDumpTool/02_SetUpHttpDumpTool.rst#_snippet_1
LANGUAGE: text
CODE:
```
mvn dependency:copy-dependencies -DoutputDirectory=lib
```
----------------------------------------
TITLE: Run Docker Container for Web Application
DESCRIPTION: This command starts a Docker container for the `myapp-container-web` application. It runs in detached mode (`-d`), maps port 8080 from the container to the host, mounts a local H2 database volume, and assigns a name to the container. This allows accessing the application via `http://localhost:8080/`.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_containerBlankProject/setup_ContainerWeb.rst#_snippet_6
LANGUAGE: text
CODE:
```
cd myapp-container-web
docker run -d -p 8080:8080 -v %CD%\h2:/usr/local/tomcat/h2 --name myapp-container-web myapp-container-web
```
----------------------------------------
TITLE: Maven Commands for Project Compilation and Dependency Download
DESCRIPTION: These Maven commands are executed to compile the project and download all required JAR dependencies into a 'lib' directory. This ensures the master data tool utilizes the same database settings as the project's unit tests.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/development_tools/testing_framework/guide/development_guide/08_TestTools/02_MasterDataSetup/02_ConfigMasterDataSetupTool.rst#_snippet_0
LANGUAGE: text
CODE:
```
mvn compile
mvn dependency:copy-dependencies -DoutputDirectory=lib
```
----------------------------------------
TITLE: Example Tag Setting Configuration String
DESCRIPTION: This snippet provides an example of a tag setting configuration string. It defines patterns for 'ui_local' and 'ui_test' environments, including a regular expression for 'set.tag'. This configuration is typically used within XML files like 'pom.xml' or 'nablarch-tools.xml' for tool setup.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/development_tools/toolbox/JspStaticAnalysis/02_JspStaticAnalysisInstall.rst#_snippet_9
LANGUAGE: Configuration
CODE:
```
ui_local,ui_test,ui_test/.*/set.tag
```
----------------------------------------
TITLE: Execute Unit Tests for Nablarch Web Project
DESCRIPTION: Navigate into the newly generated project directory and execute Maven's `test` lifecycle to run included unit tests. This step confirms the successful generation and basic functionality of the blank project, specifically checking screen visibility via `SampleActionRequestTest`.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_Web.rst#_snippet_1
LANGUAGE: text
CODE:
```
cd myapp-web
mvn test
```
----------------------------------------
TITLE: Configure Master Data Backup Schema Name
DESCRIPTION: This snippet shows how to configure the backup schema name for the master data automated recovery function within the `master_data-build.properties` file. The example sets the schema to `nablarch_test_master`.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/development_tools/testing_framework/guide/development_guide/08_TestTools/02_MasterDataSetup/02_ConfigMasterDataSetupTool.rst#_snippet_1
LANGUAGE: bash
CODE:
```
# Master data backup schema name for test
masterdata.test.backup-schema=nablarch_test_master
```
----------------------------------------
TITLE: Example: SETUP_TABLE Data for Database Preparation
DESCRIPTION: This example demonstrates the usage of the SETUP_TABLE data type to prepare database records. It shows how to specify the target table ('COMPOSER') and provide tabular data for insertion before test execution.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/development_tools/testing_framework/guide/development_guide/06_TestFWGuide/01_Abstract.rst#_snippet_3
LANGUAGE: Text
CODE:
```
SETUP_TABLE=COMPOSER
+--------+------------+-----------+
| NO | FIRST_NAME | LAST_NAME |
+========+============+===========+
| 00001 | Steve | Reich |
+--------+------------+-----------+
| 00002 | Phillip | Glass |
+--------+------------+-----------+
```
----------------------------------------
TITLE: Build Nablarch Batch Application with Maven
DESCRIPTION: Execute this Maven command to compile and package the Nablarch batch application, preparing it for execution.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_NablarchBatch.rst#_snippet_4
LANGUAGE: text
CODE:
```
mvn package
```
----------------------------------------
TITLE: Example Excel Test Data for ID Generation
DESCRIPTION: This example demonstrates the structure of Excel test data for testing ID generation. It includes setup data for the ID generation table (`TEST_SBN_TBL`) and expected values for both the ID generation table and a user information table (`USER_INFO`) after a single ID generation operation. The setup data should only include records for the test range, and the expected value is typically 'setup value + 1' for a single generation.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/ja/development_tools/testing_framework/guide/development_guide/06_TestFWGuide/03_Tips.rst#_snippet_6
LANGUAGE: Test Data (Excel Format)
CODE:
```
// 準備データ
// 採番用テーブル
SETUP_TABLE=TEST_SBN_TBL
========== =============
ID_COL NO_COL
========== =============
1101 100
========== =============
// 期待値
// 採番用テーブル
EXPECTED_TABLE=TEST_SBN_TBL
========== =============
ID_COL NO_COL
========== =============
1101 101
========== =============
// 期待値
// 採番した値が登録されるテーブル(USER_IDに採番された値が登録される。)
EXPECTED_TABLE=USER_INFO
========== ============ =============
USER_ID KANJI_NAME KANA_NAME
========== ============ =============
0000000101 漢字名 カナメイ
========== ============ =============
```
----------------------------------------
TITLE: Example Stack Trace for NoClassDefFoundError
DESCRIPTION: An example stack trace showing a NoClassDefFoundError that can occur during execution, often related to class initialization issues like org.jboss.weld.logging.BeanLogger. This snippet illustrates the typical error output.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/migration/index.rst#_snippet_27
LANGUAGE: text
CODE:
```
org.jboss.weld.exceptions.WeldException
at org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions (AbstractExecutorServices.java:82)
...
Caused by: java.lang.NoClassDefFoundError
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
...
Caused by: java.lang.NoClassDefFoundError:Could not initialize class org.jboss.weld.logging.BeanLogger
at org.jboss.weld.util.Beans.getBeanConstructor (Beans.java:279)
```
----------------------------------------
TITLE: Example: EXPECTED_TABLE with Inline Comments
DESCRIPTION: This example illustrates how to define expected database data using EXPECTED_TABLE, showcasing the comment feature. Any text starting with '//' in a cell is ignored, allowing for readability notes without affecting the actual test data.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/development_tools/testing_framework/guide/development_guide/06_TestFWGuide/01_Abstract.rst#_snippet_4
LANGUAGE: Text
CODE:
```
EXPECTED_TABLE=PLAYER
+----------+----------+----------+----------+----------------------------+
|NO |FIRST_NAME|LAST_NAME |ADDRESS | |
+==========+==========+==========+==========+============================+
|// Number |Name |Surname |Address | |
+----------+----------+----------+----------+----------------------------+
|0001 |Andres |Segovia |Spain | |
+----------+----------+----------+----------+----------------------------+
|0002 |Julian |Bream |England | // This record is added |
+----------+----------+----------+----------+----------------------------+
```
----------------------------------------
TITLE: Nablarch: SQL Example for Prefix Like Search
DESCRIPTION: Provides a concrete SQL example demonstrating a prefix match for a 'like' search, adhering to Nablarch's specified rules. This query selects users where the name starts with the value provided by the userName parameter.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/libraries/database/database.rst#_snippet_19
LANGUAGE: sql
CODE:
```
select *
from user
where name like :userName%
```
----------------------------------------
TITLE: Change Directory to Generated Project
DESCRIPTION: Command to navigate into the newly generated `myapp-jaxrs` project directory before building and launching the application.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_WebService.rst#_snippet_3
LANGUAGE: text
CODE:
```
cd myapp-jaxrs
```
----------------------------------------
TITLE: Request Message Body Example (JSON Format)
DESCRIPTION: Provides an example of a JSON-formatted request message body, serving as input data for tests. The snippet shows the beginning of a JSON object, indicating the start of the message body structure.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/development_tools/testing_framework/guide/development_guide/05_UnitTestGuide/02_RequestUnitTest/http_real.rst#_snippet_3
LANGUAGE: JSON
CODE:
```
{
```
----------------------------------------
TITLE: Launch Nablarch Messaging Batch Application (SampleResiBatch)
DESCRIPTION: This command launches the 'SampleResiBatch' application, which implements messaging using tables as queues. Note the differences in the '-diConfig' XML file and '-requestPath' compared to the on-demand batch.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_NablarchBatch.rst#_snippet_7
LANGUAGE: bash
CODE:
```
mvn exec:java -Dexec.mainClass=nablarch.fw.launcher.Main ^
-Dexec.args="'-diConfig' 'classpath:resident-batch-boot.xml' '-requestPath' 'SampleResiBatch' '-userId' 'batch_user'"
```
----------------------------------------
TITLE: HTML Usage Example for Nablarch ShowDialogAction
DESCRIPTION: Demonstrates how to declare a `ShowDialog` action within HTML using Nablarch's event action attributes. This example configures a confirmation dialog to appear when a form element with a name starting with 'form.userType' has a value of 'admin', prompting the user for confirmation before a change.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/_static/ui_dev/yuidoc/files/nablarch-widget-event-dialog_ui_public_js_nablarch_ui_event_ShowDialogAction.js.html#_snippet_4
LANGUAGE: HTML
CODE:
```
```
----------------------------------------
TITLE: Launch Nablarch On-Demand Batch Application (SampleBatch)
DESCRIPTION: This command launches the 'SampleBatch' on-demand application using Maven's exec plugin. It specifies the batch configuration XML and the request path, used for confirming basic Nablarch function communications.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_NablarchBatch.rst#_snippet_5
LANGUAGE: bash
CODE:
```
mvn exec:java -Dexec.mainClass=nablarch.fw.launcher.Main ^
-Dexec.args="'-diConfig' 'classpath:batch-boot.xml' '-requestPath' 'SampleBatch' '-userId' 'batch_user'"
```
----------------------------------------
TITLE: Bash: Execute Nablarch Example DB Queue Application
DESCRIPTION: This Bash command sequence navigates to the application directory, cleans and packages the project, and then executes the main Nablarch launcher class. It specifies the configuration file, request path, and a user ID for the application execution.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/messaging/db/getting_started/table_queue.rst#_snippet_1
LANGUAGE: bash
CODE:
```
$cd nablarch-example-db-queue
$mvn clean package
$mvn exec:java -Dexec.mainClass=nablarch.fw.launcher.Main ^
-Dexec.args="'-diConfig' 'com/nablarch/example/app/batch/project-creation-service.xml' '-requestPath' 'ProjectCreationService' '-userId' 'samp'"
```
----------------------------------------
TITLE: Verify Successful Application Launch Log Output
DESCRIPTION: Upon successful launch of the Nablarch application, a specific log message will be output to the console. This snippet shows the key log entry indicating that the NablarchServletContextListener has completed its initialization process, confirming the application is ready.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_Web.rst#_snippet_5
LANGUAGE: text
CODE:
```
(omitted)
2023-03-30 10:04:42.148 -INFO- nablarch.fw.web.servlet.NablarchServletContextListener [null] boot_proc = [] proc_sys = [web] req_id = [null] usr_id = [null] [nablarch.fw.web.servlet.NablarchServletContextListener#contextInitialized] initialization completed.
```
----------------------------------------
TITLE: Command to Run Jetty Embedded Server with Maven
DESCRIPTION: This command shows how to start the Jetty embedded server using the `jetty-ee10-maven-plugin` after it has been configured in the `pom.xml`.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/migration/index.rst#_snippet_15
LANGUAGE: batch
CODE:
```
mvn jetty:run
```
----------------------------------------
TITLE: Nablarch SlideMenu Initial HTML Markup Example
DESCRIPTION: Example HTML markup for the initial display of the Nablarch SlideMenu. It demonstrates the use of the `nablarch_SlideMenu` marker class, along with selectors for open/close buttons and the menu's content area. This setup defines the menu's structure and initial hidden state.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/_static/ui_dev/yuidoc/files/nablarch-widget-slide-menu_ui_public_js_nablarch_ui_SlideMenu.js.html#_snippet_2
LANGUAGE: HTML
CODE:
```
```
----------------------------------------
TITLE: Execute Unit Tests for Nablarch Batch Project
DESCRIPTION: After generating the Nablarch batch project, navigate into the created project directory and execute the Maven test command. This runs the included unit tests, such as SampleBatchActionRequestTest, to confirm that the blank project was successfully generated and the batch can be launched.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_NablarchBatch.rst#_snippet_1
LANGUAGE: text
CODE:
```
cd myapp-batch
mvn test
```
----------------------------------------
TITLE: Build Docker Container Image with Jib Maven Plugin
DESCRIPTION: These commands navigate into the generated project directory and then execute the Jib Maven plugin's `dockerBuild` goal. This goal creates a Docker container image of the web application, leveraging the built-in Jib plugin in the blank project.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_containerBlankProject/setup_ContainerWeb.rst#_snippet_1
LANGUAGE: text
CODE:
```
cd myapp-container-web
mvn package jib:dockerBuild
```
----------------------------------------
TITLE: Read Uploaded File from HttpRequest in Nablarch (Java)
DESCRIPTION: This Java example shows how to retrieve uploaded files from an `HttpRequest` object in Nablarch. It uses `request.getPart("uploadFile")` to get a list of `PartInfo` objects, representing the uploaded files. It also includes a check for empty `partInfoList` and demonstrates getting an `InputStream` from the first `PartInfo` for further processing.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/handlers/web/multipart_handler.rst#_snippet_6
LANGUAGE: Java
CODE:
```
public HttpResponse upload(HttpRequest request, ExecutionContext context) throws IOException {
// Acquire the uploaded file
List partInfoList = request.getPart("uploadFile");
if (partInfoList.isEmpty()) {
// Business error if the uploaded file is not specified
}
// Process the uploaded file
InputStream file = partInfoList.get(0).getInputStream();
// The read process of the uploaded file is performed below.
}
```
----------------------------------------
TITLE: Build Nablarch batch application using Maven
DESCRIPTION: Execute this Maven command to compile and package the Nablarch batch application. This step creates the necessary JAR files for execution.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_Jbatch.rst#_snippet_4
LANGUAGE: text
CODE:
```
mvn package
```
----------------------------------------
TITLE: Execute Paged SQL Query with SelectOption in Nablarch Java
DESCRIPTION: Illustrates how to fetch a specific range of records using Nablarch's paging function. It shows acquiring a database connection, preparing a statement with `SqlPStatement` using a `SelectOption` to define the start position and number of records, and then retrieving the results. This example fetches 10 records starting from the 11th.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/libraries/database/database.rst#_snippet_10
LANGUAGE: java
CODE:
```
// Acquire database connection from DbConnectionContext
AppDbConnection connection = DbConnectionContext.getConnection();
// Generate the statement object by specifying the SQLID and search range.
SqlPStatement statement = connection.prepareStatementBySqlId(
"jp.co.tis.sample.action.SampleAction#findUser", new SelectOption(11, 10));
// Execute the search process
SqlResultSet result = statement.retrieve();
```
----------------------------------------
TITLE: Nablarch Custom Tags: Specify Absolute URL (JSP)
DESCRIPTION: This JSP example shows how to use the `` custom tag to create a hyperlink with an absolute URL, starting with `http` or `https`.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/libraries/tag.rst#_snippet_110
LANGUAGE: jsp
CODE:
```
coastland
```
----------------------------------------
TITLE: Navigate to Generated Web Project Directory
DESCRIPTION: This command changes the current working directory to the 'myapp-web' folder, which is the root of the newly generated Nablarch web project. This step is necessary before executing build or run commands specific to the project.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_Web.rst#_snippet_3
LANGUAGE: text
CODE:
```
cd myapp-web
```
----------------------------------------
TITLE: Example of jakarta.validation Import in Java (Corrected)
DESCRIPTION: This Java snippet displays the corrected `import` statement for Bean Validation classes. By changing `javax.validation` to `jakarta.validation`, the application becomes compatible with Jakarta EE.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/migration/index.rst#_snippet_21
LANGUAGE: java
CODE:
```
import jakarta.validation.ConstraintValidator;
```
----------------------------------------
TITLE: Execute Registration Process (Java)
DESCRIPTION: This code block outlines the execution of the registration process. It retrieves the project information from the session store, performs the (omitted) registration logic, and then cleans up by deleting the project data from the session store after the process is complete.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/libraries/session_store/create_example.rst#_snippet_3
LANGUAGE: Java
CODE:
```
// Fetch input information from the session store
Project project = SessionUtil.get(ctx, "project");
// Registration process is omitted
// Delete the input information from the session store
SessionUtil.delete(ctx, "project");
```
----------------------------------------
TITLE: Build Nablarch Batch Application with Maven
DESCRIPTION: This command executes the Maven `package` goal to build the Nablarch batch application. It compiles the source code, runs tests, and packages the application into a distributable format, typically a JAR file, preparing it for execution.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_NablarchBatch_Dbless.rst#_snippet_4
LANGUAGE: text
CODE:
```
mvn package
```
----------------------------------------
TITLE: Return from Confirmation to Input Screen (Java)
DESCRIPTION: This snippet manages the return flow from a confirmation screen back to the input screen. It fetches the previously saved project entity from the session, converts it back into a form object, populates the request scope with this form, and finally deletes the project data from the session to clean up.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/libraries/session_store/create_example.rst#_snippet_2
LANGUAGE: Java
CODE:
```
// Fetch input information from the session store
Project project = SessionUtil.get(ctx, "project");
// Convert Entity to Form
ProjectForm form = BeanUtil.createAndCopy(ProjectForm.class, project);
// Configure input information to the request scope
context.setRequestScopedVar("form", form);
// Delete the input information from the session store
SessionUtil.delete(ctx, "project");
```
----------------------------------------
TITLE: Returning an Internal Forward Response in Java
DESCRIPTION: Java code example demonstrating how a business action can return an `HttpResponse` to trigger an internal forward. The response path must start with `forward://` to indicate the internal redirection.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/handlers/web/forwarding_handler.rst#_snippet_1
LANGUAGE: java
CODE:
```
public HttpResponse sample(HttpRequest request, ExecutionContext context) {
// Business process
// Internal forward to initialize the same business action
return new HttpResponse("forward://initialize");
}
```
----------------------------------------
TITLE: Execute unit tests for generated Jakarta Batch project
DESCRIPTION: This command navigates into the generated project directory and executes the included unit tests to confirm successful project generation and communication. The output log confirms the test results.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_Jbatch.rst#_snippet_1
LANGUAGE: text
CODE:
```
cd myapp-batch-ee
mvn test
```
----------------------------------------
TITLE: Nablarch chunk application successful execution log
DESCRIPTION: This log output indicates a successful run of the `sample-chunk` batch application, showing the start and completion of the job and its steps, along with processing statistics.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_Jbatch.rst#_snippet_6
LANGUAGE: text
CODE:
```
2020-04-28 10:39:46.955 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] start job. job name: [sample-chunk]
2020-04-28 10:39:46.974 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] start step. job name: [sample-chunk] step name: [step1]
2020-04-28 10:39:47.202 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] job name: [sample-chunk] step name: [step1] input count: [10]
2020-04-28 10:39:47.235 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] job name: [sample-chunk] step name: [step1] total tps: [156.25] current tps: [156.25] estimated end time: [2020/04/28 10:39:47.235] remaining count: [5]
2020-04-28 10:39:47.244 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] job name: [sample-chunk] step name: [step1] total tps: [243.90] current tps: [625.00] estimated end time: [2020/04/28 10:39:47.243] remaining count: [0]
2020-04-28 10:39:47.257 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] finish step. job name: [sample-chunk] step name: [step1] step status: [COMPLETED]
2020-04-28 10:39:47.263 -INFO- progress [null] boot_proc = [] proc_sys = [batch-ee] req_id = [null] usr_id = [null] finish job. job name: [sample-chunk]
```
----------------------------------------
TITLE: HttpServerFactory Configuration (After Jakarta EE Migration)
DESCRIPTION: This XML snippet illustrates the updated configuration for the `httpServerFactory` component. The class is changed to `HttpServerFactoryJetty12` to ensure the embedded server started by NTF supports Jakarta EE.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/migration/index.rst#_snippet_18
LANGUAGE: xml
CODE:
```
```
----------------------------------------
TITLE: Transition from Input to Confirmation Screen (Java)
DESCRIPTION: This code handles the transition from an input screen to a confirmation screen. It retrieves input data from the request scope, converts it from a form object to an entity object, and then saves the entity object into the session store for later retrieval during the confirmation or registration process.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/libraries/session_store/create_example.rst#_snippet_1
LANGUAGE: Java
CODE:
```
// Acquire input information from the request scope
ProjectForm form = context.getRequestScopedVar("form");
// Convert Form to Entity
Project project = BeanUtil.createAndCopy(Project.class, form);
// Save input information in session store
SessionUtil.put(ctx, "project", project);
```
----------------------------------------
TITLE: Example of javax.validation Import in Java (Requires Change)
DESCRIPTION: This Java snippet shows an `import` statement for `javax.validation.ConstraintValidator`. This is a Java EE namespace that will cause compilation errors after migrating to Jakarta EE and must be changed to `jakarta`.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/migration/index.rst#_snippet_19
LANGUAGE: java
CODE:
```
import javax.validation.ConstraintValidator;
```
----------------------------------------
TITLE: Data Conversion Examples with Placeholders
DESCRIPTION: Provides examples of various data conversion rules using a placeholder syntax (e.g., ${type,length}), demonstrating how different input patterns are converted to specific character types and lengths.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/development_tools/testing_framework/guide/development_guide/06_TestFWGuide/01_Abstract.rst#_snippet_12
LANGUAGE: Configuration
CODE:
```
${半角英字,5} | geDSfe | Converted to 5 single-byte alphabetic characters.
```
LANGUAGE: Configuration
CODE:
```
${全角ひらがな,4} | ぱさぇん | Converted to full-width Hiragana 4 characters.
```
LANGUAGE: Configuration
CODE:
```
${半角数字,2}-{半角数字4} | 37-3425 | Anything other than - is converted.
```
LANGUAGE: Configuration
CODE:
```
${全角漢字,4}123 | 山川海森123 | Anything other than the end 123 is converted.
```
----------------------------------------
TITLE: Navigate to Nablarch Batch Project Directory
DESCRIPTION: Before building or executing the batch application, use this command to change the current directory to the generated Nablarch batch project.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_blankProject/setup_NablarchBatch.rst#_snippet_3
LANGUAGE: text
CODE:
```
cd myapp-batch
```
----------------------------------------
TITLE: Run and Stop Local Redis Instance with Docker
DESCRIPTION: Commands to start a Redis 5.0.9 instance on port 6379 for local testing and how to stop it. This provides a quick way to set up a Redis server without manual installation.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/adaptors/lettuce_adaptor/redisstore_lettuce_adaptor.rst#_snippet_0
LANGUAGE: shell
CODE:
```
docker run --name redis -d -p 6379:6379 redis:5.0.9
docker stop redis
```
----------------------------------------
TITLE: List Docker Images in Local Repository
DESCRIPTION: This command displays all Docker images stored in the local repository, showing details like repository name, tag, image ID, creation date, and size. It helps verify the presence of built images.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/application_framework/blank_project/setup_containerBlankProject/setup_ContainerWeb.rst#_snippet_3
LANGUAGE: text
CODE:
```
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
myapp-container-web 0.1.0 dd60cbdc7722 50 years ago 449MB
myapp-container-web latest dd60cbdc7722 50 years ago 449MB
```
----------------------------------------
TITLE: Implement RESTful Service with Path Annotations in Nablarch
DESCRIPTION: This Java code demonstrates how to define a RESTful web service using JAX-RS `Path` and HTTP method annotations (`GET`, `POST`) within a Nablarch application. The `SampleAction` class is mapped to `/sample`, and its methods `findAll` and `register` handle `GET` and `POST` requests respectively, producing JSON output. This example illustrates how to implement resource mapping and method dispatching using annotations.
SOURCE: https://github.com/nablarch/nablarch-document/blob/main/en/application_framework/adaptors/router_adaptor.rst#_snippet_6
LANGUAGE: java
CODE:
```
@Path("/sample")
public class SampleAction {
@GET
@Produces(MediaType.APPLICATION_JSON)
public List findAll() {
// Omitted
}
@POST
@Produces(MediaType.APPLICATION_JSON)
public int register(JaxRsHttpRequest request) {
// Omitted
}
}
```