Package daos.common
Class ComponentResultDao
- java.lang.Object
-
- daos.common.AbstractDao
-
- daos.common.ComponentResultDao
-
@Singleton public class ComponentResultDao extends AbstractDao
DAO for ComponentResult entity
-
-
Field Summary
-
Fields inherited from class daos.common.AbstractDao
jpa
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendData(java.lang.Long id, java.lang.String data)Append data to 'data' field and replace data in 'dataShort' and 'dataSize'intcount()intcountByComponent(Component component)Returns the number of ComponentResults belonging to the given Component.voidcreate(ComponentResult componentResult)java.util.List<ComponentResult>findAllByComponent(Component component)java.util.List<ComponentResult>findAllByComponent(Component component, int first, int max)Returns paginated ComponentResult that belong to the given Component We can't use ScrollableResults for pagination since the MySQL Hibernate driver doesn't support it (https://stackoverflow.com/a/2826512/1278769)java.util.List<java.lang.Long>findAllIdsWhereDataSizeIsNull()Fetches all ComponentResults without 'dataSize' (is null).ComponentResultfindById(java.lang.Long id)java.util.List<ComponentResult>findByIds(java.util.List<java.lang.Long> ids)java.util.List<java.lang.Long>findIdsByComponentIds(java.util.List<java.lang.Long> componentIds)java.util.List<java.lang.Long>findIdsByComponentResultIds(java.util.List<java.lang.Long> crids)Takes a list component result IDs and checks if they exist in the database.java.util.List<java.lang.Long>findIdsByComponentUuids(java.util.List<java.lang.String> componentUuids)java.util.List<java.lang.Long>findIdsByStudyIds(java.util.List<java.lang.Long> studyIds)java.util.List<java.lang.Long>findIdsByStudyResultId(java.lang.Long srid)java.util.List<java.lang.Long>findIdsByStudyUuids(java.util.List<java.lang.String> studyUuids)java.util.List<java.lang.Long>findOrderedIdsByOrderedStudyResultIds(java.util.List<java.lang.Long> orderedSrids)Returns a list of component result IDs that belong to the given list of study result IDs.java.lang.StringgetData(java.lang.Long id)Get 'data' field without fetching the whole row.voidpurgeData(java.lang.Long id)voidrefresh(ComponentResult componentResult)voidremove(ComponentResult componentResult)voidreplaceData(java.lang.Long id, java.lang.String data)Overwrite data in 'data' fields (data, dataShort, dataSize)voidsetDataSizeAndDataShort(java.lang.Long id)Only set the 'dataShort' and 'dataSize' field with data from 'data' (used only during update from an old version of JATOS that didn't have those fields yet).voidsetQuotaReached(java.lang.Long componentResultId)longsizeByStudy(Study study)Returns data size (in Byte) that is occupied by the 'data' field of all component results belonging to the given study.voidupdate(ComponentResult componentResult)
-
-
-
Method Detail
-
create
public void create(ComponentResult componentResult)
-
update
public void update(ComponentResult componentResult)
-
replaceData
public void replaceData(java.lang.Long id, java.lang.String data)Overwrite data in 'data' fields (data, dataShort, dataSize)
-
purgeData
public void purgeData(java.lang.Long id)
-
appendData
public void appendData(java.lang.Long id, java.lang.String data)Append data to 'data' field and replace data in 'dataShort' and 'dataSize'
-
setDataSizeAndDataShort
public void setDataSizeAndDataShort(java.lang.Long id)
Only set the 'dataShort' and 'dataSize' field with data from 'data' (used only during update from an old version of JATOS that didn't have those fields yet).
-
getData
public java.lang.String getData(java.lang.Long id)
Get 'data' field without fetching the whole row. The result is of a different type depending on the database in use, MySQL or H2. So we have to treat them differently to get the String.
-
remove
public void remove(ComponentResult componentResult)
-
refresh
public void refresh(ComponentResult componentResult)
-
findById
public ComponentResult findById(java.lang.Long id)
-
findByIds
public java.util.List<ComponentResult> findByIds(java.util.List<java.lang.Long> ids)
-
count
public int count()
-
countByComponent
public int countByComponent(Component component)
Returns the number of ComponentResults belonging to the given Component.
-
findAllIdsWhereDataSizeIsNull
public java.util.List<java.lang.Long> findAllIdsWhereDataSizeIsNull()
Fetches all ComponentResults without 'dataSize' (is null). This is used only during update from an old version of JATOS that didn't have those fields yet.
-
findAllByComponent
public java.util.List<ComponentResult> findAllByComponent(Component component)
-
findAllByComponent
public java.util.List<ComponentResult> findAllByComponent(Component component, int first, int max)
Returns paginated ComponentResult that belong to the given Component We can't use ScrollableResults for pagination since the MySQL Hibernate driver doesn't support it (https://stackoverflow.com/a/2826512/1278769)
-
sizeByStudy
public long sizeByStudy(Study study)
Returns data size (in Byte) that is occupied by the 'data' field of all component results belonging to the given study.
-
findIdsByComponentIds
public java.util.List<java.lang.Long> findIdsByComponentIds(java.util.List<java.lang.Long> componentIds)
-
findIdsByComponentUuids
public java.util.List<java.lang.Long> findIdsByComponentUuids(java.util.List<java.lang.String> componentUuids)
-
findIdsByStudyIds
public java.util.List<java.lang.Long> findIdsByStudyIds(java.util.List<java.lang.Long> studyIds)
-
findIdsByStudyUuids
public java.util.List<java.lang.Long> findIdsByStudyUuids(java.util.List<java.lang.String> studyUuids)
-
findIdsByStudyResultId
public java.util.List<java.lang.Long> findIdsByStudyResultId(java.lang.Long srid)
-
findOrderedIdsByOrderedStudyResultIds
public java.util.List<java.lang.Long> findOrderedIdsByOrderedStudyResultIds(java.util.List<java.lang.Long> orderedSrids)
Returns a list of component result IDs that belong to the given list of study result IDs. The order of the study results is kept, e.g., if the study result IDs are sr1, sr2, sr3 - then in the returned list are first all component result IDs of sr1, then all of sr2, and last all of sr3.
-
findIdsByComponentResultIds
public java.util.List<java.lang.Long> findIdsByComponentResultIds(java.util.List<java.lang.Long> crids)
Takes a list component result IDs and checks if they exist in the database. Returns only the existing ones.
-
setQuotaReached
public void setQuotaReached(java.lang.Long componentResultId)
-
-