Documentum REST dm_job object on DQL queries

If you have used dctm-rest 21.x, you might have come across this error when doing something like select * from dm_job:

E_INPUT_ILLEGAL_ARGUMENTS: There are illegal arguments provided. Failed to instantiate class class com.emc.documentum.rest.view.impl.QueryResultItemView with arguments..

You might wonder if you did something wrong when deploying dctm-rest or if there’s something missing on your environment. Well, the answer is no. If you change the DQL to something like:

select *,r_object_id as method_id from dm_job

Magic! It works 🙂

Well, the “issue” is on the com.emc.documentum.rest.view.impl.JobView class, where someone at some point decided that it was a good idea to require a non-existing attribute (method_id) in dm_job view class:

protected void addMethodsLink()
{
String methodId = (String)((JobObject)getDataInternal()).getMandatoryAttribute("method_id");
makeLinkIf(!methodId.equals("0000000000000000"), CoreLinkRelation.METHOD.rel(), idUriBuilder("method", methodId).build());
}

Also, if you want a more “permanent” solution you can override this method with something like:

protected void addMethodsLink()
{
String methodId = (String)((JobObject)getDataInternal()).getMandatoryAttribute("method_id");
if (methodId!=null){
makeLinkIf(!methodId.equals("0000000000000000"), CoreLinkRelation.METHOD.rel(), idUriBuilder("method", methodId).build());
}
}

And you’ll be good to go.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.