Adding language-specific exception messages
In this lesson, you add language-specific exception messages to the properties
files used by the mediators and commands. You write the mediator and command code in a later lesson.
Procedure
- In the Enterprise Explorer view, expand .
- Right-click com.mycompany.commerce.project.logging. Click Import.
- Expand General. Select File System, then click Next.
- Navigate to the temporary location where you extracted the RecipeServices.zip file.
- Navigate to the com.mycompany.commerce.project.logging folder. Select the folder and click Ok.
-
Select the ProjectApplicationMessageKeys.java file and the
WcProjectMessages.properties file in the subdirectory. Click
Finish. Click Yes to All to overwrite any existing
files.
The ProjectApplicationMessageKeys.java and WcProjectMessages.properties files are replaced. The following code is a sample of the code from ProjectApplicationMessageKeys.java:
The following code is a sample of the code from the WcProjectMessages.properties file:/** * Constant for the message that the Project description is too long. */ public static final String _APP_PROJECT_SHORT_DESCRIPTION_TOO_LONG = "_APP_PROJECT_SHORT_DESCRIPTION_TOO_LONG"; /** * Constant for the message that the Project description is too long. */ public static final String _APP_PROJECT_LONG_DESCRIPTION_TOO_LONG = "_APP_PROJECT_LONG_DESCRIPTION_TOO_LONG"; /** * Constant for the message that an ProjectCollection Description could not * be found. */ public static final String _APP_PROJECTCOLLECTION_DESCRIPTION_NOT_FOUND = "_APP_PROJECTCOLLECTION_DESCRIPTION_NOT_FOUND"; /** * Constant for the message that an Project Instruction could not be found. */ public static final String _APP_PROJECT_INSTRUCTION_NOT_FOUND = "_APP_PROJECT_INSTRUCTION_NOT_FOUND";
_APP_PROJECT_SHORT_DESCRIPTION_TOO_LONG = Short Description is too long _APP_PROJECT_LONG_DESCRIPTION_TOO_LONG = Long Description is too long _APP_PROJECTCOLLECTION_DESCRIPTION_NOT_FOUND = The noun ProjectCollection/Description is not found _APP_PROJECT_INSTRUCTION_NOT_FOUND = The noun Project/Instruction is not found _APP_PROJECT_MATERIAL_NOT_FOUND = The noun Project/Material is not found _ERR_EXCEPTION_GETTING_STORE_ID = Cannot get store id _ERR_EXCEPTION_GETTING_LANGUAGE_ID = Cannot get language id _APP_PROJECT_MATERIAL_NAME_EMPTY= Save failed.The name is empty _APP_PROJECT_CATENTRY_DUPLICATE= Save failed. The catentry is duplicated