Skip to main content

Posts

Oracle ADF vs JET

Java is the leading language in the industry today, and with Oracle ADF we have a great offering for developer looking to be more productive leveraging Java on the Oracle platform. But there are other languages in the market too, and JavaScript is quickly gaining popularity and by many accounts is the second most popular language today. JavaScript is very popular for front end development of web interfaces. ADF and JET target completely different audiences. Below table clarifies differences between these 2 frameworks.

Overview Editor for bc4j.xcfg

This is used to customize the configuration settings for the application pool, connection pool, and transactions. Select the Application Module, then select a configuration from the Configurations list. You can specify a Default Configuration from the dropdown to use with selected application module. Edit the name of the configuration in Details. Its having 3 tabs 1.Database and Scalability 2. Properties 3. Custom Properties Database and Scalability Tab : In Database and Scalability you can mention the JDBC data source definition for each application module. You can choose to connect to a JDBC data source or to a JDBC URL.The default connection type is the default data source. A data source is a vendor-independent encapsulation of a database server connection on the application server. 1. Data sources ( JNDI name) offer advantages over a JDBC URL connection because the data source can be tuned, reconfigured, or remapped without changing the deployed application. 2. JDB...

Changing integrated weblogic server class path in 12c

To change the class path/modify/add any new jar file to 12.2.1.2 jdeveloper integrated weblogic server follow below steps. 1. Find the oracle_common\common\bin\commExtEnv.cmd file in Orcale Home     (ex  : C:\Oracle\Middleware12c\Oracle_Home_12_2_1_2\oracle_common\common\bin\commExtEnv.cmd) 2. Place your jar file to \wlserver\common\Sample.jar or some location in Oracle Home 3.  Append %MW_HOME%\wlserver\common\Sample.jar; to WEBLOGIC_CLASSPATH variable or the location where you placed your jar file..

ADF Business Components Data Types

ADF Business Components is compatible with the built-in data types the Java language provides, including strings, dates, and numeric data. In addition to these Java data types, the oracle.jbo.domain and oracle.ord.im packages of ADF Business Components provides types that are optimized for the Oracle database.

IN clause in adf view criteria

You can use below programmatic approach to solve this problem.Create a view criteria progarametically and set attribute value as bind variable.                          ViewObjectImpl view = this.getNsSentenceGroupVO();                 ViewCriteria vc = view.createViewCriteria();             vc.setName("INCriteria");             String inClause = "IN "+groupNames;             ViewCriteriaRow criteriaRow = vc.createViewCriteriaRow();             criteriaRow.setAttribute(" GroupName", inClause);             vc.ad...

Get modified rows from Entitiy Cache

To get the modified rows from entity cache we have getEntityState() method at EntityImpl class. Refer to my previous blog  Accessing EO impl methods from VO impl  where i am overriding the getEntityState() in EOimpl and calling it in VOImpl. We can use methods written or overridden in VOImpl class to AMImpl class. There are different states associated with an entity object. STATUS_UNMODIFIED STATUS_MODIFIED STATUS_NEW STATUS_DELETED STATUS_DEAD We have to check the state or row in our AmImpl class by using the VOImpl method and through this we can distinguish the rows present at vo. Add below code in AMImpl class along with my previous post. public void geCachedRowsCount(){         JobsVOImpl jobsVo = (JobsVOImpl)this.getJobsVO();         RowSetIterator iter = jobsVo.createRowSetIterator(null);             while(iter.hasNext()){             Row row = iter....

Accessing EOImpl methods from VOImpl

When you have a requirement to access EOImpl level overridden methods or any custom method from VOImpl follow below steps. 1.Create/Override method in your EOImpl class In above example i have overridden the getEntityState method to print the state of my current entity row. 2. To access this method in VOImpl class Create VOImpl and VORowImpl classes for your view object. See the code written in below VOImpl class to access the EOImpl methods. 3. Now you can expose this method to client tier through VO/AM Client Interface. As per your requirement you can use the client interface and achieve the functionality.

Customize ADF Entity Object

Like most business components, individual entity objects are partially defined by XML files. These files specify: 1. Simple metadata about the datasource, such as the table name and attribute definitions and 2. Simple business logic, such as the business logic that represents most column constraints and simple validation and security logic. In addition to XML files, entity object definitions comprise up to three Java classes: a) The entity object class - an instance of this class (an entity object instance) represents a single row from the datasource ( oracle.jbo.server.EntityImpl ) b) The entity collection class - an instance of this class represents the collection of rows currently in memory for a single user( oracle.jbo.server.EntityCache ) c) The entity definition class - the singleton instance of this class represents the entire datasource object( oracle.jbo.server.EntityDefImpl ) To access an entity row, you use a related object called the entity definition. At run...

