HP Anywhere 10.11 API Reference
Show:

HPA.Interop

Module: HPA

Available since HP Anywhere 10.00

Deprecated since HP Anywhere 10.02; use HPA.Framework.

Interoperability API - used for interacting with the HPA framework.

Usage Example:

var ctxObj = HPA.Framework.createContextObject( "QCCR1123", "ALM CR", "button doesn't work...");
HPA.Framework.openEntryPoint("DefectManager", "open", [ ctxObj ]);

Methods

addContextObjectToActivity

(
  • context
)

Available since HP Anywhere 10.00 <b>Example:</b>

Adds a context object or objects to an activity. If only one parameter is given, prompts the user to add the object/s to either the current activity or to a new one. If a second parameter is given (see below for valid values), adds the object/s without prompting the user. Use this method to add a context object to an activity as a result of user interaction with the app. For example, when a user submits a defect in a defect management app, you can use this method to add a context object to the activity representing that defect.

Parameters:

createContextObject

(
  • objectId
  • dataType
  • displayName
  • [metaData]
)
Object | Null

Available since HP Anywhere 10.00

Create a valid context object based on the arguments provided. After the object is created, it is validated by calling isValidContextObject.


A context object represents a business entity that is provided to the HP Anywhere framework by apps. For details, see the User Guide and Events Sample App Cookbook.

Parameters:

  • objectId String

    ID of the context object; globally unique identifier.

  • dataType String

    Type of data of this context object.

  • displayName String

    Name of the context object. Maximum length: 100 characters.

  • [metaData] String optional

    An arbitrary string containing extra information. Maximum length: 2000 characters.

Returns:

Object | Null: Object containing the properties passed as arguments, or 'null' if the given arguments resulted in an invalid context object.

createEntryPointObject

(
  • appId
  • entryPointId
  • displayName
)
Object | Null

Available since HP Anywhere 10.01

Create a valid entry point object based on the arguments provided.


An entry point object represents a specific app page that is provided to the HP Anywhere framework by apps. For details, see the User Guide and Events Sample App Cookbook.

Parameters:

  • appId String

    ID of the app.

  • entryPointId String

    ID of the entry point.

  • displayName String

    Name of the entry point.

Returns:

Object | Null: Object containing the properties passed as arguments, or 'null' if one of the arguments is empty.

isAppAvailable

(
  • targetAppId
)
Boolean

Available since HP Anywhere 10.00

Ask the HP Anywhere framework whether or not a specific app is available for interaction.

Parameters:

  • targetAppId String

    ID of the required app. The ID of the app containing the entry point (app specific page).

Returns:

Boolean: True if the app is available.

isValidContextObject

(
  • contextObject
)
Boolean

Available since HP Anywhere 10.00

Validate that the context object is in the correct structure. This method returns a boolean value; for an invalid object, obtain detailed information using the validateContextObject method.

Parameters:

  • contextObject Object

    Context object to be tested for validity.

Returns:

Boolean: True if the given object is valid.

openEntryPoint

(
  • targetAppId
  • entryPoint
  • [contextObjects]
  • [callback]
  • [scope]
  • [reuse]
)
async

Available since HP Anywhere 10.00

Invoke an entry point of a specific app with optional context objects.

Important: This method is different from the global openEntryPoint() method.

Important: Ajax server requests are asynchronous, and this call will return before the response has been received. Process any returned data in a callback function.

Parameters:

  • targetAppId String

    Target app ID.

  • entryPoint String

    Entry point ID.

  • [contextObjects] Array optional

    An array of context objects. An array of valid context objects. Create valid context objects using the createContextObject factory method; test existing context objects for validity using the isValidContextObject method; for an invalid object, obtain detailed information using the validateContextObject method.

  • [callback] Function optional

    Callback function to be called when the entry point is loaded.

  • [scope] Object optional

    The scope ('this' reference) in which the callback function is executed.

  • [reuse] Boolean optional

    [Desktop Edition] Whether to reuse the existing app instance.

    Usage Example:

    var ctxObj = HPA.Framework.createContextObject( "QCCR1123", "ALM CR", "Login failure");
    HPA.Framework.openEntryPoint("DefectManager", "defect", [ ctxObj ]);
    

    where DefectManager is the targetAppId parameter, defect is the entryPoint parameter, and ctxObj is the contextObjects parameter.

