# Package com.ibm.openpages.api

OpenPages with Watson Risk API

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  BatchIterator<E> | This `Iterator` interface loads objects for iteration in batches to reduce memory footprint.
  IDisposable | Interface for safely disposing an object.
  IRefreshable | This interface refreshes the object state with the latest changes, if any.

- Class Summary
  Class | Description
  --- | ---
  AbstractBulkInputModel |
  Check | Utility methods for common argument validations
  Context | Application context used to encapsulate system data to allow it to be shared with other parts of the application.
  ErrorCode | The Error Code which uniquely represents an OpenPages Error with a specific numeric Id.

- Enum Summary
  Enum | Description
  --- | ---
  ServerType | Application servers supported by OpenPages with Watson.

- Exception Summary
  Exception | Description
  --- | ---
  AccessDeniedException | Thrown to indicate that the user does not have permission to perform the action.
  IllegalStateException | Thrown to indicate that a method has been invoked at an illegal or inappropriate time.
  InvalidArgumentException | Thrown to indicate that a method was passed an invalid or inappropriate argument.
  NotSupportedException | Thrown to indicate that the requested operation is not supported.
  ObjectAlreadyExistsException | Exception thrown when trying to create an object that already exists.
  ObjectNotFoundException | Thrown to indicate that an object was not found.
  OpenPagesException | Root of all runtime exceptions that can be thrown from the OpenPages public API.
  PasswordException |
  RoleException |

## Package com.ibm.openpages.api Description

# OpenPages with Watson Risk API

Supporting interfaces for the OpenPages public API.

## Getting started

The Risk API is a set of interfaces that allow you to interact with the OpenPages with Watson application when developing solutions to extend the application with new features. A factory pattern is used to retrieve the services which are the main starting points for interacting with an area of functionality.

### Get the Context

To start a session with the Risk API you need to create a `Context` for the current user. To create a new Context without an existing OpenpagesSession provided by an existing OpenPages with Watson, you must provide user credentials:
`Context context = new Context();
//add connection information for the environment, and user credentials
context.put(Context.SERVICE_USER_NAME, "jsmith");
context.put(Context.SERVICE_USER_PASSWORD, "****");`
To create a new Context with an existing OpenpagesSession:
`Context context = new Context();
//add connection with an existing OpenpagesSession
context.put(Context.SERVICE_SESSION,openpagesSession);`

Note: To get a context in a Trigger Rule or EventHandler see `AbstractEvent.getContext()`.
Note: To get a context a Workflow custom java action that extends or CustomJavaActionBase see `com.ibm.openpages.api.workflow.action.CustomJavaActionBase#getContext()`.

### Get the ServiceFactory

From the context, you may get a reference to the `IServiceFactory` which allows you to create any of the other services to interact with the OpenPages platform features:
`//gets the serviceFactory reference IServiceFactory
serviceFactory = ServiceFactory.getServiceFactory(context);
//create the factories you need to use
IQueryService queryService = serviceFactory.createQueryService();
IMetaDataService metaService = serviceFactory.createMetaDataService();
IConfigurationService confService = serviceFactory.createConfigurationService();
//etc...`
The factories are created using the current Context and any operation performed will be with that context and its user.

## Available Services

The following public services are available in the Risk API along with a high level summary of features.

- IMetaDataService - Object Types, Fields, Dependencies
- IResourceService - CRUD Operations on GRC Objects, Documents, Folders and Associations
- IQueryService - Query the data model
- IConfigurationService - Profiles, Currencies, Registry, Application Text
- IWorkflowService - Workflow Jobs, Tasks
- ISecurityService - Users, Groups, Roles
- IApplicationService - Copy, Move, Locking, Cognos
- IAuditService - Retrieve Change History, Fields, Associations

Refer to the javadoc for further information about each service `com.ibm.openpages.api.service`

Licensed Materials - Property of IBM
OpenPages with Watson (PID: 5725-D51)
© Copyright IBM Corporation 2013, 2022. All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.