dmRecordSet Update v1.2

I just published an update to the dmRecordSet class, a more useable and flexible alternative to the DFC’s IDfCollection class.  Here is a quick list of improvements/changes in this release:

  • added getRecordSetAsList() method – returns the record set as a Java List
  • added getRecordSetAsSet() method – returns the record set as a Java Set (contains only unique objects)
  • added getRecordSetInfo() method – returns a String of stats about record set
  • added getRowCount() – returns number of rows in record set
  • added getColumnCount() – returns number of columns in record set
  • added static getVersion() – returns version information for class
  • changed getRow() to issue DfLogger statement if invalid row requested, instead of throwing exception
  • Deprecated first(), replaced with getFirstRow()
  • Deprecated last(), replaced with getLastRow()
  • Deprecated next(), replaced with getNextRow()
  • Deprecated getRow(), replaced with getCurrentRow()
  • Deprecated previous(), replaced with getPreviousRow()
  • Deprecated resetBeginning(), replaced with resetToBeginning()
  • Deprecated resetEnd(), replaced with resetToEnd()
  • getNextRow() and getPreviousRow() use getRow()
  • updated CollectionExamples test class

I also included a short tutorial that walks through some basic uses of the class.

The latest dmRecordSet class can be downloaded here.

dmRecordSet Update

I updated the code for the dmRecordSet class here.  The only change is that I removed some debug statements that made it into the released code.

IDfCollections, Part V

In this final post of the IDfCollection series, I offer an alternative to the IDfCollection object, the dmRecordSet. The dmRecordSet is an object I created to extend the capabilities of the IDfCollection and overcome many of the limitations I have been discussing here. For example, the dmRecordSet allows you to:

  • move forward, backward or randomly through the record set;
  • reset the record set to the beginning or the end to be re-processed;
  • add rows to the set;
  • determine the number of rows in the set;
  • determine if a record set is empty or not; and
  • retrieve column definitions.

The following code provides some examples of how easy it is to use the dmRecordSet object.

Instantiate a dmRecordSet:

    IDfCollection col = null;
    String dql = "select r_object_id, object_name, "
           + "r_creation_date, a_content_type, r_full_content_size, a_is_template "
           + "from dm_document where folder('/Temp',descend)";
    IDfQuery q = new DfQuery();
    IDfTypedObject tObj = null;

    col = q.execute(session, DfQuery.DF_READ_QUERY);

    // get record set
    dmRecordSet dmRS = new dmRecordSet(col);

Test for empty set and count rows:

    System.out.println("Record count = " + dmRS.getRowCount());
    if (dmRS.isEmpty()) {
       System.out.println("dmRecordSet is empty");
    } else {
       System.out.println("dmRecordSet is NOT empty");

Process record set:

    while (dmRS.hasNext()) {
       tObj =;
       System.out.print(tObj.getString("r_object_id") + "\t");

Move to end and process set backwards:

    tObj = dmRS.last();
    while (dmRS.hasPrevious()) {
        tObj = dmRS.previous();
        System.out.print(tObj.getString("r_object_id") + "\t");

The class, source code and Javadoc for the dmRecordSet can be downloaded here.

I hope you have enjoyed this series on the IDfCollection object, one of the most commonly used but least functional objects in the DFC.  As always, I appreciate your comments and feedback.

%d bloggers like this: