Download enterprise Application Development Guide

Transcript
4.8. RESOURCE FILES
BeanManager.addBean("DemoBean", DemoBean.class);
3. Use the Bean: Our DemoBean has the method storeDocument() which allows to
store a DMS document on file system. Before we could call this method we have to
get the Bean with the BeanManager like in following way. A possibility to finish a
transcation is the usage of BeanManager.commit():
DemoBean db = (DemoBean)BeanManager.getBean("DemoBean");
//code to get DMS document(s)
...
db.storeDocument(doc); //store document on file system
...
try {
//code to handle file(s)
...
BeanManager.commit(); //calls beforeCompletion() + afterCompletion()
} catch (Exception ex) {
BeanManager.rollback();
}
More details about the BeanManager could be found in the @enterprise API!
4.8
Resource Files
It is possible to change the labels and messages of @enterprise by writing your own
resource files. @enterprise uses the mechanism of "ResourceBundles" of Java for translating
language-dependent texts. See the Java documentation of java.util.ResourceBundle for details
on how this works.
@enterprise uses two ResourceBundles
<ephome>/classes/com/dec/avw/resource/Errors for error messages and
<ephome>/classes/com/dec/avw/resource/Strings for label, messages
and other texts.
The default versions contain the texts in English, the german versions, with the suffix "_de"
contain the german texts. Other language dependent resource files may follow.
You can define resource files for country dependent locales, for example a file Strings_de_AT
and overwrite selectively the labels you want to change.
Example:
finish=Senden
take=Übernehmen
This file overwrites the labels for finish and take, it has an effect for all users with Locale
de_AT. You have to put the file in the class path of @enterprise, for example:
<ephome>/classes/com/dec/avw/resource/Strings_de_AT.properties
48