Friday, March 1, 2024
Oracle ADF: Running Javascript in action listener\Java method
Wednesday, February 21, 2024
Oracle ADF client usage of an Application Module
In this period very often someone ask me how to avoid usage of deprecated API findDataControl used usually in old implementation
MyApplicationModuleImpl am= (MyApplicationModuleImpl) BindingContext.getCurrent().findDataControl("MyApplicationModuleDataControl").getDataProvider();
you can use createRootApplicationModuleHandle as follow (official suggestion)
ApplicationModuleHandle handle =
Configuration.createRootApplicationModuleHandle("mypkg.AppModule", "AppModuleShared");
ApplicationModule sharedAM = handle.useApplicationModule();
...
Configuration.releaseRootApplicationModuleHandle(handle, false);The preferred way to have a business component access is for me the pageDefUsage. Migrating an old application you can have many occurrency of findDataControl to substitute.
I avoid the usage of createRootApplciationModule method because in my experience at runtime in seams to be slow.
Thursday, November 30, 2023
Run integrated weblogic with advanced ADF debug mode
Wednesday, October 18, 2023
ADF JMETER TEST AUTOMATE SAMPLE SETTINGS
Return back to talk about ADF and JMETER
I've added PreProcessor scripts to set request variables and URL parameters of the requests.
Using that template you should only record the test case, and than PreProcessor scripts provides to add variables at every sample of the test at runtime.
into the template there are also a CSV predisposition with 2 variables username and login
PreProcessor script to update request arguments:
import java.util.regex.*;
args = sampler.getArguments();
argCount = args.getArgumentCount();
for(int i=0; i<args.getArgumentCount();i++){
arg = args.getArgument(i);
if(arg.getName().equals("_afrLoop")){
arg.setValue(vars.get("afrLoop"));
}
else if(arg.getName().equals("jsessionid")){
arg.setValue(vars.get("jsessionid"));
}
else if(arg.getName().equals("_adf.ctrl-state")){
arg.setValue(vars.get("adf.ctrl-state"));
}
else if(arg.getName().equals("javax.faces.ViewState")){
arg.setValue(vars.get("javax.faces.ViewState"));
}
else if(arg.getName().equals("unique")){
arg.setValue(vars.get("unique"));
}
else if(arg.getName().equals("Adf-Window-Id")){
arg.setValue(vars.get("afrWindowId"));
}
else if(arg.getName().equals("_afrRedirect")){
arg.setValue(vars.get("afrRedirect"));
}
else if(arg.getName().equals("_afrWindowMode")){
arg.setValue(vars.get("afrWindowMode"));
}
else if(arg.getName().equals("_afrPage")){
arg.setValue(vars.get("afrPage"));
}
}
PreProcessor script to update path variable Adf-Window-Id
import java.util.regex.*;
// La regex per cercare e sostituire il valore di param1
String regex = "Adf-Window-Id=(w[0-9]{2})";
String replacement = "Adf-Window-Id=${afrWindowId}";
String path = ctx.getCurrentSampler().getPath();
//System.out.println("0. "+path);
// Prendi il campione della richiesta HTTP corrente
if (path != null) {
// Prendi la richiesta HTTP corrente
String request = path;
//System.out.println("2. "+request);
// Effettua la sostituzione del valore di Adf-Window-Id
String modifiedRequest = request.replaceAll(regex, replacement);
//System.out.println("3. "+modifiedRequest);
// Aggiorna il corpo della richiesta con la nuova URL
ctx.getCurrentSampler().setPath(modifiedRequest);
// System.out.println("4. "+sampler.getPath());
// System.out.println("5. "+ctx.getCurrentSampler().getPath());
}
Thursday, September 7, 2023
How to create a LOV with null value based on a VO
Create a properties file
- Right click on a folder in the view controller
- Select new and choose "File"
- Name the new file and add the .properties extension
- In this new file, insert an entry with an id and a value, this entry will be the null selectable value in the LOV
Create a variable
- Go to the page definition file and right click the "Variables" in the "Executables" section
- Select "Insert inside variableIterator"
- Select "Variable"
- Set a name and set the type as "java.lang.String"
- Create the binding based on the new created variable
- Select the add in the "Bindings" section
- Select "Attribute Value", set as datasource the "Variables" section
- Select the new created variable and press ok
Create the select one choice based on VO
- In a Jsff fragment, drag and drop an instance of the View Object, select "Single Selection" and then "ADF Select One Choice"
- A window will appears where you can select which attribute to display, select "Ok"
- Remove the validator and the required attribute
- Add the attributes autosubmit="true" and immediate="true"
- Replace the default inputValue with the new created variable
Adjust settings' LOV
- Open the page definition source from the fragment
- After the tag <bindings></bindings> add this code and modify the property "PropertiesFile" with the correct path of the previous created file<ResourceBundle>
<PropertiesBundle xmlns="http://xmlns.oracle.com/adfm/resourcebundle" PropertiesFile="path.properties.file"/> </ResourceBundle> - Select the LOV in the page definition file and in the Properties tab edit the attribute "ListOperMode" to "setAttribute"
- Edit the "NullValueId" attribute. This attribute defines the id that needs to be read in the previous properties file.
- Ediit the "NullValueFlag" attribute to "start". This attribute defines the position of the null value in the LOV.
showRequired="true"
immediate="true"
If no selection was made on the LOV and the user wants to commit, we need to add a warning popup specifing to select a value on the LOV.
This check can be made by checking if the inputValue in the selectOneChoice is not null.