creating a basic skeleton to invoke an AM in Java Class in Oracle ADF

Here is a very cool way of quickly creating a basic skeleton to invoke an AM :

1) Create a Test java class.

2) Inside the mail class, type in keyword ‘bc4jclient’ :

package model;

public class Class1 {
public Class1() {
super();
}

public static void main(String[] args) {
Class1 class1 = new Class1();

bc4jclient
}
}</blockquote>
<div></div>
<blockquote>

3) Press Ctrl + Enter.4) Voila!! A small skeleton to invoke AM gets created:

package model;

import oracle.jbo.*;
import oracle.jbo.client.Configuration;
import oracle.jbo.domain.*;
import oracle.jbo.domain.Number;

public class Class1 {
public Class1() {
super();
}

public static void main(String[] args) {
Class1 class1 = new Class1();

String amDef = "test.TestModule";
String config = "TestModuleLocal";
ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
ViewObject vo = am.findViewObject("TestView");
// Work with your appmodule and view object here
Configuration.releaseRootApplicationModule(am, true);
}
}

Executing AmImpl method in managed bean in Oracle ADF | Techartifact

Requirement – Executing AmImpl method in managed bean in Oracle ADF

We can execute the AmImpl method in managed bean using following method.We can get the bindings object.

        BindingContainer bindings = getBindings();
        int checkListID =  ((BigDecimal)valueChangeEvent.getNewValue()).intValue();
       OperationBinding refreshChecklist = bindings.getOperationBinding("checklistQuery");//checklistQuery is method name in Applicationmoduleimpl file
        refreshChecklist.getParamsMap().put("checklistId", checkListID);  // checklistId is parameter for that method.


happy coding with techartifact

show af:message programatically in ADF | Techartifact

Requirment- To show the message in ADF

ADF Faces uses the standard JSF messaging API. JSF supports a built-in framework for messaging by allowing FacesMessage instances to be added to the FacesContext object using the addMessage(java.lang.String clientId, FacesMessage message) method. You can set the type of message like – error, fatal,info,warning.

            FacesContext facesContext = FacesContext.getCurrentInstance();
            facesContext.addMessage("NoRecordsFound", 
                                    new FacesMessage(FacesMessage.SEVERITY_INFO,
                                                     "No Records Found", 
                                                     "No Orders matching searched criteria"));
            facesContext.renderResponse(); 

Happy coding with Techartifact