@Test public void testGetCriteria() { context.checking(new Expectations() { { oneOf(hibernateSession).createCriteria(DomainGroup.class); } }); Criteria result = sut.getCriteria(hibernateSession); assertNotNull(result); context.assertIsSatisfied(); }
public Criteria getCriteria(final Session hibernateSession) { Criteria criteria = hibernateSession.createCriteria(DomainGroup.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("description")); fields.add(getColumn("name")); fields.add(getColumn("shortName")); fields.add(Projections.property("publicGroup").as("isPublic")); fields.add(getColumn("updatesCount")); fields.add(getColumn("followersCount")); fields.add(getColumn("dateAdded")); fields.add(getColumn("avatarId")); fields.add(getColumn("avatarCropSize")); fields.add(getColumn("avatarCropX")); fields.add(getColumn("avatarCropY")); fields.add(getColumn("bannerId")); fields.add(getColumn("overview")); fields.add(getColumn("commentable")); fields.add(getColumn("streamPostable")); fields.add(getColumn("url")); fields.add(getColumn("stickyActivityId")); fields.add(Projections.property("cb.accountId").as("personCreatedByAccountId")); fields.add(Projections.property("cb.displayName").as("personCreatedByDisplayName")); fields.add(Projections.property("cb.companyName").as("personCreatedByCompanyName")); fields.add(Projections.property("stream.id").as("streamId")); criteria.setProjection(fields); criteria.createAlias("createdBy", "cb"); criteria.createAlias("streamScope", "stream"); criteria.add(Restrictions.eq("isPending", false)); ModelViewResultTransformer<DomainGroupModelView> resultTransformer = new ModelViewResultTransformer<DomainGroupModelView>(new DomainGroupModelViewFactory()); criteria.setResultTransformer(resultTransformer); return criteria; }
DomainGroupQueryStrategy { public Criteria getCriteria(final Session hibernateSession) { Criteria criteria = hibernateSession.createCriteria(DomainGroup.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("description")); fields.add(getColumn("name")); fields.add(getColumn("shortName")); fields.add(Projections.property("publicGroup").as("isPublic")); fields.add(getColumn("updatesCount")); fields.add(getColumn("followersCount")); fields.add(getColumn("dateAdded")); fields.add(getColumn("avatarId")); fields.add(getColumn("avatarCropSize")); fields.add(getColumn("avatarCropX")); fields.add(getColumn("avatarCropY")); fields.add(getColumn("bannerId")); fields.add(getColumn("overview")); fields.add(getColumn("commentable")); fields.add(getColumn("streamPostable")); fields.add(getColumn("url")); fields.add(getColumn("stickyActivityId")); fields.add(Projections.property("cb.accountId").as("personCreatedByAccountId")); fields.add(Projections.property("cb.displayName").as("personCreatedByDisplayName")); fields.add(Projections.property("cb.companyName").as("personCreatedByCompanyName")); fields.add(Projections.property("stream.id").as("streamId")); criteria.setProjection(fields); criteria.createAlias("createdBy", "cb"); criteria.createAlias("streamScope", "stream"); criteria.add(Restrictions.eq("isPending", false)); ModelViewResultTransformer<DomainGroupModelView> resultTransformer = new ModelViewResultTransformer<DomainGroupModelView>(new DomainGroupModelViewFactory()); criteria.setResultTransformer(resultTransformer); return criteria; } }
DomainGroupQueryStrategy { public Criteria getCriteria(final Session hibernateSession) { Criteria criteria = hibernateSession.createCriteria(DomainGroup.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("description")); fields.add(getColumn("name")); fields.add(getColumn("shortName")); fields.add(Projections.property("publicGroup").as("isPublic")); fields.add(getColumn("updatesCount")); fields.add(getColumn("followersCount")); fields.add(getColumn("dateAdded")); fields.add(getColumn("avatarId")); fields.add(getColumn("avatarCropSize")); fields.add(getColumn("avatarCropX")); fields.add(getColumn("avatarCropY")); fields.add(getColumn("bannerId")); fields.add(getColumn("overview")); fields.add(getColumn("commentable")); fields.add(getColumn("streamPostable")); fields.add(getColumn("url")); fields.add(getColumn("stickyActivityId")); fields.add(Projections.property("cb.accountId").as("personCreatedByAccountId")); fields.add(Projections.property("cb.displayName").as("personCreatedByDisplayName")); fields.add(Projections.property("cb.companyName").as("personCreatedByCompanyName")); fields.add(Projections.property("stream.id").as("streamId")); criteria.setProjection(fields); criteria.createAlias("createdBy", "cb"); criteria.createAlias("streamScope", "stream"); criteria.add(Restrictions.eq("isPending", false)); ModelViewResultTransformer<DomainGroupModelView> resultTransformer = new ModelViewResultTransformer<DomainGroupModelView>(new DomainGroupModelViewFactory()); criteria.setResultTransformer(resultTransformer); return criteria; }  }
DomainGroupQueryStrategy { public Criteria getCriteria(final Session hibernateSession) { Criteria criteria = hibernateSession.createCriteria(DomainGroup.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("description")); fields.add(getColumn("name")); fields.add(getColumn("shortName")); fields.add(Projections.property("publicGroup").as("isPublic")); fields.add(getColumn("updatesCount")); fields.add(getColumn("followersCount")); fields.add(getColumn("dateAdded")); fields.add(getColumn("avatarId")); fields.add(getColumn("avatarCropSize")); fields.add(getColumn("avatarCropX")); fields.add(getColumn("avatarCropY")); fields.add(getColumn("bannerId")); fields.add(getColumn("overview")); fields.add(getColumn("commentable")); fields.add(getColumn("streamPostable")); fields.add(getColumn("url")); fields.add(getColumn("stickyActivityId")); fields.add(Projections.property("cb.accountId").as("personCreatedByAccountId")); fields.add(Projections.property("cb.displayName").as("personCreatedByDisplayName")); fields.add(Projections.property("cb.companyName").as("personCreatedByCompanyName")); fields.add(Projections.property("stream.id").as("streamId")); criteria.setProjection(fields); criteria.createAlias("createdBy", "cb"); criteria.createAlias("streamScope", "stream"); criteria.add(Restrictions.eq("isPending", false)); ModelViewResultTransformer<DomainGroupModelView> resultTransformer = new ModelViewResultTransformer<DomainGroupModelView>(new DomainGroupModelViewFactory()); criteria.setResultTransformer(resultTransformer); return criteria; }  Criteria getCriteria(final Session hibernateSession); }
DomainGroupQueryStrategy { public Criteria getCriteria(final Session hibernateSession) { Criteria criteria = hibernateSession.createCriteria(DomainGroup.class); ProjectionList fields = Projections.projectionList(); fields.add(getColumn("id")); fields.add(getColumn("description")); fields.add(getColumn("name")); fields.add(getColumn("shortName")); fields.add(Projections.property("publicGroup").as("isPublic")); fields.add(getColumn("updatesCount")); fields.add(getColumn("followersCount")); fields.add(getColumn("dateAdded")); fields.add(getColumn("avatarId")); fields.add(getColumn("avatarCropSize")); fields.add(getColumn("avatarCropX")); fields.add(getColumn("avatarCropY")); fields.add(getColumn("bannerId")); fields.add(getColumn("overview")); fields.add(getColumn("commentable")); fields.add(getColumn("streamPostable")); fields.add(getColumn("url")); fields.add(getColumn("stickyActivityId")); fields.add(Projections.property("cb.accountId").as("personCreatedByAccountId")); fields.add(Projections.property("cb.displayName").as("personCreatedByDisplayName")); fields.add(Projections.property("cb.companyName").as("personCreatedByCompanyName")); fields.add(Projections.property("stream.id").as("streamId")); criteria.setProjection(fields); criteria.createAlias("createdBy", "cb"); criteria.createAlias("streamScope", "stream"); criteria.add(Restrictions.eq("isPending", false)); ModelViewResultTransformer<DomainGroupModelView> resultTransformer = new ModelViewResultTransformer<DomainGroupModelView>(new DomainGroupModelViewFactory()); criteria.setResultTransformer(resultTransformer); return criteria; }  Criteria getCriteria(final Session hibernateSession);  }