Example usage for org.apache.commons.lang StringUtils substringAfterLast

List of usage examples for org.apache.commons.lang StringUtils substringAfterLast

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils substringAfterLast.

Prototype

public static String substringAfterLast(String str, String separator) 

Source Link

Document

Gets the substring after the last occurrence of a separator.

Usage

From source file:com.amalto.core.storage.SystemStorageWrapper.java

@Override
public long deleteDocument(String clusterName, String uniqueID, String documentType) throws XmlServerException {
    Storage storage = getStorage(clusterName);
    ComplexTypeMetadata type = getType(clusterName, storage, uniqueID);
    if (type == null) {
        return -1;
    }//from  w w w  .j  a va  2s  .  c om
    if (DROPPED_ITEM_TYPE.equals(type.getName())) {
        // head.Product.Product.0-
        uniqueID = uniqueID.substring(0, uniqueID.length() - 1);
        uniqueID = StringUtils.substringAfter(uniqueID, "."); //$NON-NLS-1$
    } else if (!COMPLETED_ROUTING_ORDER.equals(type.getName()) && !FAILED_ROUTING_ORDER.equals(type.getName())
            && !CUSTOM_FORM_TYPE.equals(type.getName())
            && !SYNCHRONIZATION_OBJECT_TYPE.equals(type.getName())) {
        if (uniqueID.startsWith(PROVISIONING_PREFIX_INFO)) {
            uniqueID = StringUtils.substringAfter(uniqueID, PROVISIONING_PREFIX_INFO);
        } else if (uniqueID.startsWith(BROWSEITEM_PREFIX_INFO)) {
            uniqueID = StringUtils.substringAfter(uniqueID, BROWSEITEM_PREFIX_INFO); //$NON-NLS-1$
        } else if (uniqueID.contains(".")) { //$NON-NLS-1$
            uniqueID = StringUtils.substringAfterLast(uniqueID, "."); //$NON-NLS-1$
        }
    }
    long start = System.currentTimeMillis();
    {
        UserQueryBuilder qb = from(type).where(eq(type.getKeyFields().iterator().next(), uniqueID));
        StorageResults results = null;
        try {
            storage.begin();
            Select select = qb.getSelect();
            results = storage.fetch(select);
            if (results.getCount() == 0) {
                throw new IllegalArgumentException("Could not find document to delete."); //$NON-NLS-1$
            }
            storage.delete(select);
            storage.commit();
        } catch (Exception e) {
            storage.rollback();
            throw new XmlServerException(e);
        } finally {
            if (results != null) {
                results.close();
            }
        }
    }
    return System.currentTimeMillis() - start;
}

From source file:com.prowidesoftware.swift.utils.SwiftFormatUtils.java

/**
 * Return the number of decimals for a string with a swift formatted amount.
 * //from w  w w. java  2 s  . c  o m
 * @param amountString may be <code>null</code> or empty, in which case this method returns 0 
 * @return the number of digits after the last , or 0 in any other case.
 * @since 7.8
 */
public static int decimalsInAmount(final String amountString) {
    if (StringUtils.isNotEmpty(amountString)) {
        final String tail = StringUtils.trim(StringUtils.substringAfterLast(amountString, ","));
        return tail.length();
    }
    return 0;
}

From source file:info.magnolia.module.admininterface.AdminTreeMVCHandler.java

/**
 * Saves a value edited directly inside the tree. This can also be a lable
 * @return name of the view// www.ja  v  a  2s  .c o m
 */
