Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile
11g Release 2 (11.1.2.3.0)

E27204-01


oracle.adfmf.framework.api
Class AdfmfContainerUtilities

java.lang.Object
  extended by oracle.adf.model.datacontrols.device.BaseProxy
      extended by oracle.adfmf.framework.api.AdfmfContainerUtilities


public class AdfmfContainerUtilities
extends oracle.adf.model.datacontrols.device.BaseProxy

Constructor Summary
AdfmfContainerUtilities()
           

 

Method Summary
static void checkForNewConfiguration()
          Checks and obtains new configuration if available
static oracle.adfmf.framework.ApplicationInformation getApplicationInformation()
          Gets ApplicatiaonInformation object containing the information about the application.
static oracle.adfmf.framework.FeatureInformation getFeatureById(java.lang.String featureId)
          Returns the feature information for the passed in feature id.
static oracle.adfmf.framework.FeatureInformation getFeatureByName(java.lang.String featureName)
          Returns the feature information for the passed in feature name.
static oracle.adfmf.framework.FeatureInformation[] getFeatures()
          Gets an array of FeatureInformation objects that provide information about the features that are available in this session of the ADF Mobile application and should be displayed on a custom springboard.
static void gotoDefaultFeature()
          Activates the default feature.
static void gotoFeature(java.lang.String featureId)
          Activates the feature with the given id.
static void gotoSpringboard()
          Activates the springboard.
static void hideNavigationBar()
          Hides navigation bar.
static java.lang.Object invokeContainerJavaScriptFunction(java.lang.String featureId, java.lang.String methodName, java.lang.Object[] args)
          Invokes a Javascript method with the given arguments on the specified feature.
static java.lang.Object invokeContainerMethod(java.lang.String className, java.lang.String methodName, java.lang.Object[] args)
          Invokes a native method on the specified class with the given arguments.
static void resetFeature(java.lang.String featureId)
          Resets the feature with the given id.
static void sendEmail(java.util.HashMap options)
          The framework enables you to display the device's e-mail interface, and optionally pre-populate certain fields:
static void sendSMS(java.util.HashMap options)
          The framework enables you to display the device's text messaging (SMS) interface, and optionally pre-populate certain fields:
static void showNavigationBar()
          Shows navigation bar.

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

AdfmfContainerUtilities

public AdfmfContainerUtilities()

Method Detail

checkForNewConfiguration

public static void checkForNewConfiguration()
                                     throws AdfException
Checks and obtains new configuration if available
Throws:
AdfException -
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        AdfmfContainerUtilities.checkForNewConfiguration();
     }catch(AdfException e) {
        // handle the exception
     }
 

getFeatures

public static oracle.adfmf.framework.FeatureInformation[] getFeatures()
                                                               throws AdfException
Gets an array of FeatureInformation objects that provide information about the features that are available in this session of the ADF Mobile application and should be displayed on a custom springboard. These features have already been filtered by the evaluation of constraints. These are the features that would normally be displayed on the default springboard.
Returns:
An array of FeatureInformation objects each representing a feature that is available. This will include the feature id, the feature name, a path to the feature icon and a path to the feature image. Normally a springboard will display the name of the feature and the image for that feature.
Throws:
AdfException -
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        FeatureInformation[] fia = null;
        fia = AdfmfContainerUtilities.getFeatures();

        for(int f = 0; f < fia.length; ++f) {
           FeatureInformation fi = fia[i];
           ...
        }
     }catch(AdfException e) {
        // handle the exception
     }
 

getApplicationInformation

public static oracle.adfmf.framework.ApplicationInformation getApplicationInformation()
                                                                               throws AdfException
Gets ApplicatiaonInformation object containing the information about the application. This can be used to get the application name for a custom springboard. Additional information such as vendor, version and application id are provided as well.
Returns:
A ApplicatiaonInformation object containing application level metadata. This includes application name, vendor, version and application id.
Throws:
AdfException -
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        ApplicationInformation[] ai = AdfmfContainerUtilities.getApplicationInformation();
        ...
     }catch(AdfException e) {
        // handle the exception
     }
 

gotoFeature

public static void gotoFeature(java.lang.String featureId)
                        throws AdfException
