Skip to content

Instantly share code, notes, and snippets.

if (keywords.size() > 0) {
SetJoin<Report, Keyword> keyword = report.join(Report_.keywords);
Expression<Long> keywordExpr = keyword.get(Keyword_.id);
Predicate pred = keywordExpr.in(keywords);
preds.add(pred);
query.having(cb.equal(cb.countDistinct(keyword.get(Keyword_.id)),
keywords.size()));
}
@oak-tree
oak-tree / regular_template_manager_use
Created December 5, 2013 16:41
regular_template_manager_use
render : function(args) {
/*
* using template manager we can allow object use diffrent
* templates.
*/
@oak-tree
oak-tree / keywordControllerTest
Created November 28, 2013 10:01
mock testing with controller...
package org.jpp.api.controller;
import org.apache.log4j.Logger;
import org.jpp.domain.Keyword;
import org.jpp.service.domain.KeywordService;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
save:function (nousevar,settings) {
//var url = this.parentType + '/' + this.parentId + '/' + this.innerObjectType + 's' + '/add/' + innerObjectId
url = this.urlRoot();
//var url = "keyword/" + this.id + "/superKeywords/add/" + superId
console.log('add relation between ' + this.parentId + ' and ' + this.id);
var self = this;
render : function() {
var that = this;
TemplateManager.get(this.template, function(template) {
$(that.el).html(template({
"canEdit" : that.canEdit,
"innerId" : that.options.innerId,
"innerType" : that.model.innerObjectType +'s',