Añadir mensajes de excepción específicos del idioma
En esta lección, añadirá mensajes de excepción específicos del idioma a los archivos de propiedades que utilizan los mediadores y los mandatos. En una lección posterior escribirá el código de los mediadores y los mandatos.
Procedimiento
- En la vista Explorador de empresa, expanda .
- Haga clic en el botón derecho del ratón en com.mycompany.commerce.project.logging. Haga clic en Importar.
- Expanda General. Seleccione Sistema de archivos y, a continuación, Haga clic en Siguiente.
- Vaya a la ubicación temporal en la que extrajo el archivo RecipeServices.zip.
- Vaya hasta la carpeta com.mycompany.commerce.project.logging: Seleccione la carpeta y Haga clic en Aceptar.
-
Seleccione el archivo ProjectApplicationMessageKeys.java y el archivo WcProjectMessages.properties en el subdirectorio. Haga clic en Finalizar. Haga clic en Sí a todos para sobrescribir los archivos existentes.
Se sustituyen los archivos ProjectApplicationMessageKeys.java y WcProjectMessages.properties. El código siguiente es un ejemplo de código de ProjectApplicationMessageKeys.java:
El código siguiente es un ejemplo de código del archivo WcProjectMessages.properties:/** * 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