Activates the feature with the given id.
Parameters:
featureId - The id of the feature to activate
Throws:
AdfException -
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        AdfmfContainerUtilities.gotoFeature("feature.id");
     }catch(AdfException e) {
        // handle the exception
     }
 

gotoSpringboard

public static void gotoSpringboard()
Activates the springboard.
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        AdfmfContainerUtilities.gotoSpringboard();
     }catch(AdfException e) {
        // handle the exception
     }
 

gotoDefaultFeature

public static void gotoDefaultFeature()
Activates the default feature.
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        AdfmfContainerUtilities.gotoDefaultFeature();
     }catch(AdfException e) {
        // handle the exception
     }
 

resetFeature

public static void resetFeature(java.lang.String featureId)
                         throws AdfException
Resets the feature with the given id.
Parameters:
featureId - The id of the feature to reset
Throws:
AdfException -
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        AdfmfContainerUtilities.resetFeature("feature.id");
     }catch(AdfException e) {
        // handle the exception
     }
 

hideNavigationBar

public static void hideNavigationBar()
Hides navigation bar.
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        AdfmfContainerUtilities.hideNavigationBar();
     }catch(Exception e) {
        // handle the exception
     }
 

showNavigationBar

public static void showNavigationBar()
Shows navigation bar.
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        AdfmfContainerUtilities.showNavigationBar();
     }catch(Exception e) {
        // handle the exception
     }
 

invokeContainerJavaScriptFunction

public static java.lang.Object invokeContainerJavaScriptFunction(java.lang.String featureId,
                                                                 java.lang.String methodName,
                                                                 java.lang.Object[] args)
                                                          throws AdfException
Invokes a Javascript method with the given arguments on the specified feature. Returns the result of the method execution.
Parameters:
featureId - The id of the feature on which to invoke the method
methodName - method name
args - array of arguments to be passed to method
Returns:
a JSON object
Throws:
AdfException -

To illustrate how this can be used, we did the following:
  • included a simple appFunction.js file to feature1 (by adding it to feature1 content's include in JDeveloper).
  • added a command button with the actionListener="#{managedBean1.invokeApplicationJavaScriptFuntions}"

appFunctions.js
    (function() 
    {
       if (!window.application) window.application = {};

       application.testFunction = function()
       {
          var args = arguments;

          alert("APP ALERT " + args.length + " ");
          return "application.testFunction - passed";
       };
    })();
 

invokeApplicationJavaScriptFuntions
    public void invokeApplicationJavaScriptFuntions(ActionEvent actionEvent) {
        AdfmfContainerUtilities.invokeContainerJavaScriptFunction("feature1", "application.testFunction", new Object[] {} );
        AdfmfContainerUtilities.invokeContainerJavaScriptFunction("feature1", "application.testFunction", new Object[] {"P1"} );
        AdfmfContainerUtilities.invokeContainerJavaScriptFunction("feature1", "application.testFunction", new Object[] {"P1", "P2"} );
    }
 

Now when the user presses the button they will see three alerts:
        APP ALERT 0
        APP ALERT 1
        APP ALERT 2
 

invokeContainerMethod

public static java.lang.Object invokeContainerMethod(java.lang.String className,
                                                     java.lang.String methodName,
                                                     java.lang.Object[] args)
Invokes a native method on the specified class with the given arguments. Returns the result of method execution.
Parameters:
className - class name
methodName - method name
args - array of arguments to be passed to method
Returns:
Object

getFeatureById

public static oracle.adfmf.framework.FeatureInformation getFeatureById(java.lang.String featureId)
                                                                throws AdfException
Returns the feature information for the passed in feature id.
Parameters:
featureId - The id of the feature to retrieve
Throws:
AdfException -
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        FeatureInformation fi = AdfmfContainerUtilities.getFeatureById("feature.id");
     }catch(AdfException e) {
        // handle the exception
     }
 

getFeatureByName

public static oracle.adfmf.framework.FeatureInformation getFeatureByName(java.lang.String featureName)
                                                                  throws AdfException
