use of org.jbei.ice.storage.DAOException in project ice by JBEI.
the class RemoteShareModelDAO method getByFolder.
public List<RemoteShareModel> getByFolder(Folder folder) {
try {
CriteriaQuery<RemoteShareModel> query = getBuilder().createQuery(RemoteShareModel.class);
Root<RemoteShareModel> from = query.from(RemoteShareModel.class);
Join<RemoteShareModel, Permission> permission = from.join("permission");
query.where(getBuilder().equal(permission.get("folder"), folder));
return currentSession().createQuery(query).list();
} catch (HibernateException he) {
Logger.error(he);
throw new DAOException(he);
}
}
use of org.jbei.ice.storage.DAOException in project ice by JBEI.
the class RequestDAO method getCount.
public int getCount(SampleRequestStatus status, String filter) {
try {
CriteriaQuery<Long> query = getBuilder().createQuery(Long.class);
Root<Request> from = query.from(Request.class);
query.select(getBuilder().countDistinct(from.get("id")));
List<Predicate> predicates = createPredicates(from, filter, status);
if (!predicates.isEmpty())
query.where(predicates.toArray(new Predicate[predicates.size()]));
return currentSession().createQuery(query).uniqueResult().intValue();
} catch (HibernateException he) {
Logger.error(he);
throw new DAOException(he);
}
}
use of org.jbei.ice.storage.DAOException in project ice by JBEI.
the class SampleDAO method getSamplesByEntry.
public List<Sample> getSamplesByEntry(Entry entry) {
try {
CriteriaQuery<Sample> query = getBuilder().createQuery(Sample.class);
Root<Sample> from = query.from(Sample.class);
query.where(getBuilder().equal(from.get("entry"), entry));
return currentSession().createQuery(query).list();
} catch (HibernateException e) {
Logger.error(e);
throw new DAOException(e);
}
}
use of org.jbei.ice.storage.DAOException in project ice by JBEI.
the class SampleDAO method hasSample.
public boolean hasSample(Entry entry) {
try {
CriteriaQuery<Long> query = getBuilder().createQuery(Long.class);
Root<Sample> from = query.from(Sample.class);
query.select(getBuilder().countDistinct(from.get("id")));
query.where(getBuilder().equal(from.get("entry"), entry));
return currentSession().createQuery(query).setMaxResults(1).uniqueResult() > 0;
} catch (HibernateException e) {
Logger.error(e);
throw new DAOException(e);
}
}
use of org.jbei.ice.storage.DAOException in project ice by JBEI.
the class SequenceDAO method getSequenceString.
public Optional<String> getSequenceString(Entry entry) {
try {
CriteriaQuery<String> query = getBuilder().createQuery(String.class);
Root<Sequence> from = query.from(Sequence.class);
query.select(from.get("sequence")).where(getBuilder().equal(from.get("entry"), entry));
return currentSession().createQuery(query).uniqueResultOptional();
} catch (HibernateException he) {
Logger.error(he);
throw new DAOException(he);
}
}
Aggregations