Showing posts with label Service Cloud. Show all posts
Showing posts with label Service Cloud. Show all posts

Monday, September 4, 2017

How To: Access one managed bean from another (ADF, JSF)

It is a common requirement to access methods between managed beans defined in varied scopes within ADF. In this post, I am invoking backing bean (method to enable/disable a button) from a request bean. The similar approach can be used for other scopes viz. pageFlow, session, application.


Download Sample Code on GitHub


Define your managed beans in your task flow:
    <managed-bean id="__1">
      <managed-bean-name id="__243">RequestBean</managed-bean-name>
      <managed-bean-class id="__244">ui.bean.RequestBean</managed-bean-class>
      <managed-bean-scope id="__245">request</managed-bean-scope>
    </managed-bean>
    <managed-bean id="__2">
      <managed-bean-name id="__248">BackingBean</managed-bean-name>
      <managed-bean-class id="__246">ui.bean.BackingBean</managed-bean-class>
      <managed-bean-scope id="__247">backingBean</managed-bean-scope>
    </managed-bean>
BackingBean Definition:
package ui.bean;

import oracle.adf.view.rich.component.rich.nav.RichCommandToolbarButton;

public class BackingBean {
    private RichButton submitBtn;

    public void setSubmitBtn(RichButton submitBtn) {
        this.submitBtn = submitBtn;
    }

    public RichButton getSubmitBtn() {
        return submitBtn;
    }
}
RequestBean Definition:
package ui.bean;

import javax.el.ELContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class RequestBean {

    public BackingBean getBackingBean() {
        FacesContext fctx = FacesContext.getCurrentInstance();
        ELContext context = fctx.getELContext();
        BackingBean backingBean =
            (BackingBean) fctx.getApplication().getExpressionFactory()
                .createValueExpression(context,"#{backingBeanScope.BackingBean}",BackingBean.class)
                .getValue(context);
        return backingBean;
    }

    public void enableSubmit(ActionEvent actionEvent) {
        /* Invoke BackingBean method to enable/disable Submit Button */
        getBackingBean().getSubmitBtn().setDisabled(false);
    }
}



Hope you find this helpful! Please share your feedback below.

CaptiveCode


Saturday, March 25, 2017

How To: Deploying applications on WebLogic using command line

This article is a quick reference on how to deploy applications to WebLogic server using command line interface.

Set classpath as follows:
set CLASSPATH=C:\Weblogic\Middleware\wlserver_10.3\server\lib\weblogic.jar


To deploy from your local desktop (remote):


To deploy a WAR file:
java weblogic.Deployer -adminurl <<admin server host:port>> -user weblogic -password ulorcl123$ -deploy C:\JDeveloper\mywork\myApp\deploy\myApp.war -remote -upload
To redeploy a WAR file:
java weblogic.Deployer -adminurl <<admin server host:port>> -user weblogic -password ulorcl123$ -redeploy -source C:\JDeveloper\mywork\myApp\deploy\myApp.war -remote -upload -name myApp.war


Common Errors:


Error:
'ModuleArchive' cannot be null
Resolution:
Make sure the source parameter is specified in the redeploy command

Hope you find this helpful! Please share your feedback below.
CaptiveCode


Wednesday, May 11, 2016

Mobile: Everything it takes to get MAF 2.3 App running for an Android Device!

In extension to my prior post to get MAF 2.3 Apps running for iOS, here is what it takes to be Android -

Your target environment:

  • MAF 2.3
  • JDeveloper 12.2
  • JDK 1.8
  • Android API Level 23

Here is how you accomplish this -

1 - Download the android studio from here

2 - Once installed, launch the SDK manager and install all the API Level 23 packages

3 - Setup your simulator:
        a) Click Tools > Manage AVDs
        b) Click Device Definitions > Select Nexus 5 > Click Create
        d) AVD configuration:
            

4 - Locate your Android SDK (This is required to be configured in Jdeveloper)
     a) For Windows:
         Android SDK: C:\Users\xyz\AppData\Local\Android\sdk
         Android Platform Location: C:\Users\xyz\AppData\Local\Android\sdk\platforms\android-23
         Android Build Tools Location C:\Users\xyz\AppData\Local\Android\sdk\build-tools\23.0.3

5 - Create a keystore to sign the application
      keytool -genkey -v -keystore myKey.keystore -alias myKey -keyalg RSA -keysize 2048 -validity 10000


6 - Open JDeveloper > Tools > Preference > MAF > Android Platform
      Key in the locations determined in the step#4
      Key in the keystore location within the Release Tab and provide the passwords for both Debug and Release.

You are all set to deploy your apps on Android platform! Click here for my notes on iOS platform.



Hope you find this information useful.Please share your feedback below. I would love to hear from you.

CaptiveCode