Returns the feature information for the passed in feature name.
Parameters:
featureName - Name of the feature to retrieve
Throws:
AdfException -
See Also:
   import oracle.adfmf.framework.api.AdfmfContainerUtilties;

   ...
     try {
        FeatureInformation fi = AdfmfContainerUtilities.getFeatureByName("feature.name");
     }catch(AdfException e) {
        // handle the exception
     }
 

sendEmail

public static void sendEmail(java.util.HashMap options)
The framework enables you to display the device's e-mail interface, and optionally pre-populate certain fields:
Parameters:
options - is a HashMap object with the following optional properties:
  • to: recipients (comma-separated)
  • cc: CC recipients (comma-separated)
  • subject: message subject
  • body: message body
  • bcc: BCC recipients (comma-separated)
  • attachments: list of filenames to attach to the e-mail (comma-separated)
  • mimeTypes:
    • iOS: List of MIME types to use for the attachments (comma-separated). Specify null to let the framework automatically determine the MIME types. It is also possible to only specify the MIME types for selected attachments; see examples below.
    • Android: MIME type in Android isn't true MIME type but just a way for Android to filter applications to be shown in the application chooser dialog. But empty MIME type doesn't work and throws exception. So if no MIME type is passed in, we use "plain/text" by default. Also, if there are multiple attachment types, user doesn't need to provide multiple MIME types, but can provide just most suitable MIME type (as per Android documentation). That being said, if the user has an application which is being deployed to both iOS and Android, they can pass in the comma-separated list of mime types and Android will still work fine.

After this interface is displayed, the user can choose to either send the e-mail or discard it. Note that it is not possible to automatically send the e-mail due to device/carrier restrictions; only the end user can actually send the e-mail. The device must also have at least one e-mail account configured to send e-mail; otherwise, an error will be displayed indicating that no e-mail accounts could be found.
Examples: Populate an e-mail to 'john.doe@foo.com', copy 'jane.doe@bar.com', with the subject 'Test message', and the body 'This is a test message'
   HashMap  options = new HashMap();

   options.put("to",          "john.doe@foo.com");
   options.put("cc",          "jane.doe@bar.com");
   options.put("subject",     "Test message");
   options.put("body",        "This is a test message");
   adf.mf.api.sendEmail(options);
 

Taking the same example, but now adding a BCC to 'mary.may@another.com' and 'lary.day@another.com' and attaching two files.
NOTE: By not specifying a value for the mimeTypes parameter, you are telling the framework to automatically determine the MIME type for each of the attachments
   HashMap  options = new HashMap();

   options.put("to",          "john.doe@foo.com");
   options.put("cc",          "jane.doe@bar.com");
   options.put("bcc",         "mary.may@another.com,lary.day@another.com");
   options.put("subject",     "Test message");
   options.put("body",        "This is a test message");
   options.put("attachments", "path/to/file1.txt,path/to/file2.png");
   adf.mf.api.sendEmail(options);
 
success callback needs to be in the form of function(request, response) where the request contains the original request and the response contains the associated AdfmfContainerUtilities method's return value.
i.e. void

failed callback needs to be in the form of function(request, response) where the request contains the original request and the response contains the error.
Throws:
AdfException

sendSMS

public static void sendSMS(java.util.HashMap options)
The framework enables you to display the device's text messaging (SMS) interface, and optionally pre-populate certain fields:
Parameters:
options - is a HashMap object with the following optional properties:
  • to: recipients (comma-separated)
  • body: message body

After this interface is displayed, the user can choose to either send the SMS or discard it. Note that it is not possible to automatically send the SMS due to device/carrier restrictions; only the end user can actually send the SMS.
Examples: Populate an SMS message to 'john.doe@foo.com' with the body 'This is a test message'
   HashMap  options = new HashMap();

   options.put("to",   "john.doe@foo.com");
   options.put("body", "This is a test message");
   AdfmfContainerUtilities.sendSMS(options);
 
success callback needs to be in the form of function(request, response) where the request contains the original request and the response contains the associated AdfmfContainerUtilities method's return value.
i.e.
void
failed callbackneeds to be in the form of function(request, response) where the request contains the original request and the response contains the error.
Throws:
AdfException

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile
11g Release 2 (11.1.2.3.0)

E27204-01


Copyright © 2012 Oracle. All Rights Reserved.