Tuesday, January 30, 2018

How to identify the correct JDeveloper version for your JCS / PaaS

Working in JCS / PaaS, many times we would be in cross roads as to which JDeveloper version needs to be picked up for the development.

I was recently made aware of the perils of choosing the wrong JDev version by my teammates, before which I slightly turned a blind eye on what might become a grave mistake.

However it is always recommented to verify the version from the JCS itself, before proceeding to downloading the appropriate JDeveloper.

Simply login into your JCS console ( i.e, Weblogic console ) and verify the version at the bottom left corner.



Also to check if your JDev is at the correct version level. Check the version from Help --> About.





Though this seems to be a trivial matter, if advanced version Jdev ( more than current JCS version ) is used to develop an application, it can never be downgraded to a lower version.
This would mean a complete re-work of the application in a lower version JDev.

Thanks for reading,
Srikanth

Friday, January 19, 2018

"To JET or not to JET !! " : How to choose between ADF and JET

In the beginning of a Oracle based/ scoped Web project we have to take a decision whether to go the conventional ADF path or tread the now trending JET path.

Many a times we get lured by the latest cutting edge technologies and incline towards that. However I would like to share my learnings in this scenario.

I feel JET is more apt choice :

a. If the application is accessed from mobile devices ( responsive applications ).

b. If it is not a very data intensive application. We can tap the full power of JET if user acts on limited set of data. That is the data is already fetched and the data is manipulated in the ViewModel layer.

c. If application uses third party Javascript libraries. Ex: cordova plugins, Camera feature, QR code scanning etc

d. The Oracle JET community is very proactive and we can expect help whenever we are in an issue.


I feel JET is not a appropriate in below scenarios : 

a. If the UI needs to show data from multiple sources. In such cases we need to go with Master-Detail screens, Cascading LOVs. 
                This becomes timetaking specially when all the sections are based on different sources ( Ex: REST services ) and the onus is on developer to handle the dependencies, filtering, sorting, searching. etc. I wish if JET could also come up with the 

b. If we need Search region, Advance search region, table level filtering, table level sorting etc there needs to be extensive coding to be done. If the project timelines provide enough bandwidth then this additional task can be compensated.

c. Even though there are a vast number of  JET Visualizations are available in JET, to feed these components with the data in appropriate format, it needs lot of data massaging which means more time obviously.

d. If the OAuth needs to be implemented more time needs to be pumped in, as it is different from SSO or weblogic based authentication.



        Finally as ADF is around for a long long time, all the features are matured enough and in a tight time lined project this allways proves to be a better choice.
Given the extensive documentation, Blogs and Support we are not stuck at particular issue.

Though I have shared my experiences, it is upto the requirement of the project and ofcourse the client preferences !! :)

Thanks for reading,
Srikanth




Thursday, January 11, 2018

Oracle JET : How to populate a Combobox from a REST service

We can statically populate a combobox in the HTML as shown in the cook book :

 <oj-combobox-one id="combobox" value="{{val}}"
            style="max-width:20em">
            <oj-option value="Internet Explorer">Internet Explorer</oj-option>
            <oj-option value="Firefox">Firefox</oj-option>
            <oj-option value="Chrome">Chrome</oj-option>
            <oj-option value="Opera">Opera</oj-option>
            <oj-option value="Safari">Safari</oj-option>
          </oj-combobox-one>

However if the option list is long and if we would want to source it from a REST service.

Please note that I would not confirm this is the best way to fetch, however this worked for me and performance wise also its not bad.

To do this we would need to create a new helper javascript file apart from the JET component ( .html and .js )

A. Lets say we want to populate the Colours LOV. Create a new .js viewModel as below :
     Write the code to fetch from Colours REST url. The main method is the fetch() method highlighted in yellow : 


define(['ojs/ojcore', 'knockout', 'ojs/ojmodel', 'ojs/ojtable','ojs/ojcollectiontabledatasource',
        'jquery', 'ojs/ojbutton', 'ojs/ojinputtext'], function (oj, ko) {

    function coloursLOVHelperViewModule() {
        var self = this;
        
         self.urlcoloursLOVURL = ko.observable("YOUR URL ") ;

        self.coloursArray = ko.observableArray([]);
        self.ColoursLOVCol = ko.observable();
        self.ColoursLOVDataSource = ko.observable();
        
        self.fetch = function(successCallBack) {
                        // populate the collection by calling fetch()
                        self.ColoursLOVCol().fetch({
                        success: successCallBack,
                        error: function(jqXHR, textStatus, errorThrown){
                        console.log('WorkRequestIDHelper : Error in fetch: ' + textStatus);
                        }
                        });
                        };
        
        
        // Colours LOV
        parseColour = function (response) {
            if (response['items']) {
            var innerResponse = response['items'][0];
           
                    return {ColourId: innerResponse['ColourId'],
                            ColourName: innerResponse['ColourName']
                            };
            }            
            return {
                    ColourId: response['ColourId'],
                    ColourName: response['ColourName']
                  };
        };
        
         var ColourLOVModel  = oj.Model.extend({
                urlRoot: self.urlColoursLOVURL() , // urlWorkRequests,
                parse: parseColour,
                idAttribute: "ColourId"
            });     
        
         var myColourLOVModel = new ColourLOVModel();
            
         var collectionColoursLov = oj.Collection.extend({
                    url: self.urlColoursLOVURL(),
                    //fetchSize: -1,
                    model: myColourLOVModel
                });
                
         
         self.ColoursLOVCol(new collectionColoursLov());
         self.ColoursLOVDataSource(new oj.CollectionTableDataSource(self.ColoursLOVCol()));
}
    return new coloursLOVHelperViewModule();
});


B. Import the above .js in our main viewModel .js file :

define(['ojs/ojcore', 'knockout', 'viewModels/common/coloursLOVHelper',...)
], function (oj, ko, colourLOV )...........

C. Call the fetch method as below :

        self.colorsArray= ko.observableArray([]); 
       colourLOV.fetch(
                                function(collection, response, options)
                                    {
                                                                             
                                        if(self.colorsArray.length == 0) 
                                        {
                                            for (var i = 0; i < collection.size(); i++) 
                                            {
                                                var coloursModel = collection.at(i);
                                                self.colorsArray.push({value: coloursModel.attributes.colorId, label: coloursModel.attributes.colourName});
                                            }
                                        }
                                    }
                             )

D. Now in the main html page use the above populated array variable :

    <oj-combobox-one id="coloursCombobox" options="[[colorsArray]]" value="{{colorsSelectedValue}}" 

Hope this helps.
Srikanth

Fusion BIP : How to show one parameter in report and pass different value to the datamodel

Hi All, There can be a scenario where we might need to show one value in the report and a different value to the actual query. Lets say a...