Wednesday, February 19, 2014

ADF/WebCenter (Fusion Middleware) Errors and their solutions

  This page is to list down all issues that I face while working with ADF/Webcenter (Fusion Middleware products)

 

Issue 1:                                                                                           

ADF - Error in Jdev as shown below

Caused by: oracle.jbo.PersistenceException: JBO-34000: Definition class name missing in XML file of type taskFlow
     at oracle.adf.model.binding.DCDefBase.createAndLoadFromXML(DCDefBase.java:402)
     at oracle.adf.model.binding.DCBindingContainerDef.loadExecutables(DCBindingContainerDef.java:1405)
     at oracle.adf.model.binding.DCBindingContainerDef.loadChildrenFromXML(DCBindingContainerDef.java:1201)
     at oracle.adf.model.binding.DCDefBase.loadFromXML(DCDefBase.java:325)

Solution: Add following entries in DataBindings.cpx

  <definitionFactories>
      <dtfactory className="oracle.adf.controller.internal.dtrt.binding.BindingDTObjectFactory"/>
      <factory nameSpace="http://xmlns.oracle.com/adfm/dvt"
               className="oracle.adfinternal.view.faces.dvt.model.binding.FacesBindingFactory"/>
      <factory nameSpace="http://xmlns.oracle.com/adf/controller/binding"
               className="oracle.adf.controller.internal.binding.TaskFlowBindingDefFactoryImpl"/>
      <dtfactory className="oracle.adf.controller.internal.dtrt.binding.BindingDTObjectFactory"/>
   </definitionFactories>



=================================================================

Issue 2: http://server/webcenter/faces/oracle/webcenter/sitestructure/render.jspx?datasource=UCM%23dDocName%3mydoc shows blank page.

Solution: Check if you have navigation-renderer.jspx and its pagedef file in project. At times we delete them by mistake. These files are needed to render content which does not have a dedicated page.

===========================================================================


Issue 3: Weblogic throws 'Too many open files'
Solution: ulimit -n 4096

 

 

Thursday, February 13, 2014

Reading fillable PDF form using iText APIs


 To follow this example you need to download itext libraries. You can do it from http://sourceforge.net/projects/itext/files/latest/download


Code:

import com.itextpdf.text.pdf.AcroFields;
import com.itextpdf.text.pdf.PdfReader;

import java.io.IOException;

import java.util.Set;


public class PDFUtil {
    public PDFUtil() {
        super();
    }
   
    public static void main(String[] args) {
        String src = "D:\\Doc\\Filled_PDF_Form.pdf";
        PdfReader reader;
        try {
            reader = new PdfReader(src);
            AcroFields fields= reader.getAcroFields();
           
            Set<String> fieldKeys = fields.getFields().keySet();
            for(String itemKey : fieldKeys){
                System.out.println(itemKey + ": " + fields.getField(itemKey));
            }
            reader.close();
           
        } catch (IOException e) {
            System.out.println("IO Exception");
            e.printStackTrace();
        }

    }
}


This program will show key value pair of each field. For example

key1: value1
key2: value2





Reference: http://www.itextpdf.com/book/examples.php

NOTE: Before using iText libraries I would recommend to read  iText-licensing and pricing information.

Disclaimer: Any views or opinions presented in this blog are solely those of the author and do not necessarily represent those of the company.

Saturday, February 8, 2014

Special characters appearing in content presenter text. [Providing default style for content]

We use content presenter to show content from UCM. Content definition is defined by region-definition file and its template is create in webcenter. Let say we want to show news items in webcenter page.
First we define our news item. It may consist a title, a description and an image. All this definition goes in region definition file say NEWS_REG_DEF

In our webcenter content presenter template we refer region defintion and its element to show content. For example to show title of a news we use
 <af:outputText value="#{node.propertyMap['NEWS_REG_DEF:TXT_ELEMENT'].asTextHtml}"
                                                               id="ot11"/>


BUT there is a problem with this. If user has some special characters like quotes in text_element element, it will start showing &quote in UI. To avoid that we can use escape="false".
 <af:outputText value="#{node.propertyMap['NEWS_REG_DEF:TXT_ELEMENT'].asTextHtml}"
                                                               id="ot11" escape="false"/>


Now special characters will not appear in UI.

BUT at times we want to show text element with some specific styling. Using escape false, system will ignore any styleclass mentioned with outputtext.

As a solution we can create a panelgrouplayout around outputtext and specify styles on panelgrouplayout.

For example

Template code:
  <af:panelGroupLayout id="pgl21"  layout="vertical" styleClass="headline">
       <af:outputText value="#{node.propertyMap['NEWS_REG_DEF:TXT_ELEMENT'].asTextHtml}"
                  id="ot11" escape="false"/>
      </af:panelGroupLayout>


CSS:
.headline {
    font-size: 16px;
    color: #000000;
    font-weight:bold;
    }


NOTE: PanelGroupLayout can only provide default styles. If element is of type wysiwyg, contributor can put styling while creating content and in that case those styling will take preference. Functionally and Technically it makes sense also. That is why I referred it as a default syling by panelgrouplayout. It will only work if contributor has not overridden it by providing his own setting.

Disclaimer: Any views or opinions presented in this blog are solely those of the author and do not necessarily represent those of the company.