I needed to get some information contained in the selected row of an ADF Tree component.
/* START PRESERVE DEFAULT ADF SELECT BEHAVIOR
* Courtesy of Frank Nimphius - https://blogs.oracle.com/jdevotnharvest/entry/how_to_read_data_from */
FacesContext fctx = FacesContext.getCurrentInstance();
Application application = fctx.getApplication();
ELContext elCtx = fctx.getELContext();
ExpressionFactory exprFactory = application.getExpressionFactory();
MethodExpression me = null;
me = exprFactory.createMethodExpression(elCtx, adfSelectionListener, Object.class, new Class[] {SelectionEvent.class});
me.invoke(elCtx, new Object[] { selectionEvent });
/* END PRESERVE DEFAULT ADF SELECT BEHAVIOR */
RichTree tree = (RichTree)selectionEvent.getSource();
TreeModel model = (TreeModel)tree.getValue();
// get selected nodes
RowKeySet rowKeySet = selectionEvent.getAddedSet();
Iterator rksIterator = rowKeySet.iterator();
while (rksIterator.hasNext()) {
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
CollectionModel collectionModel = (CollectionModel)tree.getValue();
treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();
JUCtrlHierNodeBinding nodeBinding = null;
nodeBinding = treeBinding.findNodeByKeyPath(key);
Row row = nodeBinding.getRow();
// Get the LexisAccountNumber and enable the delete image link
String value = row.getAttribute("someAttribute").toString();
}
Friday, May 1, 2015
Wednesday, April 29, 2015
Invoke ADF Data Control Operation via Bindings Layer
Assumptions:
- You have created a data control.
- You have created a methodAction binding for the respective operation on a page.
import oracle.binding.AttributeBinding;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
import oracle.adf.model.BindingContext;
public class BindingsExample{
public BindingsExample(){
super();
}
public void invokeOperation() {
// get a handle on the bindingContainerBindingContainer
bindingContainer = BindingContext.getCurrent().getCurrentBindingsEntry();
// get a handle on the operation you want to invoke
OperationBinding operationBinding = bindingContainer.getOperationBinding("yourOperation");
// get a handle on an attribute that is bound to some component on a page
AttributeBinding yourAttr = (AttributeBinding)bindingContainer.getControlBinding("yourComponentBinding");
// put the value of the attribute in an operationBinding map
operationBinding.getParamsMap().put("yourKey", yourAttr.getInputValue().toString();
// invoke your operation
operationBinding.execute();
// check for any exceptions
if (!operationBinding.getErrors().isEmpty()) {
// handle exceptions accordingly
}
}
}
If you're dealing with complex types in the WSDL, you can update the request using the DCBindingIterator.
// cast your bindingContainer to a DCBindingContainer
DCBindingContainer dcBindingContainer = (DCBindingContainer)bindingContainer;
// get the data control iterator
DCIteratorBinding dcIteratorBinding = dcBindingContainer.findIteratorBinding("yourIterator");
// update the row with the value of an attribute bound to a page
Row row = dcIteratorBinding.getCurrentRow();
String value = yourAttr.getInputValue().toString();
row.setAttribute("DateTime", value);
References:
http://biemond.blogspot.com/2009/03/some-handy-code-for-backing-beans-adf.html
http://steve-hawes.blogspot.com/2011/11/invoking-web-service-from-adf-managed.html
Thursday, February 26, 2015
JDeveloper Cannot Establish Connection or Local Host Not Known When Connecting to Application Server
I updated to OS X Yosemite recently. After which, I experienced some issues with JDeveloper when trying to create a connection to an Application Server. I observed the following exceptions:
Testing JSR-160 Runtime ... failed.
Cannot establish connection.
Testing JSR-160 DomainRuntime ... skipped.
Testing JSR-88 ... skipped.
Testing JSR-88-LOCAL ... skipped.
Testing JNDI ... skipped.
Testing JSR-160 Edit ... skipped.
Testing HTTP ... success.
Testing Server MBeans Model ... skipped.
Testing HTTP Authentication ... success.
and
Testing JSR-160 Runtime ... failed.
Local host not known?!
Testing JSR-160 DomainRuntime ... skipped.
Testing JSR-88 ... skipped.
Testing JSR-88-LOCAL ... skipped.
Testing JNDI ... skipped.
Testing JSR-160 Edit ... skipped.
Testing HTTP ... success.
Testing Server MBeans Model ... skipped.
Testing HTTP Authentication ... success.
I went into OS X System Preferences and set my Computer Name to something other than MacBook Pro. I also clicked the Edit button there and set my Local Hostname: to the same value.
Also, check your /etc/hosts file for the proper alias, e.g. hostname.local
I had no more issue with JDeveloper connecting to an Application Server.
Testing JSR-160 Runtime ... failed.
Cannot establish connection.
Testing JSR-160 DomainRuntime ... skipped.
Testing JSR-88 ... skipped.
Testing JSR-88-LOCAL ... skipped.
Testing JNDI ... skipped.
Testing JSR-160 Edit ... skipped.
Testing HTTP ... success.
Testing Server MBeans Model ... skipped.
Testing HTTP Authentication ... success.
and
Testing JSR-160 Runtime ... failed.
Local host not known?!
Testing JSR-160 DomainRuntime ... skipped.
Testing JSR-88 ... skipped.
Testing JSR-88-LOCAL ... skipped.
Testing JNDI ... skipped.
Testing JSR-160 Edit ... skipped.
Testing HTTP ... success.
Testing Server MBeans Model ... skipped.
Testing HTTP Authentication ... success.
I went into OS X System Preferences and set my Computer Name to something other than MacBook Pro. I also clicked the Edit button there and set my Local Hostname: to the same value.
Also, check your /etc/hosts file for the proper alias, e.g. hostname.local
I had no more issue with JDeveloper connecting to an Application Server.
Tuesday, February 10, 2015
RCU-6016:The specified prefix already exists
I was running RCU via command line as part of a silent installation, and the script threw an exception while doing it's thing. I reran RCU via command line to drop the repository; however, it too threw an exception. So, I connected to the DB and removed the schemas manually. When RCU was executed again to create the schemas, another exception was thrown:
RCU-6016:The specified prefix already exists.
RCU-6091:Component name/schema prefix validation failed.
I reconnected to the database and manually created the schemas that RCU creates automatically. I was then able to successfully run RCU to drop and recreate the schemas.
As a side note, some RCU components create additional schemas that are not advertised. Case in point, the IAU component creates the following schemas:
${prefix}_IAU
${prefix}_IAU_APPEND
${prefix}_IAU_VIEWER
RCU-6016:The specified prefix already exists.
RCU-6091:Component name/schema prefix validation failed.
I reconnected to the database and manually created the schemas that RCU creates automatically. I was then able to successfully run RCU to drop and recreate the schemas.
As a side note, some RCU components create additional schemas that are not advertised. Case in point, the IAU component creates the following schemas:
${prefix}_IAU
${prefix}_IAU_APPEND
${prefix}_IAU_VIEWER
Friday, February 6, 2015
Linux sed Replace with Environment Variable Containing Path
I had a use case to construct a bash script to search a configuration file and replace a string with a path. This path was stored as an environment variable.
PATH=/some/path
export PATH
My original sed command looked like this:
sed -i "s/findThis/$PATH/g" someFile.cfg
Execution of the script kept throwing the following exception:
PATH=/some/path
export PATH
My original sed command looked like this:
sed -i "s/findThis/$PATH/g" someFile.cfg
Execution of the script kept throwing the following exception:
sed: -e expression #1, char 33: unknown option to `s'
After some trial and error, I discovered that the issue was related to the file separators (/) in the value of PATH. Instead of using a '/' as the separator for sed, use a pipe '|'.
sed -i "s|findThis|$PATH|g" someFile.cfg
Monday, January 26, 2015
Property “Name” of Server with original name “_sample” is invalid. The property value is duplicated.
I was writing some scripts using WebLogic Scripting Tool (WLST) to automagically create a domain, and I experienced this exception in the dumpStack():
Property "Name" of Server with original name "_sample" is invalid. The property value is duplicated.
You may experience this error when you attempt to create a managed server that already exists, especially if you have read an existing template.
In my case, I was building an Oracle Access Manager (OAM) domain and referenced the oracle.oam_ds_11.1.2.0.0_template.jar template. This template defines a managed server, "oam_server1". In my logic, I was trying to create a managed server with the same name, thus the exception was being thrown.
As a workaround, you can do the following:
Property "Name" of Server with original name "_sample" is invalid. The property value is duplicated.
You may experience this error when you attempt to create a managed server that already exists, especially if you have read an existing template.
In my case, I was building an Oracle Access Manager (OAM) domain and referenced the oracle.oam_ds_11.1.2.0.0_template.jar template. This template defines a managed server, "oam_server1". In my logic, I was trying to create a managed server with the same name, thus the exception was being thrown.
As a workaround, you can do the following:
- In your script logic, reference the pre-existing managed server and manipulate it,
- Name your new managed server something else, or
- Remove the reference to whatever domain template you may be using.
Tuesday, September 16, 2014
Deploy custom JARs or Classes to Oracle SOA for BPEL consumption
Need to include custom JARs or classes in Weblogic so that your BPEL process can consume them?
Add JARs to oracle.soa.ext.jar Manifest
Navigate to $ORACLE_HOME/soa/modules/oracle.soa.ext_11.1.
Place any requisite JARs in this directory. You may also place custom classes in the /classes directory.
SOA comes with a version of Ant in $MW_HOME/modules/org.apache.ant_1.7.1; however, when you run the build.xml file in this directory, the build will fail.
In order to correct the problem, download ant-contrib and place it in your $MW_HOME/modules/org.apache.ant_1.7.1/lib directory. Then, edit the build.xml file placing the following node just below the <project> node.
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
Ant will rebuild the manifest included in oracle.soa.ext.jar.
Add JARs to BpelClasspath
Login to the SOA domain Enterprise Manager console.
From the SOA Infrastructure menu, select SOA Administration > BPEL Properties.
At the bottom of the BPEL Service Engine Properties page, click More BPEL Configuration Properties.
Click BpelClasspath.
In the Value field, specify the class path - $ORACLE_HOME/soa/modules/oracle.soa.ext_11.1/*
For example, /u01/app/oracle/middleware/soa/modules/oracle.soa.ext_11.1/*
Click Apply.
Click Return.
In addition, ensure that the JARs are loaded by the SOA composite application.
Redeploy your application.
Lastly, restart your SOA managed server.
References
Subscribe to:
Posts (Atom)