Difference between revisions of "Configuration Settings"
(New page: In opentaps 1.4.x and earlier versions, configurations were usually in the form of .properties files, and they could be obtained by using the <tt>org.ofbiz.base.util.UtilProperties</tt> cl...) |
m (Protected "Configuration Settings": Sysop page [edit=sysop:move=sysop]) |
(No difference)
|
Revision as of 21:37, 16 June 2010
In opentaps 1.4.x and earlier versions, configurations were usually in the form of .properties files, and they could be obtained by using the org.ofbiz.base.util.UtilProperties class. An example is:
boolean shipmentUpsSaveCertificationInfo = "true".equals(UtilProperties.getPropertyValue("shipment", "shipment.ups.save.certification.info"));
which obtains the property: shipment.ups.save.certification.info=true
from shipment.properties in applications/product/config/shipment.properties
Beginning in opentaps 1.5, a new OpentapsConfiguration entity is introduced to hold configuration data in the database. This entity is keyed on OpentapsConfigurationType for the values which can be configured, and the values are printed when they are stored in the database. An example of this are some of the properties defined for the Opentaps Concur Integration:
<OpentapsConfigurationType configTypeId="CONCUR_CONFIG" description="Concur integration configuration"/> <OpentapsConfigurationType configTypeId="CONCUR_REIMB_PAYMENT_TYPE_ID" parentConfigTypeId="CONCUR_CONFIG" description="Default Payment.paymentTypeId for concur reimbursements"/> <OpentapsConfigurationType configTypeId="CONCUR_REIMB_PAYMENT_METHOD_ID" parentConfigTypeId="CONCUR_CONFIG" description="Default Payment.paymentMethodId for concur reimbursements"/>
The values for the configuration properties can be loaded with entity engine XML (or other database loading scripts):
<OpentapsConfiguration configTypeId="CONCUR_REIMB_PAYMENT_TYPE_ID" value="REIMBURSEMENT"/> <OpentapsConfiguration configTypeId="CONCUR_REIMB_PAYMENT_METHOD_ID" value="COCHECKING" comments="By default, reimbursements are made from the Company Checking account"/>
To use them in your code, use the Infrastructure.getConfigurationValue method:
String reimbursementPaymentTypeId = infrastructure.getConfigurationValue("CONCUR_REIMB_PAYMENT_TYPE_ID"); String reimbursementPaymentMethodId = infrastructure.getConfigurationValue("CONCUR_REIMB_PAYMENT_METHOD_ID");
Overtime, we plan to set up user interface for configuration entities, and also to migrate existing code to them. This should give us a better way to manage system configurations.