Thursday, August 26, 2010

Bus Factor

Recently I came across a pretty interesting term called Bus Factor in a software project.
















According to Wikipedia,the bus factor is the total number of key developers who would need to be incapacitated, (as by getting hit by a bus) to send the project into such disarray that it would not be able to proceed.

Obviously,for project managers,its important to increase the Bus Factor as much as possible....and for developers (like me) its important to try to keep it as low as possible :) .

Tuesday, January 5, 2010

Action Preconditions in Documentum

Action precondition classes checks whether an action can be performed or not. Action precondition classes renders an action control as enabled or disabled. The structure of an action precondition class is as follows:
public class TestActionPrecondition implements IActionPrecondition
{
public String[] getRequiredParams()
{
return new String[0];
}

public boolean queryExecute(String strAction, IConfigElement config, ArgumentList arg, Context context, Component component)
{
boolean isActionEnabled = false;
String object_name=(String)arg.get(“object_name”);
return isActionEnabled;
}
}

An action precondition class implements IActionPrecondition interface and overrides the queryExecute method of that interface. queryExecute() method returns a boolean value which determines whether the corresponding action will be enabled or disabled.

The corresponding action xml will be :


<config>
<scope>
<action id="test_action">
<params>
<param name="object_name" required="true"/>

</params>
<preconditions>
<precondition class="com.poc.TestActionPrecondition"></precondition>
</preconditions>
<execution class="com.documentum.web.formext.action.LaunchComponent">
<component>report_history_component</component>
<navigation>jump</navigation>
</execution>
</action>
</scope>
</config>



The jsp part of the component from where the action will be called is described below. An action link is used for the purpose:






<dmf:datagridRow height='15' altclass="row1" cssclass="row2" width="100%">
<td width="10%" align="center">
<dmfx:actionlink name="user_report_view" action='test_action' showifinvalid="true" datefield="process_name" >
<dmf:argument name="object_name" datafield="object_name"/>
</dmfx:actionlink>
</td>
</dmf:datagridRow>

A typical scenario of using action precondition can be a requirement where roles are created dynamically and based on those roles action links are getting generated dynamically. The logged in user will have access to the action link(s) iff that user is present in the corresponding role(s).
For roles which are not created dynamically and are fixed, documentum’s out of box RolePrecondition can also be used. Also, just by mentioning scope=<role_name> , in action xml, role based action control enable/disable feature can be achieved.

CAUTION: Please avoid putting codes that access the docbase(for e.g dql queries and dfc api call) as much as possible in queryExecute() method because the method will get executed for each and every action links generated .So that can be a performance bottleneck.