Thursday, February 27, 2014

How to make run time customizations to the webcenter portal application?

Inorder to make the run time customizations, we need to login to the webcenter portal administration console.

We can open the console from the following link

http://hostname:port/Application-Context-Root/admin

For example: http://localhost:7101/PracticeWebcenterOne-Portal-context-root/admin




All the actions that can be performed in the admin console is coming up in the next post.

Wednesday, February 26, 2014

java.lang.IllegalStateException: The expression "#{bindings}" evaluates to "null" exception

Sometimes when using the Webcenter out of the box taskflows, we might drag and drop the them from the resource palette either to page template or page. But when running the page might result in the following error

java.lang.IllegalStateException: The expression "#{bindings.pagemenudefinition1.regionModel}"
(that was specified for the RegionModel "value" attribute of the
region component with id "pt_r2") evaluated to null.
This is typically due to an error in the configuration
of the objects referenced by this expression. If it helps,
the expression "#{bindings.pagemenudefinition1}" evaluates to "null"
If it helps, the expression "#{bindings}" evaluates to "null".
Now using an empty RegionModel instead.




Solution

The reason is that the pagedef doesn't have a reference to the taskflow. or the bindings does not have the reference. Open the page source, you will find the bindings warning as below




Add the page reference binding as below


 Or edit the page def source code as below


Monday, February 24, 2014

Iterate through all the pages using Navigation Context in webcenter portal

Sometimes we might need to iterate through all the pages in the custom or default navigation model in the webcenter portal. For example in order to create the custom header in the portal template etc..

The following code will iterate through all the pages in the navigation context.

<af:forEach var="node" varStatus="vs"
items="#{navigationContext.defaultNavigationModel.listModel['startNode=/, includeStartNode=false']}">
<af:commandLink id="pt_cl1" text="#{node.title}"
actionListener="#{navigationContext.processAction}"
 <f:attribute name="node" value="#{node}"/>
 <af:showPopupBehavior popupId="menuPopup"
align="afterStart"
triggerType="mouseOver"/>
</af:commandLink>
</af:forEach>


In the items section mention the navigation model to be iterated and the startNode specifies the path from root node where the iteration should start.

Friday, October 11, 2013

How to preserve the user session data during activation and passivation of application module in Oracle ADF?

User session specific information, like a queried user name or account data, can be saved in the Oracle ADF Business Components session using a call to getUserData() that returns a java.util.HashMap as a data store.

The user data map can be accessed from Java can be obtained from the user session using the below method call

getDBTransaction().getSession().getUserData()

However, the user specific information in the userData HashMap is not persisted by default when activation / passivation occurs for application modules that have Application Module pooling enabled, which means that custom session data may be lost between requests.

What we need to to is to passivate the session user data together with the other state data stored by the framework and load it back when the AM is requested the next time (when it gets activated again). To do this we have to overwrite the following two methods in the AMImpl class of ADF application module.