public String saveValue() {
    String saveName = this.getRequest().getParameter("saveName"); //$NON-NLS-1$
    Tree tree = getTree();

    // value to save is a node data's value (config admin)
    boolean isNodeDataValue = "true".equals(this.getRequest().getParameter("isNodeDataValue")); //$NON-NLS-1$ //$NON-NLS-2$

    // value to save is a node data's type (config admin)
    boolean isNodeDataType = "true".equals(this.getRequest().getParameter("isNodeDataType")); //$NON-NLS-1$ //$NON-NLS-2$

    String value = StringUtils.defaultString(this.getRequest().getParameter("saveValue")); //$NON-NLS-1$
    displayValue = StringUtils.EMPTY;
    // value to save is a content's meta information
    boolean isMeta = "true".equals(this.getRequest().getParameter("isMeta")); //$NON-NLS-1$ //$NON-NLS-2$
    // value to save is a label (name of page, content node or node data)
    boolean isLabel = "true".equals(this.getRequest().getParameter("isLabel")); //$NON-NLS-1$ //$NON-NLS-2$

    if (isNodeDataValue || isNodeDataType) {
        tree.setPath(StringUtils.substringBeforeLast(path, "/")); //$NON-NLS-1$
        saveName = StringUtils.substringAfterLast(path, "/"); //$NON-NLS-1$
    } else {
        // "/modules/templating/Templates/x"
        tree.setPath(path);
    }

    if (isLabel) {
        displayValue = rename(value);
    } else if (isNodeDataType) {
        int type = Integer.valueOf(value).intValue();
        synchronized (ExclusiveWrite.getInstance()) {
            displayValue = tree.saveNodeDataType(saveName, type);
        }
    } else {
        synchronized (ExclusiveWrite.getInstance()) {
            displayValue = tree.saveNodeData(saveName, value, isMeta);
        }
    }

    // if there was a displayValue passed show it instead of the written value
    displayValue = StringUtils.defaultString(this.getRequest().getParameter("displayValue"), value); //$NON-NLS-1$

    // @todo should be handled in a better way but, at the moment, this is better than nothing
    if (path.startsWith("/subscribers/")) { //$NON-NLS-1$
        Subscriber.reload();
    } else if (path.startsWith("/server/MIMEMapping")) { //$NON-NLS-1$
        MIMEMapping.reload();
    }

    return VIEW_VALUE;
}

From source file:com.cubusmail.mail.MessageHandler.java

/**
 * @return Returns the attachments./*  w ww .j a  va  2 s .c  om*/
 */
public GWTAttachment[] getGWTComposeAttachments() {

    if (this.composeAttachments != null) {
        int index = 0;
        GWTAttachment[] gwtAttachments = new GWTAttachment[this.composeAttachments.size()];
        for (DataSource attachment : this.composeAttachments) {
            gwtAttachments[index] = new GWTAttachment();
            gwtAttachments[index].setFileName(attachment.getName());
            int size = -1;
            try {
                size = attachment.getInputStream().available();
            } catch (IOException e) {
                // do nothing
            }
            gwtAttachments[index].setSize(size);
            gwtAttachments[index].setSizeText(MessageUtils.formatPartSize(size,
                    MessageUtils.createSizeFormat(SessionManager.get().getLocale())));
            gwtAttachments[index].setMessageId(0);
            gwtAttachments[index].setIndex(index);

            String extension = StringUtils.substringAfterLast(attachment.getName(), ".");
            if (extension != null) {
                extension = extension.toLowerCase();
                if (ArrayUtils.contains(PREVIEW_EXTENSIONS, extension)) {
                    gwtAttachments[index].setPreview(true);
                }
            }
            index++;
        }

        return gwtAttachments;
    }

    return null;
}

From source file:info.magnolia.link.LinkUtil.java

/**
 * Creates link to the content identified by the repository and path. Link will use specified extension and will also contain the anchor and parameters if specified.
 * @param workspaceName Source repository for the content.
 * @param path Path to the content of interest.
 * @param extension Optional extension to be used in the link
 * @param anchor Optional link anchor./*from   www  . j  a  va  2 s  .  c  om*/
 * @param parameters Optional link parameters.
 * @return Link pointing to the content denoted by repository and path including extension, anchor and parameters if such were provided.
 * @throws LinkException
 */
