Ajout de messages d'exception spécifiques à la langue
Dans cette leçon, vous ajoutez des messages d'exception spécifiques de la langue dans les fichiers de propriétés utilisés par les médiateurs et les commandes. Vous rédigerez le code du médiateur et des commandes dans une leçon ultérieure.
Procédure
- Dans la vue Explorateur d'entreprise, développez .
- Cliquez avec le bouton droit de la souris sur com.mycompany.commerce.project.logging. Cliquez sur Importer.
- Développez Général. Sélectionnez Système de fichiers et cliquez sur Suivant.
- Accédez au répertoire temporaire dans lequel vous avez extrait le fichier RecipeServices.zip.
- Accédez au dossier com.mycompany.commerce.project.logging. Sélectionnez un dossier et cliquez sur Ok.
-
Sélectionnez le fichier ProjectApplicationMessageKeys.java et le fichier WcProjectMessages.properties dans le sous-répertoire. Cliquez sur Terminer. Cliquez sur Oui pour tout pour remplacer les fichiers existants.
Les fichiers ProjectApplicationMessageKeys.java et WcProjectMessages.properties sont remplacés. Le code suivant est un exemple du code provenant de ProjectApplicationMessageKeys.java :
Le code suivant est un exemple de code provenant du fichier 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