Package models.common
Class Study
- java.lang.Object
-
- models.common.Study
-
@Entity public class Study extends java.lang.ObjectDB entity of a study. Used for JSON marshalling and JPA persistance. This entity has all properties of a study but not the results of a study. The results of a study are stored in StudyResults and ComponentResult. A study consists of a list components and their model is Component. It can have several Batches. Default values, where necessary, are at the fields or in the constructor. For the GUI a different model (models.gui.StudyProperties) is used.
-
-
Field Summary
Fields Modifier and Type Field Description static intSERIAL_VERSIONVersion of this model used for serialisation (e.g.static java.lang.StringSTUDYstatic java.lang.StringUSERS
-
Constructor Summary
Constructors Constructor Description Study()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAllUsers(java.util.List<User> userList)voidaddBatch(Batch batch)Adds a batch to this study and the study to the batch.voidaddComponent(Component component)voidaddUser(User user)Adds a user to this study and the study to the user.booleanequals(java.lang.Object obj)java.util.List<Batch>getBatchList()java.lang.StringgetComments()ComponentgetComponent(int position)Gets the component of this study at the given position.java.util.List<Component>getComponentList()java.lang.IntegergetComponentPosition(Component component)Returns the position (index+1) of the component in the list of components of this study or null if it doesn't exist.java.sql.TimestampgetDate()BatchgetDefaultBatch()java.lang.StringgetDescription()java.lang.StringgetDescriptionHash()java.lang.StringgetDirName()java.lang.StringgetEndRedirectUrl()java.util.Optional<Component>getFirstComponent()java.lang.LonggetId()java.util.Optional<Component>getLastComponent()java.util.Optional<Component>getNextComponent(Component component)java.lang.StringgetStudyEntryMsg()java.lang.StringgetStudyInput()java.lang.StringgetTitle()java.util.Set<User>getUserList()java.lang.StringgetUuid()booleanhasComponent(Component component)inthashCode()booleanhasUser(User user)booleanisActive()booleanisAllowPreview()booleanisGroupStudy()booleanisLinearStudy()booleanisLocked()voidremoveAllUsers(java.util.List<User> userList)voidremoveBatch(Batch batch)Removes a batch from this study and the study from the batch.voidremoveComponent(Component component)voidremoveUser(User user)Removes a user from this study and the study from the user.voidsetActive(boolean active)voidsetAllowPreview(boolean allowPreview)voidsetComments(java.lang.String comments)voidsetDate(java.sql.Timestamp timestamp)voidsetDescription(java.lang.String description)voidsetDirName(java.lang.String dirName)voidsetEndRedirectUrl(java.lang.String endRedirectUrl)voidsetGroupStudy(boolean groupStudy)voidsetId(java.lang.Long id)voidsetLinearStudy(boolean linearStudy)voidsetLocked(boolean locked)voidsetStudyEntryMsg(java.lang.String studyEntryMsg)voidsetStudyInput(java.lang.String studyInput)voidsetTitle(java.lang.String title)voidsetUuid(java.lang.String uuid)java.lang.StringtoString()
-
-
-
Field Detail
-
SERIAL_VERSION
public static final int SERIAL_VERSION
Version of this model used for serialisation (e.g. JSON marshaling)- See Also:
- Constant Field Values
-
USERS
public static final java.lang.String USERS
- See Also:
- Constant Field Values
-
STUDY
public static final java.lang.String STUDY
- See Also:
- Constant Field Values
-
-
Method Detail
-
setId
public void setId(java.lang.Long id)
-
getId
public java.lang.Long getId()
-
setUuid
public void setUuid(java.lang.String uuid)
-
getUuid
public java.lang.String getUuid()
-
setTitle
public void setTitle(java.lang.String title)
-
getTitle
public java.lang.String getTitle()
-
setDescription
public void setDescription(java.lang.String description)
-
getDescription
public java.lang.String getDescription()
-
getDescriptionHash
public java.lang.String getDescriptionHash()
-
setDirName
public void setDirName(java.lang.String dirName)
-
getDirName
public java.lang.String getDirName()
-
setComments
public void setComments(java.lang.String comments)
-
getComments
public java.lang.String getComments()
-
setDate
public void setDate(java.sql.Timestamp timestamp)
-
getDate
public java.sql.Timestamp getDate()
-
setLocked
public void setLocked(boolean locked)
-
isLocked
public boolean isLocked()
-
isActive
public boolean isActive()
-
setActive
public void setActive(boolean active)
-
isGroupStudy
public boolean isGroupStudy()
-
setGroupStudy
public void setGroupStudy(boolean groupStudy)
-
isLinearStudy
public boolean isLinearStudy()
-
setLinearStudy
public void setLinearStudy(boolean linearStudy)
-
isAllowPreview
public boolean isAllowPreview()
-
setAllowPreview
public void setAllowPreview(boolean allowPreview)
-
getStudyInput
public java.lang.String getStudyInput()
-
setStudyInput
public void setStudyInput(java.lang.String studyInput)
-
getEndRedirectUrl
public java.lang.String getEndRedirectUrl()
-
setEndRedirectUrl
public void setEndRedirectUrl(java.lang.String endRedirectUrl)
-
getStudyEntryMsg
public java.lang.String getStudyEntryMsg()
-
setStudyEntryMsg
public void setStudyEntryMsg(java.lang.String studyEntryMsg)
-
getUserList
public java.util.Set<User> getUserList()
-
addUser
public void addUser(User user)
Adds a user to this study and the study to the user. Because Study is the owning side of the relationship, both updates are handled here to have one source of truth.
-
addAllUsers
public void addAllUsers(java.util.List<User> userList)
-
removeUser
public void removeUser(User user)
Removes a user from this study and the study from the user. Because Study is the owning side of the relationship, both updates are handled here to have one source of truth.
-
removeAllUsers
public void removeAllUsers(java.util.List<User> userList)
-
hasUser
public boolean hasUser(User user)
-
getComponentList
public java.util.List<Component> getComponentList()
-
getComponent
public Component getComponent(int position)
Gets the component of this study at the given position. The smallest position is 1 (and not 0 as in an array).
-
getComponentPosition
public java.lang.Integer getComponentPosition(Component component)
Returns the position (index+1) of the component in the list of components of this study or null if it doesn't exist.
-
addComponent
public void addComponent(Component component)
-
removeComponent
public void removeComponent(Component component)
-
hasComponent
public boolean hasComponent(Component component)
-
getFirstComponent
public java.util.Optional<Component> getFirstComponent()
-
getLastComponent
public java.util.Optional<Component> getLastComponent()
-
getBatchList
public java.util.List<Batch> getBatchList()
-
addBatch
public void addBatch(Batch batch)
Adds a batch to this study and the study to the batch. Because Study is the owning side of the relationship, both updates are handled here to have one source of truth.
-
removeBatch
public void removeBatch(Batch batch)
Removes a batch from this study and the study from the batch. Because Study is the owning side of the relationship, both updates are handled here to have one source of truth.
-
getDefaultBatch
public Batch getDefaultBatch()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-