Tuesday, May 31, 2016

CLOB to String ADF


  • call a function or a ROVO which returns CLOB;
  • pass it to this method
  • Call this method
private String clobToString(Clob data) {
        ADFContext adfCtx = ADFContext.getCurrent();
    
        Map pageFlowScope = adfCtx.getPageFlowScope();
        
       
    StringBuilder sb = new StringBuilder();
    try {
        Reader reader = data.getCharacterStream();
        BufferedReader br = new BufferedReader(reader);

        String line;
        while(null != (line = br.readLine())) {
            sb.append(line);
        }
        br.close();
    } catch (SQLException e) {
        // handle this exception
    } catch (IOException e) {
        // handle this exception
    }
 pageFlowScope.put("clobString",sb.toString());

    return sb.toString();
}


  • Use RichInputTextEditor to paint the screen using html tags in the CLOB (assuming CLOB has formatted text)
layout:scroll; simple format will get rid of extra components in RichInputTextEditor**

No comments: