public String getDocument(String docKey) throws DBException {
Transaction tx = new Transaction();
try {
DocumentTable dt = col.getDocument(tx, docKey);
if ( dt == null )
throw new DBException(FaultCodes.COL_CANNOT_RETRIEVE, "Document '"+docKey+"' not found");
return DTSMHelper.tableToText(dt);
}
catch ( DBException e ) {
tx.cancel();
throw e;
}
catch ( DTSMException e ) {
tx.cancel();
throw new DBException(FaultCodes.COL_CANNOT_RETRIEVE, "Can't convert Document '" + docKey + "' to text", e);
}
finally {
if ( tx.getStatus() == Transaction.ACTIVE )
tx.commit();
}