public static Link createLinkInstance(String workspaceName, String path, String extension, String anchor,
        String parameters) throws LinkException {
    Node node = null;
    String fileName = null;
    String nodeDataName = null;
    Property property = null;
    try {
        Session session = MgnlContext.getJCRSession(workspaceName);

        boolean exists = false;
        try {
            PathParser.checkFormat(path);
        } catch (MalformedPathException e) {
            // we first check for path incl. the file name. While file name might not be necessarily part of the path, it might contain also non ascii chars. If that is the case, parsing exception will occur so we know that path with filename can't exist.
        }
        exists = session.itemExists(path) && !session.propertyExists(path);
        if (exists) {
            node = session.getNode(path);
        }
        if (node == null) {
            if (session.nodeExists(path)) {
                node = session.getNode(path);
            }
            if (node != null && node.isNodeType(NodeTypes.Resource.NAME) && node.hasProperty("fileName")) {
                fileName = node.getProperty("fileName").getString();
            }
            if (session.propertyExists(path)) {
                nodeDataName = StringUtils.substringAfterLast(path, "/");
                path = StringUtils.substringBeforeLast(path, "/");
                property = node.getProperty(nodeDataName);
            }
        }
        if (node == null) {
            throw new LinkException("can't find node " + path + " in repository " + workspaceName);
        }
    } catch (RepositoryException e) {
        throw new LinkException("can't get node with path " + path + " from repository " + workspaceName);
    }

    Link link = new Link(node);
    link.setAnchor(anchor);
    link.setExtension(extension);
    link.setParameters(parameters);
    link.setFileName(fileName);
    link.setPropertyName(nodeDataName);
    link.setProperty(property);
    link.setPath(path);
    return link;
}

From source file:com.iorga.webappwatcher.RequestLogFilter.java

private void handleFilterCommandRequest(final String requestURI, final HttpServletRequest httpRequest,
        final ServletResponse response) throws Exception {
    // This is a Command Request, let's execute it
    final HttpServletResponse httpResponse = ((HttpServletResponse) response);
    final HashMap<Class<?>, Object> commandContext = new HashMap<Class<?>, Object>(parametersContext);
    commandContext.put(HttpServletRequest.class, httpRequest);
    commandContext.put(HttpServletResponse.class, httpResponse);
    final String commandName = StringUtils.substringAfterLast(requestURI, "/");
    final boolean commandHandledResponse;
    if (StringUtils.isEmpty(commandName) || commandName.equals(getCmdRequestName())) {
        // Here is the default command : nothing after last /, or no last /
        commandHandledResponse = defaultCommandHandler.execute(commandContext);
    } else {/*ww w . j av a2s .com*/
        final CommandHandler commandHandler = commandHandlers.get(commandName);
        if (commandHandler != null) {
            commandHandledResponse = commandHandler.execute(commandContext);
        } else {
            commandHandledResponse = true;
            httpResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            httpResponse.getWriter().write("ERROR : Command not understood");
        }
    }
    if (!commandHandledResponse) {
        httpResponse.setStatus(HttpServletResponse.SC_OK);
        httpResponse.getWriter().write("OK : Command successfully completed");
    }
}

From source file:info.magnolia.module.admininterface.AdminTreeMVCHandler.java

