use of javax.persistence.criteria.CriteriaBuilder in project nikita-noark5-core by HiOA-ABI.
the class BasicRecordService method findBasicRecordByOwnerPaginated.
// All READ operations
@Override
public List<BasicRecord> findBasicRecordByOwnerPaginated(Integer top, Integer skip) {
if (top == null || top > maxPageSize) {
top = maxPageSize;
}
if (skip == null) {
skip = 0;
}
String loggedInUser = SecurityContextHolder.getContext().getAuthentication().getName();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<BasicRecord> criteriaQuery = criteriaBuilder.createQuery(BasicRecord.class);
Root<BasicRecord> from = criteriaQuery.from(BasicRecord.class);
CriteriaQuery<BasicRecord> select = criteriaQuery.select(from);
criteriaQuery.where(criteriaBuilder.equal(from.get("ownedBy"), loggedInUser));
TypedQuery<BasicRecord> typedQuery = entityManager.createQuery(select);
typedQuery.setFirstResult(skip);
typedQuery.setMaxResults(maxPageSize);
return typedQuery.getResultList();
}
use of javax.persistence.criteria.CriteriaBuilder in project nikita-noark5-core by HiOA-ABI.
the class CaseFileService method findCaseFileByOwnerPaginated.
// All READ operations
@Override
public List<CaseFile> findCaseFileByOwnerPaginated(Integer top, Integer skip) {
if (top == null || top > maxPageSize) {
top = maxPageSize;
}
if (skip == null) {
skip = 0;
}
String loggedInUser = SecurityContextHolder.getContext().getAuthentication().getName();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<CaseFile> criteriaQuery = criteriaBuilder.createQuery(CaseFile.class);
Root<CaseFile> from = criteriaQuery.from(CaseFile.class);
CriteriaQuery<CaseFile> select = criteriaQuery.select(from);
criteriaQuery.where(criteriaBuilder.equal(from.get("ownedBy"), loggedInUser));
TypedQuery<CaseFile> typedQuery = entityManager.createQuery(select);
typedQuery.setFirstResult(skip);
typedQuery.setMaxResults(maxPageSize);
return typedQuery.getResultList();
}
use of javax.persistence.criteria.CriteriaBuilder in project nikita-noark5-core by HiOA-ABI.
the class ClassService method findClassByOwnerPaginated.
// All READ operations
@Override
public List<Class> findClassByOwnerPaginated(Integer top, Integer skip) {
if (top == null || top > maxPageSize) {
top = maxPageSize;
}
if (skip == null) {
skip = 0;
}
String loggedInUser = SecurityContextHolder.getContext().getAuthentication().getName();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<Class> criteriaQuery = criteriaBuilder.createQuery(Class.class);
Root<Class> from = criteriaQuery.from(Class.class);
CriteriaQuery<Class> select = criteriaQuery.select(from);
criteriaQuery.where(criteriaBuilder.equal(from.get("ownedBy"), loggedInUser));
TypedQuery<Class> typedQuery = entityManager.createQuery(select);
typedQuery.setFirstResult(skip);
typedQuery.setMaxResults(maxPageSize);
return typedQuery.getResultList();
}
use of javax.persistence.criteria.CriteriaBuilder in project nikita-noark5-core by HiOA-ABI.
the class DocumentDescriptionService method findDocumentDescriptionByOwnerPaginated.
// All READ operations
@Override
public List<DocumentDescription> findDocumentDescriptionByOwnerPaginated(Integer top, Integer skip) {
if (top == null || top > maxPageSize) {
top = maxPageSize;
}
if (skip == null) {
skip = 0;
}
String loggedInUser = SecurityContextHolder.getContext().getAuthentication().getName();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<DocumentDescription> criteriaQuery = criteriaBuilder.createQuery(DocumentDescription.class);
Root<DocumentDescription> from = criteriaQuery.from(DocumentDescription.class);
CriteriaQuery<DocumentDescription> select = criteriaQuery.select(from);
criteriaQuery.where(criteriaBuilder.equal(from.get("ownedBy"), loggedInUser));
TypedQuery<DocumentDescription> typedQuery = entityManager.createQuery(select);
typedQuery.setFirstResult(skip);
typedQuery.setMaxResults(maxPageSize);
return typedQuery.getResultList();
}
use of javax.persistence.criteria.CriteriaBuilder in project nikita-noark5-core by HiOA-ABI.
the class FileService method findFileByOwnerPaginated.
// All READ operations
@Override
public List<File> findFileByOwnerPaginated(Integer top, Integer skip) {
if (top == null || top > maxPageSize) {
top = maxPageSize;
}
if (skip == null) {
skip = 0;
}
String loggedInUser = SecurityContextHolder.getContext().getAuthentication().getName();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<File> criteriaQuery = criteriaBuilder.createQuery(File.class);
Root<File> from = criteriaQuery.from(File.class);
CriteriaQuery<File> select = criteriaQuery.select(from);
criteriaQuery.where(criteriaBuilder.equal(from.get("ownedBy"), loggedInUser));
TypedQuery<File> typedQuery = entityManager.createQuery(select);
typedQuery.setFirstResult(skip);
typedQuery.setMaxResults(maxPageSize);
return typedQuery.getResultList();
}
Aggregations