Localization/Internationalization in oracle adf

Internationalization and Localization are means of adapting aplication to different languages, regional differences and technical requirements of a target market. Internationalization is the process of designing a software application so that it can potentially be adapted to various languages and regions without engineering changes. Localization is the process of adapting internationalized software for aspecific region or language by adding locale-specific components and translating text. Follow below steps for doing localization. 1. Create .properties files as per the locales required in your application. For demo purpose i created german and english locale properties file, one main file is required which will congtain all labelsSo total 3 properties files are there. For property file creation ViewController->New->General->File InterBundle.properties file is the main properties file and for the same labels 2 different files are created one is for english and a...

ADF Servlet Filter

This blog is to guide you how you can filter the requests and add your custom checks in ADF application. Follow below steps to create/configure a Servlet Filter in your ADF/Webcenter application. 1. From new wizard select Servlet and select Servlet Filter 2. Click on next 3. Enter the name of Servlet filter and package 4. Map to Servlet or JSP radio button should be selected and it is default selection. 5. Click on finish and you will get a servlet filter created. This is the class generated after you click finish, it is having init, destroy and doFilter methods.  We will write our logic in doFilter method. This will be called whenever a Servlet or jsp page request arrive to application.    As we created servlet filter with ADF steps so it has added our filter entry in web.xml file which is a mandate to work our filter.  We can create other filters also but we must register it in web.xml file. W...

Read data from ADF property file using java

