It's all about the answers!

Ask a question

Query RTC api server - Argument must be an instance of IAuditableHandle

Emiliano Iannetti (111) | asked May 07, 7:28 a.m.

 RTC 6.0.5, java version 1.7, api server,

java plugin in a Custom Advisor (but it will also be used for an Operation participant).

Hi, I tried to follow the methods to query RTC with the bees server, I think I have seen them all and I have also thrown something down, but unfortunately I always get this error:

Exception checking precondition. An unhandled exception occurred during "Prohibit Save (ASISE)".
Argument must be an instance of IAuditableHandle.
Now do not pay attention to the details but it is a CustomAdvisor that gives the problem as if I had not instantiated something correctly but what ?? Thanks.
I also attach the code, but it is exactly what I found both here and on other posts, I just changed the value of an attribute ...
IAuditableCommon audCommon = workItemServer.getAuditableCommon ();
IQueryableAttributeFactory queryAttrFactory = QueryableAttributes.getFactory (IWorkItem.ITEM_TYPE);
// IQueryableAttribute projectareaAttribute = QueryableAttributes.getFactory (IWorkItem.ITEM_TYPE) .findAttribute (projectArea, IWorkItem.PROJECT_AREA_PROPERTY, audCommon, monitor);
IQueryableAttribute projectAreaAttribute = queryAttrFactory.findAttribute (projectArea, IWorkItem.PROJECT_AREA_PROPERTY, audCommon, monitor);
AttributeExpression projectAreaExpression = new AttributeExpression (projectAreaAttribute, AttributeOperation.EQUALS, projectArea);
// TipoWi
// IQueryableAttribute typeAttribute = QueryableAttributes.getFactory (IWorkItem.ITEM_TYPE) .findAttribute (projectArea, IWorkItem.TYPE_PROPERTY, audCommon, monitor);
IQueryableAttribute typeAttribute = queryAttrFactory.findAttribute (projectArea, IWorkItem.TYPE_PROPERTY, audCommon, monitor);
AttributeExpression typeExpression = new AttributeExpression (typeAttribute, AttributeOperation.EQUALS, "");

IQueryableAttribute referencingWIAttribute = queryAttrFactory.findAttribute (projectArea, IWorkItem.TARGET_PROPERTY, audCommon, monitor);
AttributeExpression referencingWIExpression = new AttributeExpression (referencingWIAttribute, AttributeOperation.EQUALS, valueAttribute);

Term term = new Term (Term.Operator.AND);
term.add (projectAreaExpression);
term.add (typeExpression);
term.add (referencingWIExpression);

System.out.println ( "****");
System.out.println ("Attribute:" + typeExpression.toString ());
System.out.println ("Wi:" + referencingWIExpression.toString ());
System.out.println ("term:" + term.toString ());
IQueryResult <IResolvedResult <IWorkItem>> queryResult = queryCommon.getResolvedExpressionResults (projectArea, term, IWorkItem.FULL_PROFILE);
int resultSize = queryResult.getResultSize (monitor) .getTotal ();
[/ Code]

One answer

permanent link
Emiliano Iannetti (111) | answered May 07, 8:11 a.m.

 Hi, I answer immediately because I have not found the solution but I have found the answer.

The problem is the plannedFor attribute, obviously I use it badly and therefore gave that error. Putting a custom attribute created by me (which is nothing more than a string populated by a js with the same value as PlannedFor) works, thanks.

Your answer

Register or to post your answer.