}
}
public Content getSide(Integer id, Integer siteId, Integer channelId,
boolean next, boolean cacheable) {
Finder f = Finder.create("from Content bean where 1=1");
if (channelId != null) {
f.append(" and bean.channel.id=:channelId");
f.setParam("channelId", channelId);
} else if (siteId != null) {
f.append(" and bean.site.id=:siteId");
f.setParam("siteId", siteId);
}
if (next) {
f.append(" and bean.id>:id");
f.setParam("id", id);
f.append(" and bean.status=" + ContentCheck.CHECKED);
f.append(" order by bean.id asc");
} else {
f.append(" and bean.id<:id");
f.setParam("id", id);
f.append(" and bean.status=" + ContentCheck.CHECKED);
f.append(" order by bean.id desc");
}
Query query = f.createQuery(getSession());
query.setCacheable(cacheable).setMaxResults(1);
return (Content) query.uniqueResult();
}