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.

About this task

Procedure

  1. In the Enterprise Explorer view, expand Project-Server/ejbModule.
  2. Right-click com.mycompany.commerce.project.logging; click Import.
  3. Expand General; select File System, then click Next.
  4. Navigate to the temporary location where you extracted the RecipeServices.zip file.
  5. Navigate to the com.mycompany.commerce.project.logging folder; select the folder and click Ok.
  6. 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 will be replaced. The following is a sample of the code from ProjectApplicationMessageKeys.java:
    	/**
    	 * 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";
    
    
    The following is a sample of the code from the WcProjectMessages.properties file:
    _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

Results