Account Properties
From DOC
Simple string-based properties can be defined on an account-by-account basis. In addition, account properties can be declared for an entire AccountType (eg echr or ephr).
Declaring properties in application metadata
An application.xml file can define properties that will be accessible for the entire AccountType. There are two forms of the property element. The inline form assigns a short string to a name:
<property name="myProperty">A small property value</property>
The other form is for larger property values which read the contents of a text file into the property value.
<property name="myProperty" file="legal/disclaimer.txt"/>
Accessing Account Properties
A Map that wraps the properties is available on the Account and AccountUser objects. This makes it easy for web pages to access these properties for get and put operations.
<h:outputText value="#{top.accountUser.property['myAccountUserProperty']}"/>
<h:outputText value="#{top.accountUser.account.property['myAccountProperty']}"/>
The property map can also be accessed via API. To set a property on an Account object:
Account account = accountDAOBean.findAccount( 123 ); Map<String, String> accountPropertyMap = account.getProperty(); accountPropertyMap.put( "com.myOrg.phoneNumber", phoneNumber );
Likewise, to set a property on an AccountUser object
AccountUser accountUser = accountDAOBean.findAccountUser( "user@company.com", account.getId ); Map<String, String> accountUserPropertyMap = accountUser.getProperty(); accountUserPropertyMap.put( "com.myOrg.memberId", memberId );
As long as you access Account (or AccountUser) from within a transaction, which would usually be the case, you don't need to do anything special to update the Account (or AccountUser) database entity, EJB3 takes care of it automatically.
To get a property:
Account account = accountDAOBean.findAccount( 123 ); Map<String, String> accountPropertyMap = account.getProperty(); String phoneNumber = accountPropertyMap.get( "com.myOrg.phoneNumber" );
Or, more compactly:
Account account = accountDAOBean.findAccount( 123 ); String phoneNumber = account.getProperty().get( "com.myOrg.phoneNumber" );
Search Algorithm
A multi-level search for the property which includes consideration of Brand (when available) and Locale
property-name[.brand][_locale]
- property-name.brand_locale
- property-name.brand
- property-name_locale
- property-name
If brand is not provided, then half of the searches are not attempted. Each search in the above list proceeds as follows:
- Account - A property defined in the user's account
- AccountType - A property defined in the template account for the accountType.
- System property - These properties are defined in the TolvenProperties table in the database
A total of twelve complete searches are possible - the first one to return a value ends the search. All possible search combinations are enumerated here:
- Look for a property named
property-name.brand_localein the account - Look for a property named
property-name.brand_localein the accountType - Look for a property named
property-name.brand_localein the system properties - Look for a property named
property-name.brandin the account - Look for a property named
property-name.brandin the accountType - Look for a property named
property-name.brandin the system properties - Look for a property named
property-name_localein the account - Look for a property named
property-name_localein the accountType - Look for a property named
property-name_localein the system properties - Look for a property named
property-namein the account - Look for a property named
property-namein the accountType - Look for a property named
property-namein the system properties

