Skip to content

Instantly share code, notes, and snippets.

View CedricL46's full-sized avatar

Cedric L CedricL46

View GitHub Profile
--Key BPEL Indicator (usefull to build a monitoring system with EM or Kibana, etc)
-- Replace soa_user with your own Oracle SOA Database Schema user
--Indentify bpel errors in the last 10 minutes
select ci.title, ci.ecid, cui.composite_name, cui.composite_revision, ci.created_time,
(SELECT count(1) FROM soa_user.REFERENCE_INSTANCE ri WHERE ri.ecid = ci.ecid and error_message is not null) +
(select count(1) from soa_user.bpel_faults_vw bf where bf.ecid = ci.ecid) as nbfaults
from soa_user.composite_instance ci
inner join soa_user.cube_instance cui on cui.ecid = ci.ecid
where (select count(1) from soa_user.bpel_faults_vw bf where bf.ecid = ci.ecid) !=0
and ci.created_time >= sysdate - 10/(24*60);
/**
* Apply view criteria named MyViewCriteria to it's ViewObject
* by getting it through the binding iterator MyViewObjectIterator
* Full library : https://github.com/CedricL46/Oracle-ADF-and-JSF-Utils-libraries
*/
public void applyViewCriteriaOnViewObjectByIteratorName(String MyViewCriteriaName, String MyViewObjectIteratorName) {
try {
//Get The viewObject from the iterator define in the current binding context
ViewObject vo = this.getViewObjectFromIteratorName(MyViewObjectIteratorName)
//Get all it's ViewCriteria using the ViewCriteriaManager of the ViewObject
/**
* Unapply a view criteria named MyViewCriteria to it's ViewObject
* by getting it through the binding iterator MyViewObjectIterator
* Full library: https://github.com/CedricL46/Oracle-ADF-and-JSF-Utils-libraries
*/
public void UnApplyViewCriteriaOnViewObjectByIteratorName(String MyViewCriteriaName, String MyViewObjectIteratorName) {
try {
//Get The viewObject from the iterator define in the current binding context
ViewObject vo = this.getViewObjectFromIteratorName(MyViewObjectIteratorName)
//Get all it's ViewCriteria using the ViewCriteriaManager of the ViewObject
//Function to call as follow :
//Object myValue = MyBean.getRichTableSelectedRowAttributeValue("tableID", "VoAttributeName");
public Object getRichTableSelectedRowAttributeValue(String tableID, String attributeName) {
Object value = null;
RichTable richTable = (RichTable)findComponentInRoot(tableID); //part of the JSFUtils opensource class
if (richTable != null) {
ViewObject vo = getViewObjectFromTable(richTable); //part of the ADFUtils opensource class
if (vo != null) {
//Get select row from the view object
//Oracle ADF ActionEvent to duplicate a row
public void duplicateRowLine(ActionEvent e) {
ViewObject vo = this.getViewObjectFromIterator("YOUR_ITERATOR_NAME");
Row currentRow = vo.getCurrentRow();
Row duplicatedRow = vo.createRow();
AttributeDef[] voKeyAttributes = vo.getKeyAttributeDefs(); //List of the primary keys that need to be unique
String[] currentRowAttributes = currentRow.getAttributeNames();
for (String attributeName : currentRowAttributes) {
int attributeIndex = duplicatedRow.getAttributeIndexOf(attributeName);
//Check if the attribute is updatable
//Function to call as follow :
//setRichTableSelectedRowAttributeValue("YOUR_TABLE_JSF_ID", "YOUR_VO_ATTRIBUTE_NAME", "THE_NEW_VALUE_TO_SET");
public void setRichTableSelectedRowAttributeValue(String tableID, String attributeName, Object newAttributeValueToSet) {
Object value = null;
RichTable richTable = (RichTable)JSFUtils.findComponentInRoot(tableID);
if (richTable != null) {
RowKeySet rks = richTable.getSelectedRowKeys();
Iterator it = rks.iterator();
while (it.hasNext()) {
//Here is how to simply retreive the value of and ADF Binding from the view El Expression :
//Below is a view example with values taken from an ADF View Object
<af:inputText id="it1" autoSubmit="true" value="#{bindings.YOUR_VO.YOUR_VO_ATTRIBUTE.inputValue}" />
<af:table value="#{bindings.YOUR_VO.collectionModel}" var="row">
<af:column sortProperty="#{bindings.YOUR_VO.hints.YOUR_VO_ATTRIBUTE.name}"
id="c1">
<af:outputText value="#{row.YOUR_VO_ATTRIBUTE}" id="ot1"/>
</af:column>
</af:table>
<!-- use xmlns:f="http://java.sun.com/jsf/core" in the f:view at the top of your jsf file -->
<!-- e.g: <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich" -->
<!-- Here's how to set binding values one a button click - useful when you want to set values right before commiting a user form -->
<af:commandButton text="YOUR_BUTTON" id="bid1" action="#{YOUR_SCOPE.YOUR_BEAN.YOUR_ACTION_FUNC}">
<!-- You can either set a custom value YOUR_VALUE or the value of another binding #{bindings.YOUR_SOURCE_BINDING.inputValue} -->
<!-- or even the value of an attribute of YOUR_BEAN with getter and setter generated-->
<f:setPropertyActionListener value="YOUR_VALUE" target="#{bindings.YOUR_TARGET_BINDING1.inputValue}"/>
<f:setPropertyActionListener value="#{bindings.YOUR_SOURCE_BINDING.inputValue}" target="#{bindings.YOUR_TARGET_BINDING2.inputValue}"/>
<f:setPropertyActionListener value="#{YOUR_SCOPE.YOUR_BEAN.YOUR_ATTRIBUTE}" target="#{bindings.YOUR_TARGET_BINDI
# 1) First step is to sudo as the unix user with weblogic access (replace YOUR_SUDO_USER with yours)
ssh YOUR_USER@YOUR_LINUX_SERVER
sudo su - YOUR_SUDO_USER
# 2) Locate your installed weblogic domain start file
find / -name startManagedWebLogic.sh -type f -print 2>/dev/null
#or if you use mlocate
locate startManagedWebLogic.sh
## After a while this command should print something like :
##/YOUR_SUDO_USER/weblogic/user_projects/domains/YOUR_DOMAIN/bin/startManagedWebLogic.sh
--Audit Trail
-- SQL Query to provide detail audit trail via SQL (useful when a flowtrace can't be open)
-- SQL to get bpel ECID from ID Demande :
select ECID, ID, composite_dn
from soa_user.composite_instance
where title ='&BUSINESS_DEFINED_ID'
order by created_time desc;
--SQL to get detailed status of a bpel instance and his ECID Replace Flowtrace