@Override protected void activateState(Element aElement) { super.activateState(aElement); if (true) { Hashtable lData = getSession().getUserData(); if (aElement != null) { // 1. Search the element for any <PrivData> elements NodeList nl = aElement.getElementsByTagName(PRIVATEDATA); if (nl != null) { // 2. If any found, loop over the nodes found for (int i = 0, length = nl.getLength(); i < length; i++) { // 3. Get first child node of the <PrivData> element Node child = nl.item(i).getFirstChild(); if (child != null) { // 4. Set the data value to the user data hashmap String lDataString = child.getNodeValue(); String[] lSplitkeyval = lDataString.split(";"); for (int ii = 0; ii < lSplitkeyval.length; ii++) { mLogger.fine("..." + lSplitkeyval[ii]); String[] lSplit = lSplitkeyval[ii].split("="); lData.put(lSplit[0], lSplit[1]); } break; } } } } } }

@Override
protected void passivateState(Document aDocument, Element aElement) {
super.passivateState(aDocument, aElement); if (true) { // 1. Retrieve the value of the user data to save and build a string representation Session lSession = getSession(); Hashtable lData = lSession.getUserData(); String lDataString = ""; Set<String> keyset = lData.keySet(); if (!keyset.isEmpty()) { Iterator<String> keys = keyset.iterator(); while (keys.hasNext()) { String key = keys.next(); mLogger.fine("..." + key + "=" + lData.get(key)); lDataString += key + "=" + lData.get(key) + ";"; } } // 2. Create an XML element to contain the value Node node = aDocument.createElement(PRIVATEDATA); // 3. Create an XML text node to represent the value Node cNode = aDocument.createTextNode(lDataString); // 4. Append the text node as a child of the element node.appendChild(cNode); // 5. Append the element to the parent element passed in aElement.appendChild(node); } }

Tuesday, October 1, 2013

How to call the valueChangeListener of af:inputText from the java script in Oracle ADF?

Step1

Let us say our value change listener is as follows

import javax.faces.context.FacesContext;
import javax.faces.application.FacesMessage;

public void onChangeCompanyName(ValueChangeEvent valueChangeEvent) {
    FacesMessage msg = new FacesMessage("In the value change listener of company");
    FacesContext context = FacesContext.getCurrentInstance();
    context.addMessage(null, msg);
}


Step2

Our javascript should be

function callValueChangeEvent(evt) {
      //Method to get component using id (here inputText)
      var field = AdfPage.PAGE.findComponentByAbsoluteId('it1');

      //Change(set) field's value
      field.setValue('I am JavaScript text');

      //Get New changed value
      var newVal = field.getValue();

      //Queue ValueChangeEvent (component,oldValue,newValue,autoSubmit)
      AdfValueChangeEvent.queue(field, null, newVal, false);
}

Friday, June 28, 2013

Implement Primary Key Population for ADF BC based on SQL server

We can auto populate the primary key attribute in many ways for an ADF BC Entity Object based on Oracle Database but for the Entity Objects generated using SQL Server the following proceedure should be used

Step 1. Create an auxiliary database table
Create an auxiliary database table that will be used to generate the primary key values as shown below.

CREATE TABLE [dbo].[S_ROW_ID](
[start_id] [numeric](38, 0) NULL,
[next_id] [numeric](38, 0) NULL,
[MAX_ID] [numeric](38, 0) NULL,
[AUX_START_ID] [numeric](38, 0) NULL,
[AUX_MAX_ID] [numeric](38, 0) NULL
)

Step 2. Create the database Connection 
ROWIDAM_DB
In your application, create a database connection named ROWIDAM_DB that points to the database containing your S_ROW_ID table.
Note: It is mandatory to use the same connection name

Step 3. Configure the Primary Key Attributes 
Set the primary key attribute value to oracle.jbo.server.uniqueid.UniqueIdHelper.getNextId() in the Entity Object as shown below



Step 4. Modify the adf-config.xml
Though we create the connection to the sql server, we need to modify the default preferences in adf-config.xml as shown below. 



Saturday, June 16, 2012

ADF binding classes explained

ADFBindingContext 
  - Life instance of the adfc-config.xml file
  - Exposes the security Context, Check permissions on an object
  - Exposes MDS Object Session

DCBindingContainer
  - Implmentation of the binding container interface
  - Represents the page definition file at runtime
  - At Runtime Binding is enclosed in a java object, that is this DcBindingContainer
  - All executable bindings, variables, can be obtained
  - #{binding}

BindingContext
  - Life representation of databindings.cpx file, which is the registry of pagedef files
  - It contains the reference to the datacontrols used
  - We can access and manipulate the data controls

DCIteratorBinding
  - browse through the collection of data
  - insert/update/delete data from data collection
  - Iterator binding links to the data source
  - All the operation on the data are internally performed on this DCIteratorBinding

OperationBinding
  - Call a custom method
  - Call the binding method

Friday, February 24, 2012

How to create a UCM connection from JDeveloper?

For many development purposes we need to connect to the content repository and retrieve the content at design time.

Step 1:

Select the Content Repository from the Application Resources -> Connections -> New Connection -> Content Repository

Step 2:

Select Repository Type: Oracle Content Server
Enter the RIDC scoket type, Server Host name, content server port and leave all others as they are.


Give the Credentials if you have them  else uncheck "Specify login credentials..." and then Click Ok

Step 3:

Open the connection in the application resources and browse through the files and folders


Sunday, October 9, 2011