In Documentum 6.5 release there is a new capability called Smart Container. What’s that about?
In many applications there is a need for the repeated construction of composite objects. For example, in a police application there might be an incident folder which contains a subfolder for affidavits, another for officer reports, perhaps a structured interview form. Typically you would program the construction of this composite structure by hand using DFC or DFS primitives. This can take considerable time and requires a strong skillset. Smart Containers offer a way to declaratively specify a template for such composite structures and provides a runtime factory that observes the declarative specification.
In Composer there is a graphical editor with which you can define your template (give it a try). The template is built in terms of objects and relationships. Once you have completed your template you can install it into the docbase using normal Composer install procedures. The result will be an instance of dmc_class whose content is an XML representation of the template. Attached to the object is an aspect that contains the logic to interpret the template. In effect it is a factory object.
In order to construct a new composite, as declared in your template, you would do the following …
IObjectFactory factory = (IObjectFactory) session.getObjectByQualification("dmc_class where object_name='myTemplateName'");
IDfPersistentObject myCompositePrimaryObject = factory.newObject();
myCompositePrimaryObject.save();
That’s it. There is no more code.
You get the primary object returned and all the others are linked (in folders or by dm_relations) according to your declarative template once you save the primary object.
IObjectFactory also has a signature that allows you to provide a Map of parameter values if your template is parameterized. Template parameterization is important to allow for runtime context – the identity of a Captiva-scanned initial incident report maybe.
The IObjectFactory interface is defined in the dmc_class.jar which you can extract from the dmc_class TBO module in the docbase.
2 responses so far ↓
Lee Dallas // November 26, 2008 at 5:30 am
this is very cool – I want to try it out but I have a question off the top of my head. Does this have problems in a transaction?
donr7n // November 26, 2008 at 5:55 am
Lee
The factory method will participate in any user defined transaction in the same way as any other DFC code. It does not initiate a transaction itself.
With one (unavoidable) exception none of the objects and none of the dm_relation instances are saved either until you save the primary object (which propagates the saves). The exception is that any objects created from Template elements are saved within the factory method.
The intent is, as much as possible, to follow the semantics of IDfSession.newObject.
Don