Wednesday, 1 April 2015

Reusable process in Oracle BPM

In this post I just want to jot down my findings about the reusable processes in oracle BPM.

  • Reusable Process starts with a None start event.
  • And there won't be initiator after that.
  • If any initiator node is added, or the start event is changed, this no longer becomes a reusable process.
  • A Reusable Process can be called from a 'Call' Activity
  • Most importantly the execution data will be carry forwarded from the calling process to the reusable process.
    • Means the attachments, user comments that are added in the calling process will be available in the reusable process.




In the above sample processes, the first process will the second reusable process using the call activity.
Whatever the documents uploaded or comments entered in the first human task in the first process will be available for the first human task in the second process. So it is like only one process is getting executed with respect to the execution data.

Monday, 30 March 2015

Using for loop in XSL

By default xsl supports the for-each functionality which will iterate over the number of elements in source xml.
But what if we need something like for loop in normal programming language??
like for (int i=0;i<10 ;i++)

Solution:
We can achieve the above requirement with the help of callable template as described below,


 <xsl:template name="party">
    <xsl:param name="count"/>
    <xsl:param name="xml"/>

    <xsl:if test=" $count > 0">
            <name>
                  <xsl:value-of select="$xml/name"/>
          </name>
     </xsl:if>     
      <xsl:call-template name="party">
            <xsl:with-param name="count" select="$count - 1"/>
            <xsl:with-param name="xml" select="/"/>
        </xsl:call-template>  
  </xsl:template>          
       
   
Call the above template like this,

        <xsl:call-template name="party">
            <xsl:with-param name="count" select="6"/>
            <xsl:with-param name="xml" select="/"/>
        </xsl:call-template>           
                   
 
Above code creates the tag six times.

In this you can see how to access the source xml in the templates.
As you will not have direct access to the source xml in the callable template we need to pass it as parameter and use in the template.

Thursday, 27 November 2014

Service Bus 12c deployment issue: MalformedURLException

This is the first error that i had encountered when i started working with oracle service bus 12c.











The resolution is,


  • Open weblogic admin console and go to Services --> OSGi Frameworks
  • Select bac-svnserver-osgi-framework








  • Enter felix.service.urlhandlers=false in the init properties.


















  • Save the changes and restart the server. The above error should be resolved.



Wednesday, 19 November 2014

Correlation in oracle BPM 12c (with initiator task)

Using correlation with initiator task in oracle BPM 12c (or in 11g). i. e.., if your requirement is something like you have an initiator task where the process will be kick started and at some point in the process you are using a catch message event waiting for an external system to invoke this and resume the process with the help of correlation.

And surprisingly the correlation didn't work for me.

So I had used and alternative which solved my problem. I moved the catch message event to another process with message start event and called that process from this main process. 

PS: Its a temporary work around that I followed(and worked for my scenario) which might have other issues like timeout for service call etc.

Tuesday, 4 November 2014

IP address issue for VM in Oracle virtual box

The issue that i used to face whenever I import a VM into oracle virtual box and start it is no IP (the VM will not be assigned with any IP, I normally want to access the VM from my laptop or some other machine).
Here are the steps i followed to resolve this,


  1. The network adapter in the settings for the VM should be Bridged adapter (this we will always do it, i am just mentioning just not to miss anything)
  2. Go to the VM and open a terminal(mine is a linux VM).
  3. Open the network setting by running "system-config-network" command.
  4. Select Device Configuration
  5. Select eth0 and Activate it.
  6. Once activated, click on save, save&quit buttons.
  7. From the command prompt run following commands,
  8. ifdown eth0
  9. ifup eth0
  10. ifconfig will give the new IP for the VM.

Monday, 20 October 2014

Trusting certficates on the fly in java

   Below is the code snippet which helps you in trusting the https certificates on the fly in jave program,


 public Response trustCertificate(HttpsURLConnection conn,Method method,String body){
        Response response = new Response();
        try {
            // Create a trust manager that does not validate certificate chains
            final TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
                @Override
                public void checkClientTrusted( final X509Certificate[] chain, final String authType ) {
                }
                @Override
                public void checkServerTrusted( final X509Certificate[] chain, final String authType ) {
                }
                @Override
                public X509Certificate[] getAcceptedIssuers() {
                    return null;
                }
            } };
            // Install the all-trusting trust manager
            final SSLContext sslContext = SSLContext.getInstance( "SSL" );
            //sslContext.init( null, trustAllCerts, new java.security.SecureRandom() );
            // Create an ssl socket factory with our all-trusting manager
            final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
            // Tell the url connection object to use our socket factory which bypasses security checks
            ( (HttpsURLConnection) conn ).setSSLSocketFactory( sslSocketFactory );
            if(Method.PUT.equals(method) || Method.POST.equals(method)){
                conn.setDoOutput(true);
                final OutputStream os = conn.getOutputStream();
                os.write(body.getBytes());
                os.flush();
                os.close();
            }
           
           
            final InputStream input = conn.getInputStream();
            BufferedReader rd = new BufferedReader(new InputStreamReader( input));

            String line;
            while ((line = rd.readLine()) != null)
            {
                response.body += line;
            }              
            rd.close();

            response.statusCode = conn.getResponseCode();
            conn.disconnect();
           
        } catch ( final Exception e ) {
            e.printStackTrace();
            response.exception = e.getMessage();
        }
        return response;
    }

Disabling auto build on save in Jdeveloper 12c

In Jdeveloper 12c (installed through SOA quick start or BPM quick start), whenever you save a file in your project it initiates the auto build and jdev gets a bit slower and shows some erros (obviously, because you any may not actually want to build).

So here is the setting where you can disable auto build on save in jdveloper,

  • Go to Tools --> Preferences

  • Go to Code Editor --> Save Actions, And remove Build Projects After Save and click OK.