public String pasteNode(String pathOrigin, String pathSelected, int pasteType, int action)
        throws ExchangeException, RepositoryException {
    boolean move = false;
    if (action == Tree.ACTION_MOVE) {
        move = true;/*from ww w. j a va 2 s  .co  m*/
    }
    String label = StringUtils.substringAfterLast(pathOrigin, "/"); //$NON-NLS-1$
    String slash = "/"; //$NON-NLS-1$
    if (pathSelected.equals("/")) { //$NON-NLS-1$
        slash = StringUtils.EMPTY;
    }
    String destination = pathSelected + slash + label;
    if (pasteType == Tree.PASTETYPE_SUB && action != Tree.ACTION_COPY && destination.equals(pathOrigin)) {
        // drag node to parent node: move to last position
        pasteType = Tree.PASTETYPE_LAST;
    }
    if (pasteType == Tree.PASTETYPE_SUB) {
        destination = pathSelected + slash + label;
        Content touchedContent = this.copyMoveNode(pathOrigin, destination, move);
        if (touchedContent == null) {
            return StringUtils.EMPTY;
        }
        return touchedContent.getHandle();

    } else if (pasteType == Tree.PASTETYPE_LAST) {
        // LAST only available for sorting inside the same directory
        try {
            Content touchedContent = getHierarchyManager().getContent(pathOrigin);
            return touchedContent.getHandle();
        } catch (RepositoryException re) {
            return StringUtils.EMPTY;
        }
    } else {
        try {
            // PASTETYPE_ABOVE | PASTETYPE_BELOW
            String nameSelected = StringUtils.substringAfterLast(pathSelected, "/"); //$NON-NLS-1$
            String nameOrigin = StringUtils.substringAfterLast(pathOrigin, "/"); //$NON-NLS-1$
            Content tomove = getHierarchyManager().getContent(pathOrigin);
            Content selected = getHierarchyManager().getContent(pathSelected);
            if (tomove.getParent().getUUID().equals(selected.getParent().getUUID())) {
                tomove.getParent().orderBefore(nameOrigin, nameSelected);
                tomove.getParent().save();
            } else {
                String newOrigin = selected.getParent().getHandle() + "/" + nameOrigin;
                getHierarchyManager().moveTo(pathOrigin, newOrigin);
                Content newNode = getHierarchyManager().getContent(newOrigin);
                if (pasteType == Tree.PASTETYPE_ABOVE) {
                    newNode.getParent().orderBefore(nameOrigin, nameSelected);
                }
            }
            return tomove.getHandle();
        } catch (RepositoryException re) {
            re.printStackTrace();
            log.error("Problem when pasting node", re);
            return StringUtils.EMPTY;
        }
    }
}

From source file:edu.mayo.cts2.framework.plugin.service.bioportal.rest.BioportalRestService.java

/**
 * Gets the updated ontologies.//from  w w w  .j  a  va  2  s.  c  o m
 *
 * @param feed the feed
 * @param fromDate the from date
 * @return the updated ontologies
 */
protected List<String> getUpdatedOntologies(SyndFeed feed, Date fromDate) {

    List<String> ontologyIdList = new ArrayList<String>();

    for (Object entry : feed.getEntries()) {
        SyndEntry syndEntry = (SyndEntry) entry;
        DateModule date = (DateModule) syndEntry.getModule(DateModule.URI);
        Date foundDate = date.getDate();
        if (foundDate.after(foundDate)) {
            ontologyIdList.add(StringUtils.substringAfterLast(syndEntry.getLink(), "/"));
        }
    }

    return ontologyIdList;
}

From source file:com.jayway.maven.plugins.android.AbstractEmulatorMojo.java

/**
 * This method extracts a port number from the serial number of a device.
 * It assumes that the device name is of format [xxxx-nnnn] where nnnn is the
 * port number./*from   w w  w  .  j a  v  a 2  s.c o  m*/
 *
 * @param device The device to extract the port number from.
 * @return Returns the port number of the device
 */
private int extractPortFromDevice(IDevice device) {
    String portStr = StringUtils.substringAfterLast(device.getSerialNumber(), "-");
    if (StringUtils.isNotBlank(portStr) && StringUtils.isNumeric(portStr)) {
        return Integer.parseInt(portStr);
    }

    //If the port is not available then return -1
    return -1;
}

From source file:edu.ku.brc.specify.ui.db.ResultSetTableModel.java