openInnerPoint

(
  • displayName
  • callback
  • scope
  • [params]
  • [validationCallback]
  • [removeCallback]
)
async

Available since HP Anywhere 10.00

[Desktop Edition]

Mark the user state of the current app as an internal navigation point, so that the end-user can return to this point via the drop-down navigation menu.

Important: Ajax server requests are asynchronous, and this call will return before the response has been received. Process any returned data in a callback function.

Parameters:

  • displayName String

    Name to be displayed in the drop-down navigation menu.

  • callback Function

    Callback function to be called when the navigation point is selected, if the validation callback did not return False.

  • scope Object

    The scope ('this' reference) in which the callback functions are executed.

  • [params] Object optional

    Parameters to be passed as arguments when the callbacks are called.

  • [validationCallback] Function optional

    Callback function to be called just before switching to this page. If the function returns False, navigation to this page is canceled.

  • [removeCallback] Function optional

    [since HP Anywhere 10.01] Callback function to be called after this page is removed.

saveState

(
  • state
)

Available since HP Anywhere 10.00

Persist an object representing the current app state. There is no restriction on the object format; maximum size is 100kB (102,400 bytes). The state is saved per user, per activity, per app instance. When the user enters the app in the activity again, the last saved state is provided to the app, via its openEntryPoint method, params argument.

Parameters:

  • state Any

    An object in arbitrary format.

setActions

(
  • hideActions
)
deprecated

Deprecated Use HPA.ActionsBar.setVisible for showing or hiding the Actions bar, and HPA.ActionsBar.setActions for customizing the Actions bar or restoring it to its default state.

Hide or show the actions bar.

Parameters:

  • hideActions Boolean

    True to hide the actions bar, false to show it.

setCurrentContext

(
  • [context]
  • [entryPointObject]
)

Available since HP Anywhere 10.01

Notify the HP Anywhere framework of the current context of the app. If the user adds a post in the timeline, objects in the current context that are not in the current activity are automatically added to the activity (no objects are deleted or updated).

Parameters:

  • [context] Object | Array optional

    A valid context object or an array of valid context objects. Create valid context objects using the factory method. Test existing context objects for validity using the isValidContextObject method. For an invalid object, obtain detailed information using the validateContextObject method.

  • [entryPointObject] Object optional

    A valid entry point object. Create valid entry point objects using the createEntryPointObject factory method.

setReady

(
  • readyState
)

Available since HP Anywhere 10.00

Notify the HPA framework that the app is ready to accept entry point requests.

This method must be called by the app developer whenever the app is loaded.

Parameters:

  • readyState Boolean | Object

    Either an object with the properties listed below, describing the relevant app capabilities, or simply the boolean True.

    • [hasDefaultAction] Boolean optional

      [Smartphone Edition] Show an integrated default Action button in the Actions bar. The app needs to handle the DefaultAction entry point.

    • [moreActions] Array optional

      [Smartphone Edition] Show integrated menu items in the More menu. The app needs to handle the MoreActions entry point.

    • [hasAutoContext] Boolean optional

      Support auto-injection of context objects. The app needs to handle the GetContextObjects entry point.

validateContextObject

(
  • contextObject
)
String[]

Available since HP Anywhere 10.00

Validate that the given context object is in the correct structure, otherwise returns detailed information. Note that returned messages aren't localized (are always in English).

Parameters:

  • contextObject Object

    Context object to be tested for validity.

Returns:

String[]: Array of validation error messages, with length zero if the given object is valid.