viernes, 15 de junio de 2018

ADF 12cR2: Using WebSockets for warning Task Flow Concurrency

Hi all,

I started to upload ADF 12cR2 POCs in my GITHub Repository with samples I develop for my current clients for technical feasibility.

https://github.com/DanielMerchan/adf

The first project is WebSocketConcurrentTaskFlowEdit.

Basically, it uses CDI Managed Bean + Jakarta EE WebSockets for communicating users which are concurrently editing the same information in an ADF Page / ADF Bounded Task Flow.
 

The components are the following:
  • TaskFlowWebSocketServer.java: Contains the WebSocket Server Side Logic.

  • TaskFlowSessionHandler.java: It is a CDI Bean injected in our TaskFlowWebSocketServer.java for decoupling the logic and handling the mapping between Socket Sessions with Task Flows.

  • TaskFlowWebSocket.js: It is the WebSocket Client written in JavaScript which is the responsible of opening the Socket Connection and manage the messages received (in JSON Format) from the TaskFlowWebSocketServer.java

  • SocketHandler.java: Is an ADF Managed Bean used by TaskFlowWebSocket.js for sending a message to the backend to produce a JSF Faces Message based on the message received in the socket. This component is optional as also we can intercept the message and use directly JS to show the notification using ADF Components or just plain HTML/CSS non-obstructive popup.

  • test.jsf: It is the test page which initializes the WebSocket connection when pageLoad by passing the userId and the TaskFlowId from the binding layer.

  • Fake-tf.xml: It is just a mock Task Flow for demo purposes.

As you can see, I have used CDI Managed Beans, Injection and easy annotations for developing my WebSocket Server Endpoint.

Have a look into the code and execute test.jsf. Login in one browser with user A and another browser with user B.

You will see the warning ;).

Happy learning!. Follow your dreams. 

viernes, 1 de junio de 2018

About the blog...

Hi people,

It has been a while without blogging due to personal reasons.

I am planning to upgrade or probably migrate to another blogging platform for starting blogging about Jakarta EE, Containers, Microservices, Hippo CMS... and the new trending technologies.

I will keep answering questions around Oracle Fusion Middleware in the OTN Forums and in the projects of Oracle I am involve with.

But, is time to move on!!!!! Let's continue growing on knowledge and obviously sharing it!.

Kind regards!.

lunes, 31 de julio de 2017

WCP 12c: Using WCCDOC Task Flow as Document Preview

One of the biggest changes of Oracle WebCenter Portal 12c has been its integration with Oracle WebCenter Content.

All the legacy ADF Bounded Task Flows such as Document Explorer, Document Viewer etc... has been deprecated and replaced with the same component as used by WCC ADF UI.

Oracle WebCenter Portal 12c uses a wrapper to WCC ADF UI called Content Manager Task Flow (which internally calls to wccdoc, wccmain and other internal Task Flows used by Oracle WebCenter Content).


One of the missing functionalities is how can we preview a Document in WCP 12c as Document Viewer does not exists anymore.

In OTN WCP Forum I was asked how to achieve this. It can be achieved with the wccdoc Task Flow (https://community.oracle.com/thread/4061288)

There are two choices for accessing a detail of a specific content / document in WCP 12c:
  • Offer a link by using /wccdoc Servlet which will open a Oracle WebCenter Portal page with Content Manager Task Flow pre-loading the specific content / document specified in the dDocName parameter. (E.g.: /wccdoc/d?dDocName=[YourdDocName])

    Use the following snippet of code for generating links to Detail / Download a specific document in WCP:
    public static String getApplicationURL() {
     HttpServletRequest request = (HttpServletRequest)ADFContext.getCurrent().getEnvironment().getRequest();
     StringBuilder urlBuilder = new StringBuilder(request.getScheme()).append("://").append(request.getServerName()).append(':').append(request.getServerPort()).append(request.getContextPath());
     return urlBuilder.toString();
    }
    
    public static String generateDownloadDocumentLink(String dDocName) {
     StringBuilder docURL = new StringBuilder(DocUtil.getApplicationURL());
     docURL.append("/wccproxy/d?dDocName=");
     docURL.append(dDocName);
     return docURL.toString();
    }
    
    public static String generateDetailDocumentLink(String dDocName) {
     StringBuilder docURL = new StringBuilder(DocUtil.getApplicationURL());
     docURL.append("/portal/wccdoc?dDocName=");
     docURL.append(dDocName);
     return docURL.toString();
    }

  • By adding the wccdoc Task Flow to the Resource Catalog and configuring its Input Parameters.
    wccdoc Task Flow in the Resource Catalog

    WCCDOC Task Flow Input Parameters (Compact Mode overrided)
Take care when configuring the WCCDOC Task Flow as it will throw a  ClassCastException ( javax.servlet.ServletException: /wcc/docInfoTabs.jsff @23,67 test="#{wccDocInfoBean.summaryTabDisplayed}": java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean) If you try to use the checkbox of the Compact Mode Input Parameter. The secret is to setup manually to a boolean EL Expression!!.

Use #{wccRuiConfiguration} in the Wcc Rui Configuration Input Parameter. It is a Managed Bean pre-calculated by Oracle WebCenter Portal with the connection settings.

Now you can configure a WebCenter Portal Page to display specific document / content.
Map the dID and (or) dDocName to a URL parameter or Page Attribute to make it dynamic!.

Note: The usage of WCCDOC Task Flow is not supported by Oracle.