@Override
//@SuppressWarnings("null")
public synchronized void exectionDone(final SQLExecutionProcessor process, final ResultSet resultSet) {
    if (statusBar != null) {
        statusBar.incrementValue(getClass().getSimpleName());
    }/*from w w w.j  av a  2  s  .  c o  m*/

    if (resultSet == null || results == null) {
        log.error("The " + (resultSet == null ? "resultSet" : "results") + " is null.");
        if (propertyListener != null) {
            propertyListener.propertyChange(new PropertyChangeEvent(this, "rowCount", null, 0));
        }
        return;
    }

    List<ERTICaptionInfo> captions = results.getVisibleCaptionInfo();

    // This can do one of two things:
    // 1) Take multiple columns and create an object and use a DataObjectFormatter to format the object.
    // 2) Table multiple objects that were derived from the columns and roll those up into a single column's value.
    //    This happens when you get back rows of info where part of the columns are duplicated because you really
    //    want those value to be put into a single column.
    //
    // Step One - Is to figure out what type of object needs to be created and what the Columns are 
    //            that need to be set into the object so the dataObjFormatter can do its job.
    //
    // Step Two - If the objects are being aggregated then the object created from the columns are added to a List
    //            and then last formatted as an "aggregation"

    try {
        if (resultSet.next()) {
            ResultSetMetaData metaData = resultSet.getMetaData();

            // Composite
            boolean hasCompositeObj = false;
            DataObjSwitchFormatter dataObjFormatter = null;
            UIFieldFormatterIFace formatter = null;
            Object compObj = null;

            // Aggregates
            ERTICaptionInfo aggCaption = null;
            ERTICaptionInfo compositeCaption = null;
            Vector<Object> aggList = null;
            DataObjectSettable aggSetter = null;
            Stack<Object> aggListRecycler = null;

            DataObjectSettable dataSetter = null; // data getter for Aggregate or the Subclass

            // Loop through the caption to figure out what columns will be displayed.
            // Watch for Captions with an Aggregator or Composite 
            numColumns = captions.size();
            for (ERTICaptionInfo caption : captions) {
                colNames.addElement(caption.getColLabel());

                int inx = caption.getPosIndex() + 1;
                //log.debug(metaData.getColumnClassName(inx));
                Class<?> cls = null;
                try {
                    cls = Class.forName(metaData.getColumnClassName(inx));
                    if (cls == Calendar.class || cls == java.sql.Date.class || cls == Date.class) {
                        cls = String.class;
                    }
                } catch (SQLException ex) {
                    cls = String.class;
                }
                classNames.addElement(cls);
                caption.setColClass(cls);

                if (caption.getAggregatorName() != null) {
                    //log.debug("The Agg is ["+caption.getAggregatorName()+"] "+caption.getColName());

                    // Alright we have an aggregator
                    aggList = new Vector<Object>();
                    aggListRecycler = new Stack<Object>();
                    aggCaption = caption;
                    aggSetter = DataObjectSettableFactory.get(aggCaption.getAggClass().getName(),
                            FormHelper.DATA_OBJ_SETTER);

                    // Now check to see if we are aggregating the this type of object or a child object of this object
                    // For example Collectors use an Agent as part of the aggregation
                    if (aggCaption.getSubClass() != null) {
                        dataSetter = DataObjectSettableFactory.get(aggCaption.getSubClass().getName(),
                                FormHelper.DATA_OBJ_SETTER);
                    } else {
                        dataSetter = aggSetter;
                    }

                } else if (caption.getColInfoList() != null) {
                    formatter = caption.getUiFieldFormatter();
                    if (formatter != null) {
                        compositeCaption = caption;
                    } else {
                        // OK, now aggregation but we will be rolling up multiple columns into a single object for formatting
                        // We need to get the formatter to see what the Class is of the object
                        hasCompositeObj = true;
                        aggCaption = caption;
                        dataObjFormatter = caption.getDataObjFormatter();
                        if (dataObjFormatter != null) {
                            if (dataObjFormatter.getDataClass() != null) {
                                aggSetter = DataObjectSettableFactory.get(
                                        dataObjFormatter.getDataClass().getName(),
                                        "edu.ku.brc.af.ui.forms.DataSetterForObj");
                            } else {
                                log.error("formatterObj.getDataClass() was null for " + caption.getColName());
                            }
                        } else {
                            log.error("DataObjFormatter was null for " + caption.getColName());
                        }
                    }

                }
                //colNames.addElement(metaData.getColumnName(i));
                //System.out.println("**************** " + caption.getColLabel()+ " "+inx+ " " + caption.getColClass().getSimpleName());
            }

            // aggCaption will be non-null for both a Aggregate AND a Composite
            if (aggCaption != null) {
                // Here we need to dynamically discover what the column indexes are that we to grab
                // in order to set them into the created data object
                for (ERTICaptionInfo.ColInfo colInfo : aggCaption.getColInfoList()) {
                    for (int i = 0; i < metaData.getColumnCount(); i++) {
                        String colName = StringUtils.substringAfterLast(colInfo.getColumnName(), ".");
                        if (colName.equalsIgnoreCase(metaData.getColumnName(i + 1))) {
                            colInfo.setPosition(i);
                            break;
                        }
                    }
                }

                // Now check to see if there is an Order Column because the Aggregator 
                // might need it for sorting the Aggregation
                String ordColName = aggCaption.getOrderCol();
                if (StringUtils.isNotEmpty(ordColName)) {
                    String colName = StringUtils.substringAfterLast(ordColName, ".");
                    //log.debug("colName ["+colName+"]");
                    for (int i = 0; i < metaData.getColumnCount(); i++) {
                        //log.debug("["+colName+"]["+metaData.getColumnName(i+1)+"]");
                        if (colName.equalsIgnoreCase(metaData.getColumnName(i + 1))) {
                            aggCaption.setOrderColIndex(i);
                            break;
                        }
                    }
                    if (aggCaption.getOrderColIndex() == -1) {
                        log.error("Agg Order Column Index wasn't found [" + ordColName + "]");
                    }
                }
            }

            if (ids == null) {
                ids = new Vector<Integer>();
            } else {
                ids.clear();
            }

            // Here is the tricky part.
            // When we are doing a Composite we are just taking multiple columns and 
            // essentially replace them with a single value from the DataObjFormatter
            //
            // But when doing an Aggregation we taking several rows and rolling them up into a single value.
            // so this code knows when it is doing an aggregation, so it knows to only add a new row to the display-able
            // results when primary id changes.

            DataObjFieldFormatMgr dataObjMgr = DataObjFieldFormatMgr.getInstance();
            Vector<Object> row = null;
            boolean firstTime = true;
            int prevId = Integer.MAX_VALUE; // really can't assume any value but will choose Max

            int numCols = resultSet.getMetaData().getColumnCount();
            do {
                int id = resultSet.getInt(1);
                //log.debug("id: "+id+"  prevId: "+prevId);

                // Remember aggCaption is used by both a Aggregation and a Composite
                if (aggCaption != null && !hasCompositeObj) {
                    if (firstTime) {
                        prevId = id;
                        row = new Vector<Object>();
                        firstTime = false;
                        cache.add(row);
                        ids.add(id);

                    } else if (id != prevId) {
                        //log.debug("Agg List len: "+aggList.size());

                        if (row != null && aggList != null) {
                            int aggInx = captions.indexOf(aggCaption);
                            row.remove(aggInx);
                            row.insertElementAt(dataObjMgr.aggregate(aggList, aggCaption.getAggClass()),
                                    aggInx);

                            if (aggListRecycler != null) {
                                aggListRecycler.addAll(aggList);
                            }
                            aggList.clear();

                            row = new Vector<Object>();
                            cache.add(row);
                            ids.add(id);
                        }
                        prevId = id;

                    } else if (row == null) {
                        row = new Vector<Object>();
                        cache.add(row);
                        ids.add(id);
                    }
                } else {
                    row = new Vector<Object>();
                    cache.add(row);
                    ids.add(id);
                }

                // Now for each Caption column get a value
                for (ERTICaptionInfo caption : captions) {
                    int posIndex = caption.getPosIndex();
                    if (caption == aggCaption) // Checks to see if we need to take multiple columns and make one column
                    {
                        if (hasCompositeObj) // just doing a Composite
                        {
                            if (aggSetter != null && row != null && dataObjFormatter != null) {
                                if (compObj == null) {
                                    compObj = aggCaption.getAggClass().newInstance();
                                }

                                for (ERTICaptionInfo.ColInfo colInfo : aggCaption.getColInfoList()) {
                                    setField(aggSetter, compObj, colInfo.getFieldName(),
                                            colInfo.getFieldClass(), resultSet, colInfo.getPosition());
                                }
                                row.add(DataObjFieldFormatMgr.getInstance().format(compObj,
                                        compObj.getClass()));

                            } else if (formatter != null) {
                                int len = compositeCaption.getColInfoList().size();
                                Object[] val = new Object[len];
                                int i = 0;
                                for (ERTICaptionInfo.ColInfo colInfo : compositeCaption.getColInfoList()) {
                                    int colInx = colInfo.getPosition() + posIndex + 1;
                                    if (colInx < numCols) {
                                        val[i++] = resultSet.getObject(colInx);
                                    } else {
                                        //val[i++] = resultSet.getObject(posIndex+1);
                                        val[i++] = "(Missing Data)";
                                    }
                                }
                                row.add(formatter.formatToUI(val));

                            } else {
                                log.error("Aggregator is null! [" + aggCaption.getAggregatorName()
                                        + "] or row or aggList");
                            }
                        } else if (aggSetter != null && row != null && aggList != null) // Doing an Aggregation
                        {
                            Object aggObj;
                            if (aggListRecycler.size() == 0) {
                                aggObj = aggCaption.getAggClass().newInstance();
                            } else {
                                aggObj = aggListRecycler.pop();
                            }
                            Object aggSubObj = aggCaption.getSubClass() != null
                                    ? aggCaption.getSubClass().newInstance()
                                    : null;
                            aggList.add(aggObj);

                            //@SuppressWarnings("unused")
                            //DataObjAggregator aggregator = DataObjFieldFormatMgr.getInstance().getAggregator(aggCaption.getAggregatorName());
                            //log.debug(" aggCaption.getOrderColIndex() "+ aggCaption.getOrderColIndex());

                            //aggSetter.setFieldValue(aggObj, aggregator.getOrderFieldName(), resultSet.getObject(aggCaption.getOrderColIndex() + 1));

                            Object dataObj;
                            if (aggSubObj != null) {
                                aggSetter.setFieldValue(aggObj, aggCaption.getSubClassFieldName(), aggSubObj);
                                dataObj = aggSubObj;
                            } else {
                                dataObj = aggObj;
                            }

                            for (ERTICaptionInfo.ColInfo colInfo : aggCaption.getColInfoList()) {
                                setField(dataSetter, dataObj, colInfo.getFieldName(), colInfo.getFieldClass(),
                                        resultSet, colInfo.getPosition());
                            }
                            row.add("PlaceHolder");

                        } else if (aggSetter == null || aggList == null) {
                            log.error("Aggregator is null! [" + aggCaption.getAggregatorName() + "] or aggList["
                                    + aggList + "]");
                        }

                    } else if (row != null) {
                        if (caption.getColName() == null && caption.getColInfoList().size() > 0) {
                            int len = caption.getColInfoList().size();
                            Object[] val = new Object[len];
                            for (int i = 0; i < caption.getColInfoList().size(); i++) {
                                int inx = posIndex + 1 + i;
                                val[i] = caption.processValue(resultSet.getObject(inx));
                            }
                            row.add(caption.getUiFieldFormatter().formatToUI(val));
                            //col += caption.getColInfoList().size() - 1;

                        } else {
                            Object obj = caption.processValue(resultSet.getObject(posIndex + 1));
                            row.add(obj);
                        }
                    }
                }

            } while (resultSet.next());

            // We were always setting the rolled up data when the ID changed
            // but on the last row we need to do it here manually (so to speak)
            if (aggCaption != null && aggList != null && aggList.size() > 0 && row != null) {
                int aggInx = captions.indexOf(aggCaption);
                row.remove(aggInx);
                String colStr;
                if (StringUtils.isNotEmpty(aggCaption.getAggregatorName())) {
                    colStr = DataObjFieldFormatMgr.getInstance().aggregate(aggList,
                            aggCaption.getAggregatorName());

                } else {
                    colStr = DataObjFieldFormatMgr.getInstance().aggregate(aggList, aggCaption.getAggClass());
                }
                row.insertElementAt(colStr, aggInx);
                aggList.clear();
                aggListRecycler.clear();
            }

            fireTableStructureChanged();
            fireTableDataChanged();
        }

    } catch (Exception ex) {
        ex.printStackTrace();
    }

    if (propertyListener != null) {
        propertyListener
                .propertyChange(new PropertyChangeEvent(this, "rowCount", null, new Integer(cache.size())));
    }
}