Package services.gui
Class BatchService
- java.lang.Object
-
- services.gui.BatchService
-
@Singleton public class BatchService extends java.lang.ObjectService class for JATOS Controllers (not Publix).
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDefaultAllowedWorkerTypes(Batch batch)BatchbindToBatch(BatchProperties props)BatchPropertiesbindToProperties(Batch batch)Batchclone(Batch batch)Clones a Batch but does not persists.BatchcreateDefaultBatch()Create and initialises default Batch.BatchfetchBatch(java.lang.Long batchId, Study study)Gets the batch with given ID from the database or if the batchId is -1 returns the default batch of this study.BatchgetBatchFromIdOrUuid(java.lang.String idOrUuid)BatchgetBatchOrDefaultBatch(java.lang.Long batchId, Study study)voidinitAndPersistBatch(Batch batch, Study study, User signedinUser)voidinitBatch(Batch batch, Study study)voidremove(Batch batch, User signedinUser)Removes batch, all it's StudyResults, ComponentResults, GroupResults and Workers (if they don't belong to another batch) and persists the changes to the database.voidupdateBatch(Batch batch, BatchProperties updatedBatchProps)Updates the given batch in the database with the given BatchPropertiesvoidvalidate(Batch batch)Validates the batch by converting it to BatchProperties and uses its validate method.
-
-
-
Method Detail
-
clone
public Batch clone(Batch batch)
Clones a Batch but does not persists. Doesn't copy batch session data and version.
-
createDefaultBatch
public Batch createDefaultBatch()
Create and initialises default Batch. Each Study has a default batch. Does NOT persist.
-
addDefaultAllowedWorkerTypes
public void addDefaultAllowedWorkerTypes(Batch batch)
-
updateBatch
public void updateBatch(Batch batch, BatchProperties updatedBatchProps)
Updates the given batch in the database with the given BatchProperties
-
bindToProperties
public BatchProperties bindToProperties(Batch batch)
-
bindToBatch
public Batch bindToBatch(BatchProperties props)
-
fetchBatch
public Batch fetchBatch(java.lang.Long batchId, Study study) throws NotFoundException
Gets the batch with given ID from the database or if the batchId is -1 returns the default batch of this study. If the batch doesn't exist it throws an NotFoundException.- Throws:
NotFoundException
-
remove
public void remove(Batch batch, User signedinUser)
Removes batch, all it's StudyResults, ComponentResults, GroupResults and Workers (if they don't belong to another batch) and persists the changes to the database.
-
validate
public void validate(Batch batch) throws javax.validation.ValidationException
Validates the batch by converting it to BatchProperties and uses its validate method. Throws ValidationException in case of an error.- Throws:
javax.validation.ValidationException
-
getBatchFromIdOrUuid
public Batch getBatchFromIdOrUuid(java.lang.String idOrUuid)
-
-