In case you need a query or some special logic in velocity it would be fine to have the ability to add that easily in Java.
In velocity it is possible to access all logic being accessible in beans and some objects that are handed over by the caller.
To integrate own logic, it must get accessible in a bean.
To achieve that the contour-service-helper.xml can be patched the following way, insert:
<bean id="frequentisJamaUtils" class="com.jamasoftware.contour.plugin.jama.FrequentisJamaUtils">
</bean>
Where FrequentisJamaUtils is the java class, we have placed that in the plugin package.
In velocity you must add the following:
#set($fju = $applicationContext.getBean("frequentisJamaUtils"))
A call would look like the following:
#set($reviews = $fju.getReviewsForGlobalId($vDoc.document.globalId))
Here a query is called providing all reviews also reviews done in other projects on synched items.
The query looks like:
public List<Review> getReviewsForGlobalId( final String globalId ) {
@SuppressWarnings("unchecked")
final List<Review> reviews =
this.getSession()
.createQuery(
"select rw from Review rw where rw.id in (select rev.review.id from Revision rev inner join rev.revisionItems ri where ri.version.originDocument.id in (select doc.id from Document doc where doc.globalId = :globalId))" )
.setParameter( "globalId", globalId ).list();
return reviews;
}
In case you make your own trials, don't forget the "@Autowired" at the class declaration.
Harald