Criteria<Article> criteria = Criteria.create( Article.class );
processCriteria( criteria, request );
if ( request.getCategory() != null )
{
Category category = categoryService.getCategoryByNormalizedName( request.getCategory() );
// return empty result if category was not found
if ( category == null )
{
return new ArrayList<Article>();
}
criteria.addCriteria( Restrictions.eq( "category", category.getId() ) );
}
if ( request.isPublished() != null )
{
criteria.addCriteria( Restrictions.eq( "published", true ) );