A Qit View Extension

I like and use the Qit Documentum tool a lot.  Of all the capabilities it provides, it does not have the ability to easily view the content of a repository object in its native application.  I have previously written about how easy it is to write plugins for the tool to extend and customize its capabilities, so that’s what I did to implement a simple View feature.  The entire Eclipse project is here; the guts of the simple class code follow.

    public boolean execute(IRepositoryObject object) throws QDocumentumMenuActionException {
        boolean rv = true;

        try {
            // get the selected object
            IDfSysObject oSysObj = (IDfSysObject) getSession().getObject(new DfId(object.getObjectid()));

            // if it has content continue
            if (oSysObj.getContentSize() > 0) {

                // get file to temp dir
                String sTempDir = System.getProperty("java.io.tmpdir");
                String sTempFile = sTempDir + oSysObj.getObjectId().toString() + "." + oSysObj.getFormat().getDOSExtension();
                sTempFile = oSysObj.getFile(sTempFile);

                // if the file exists and it has content, open it
                File oTempFile = new File(sTempFile);
                if (oTempFile.exists() && oTempFile.length() > 0) {
                    logMessage("Viewing " + oSysObj.getObjectName() + " (" + sTempFile + ")");

                    // open file with desktop default app
                    if (Desktop.isDesktopSupported() == true) {
                        Desktop desktop = Desktop.getDesktop();
                        URI uri = oTempFile.toURI();
                    } else {
                        logMessage("Desktop is not supported on this system");

                } else {
                    logMessage("Content for " + oSysObj.getObjectId().toString() + " could not be downloaded to " + sTempFile);

            } else {
                logMessage("Object " + oSysObj.getObjectName() + " has no content");

        } catch (Exception e) {
            rv = false;
            throw new QDocumentumMenuActionException();

        return rv;

The framework for this code is essentially the same as the SHA256 extension I wrote previously.  The only major difference, and the key to the whole thing, is the use of the Desktop class to open the content file once it is downloaded.  Enjoy!

Have you written any Qit extensions you would like to share?  Let me know.



About Scott
I have been implementing Documentum solutions since 1997. In 2005, I published a book about developing Documentum solutions for the Documentum Desktop Client (ISBN 0595339689). In 2010, I began this blog as a record of interesting and (hopefully) helpful bits of information related to Documentum, and as a creative outlet.

One Response to A Qit View Extension

  1. Pingback: Links to All of My Source Code | dm_misc: Miscellaneous Documentum Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: