Saturday, October 13, 2018

How to execute lov View Accessor Query?

UseCase:
At each  Employee record, You want to display list of departments, this list of departments is changed according to a parameter changed at run-time.

You click a button and change the parameter value, the LOV must execute its query to fetch the correct data after changing the parameter.

So you have a ViewAccessor  it's query has a parameter ( :bvDeptId ) to filter data,
this parameter is changed during run-time when you click a button you change this parameter but the LOV shows old data, so how to make it's query to be executed:


Departments as list of value (LOV) at EmployeesView

DepartmentsView1 is the ViewAccessor attached to EmployeesView1 ViewObject .
ViewAccessor has a parameter ( bvDeptId ) to filter data,

Solution:
Note: When you create  LOV, you bound an attribute of a ViewObject with a ViewAccessor, This ViewAccessor is a new instance of the ViewObject ( Departments ), this instance is different than instances exists at application module container, this is new instance.

Ways to make the LOV execute it's query:

1- Get the view object which the LOV created on  (EmployeesView1) then retrieve the LOV view accessor  (DepartmentsView1)  then executes it's query:
ApplicationModuleImpl am = ADFUtils.getAppImpl("AppModule");
ViewObject vo =  am.findViewObject("EmployeesView1");
RowSet lov =(RowSet) vo.getCurrentRow().getAttribute("DepartmentsView1"); lov.executeQuery();
2-From the binding container get the LOV attribute and retrieves it's attached view object  then executes it's query:
BindingContainer bindings = getBindingContainer();
//FacesCtrlListBinding
FacesCtrlLOVBinding lov = (FacesCtrlLOVBinding) bindings.get("DepartmentId");
ViewObject departmentVO = lov.getListIterBinding().getViewObject();
departmentVO .executeQuery();
3- You can execute custom method at applicationModuleImpl as described here:
http://come2adf.blogspot.com/2013/05/create-department-while-creating.html

Friday, August 17, 2018

Configure gmail email to send and receive messages in Oracle SOA Suite

1- 






2- configure SMTP certificate in trust store  by following steps:
  • Retrieve certificate for smtp.gmail.com using OpenSSL
  • Create a text file with only the certificate
  • Load the certificate into the keystore
  • Restart WebLogic Domain
https://technology.amis.nl/2014/08/05/setup-gmail-as-mail-provider-for-soa-suite-12c-configure-smtp-certificate-in-trust-store/

Tuesday, July 17, 2018

Run Quick start installer to create a stand alone osb domain from existing integrated weblogic domain

To run quick start configuration wizard for new domain:
Open cmd and write the following:
set MW_HOME=C:\Oracle\Middleware
cd C:\Oracle\Middleware\osb\common\bin
create_sample_domain.bat

OR

cd oracle_home/Middleware/osb/common/bin
set QS_TEMPLATES= oracle_home/Middleware/osb/common/templates/oracle.osb_template.jar
call "oracle_home/Middleware/osb/common/bin\qs_config.cmd"

Sunday, February 25, 2018

Deploy ADF Application to Oracle Cloud


To deploy your Oracle ADF Application to the Oracle Cloud:

Create Oracle Cloud Account from

https://cloud.oracle.com/en_US/home

 Click on "Try For Free"

Enter a name for "Cloud Oracle  Name" , country , Region and your Email.

An Email will be sent to your Email with login details 

( remember your cloud account name and the temporary password for login )


Login with your Cloud Account Name from here
https://cloud.oracle.com/en_US/sign-in

 click on "My Services" button , then a  new tab is opened

 Enter Your Email Address and the temporary password for login to your services 

Click on the menu navigator then click on "Database" under "Services" to create new database instance.

Click on "Create Instance"

 1.     Choose an instance name then click next (Ex. MASSDATABASE).


Click Edit button beside the "SSH Public Key" field

Choose "create new key" radio button and click "enter" button.

 A new popup appears , click on "Download" button download a zip file that contains a  three files publickey , privatekey and service_credentials.txt .
Note that file "service_credentials.txt" is a text file contains the following line in a plain text format:
Password (to access DBCS): XJFRIFF_VR

fill the remain fields.remember the "administration password" (you will need it to connect to the database)
then click next 


A summary of the instance is shown before starting creating the database instance.

( Remember your PDB name and port number that you will need for connecting to the database.


The available database services appears
( note: The new database instance status is "Creating instance..." ,
The Storage number and public IPS is increased.).

Wait about 25 minutes to be created , meanwhile you can create another service if you need.
 You can see the status of all your services by click on the upper right menu navigator and click on "Platform Services".


You can see from here your database instance status with other different services status , click on the refresh icon to keep track of the new status.


When the "created on" date field shown ,it means that the database creation is done.

Click on the menu navigator beside your new database instance then click "Access Rules" button.

Enable the rule with name: ora_pr_dblistener and ora_p2_dbconsole
( note that the icon is changed after enable ). 


click the link "Oracle Database Cloud Service" to return to database instances page

When the "created on" date field shown means that the database creation is done.
Click on your database instance name which is link to get the connection string


(Remember the "Public IP" field and "Connect String").


Copy the Public IP and the connect string, then open JDeveloper.



Create new connection and click test


Next You will need to create weblogic server cloud  instance (Oracle Java Cloud Instance) to deploy the application to it.

Thursday, February 15, 2018

Exception: Scope object serialization failed (object not serializable)

A common reason for the "SEVERE: ADFc:Scope object serialization failed (object not serializable)" error message is that :
application developers reference JSF components in managed beans with a scope larger than request.

When using the JSF component Binding property to point to a managed bean, think backing bean and thus don't reference beans that are in scopes larger than request scope (so don't: use viewScope, pageFlowSope, sessionScope or applicationScope).
If, from a managed bean in a scope larger than request you need to have access to a component instance (though the other way around is a more common use case) then either
- look up the component on the UIViewRoot.

- resolve an EL reference to a managed bean in request scope that holds the component binding.

This article contains more details and other important subjects :
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/may2012-otn-harvest-1652358.pdf


Saturday, February 10, 2018

google json library to convert from and to json

Google Gson is an open source  java based library developed by Google.
It facilitates serialization of Java objects to JSON and vice versa.

import com.google.gson.Gson;
import java.util.HashMap;
import java.util.Map;
public class FormToGson {
    public FormToGson () {
        super();
    }
    public static void main(String[] args) {
        Map map = new HashMap();
        map.put("Name", "Mahmoud");
        map.put("Job", "DEV");
        Gson gosn = new Gson();
        String paramsJsonString =  gosn.toJson(map);
        System.out.println(paramsJsonString);
       
        HashMap map2 = gosn.fromJson(paramsJsonString, HashMap.class);
        System.out.println(map2.get("Name"));
    }
}
This can be helpful when calling a servlet for example to print a jasper report you will pass only one query parameter that holds the json object as a string from the bean class :
 /Servlet?params=paramsJsonString .

To downlaod the jar:

https://mvnrepository.com/artifact/com.google.code.gson/gson




java - fill distinct objects in ArrayList

If you have a list that contains some objects that it is considered as duplication when two or three fields of these objects are equal. How ...