Vault Path by Content ID
August 18, 2008
Sometimes you have a Content ID and need to find the path to the Vault file. If you are in a JSP (Java Server Page) or in a Java Class in your backend component you can use this method. 10gR3 introduces the FileStoreProvider component that is not necessarily compatible with this method. I'll try to conjure up a FileStoreProvider compatible version in the future, someday. If you already have one and want to share please drop me a note! This is not without issue I suppose but it should get you started:
private String findLatestVaultPath(String strContentID) throws DataException
{
// Setup a value to return
String strPath = null;
// Setup a binder to perform our lookup with
DataBinder dbDocInfo = new DataBinder();
dbDocInfo.putLocal("dDocName", strContentID);
// Grab latest id by name
ResultSet rsLatestByName =
m_workspace.createResultSet("QlatestIDByName", dbDocInfo);
// If we didn't get any results we are returning null
if(rsLatestByName != null && rsLatestByName.isRowPresent())
{
// Get out the id
String strID =
rsLatestByName.getStringValue(ResultSetUtils.getIndexMustExist(rsLatestByName, "dID"));
// If we don't have an id we're returning null
if(strID != null && strID.length() != 0)
{
// Put the id in our binder
dbDocInfo.putLocal("dID", strID);
// Look up the DOC_INFO
ResultSet rsDocInfo = m_workspace.createResultSet("QdocInfo", dbDocInfo);
DataResultSet drsDocInfo = new DataResultSet();
drsDocInfo.copy(rsDocInfo);
dbDocInfo.addResultSet("DOC_INFO", drsDocInfo);
// Finally, compute the path
strPath = DirectoryLocator.computeVaultPath(DirectoryLocator.computeVaultFileName(dbDocInfo), dbDocInfo);
}
}
return strPath;
}
Categories: OracleUCM