Example: AIS connection code for Address Book Data Control Class
public class AddressBookDC { // Session variables. private E1UserSessionBean userBean; private LoginEnvironment loginEnv; private boolean runningInJDEADFContainer = true; // Hard coded connection values. private static final String AIS_SERVER = "http://host:port"; private static final String USER_NAME = "username"; private static final String PASSWORD = "password"; private static final String ROLE = "role"; private static final String ENVIRONMENT = "environment"; private static final String DEVICE = "E1ADFApps"; public AddressBookDC() { String handshakeId = (String) ADFContext.getCurrent().getPageFlowScope().get("handshakeId"); if (handshakeId == null || (handshakeId != null && handshakeId.length() == 0)) { runningInJDEADFContainer = false; userBean = new E1UserSessionBean(AIS_SERVER, USER_NAME, PASSWORD, ENVIRONMENT, ROLE, DEVICE); } else { // Only initialize application About properties when running in the JDEADFContainer. E1AdfUtils.intializeAppInstance("/com/oracle/e1/E01012/"); } loginEnv = E1AdfUtils.getLoginEnvironment(userBean); if (loginEnv != null) { // Specify all AIS capabilities required by data control. List<String> reqCapabilities = loginEnv.getRequiredCapabilities(); reqCapabilities.add("processingOption"); retrievePOValues(); } } }
When the EnterpriseOne ADF application is running locally, the handshakeId input parameter will be null. As a result, the EnterpriseOne ADF application creates a direct connection to the AIS Server using hard coded AIS credentials and the E1UserSessionBean class included in E1UserSession.jar. E1AdfUtils will then use the E1UserSessionBean connection to create a LoginEnvironment object, which is used in all subsequent service requests to the AIS Server.
When an EnterpriseOne ADF application launches from an EnterpriseOne menu and executes within the JDEADFContainer, a valid handshakeId value is passed to the application's bounded task flow as an input parameter. The data control will then inherit the LoginEnvironment object maintained by the JDEADFContainer, which was created after the user signed into EnterpriseOne and a connection was established between the EnterpriseOne HTML Server, EnterpriseOne AIS Server, and the JDEADFContainer.