Sunday, March 2, 2014

ADF Mobile - Reading custom properties from adf-config.xml

Take a scenario where you have integrated the push notification feature into mobile application and application needs to be shipped to client, to work push notification feature you need Sender ID for both Android and iOS and client want's to use their own Sender Id.

Next question will be where can we store the custom Sender Id in the application so that the client can edit. Credit goes to Srini Indla(Oracle), I have extracted the idea based on one of his forum reply and below is one of the way.

Custom values can be stored in add-config.xml file under <adf:adf-properties-child> tag, add-config.xml is used to configure application-level settings, including the Configuration Service parameters and read more on ADF Mobile Configuration Service Usage. The advantage of storing the properties and accessing it via the adf-confg.xml is that the values can be accessible using the EL expression at run time.

Below is a sample adf-confif.xml with custom properties:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<adf-config xmlns="http://xmlns.oracle.com/adf/config" xmlns:config="http://xmlns.oracle.com/bc4j/configuration"
            xmlns:adf="http://xmlns.oracle.com/adf/config/properties">
  <adf-adfm-config xmlns="http://xmlns.oracle.com/adfm/config">
    <defaults changeEventPolicy="ppr" useBindVarsForViewCriteriaLiterals="true"/>
    <startup>
      <amconfig-overrides>
        <config:Database jbo.locking.mode="optimistic"/>
      </amconfig-overrides>
    </startup>
  </adf-adfm-config>
  <adf:adf-properties-child xmlns="http://xmlns.oracle.com/adf/config/properties">
    <adf-property name="adfAppUID" value="MobileAdfConfig-1564"/>
    <adf-property name="username" value="Weblogic"/>
    <adf-property name="password" value="Weblogic1"/>
  </adf:adf-properties-child>
</adf-config>
In Amx page you can access the above custom defined properties using EL expression.
For ex:  "#{applicationScope.configuration.username}"

Below is the sample code to access custom properties from adf-config.xml in managed bean.
ValueExpression userNameVe =
            AdfmfJavaUtilities.getValueExpression("#{applicationScope.configuration.username}", String.class);
String userName = (String)userNameVe.getValue(AdfmfJavaUtilities.getAdfELContext());

ValueExpression passwordVe =
            AdfmfJavaUtilities.getValueExpression("#{applicationScope.configuration.password}", String.class);
String password = (String)passwordVe.getValue(AdfmfJavaUtilities.getAdfELContext());

39 comments:

  1. Could you set the property on the fly as well?. For instance, from a value returned from a REST service?

    ReplyDelete
  2. There is a great blog about Oracle ADF and thanks for sharing about Oracle ADF information. We are providing online training classes OracleADFonlinetraining

    ReplyDelete
  3. This is very good information for knowing the oracle adf basic knowledge and use full for your online class . oracleadfonlinetraining

    ReplyDelete
  4. Nice Blog !
    QuickBooks is a well-known accounting software that is designed to serve all the needs of businesses. Our team at QuickBooks Customer Service Number 1-855-550-7546 is best known for their incredible technical support.

    ReplyDelete
  5. Avail the best assistance for QuickBooks on Quickbooks Phone Number1 877-948-5867.

    ReplyDelete
  6. Small business owners benefit from the accounting software as it helps business owners to track all the processes of accounting. QuickBooks is one of the best accounting software Quickbooks Phone Number.

    ReplyDelete
  7. Obtain pocket-friendly technical support service for QuickBooks at Quickbooks Phone Number 1833-244-5865

    ReplyDelete
  8. These errors can cause a serious issue in your work. To eliminate these errors, connect with our team at Quickbooks Phone Number1 877-754-1114.

    ReplyDelete
  9. Let us take the pleasure to serve you, trust our team at Quickbooks Phone Number 1 855-377-7767 will surely help you get out of every technical glitch you are facing or going to face in the future.
    Quickbooks Phone Number

    ReplyDelete
  10. Avail curbing solutions for QuickBooks at quickbooks phone number Quickbooks Phone Number 1 316-600-2287

    ReplyDelete
  11. Really so amazing picture thanks for sharing .if you have anu problem with quickbooks software then please contact at

    QuickBooks Customer Service

    ReplyDelete
  12. QuickBooks is safest and most demandable software in the market for your business needed if you have any issue then contact at
    QuickBooks Customer Service for technical support

    ReplyDelete
  13. QuickBooks is a user-friendly accounting software which helps you to manage and run your accounts smoothly with more impact to your business. But, there are rare times when our customers struggle with persistent bugs & errors, namely QuickBooks Error 15215.
    quickbooks customer service (866)-822-4745

    ReplyDelete
  14. QuickBooks Error 15215 is usually triggered by a conflict with another application running in the background when you attempt to download and install a payroll update.
    quickboks customer service(855) 742-7868.

    ReplyDelete
  15. There are many ways to resolve QuickBooks Error 15215 and get your affairs back running on our software like - rebooting the system or running QuickBooks as a Windows Administrator. However, you can contact our team at
    Quickbooks Phone Number (877) 762-1118

    ReplyDelete
  16. QuickBooks is a user-friendly accounting software which helps you to manage and run your accounts smoothly with more impact to your business.
    quickbooks customer service (877)948-5867

    ReplyDelete
  17. quickbooks is most demanding software Our company is working with this software that we provide high quality service at competitive prices.

    QuickBooks Customer Service

    ReplyDelete
  18. QuickBooks is financial accounting software may occur these errors while using it just call at ours team at

    quickbooks customer service

    ReplyDelete
  19. "The Masters Real Estate" is official sales partner of Lahore Smart City and 1st Smart City which is Capital Smart City . We are one of the most enticing options on the planet of real estate. Our prestigious forum provides the potential solution of all your ambiguities regarding the purchasing of shops, lands, and houses.

    We have engaged our teams in various cities of Pakistan as well as the online world to make our services accessible. The provision of reasonable price real estate properties by our company is attracting the residents and the foreigners. We have intended to provide luxurious construction projects and houses at affordable prices to our nation. One more socity launch soon which is Faisalabad Smart City .

    Also Check Location at: Lahore Smart City Location

    Our Other Projects are here: Nova City Islamabad | Park View City Lahore | Park View City Islamabad

    For More Visit: The Masters Real Estate

    ReplyDelete
  20. Finish the Python Training in Chennai from Infycle Technologies, the best software training institute in Chennai which is providing professional software courses such as Hadoop, Big Data, Android, and iOS Development, Data Science, Artificial Intelligence, Java, Oracle, etc with 100% hands-on practical training. Call 7504633633 to get more info and a free demo and to grab the certification for having a peak rise in your career.

    ReplyDelete
  21. Acquire the trending DevOps Training in Chennai from the best software training institute in Chennai, Infycle Technologies. Additionally, we come up with the latest demanded technological courses like Python, Data Science, Digital Marketing, Big Data, Oracle, AWS, Azure, Google Cloud, Java, and Oracle with the best faculties in the industry. To clear your doubts, call +91-7504633633 or +91-7502633633.

    ReplyDelete
  22. Qb error PS077 happens due to downloading payroll application,But no issue we have a blog that will help you to fix the issue of QuickBooks error PS077 . You can call on 855-738-0359

    ReplyDelete