public class EntryDAO extends HibernateRepository<Entry>
Entry
objects in the database.Constructor and Description |
---|
EntryDAO() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkAddFilter(List<javax.persistence.criteria.Predicate> predicates,
javax.persistence.criteria.Root<Entry> root,
String filter) |
protected String |
columnFieldToString(ColumnField field) |
Entry |
create(Entry entry)
Creates new object in the database
|
List<Long> |
filterByUserId(String userId,
List<Long> entries) |
void |
fullDelete(Entry entry) |
void |
generateNextStrainNameForEntry(Entry entry,
String prefix) |
Entry |
get(long id)
Retrieve an
Entry object from the database by id. |
long |
getAllEntryCount(String filter) |
List<Entry> |
getByName(String name)
Retrieve an
Entry by it's name. |
Entry |
getByPartNumber(String partNumber)
Retrieve an
Entry by it's part number. |
Entry |
getByRecordId(String recordId)
Retrieve an
Entry object in the database by recordId field. |
List<Entry> |
getByVisibility(String ownerEmail,
Visibility visibility,
ColumnField field,
boolean asc,
int start,
int limit,
String filter) |
long |
getByVisibilityCount(String ownerEmail,
Visibility visibility,
String filter) |
long |
getByVisibilityCount(Visibility visibility) |
int |
getDeletedCount(String ownerUserId) |
List<Entry> |
getEntriesByIdSet(List<Long> ids)
Retrieve
Entry objects of the given list of ids. |
protected Entry |
getEntryByField(String field,
String fieldValue) |
String |
getEntrySummary(long id) |
List<String> |
getMatchingEntryPartNumbers(String token,
int limit,
Set<String> include) |
List<String> |
getMatchingPlasmidField(AutoCompleteField field,
String token,
int limit) |
List<Long> |
getOwnerEntryIds(String ownerEmail,
EntryType type)
Retrieves list of entry ids whose owner email column matches the specified ownerEmail parameter,
with a visibility of
|
List<Entry> |
getParents(long entryId)
links are stored in a join table in the form [entry_id, linked_entry_id] which is used
to represent a parent child reln.
|
List<String> |
getRecordTypes(List<Long> list) |
List<Long> |
getVisibleEntryIds(boolean admin,
Group publicGroup) |
long |
ownerEntryCount(Account requester,
String ownerEmail,
Set<Group> accountGroups) |
long |
ownerEntryCount(String ownerEmail) |
List<Entry> |
retrieveAllEntries(ColumnField sort,
boolean asc,
int start,
int limit,
String filter) |
List<Entry> |
retrieveOwnerEntries(String ownerEmail,
ColumnField sort,
boolean asc,
int start,
int limit,
String filter)
Retrieves entries owned by account with specified email and with visibility of "pending" or "ok"
|
List<Entry> |
retrieveUserEntries(Account requester,
String owner,
Set<Group> requesterGroups,
ColumnField sortField,
boolean asc,
int start,
int limit,
String filter)
Retrieves the entries for the specified owner, that the requester has read access to
|
List<Entry> |
retrieveVisibleEntries(Account account,
Set<Group> groups,
ColumnField sortField,
boolean asc,
int start,
int count,
String filter)
Retrieve
Entries visible to everyone. |
int |
setEntryVisibility(List<Long> list,
Visibility ok) |
long |
sharedEntryCount(Account requester,
Set<Group> accountGroups,
String filter)
An entry is shared if requester has explicit read or write permissions of belongs
to a group that have explicit read or write permissions
|
List<Entry> |
sharedWithUserEntries(Account requester,
Set<Group> accountGroups,
ColumnField sort,
boolean asc,
int start,
int limit,
String filter) |
List<Long> |
sharedWithUserEntryIds(Account account,
Set<Group> groups) |
long |
visibleEntryCount(Account account,
Set<Group> groups,
String filter) |
currentSession, delete, get, getBuilder, update
public Entry get(long id)
Entry
object from the database by id.id
- unique local identifier for entry record (typically synthetic database id)DAOException
public String getEntrySummary(long id)
public List<String> getMatchingPlasmidField(AutoCompleteField field, String token, int limit)
public List<String> getMatchingEntryPartNumbers(String token, int limit, Set<String> include)
public Entry getByRecordId(String recordId)
Entry
object in the database by recordId field.recordId
- unique global identifier for entry record (typically UUID)DAOException
public Entry getByPartNumber(String partNumber)
Entry
by it's part number.
If multiple Entries exist with the same part number, this method throws an exception.partNumber
- part number associated with entryDAOException
public List<Entry> getByName(String name)
Entry
by it's name. Note that name is not a unique field
so this could return more than one entryname
- name associated with entryDAOException
- on hibernate exceptionpublic List<Entry> retrieveVisibleEntries(Account account, Set<Group> groups, ColumnField sortField, boolean asc, int start, int count, String filter)
Entries
visible to everyone.DAOException
- on hibernate exceptionprotected void checkAddFilter(List<javax.persistence.criteria.Predicate> predicates, javax.persistence.criteria.Root<Entry> root, String filter)
public long sharedEntryCount(Account requester, Set<Group> accountGroups, String filter)
requester
- account that entries are shared withaccountGroups
- groups that account belongs topublic List<Entry> sharedWithUserEntries(Account requester, Set<Group> accountGroups, ColumnField sort, boolean asc, int start, int limit, String filter)
public List<Entry> retrieveUserEntries(Account requester, String owner, Set<Group> requesterGroups, ColumnField sortField, boolean asc, int start, int limit, String filter)
requester
- account for user making requestowner
- user id of entries' ownerrequesterGroups
- groups that the requester is a member of. Used to check access permissionssortField
- field for sortasc
- sort orderstart
- index to start retrieving records fromlimit
- maximum number of entries to retrieveDAOException
- on HibernateExceptionpublic List<Entry> getEntriesByIdSet(List<Long> ids)
Entry
objects of the given list of ids.ids
- list of ids to retrieveDAOException
public Entry create(Entry entry)
HibernateRepository
create
in interface IRepository<Entry>
create
in class HibernateRepository<Entry>
entry
- DataModel
object to createDataModel
objectpublic void generateNextStrainNameForEntry(Entry entry, String prefix)
public List<Entry> getByVisibility(String ownerEmail, Visibility visibility, ColumnField field, boolean asc, int start, int limit, String filter)
public long getByVisibilityCount(String ownerEmail, Visibility visibility, String filter)
public long getByVisibilityCount(Visibility visibility)
protected String columnFieldToString(ColumnField field)
public List<Entry> retrieveOwnerEntries(String ownerEmail, ColumnField sort, boolean asc, int start, int limit, String filter)
ownerEmail
- email for account whose entries are to be retrievedsort
- field to sort results onasc
- sort orderstart
- start of retrievelimit
- maximum number of records to retrieve fromfilter
- filter for entriesDAOException
- on Hibernate Exceptionpublic List<Long> getOwnerEntryIds(String ownerEmail, EntryType type)
OKor
PENDINGand if not null, matches the type
ownerEmail
- value of owner email column that desired entries must matchtype
- option entry type parameterpublic long getAllEntryCount(String filter)
public List<Entry> retrieveAllEntries(ColumnField sort, boolean asc, int start, int limit, String filter)
public long ownerEntryCount(String ownerEmail)
public long ownerEntryCount(Account requester, String ownerEmail, Set<Group> accountGroups)
public void fullDelete(Entry entry)
public List<Entry> getParents(long entryId)
public int getDeletedCount(String ownerUserId)
public int setEntryVisibility(List<Long> list, Visibility ok)
Copyright © 2017. All rights reserved.