String primaryEntityTitle = "";
if ((dataMatrix.getCurrentBuffer().getContents() == null) ||
(dataMatrix.getCurrentBuffer().getContents().size() < 1)) {
// No rows in data matrix. Set the title using an empty string.
DataBuffer tempBuffer = new DataBuffer(delegator, dataMatrix);
primaryEntityTitle = UIWebUtility.decodeEntityDisplayDef(titleDef,
tempBuffer.createEmptyRow(), "");
} else {
// There is data in the data matrix. Use the first row to set the title.
primaryEntityTitle = UIWebUtility.decodeEntityDisplayDef(titleDef,
dataMatrix.getCurrentBuffer().getContentsRow(0), "");
}