package propertyfile; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; public class ReadPropertyFile {     public ReadPropertyFile() {         super();     }       public static void main(String args []){         try {             File file = new File("/opt/oracle/urls/test.properties");             FileInputStream fileInputStream = new FileInputStream(file);             ResourceBundle bundle =new PropertyResourceBundle(fileInputStream);             String appURL = bundle.getString("googleRedirectURL");             System.out.println(appURL);             fileInputStream.clo...

Java Design Patterns

Introduction : Design patterns represent the best practices used by experienced object-oriented software developers. Design patterns are solutions to general problems that software developers faced during software development. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. These solutions were obtained by trial and error by numerous software developers over quite a substantial period of time. In 1994, four authors Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides published a book titled Design Patterns - Elements of Reusable Object-Oriented Software which initiated the concept of Design Pattern in Software development.These authors are collectively known as Gang of Four (GOF). As per the design pattern reference book Design Patterns - Elements of Reusable Object-Oriented Software, there are 23 design patterns which can be ...

Deployment - Session-Descriptor Parameters

Below list of will help you to configure cookies and do session related settings. You can do these settings at application or server level. 1. timeout-secs Sets the time, in seconds, that WebLogic Server waits before timing out a session. The default value is 3600 seconds. On busy sites, you can tune your application by adjusting the timeout of sessions. While you want to give a browser client every opportunity to finish a session, you do not want to tie up the server needlessly if the user has left the site or otherwise abandoned the session. This element can be overridden by the session-timeout element (defined in minutes) in web.xml. 2. invalidation-interval-secs Sets the time, in seconds, that WebLogic Server waits between doing house-cleaning checks for timed-out and invalid sessions, and deleting the old sessions and freeing up memory. Use this element to tune WebLogic Server for best performance on high traffic sites. The default value is 60 seconds. 3. sharing-ena...

ADF Faces configuration

ADF Faces configuration options are defined in the web.xml file using <context-param> elements. STATE_SAVING_METHOD : The JSF parameter javax.faces.STATE_SAVING_METHOD identifies where the state of the view is stored between requests.  By default, the state is saved in the servlet session. Set the STATE_SAVING_METHOD parameter to client in the context-param stanza of the web.xml file, so that JSF stores the state of the entire view in a hidden field on the rendered page. If you do not, then JSF may attempt to cache that state,  which is not serializable, in the session object. <context-param>     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>     <param-value>client</param-value> </context-param> CLIENT_STATE_METHOD  :  org.apache.myfaces.trinidad.CLIENT_STATE_METHOD specifies the type of client-side state saving to use when client-side state saving is enabled by using javax.fa...

ADF Deployment - Security settings

To Avoid the Cross-Site Request Forgery (CSRF) attack in your application, make below settings in web.xml file. <!--Enable client-side state saving, to store the view state on the browser client.--> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <!--- Specifies the type of client-side state saving to use when client-side state saving is enabled by using javax.faces.STATE_SAVING_METHOD-->  <context-param> <param-name>org.apache.myfaces.trinidad.CLIENT_STATE_METHOD</param-name> <param-value>token</param-value> </context-param> <!--Defined to specify context parameter to use framebusting in your application--> <context-param> <param-name>org.apache.myfaces.trinidad.security.FRAME_BUSTING</param-name> <param-value>differentDomain</param-value> </context-p...

LinkedList in Java

/* LinkedList is a linked list implementation of the List interface.  * Implements all optional list operations, and permits all elements (including null).  * In addition to implementing the List interface, the LinkedList class provides uniformly named methods to get,  * remove and insert an element at the beginning and end of the list.  * These operations allow linked lists to be used as a stack, queue, or double-ended queue.  */ package collection.list; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; public class LinkedListDemo {     public LinkedListDemo() {         super();     }         public static void main(String[] args){ /* Linked list simple example  * LinkedList of type String */         simpleLinkedList(); /* LinkedList emaple with Employee class objects  * with sorting, it...

Vector in Java

/* The Vector class implements a growable array of objects.  * Like an array, it contains components that can be accessed using an integer index.  * However, the size of a Vector can grow or shrink as needed to accommodate adding and removing items after the Vector has been created.  */ package collection.list; import java.util.Collection; import java.util.Collections; import java.util.Vector; public class VectorDemo {     public VectorDemo() {         super();     }         public static void main(String []Args){ /*  * vector containing Integers  */         simpleVector(); /*  * vector containing objects of class Student  */        Vector<Student> students=vectorOfStudents();           }         public static void simpleVector(){         Vector<Integ...

ArrayList in java

/*  * Java ArrayList class uses a dynamic array for storing the elements.It extends AbstractList class and implements List interface.  * Can contain duplicate elements.  * Maintains insertion order.  * Non synchronized.  * Allows random access because array works at the index basis.  * Manipulation is slow because a lot of shifting needs to be occurred if any element is removed from the array list. */ package collection.list; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; public class ArrayListDemo {     public ArrayListDemo() {         super();     }         public static void main(String args []){         /*  * creating old non-generic arraylist  */         ArrayList al=new ArrayList();         /*  * ArrayList with normal data or obje...

List interface in java

List Interface : A List interface is about the index . The one thing that List has that non-lists don't have is a set of methods related to the index. Those key methods are like get(int index), indexOf(Object o), add(int index, Object obj), and so on. All three List implementations are ordered by index position. position that you determine either by setting an object at a specific index or by adding it without specifying position.The three List implementations are.      ArrayList      Vector      LinkedList Some key points about these implementation classes are Refer below links for above classes examples. 1.  Array List implementation 2.  Vector Implementation 3.  LinkedList Implementation

Session Timeout

HTTP is a stateless protocol, the server receives no implicit notice that a client has closed his browser or it is idle. Therefore any Java EE-compliant server provides a standard, configurable session timeout mechanism to allow resources tied to the HTTP session to be freed when the user has stopped performing requests. We have to timeout mechanisams. 1. Implicit Timeout Due to User Inactivity and 2. Explicit HttpSession Timeout 1. Configure the Implicit Timeout Due to User Inactivity : You configure the session timeout threshold using the session-timeout tag in the web.xml file. The default value is 35 minutes. When the HttpSession times out the BindingContext goes out of scope, and along with it, any data controls that might have referenced application modules released to the pool in the managed state level. The application module pool resets any of these referenced application modules and marks the instances unreferenced again. 2. Explicit HttpSession Timeout  : T...