// FrontEnd Plus GUI for JAD // DeCompiled : TableDataProviderUtil.class package com.custom; import com.documentum.web.common.reporting.*; import com.documentum.web.form.control.databound.*; import com.documentum.web.form.control.format.DateValueFormatter; import com.documentum.web.formext.control.docbase.format.*; import java.util.*; public class CEGTableDataProviderUtil { public CEGTableDataProviderUtil() { } public static MetaData getMetaData(List columnDescList) { List colInfoList = new ArrayList(); Iterator i$ = columnDescList.iterator(); do { if(!i$.hasNext()) break; ColumnDescriptor columnDesc = (ColumnDescriptor)i$.next(); if(columnDesc.isVisible()) { String columnAttribute = columnDesc.getAttribute(); String columnLabel = columnDesc.getLabel(); colInfoList.add(new ColumnInfo(columnAttribute, com.documentum.web.common.reporting.ColumnInfo.TYPE.STRING, columnLabel)); } } while(true); return new MetaData(colInfoList); } public static Iterator getRows(DataProvider dataprovider, List columnNames) { return getRows(dataprovider, columnNames, null); } public static Iterator getRows(DataProvider dataprovider, List columnNames, ITableDataFormatter formatter) { List rows = new ArrayList(); boolean bOrigIsPaged = dataprovider.isPaged(); int iOrigCurrentPage = dataprovider.getCurrentPage(); dataprovider.firstPage(); dataprovider.setPaged(false); dataprovider.initBind(); if(dataprovider.getResultsCount() > 0) do { Map cellList = new HashMap(); for(Iterator i$ = columnNames.iterator(); i$.hasNext();) { String columnAttribute = (String)i$.next(); try { String columnValue = dataprovider.getDataField(columnAttribute); cellList.put(columnAttribute, new Cell(columnValue)); } catch(DataBoundException e) { cellList.put(columnAttribute, new Cell("")); } } formatCells(cellList, formatter, dataprovider); Row row = new Row(cellList); rows.add(row); } while(dataprovider.nextRow()); dataprovider.setPaged(bOrigIsPaged); dataprovider.setCurrentPage(iOrigCurrentPage); return rows.iterator(); } private static void formatCells(Map cellList, ITableDataFormatter formatter, DataProvider dataprovider) { Cell cell; String formattedValue; for(Iterator i$ = cellList.keySet().iterator(); i$.hasNext(); cell.setValue(formattedValue)) { String cellName = (String)i$.next(); cell = (Cell)cellList.get(cellName); String unformattedValue = (String)cell.getValue(); formattedValue = unformattedValue; String objectType = dataprovider.getDataField("r_object_type"); if(formatter == null) formattedValue = formatDataFieldValue(cellName, unformattedValue, objectType); else formattedValue = formatter.getFormattedValue(cellName, unformattedValue, objectType); } } private static String formatDataFieldValue(String attributeName, String attributeValue, String objectType) { String retStr = attributeValue; if(attributeName.equals("title") || attributeName.equals("authors") || attributeName.equals("r_version_label")) { FolderExclusionFormatter folderExclusionFormatter = new FolderExclusionFormatter(); folderExclusionFormatter.setType(objectType); retStr = folderExclusionFormatter.format(attributeValue); } else if(attributeName.equals("a_content_type")) { DocFormatValueFormatter docFormatValueFormatter = new DocFormatValueFormatter(); retStr = docFormatValueFormatter.format(attributeValue); } else if(attributeName.equals("r_content_size")) { DocsizeValueFormatter docSizeValueFormatter = new DocsizeValueFormatter(); docSizeValueFormatter.setType(objectType); retStr = docSizeValueFormatter.format(attributeValue); } else if(attributeName.equals("r_creation_date") || attributeName.equals("r_modify_date") || attributeName.equals("r_access_date")) { DateValueFormatter dateValueFormatter = new DateValueFormatter(); retStr = dateValueFormatter.format(attributeValue); } else if(attributeName.equals("score")) { float fRank = Float.parseFloat(attributeValue); int percentToFill = 0; if(fRank != 0.0F) percentToFill = (int)(fRank * 100F); retStr = (new StringBuilder()).append(String.valueOf(percentToFill)).append("%").toString(); } else if(attributeName.endsWith("_date")) { DateValueFormatter dateValueFormatter = new DateValueFormatter(); retStr = dateValueFormatter.format(attributeValue); } if(retStr.equals(" ")) retStr = ""; return retStr; } }