cst.common.businessLayer
Class TrialActivityModel
java.lang.Object
cst.common.businessLayer.TrialActivityModel
- All Implemented Interfaces:
- java.lang.Cloneable
public class TrialActivityModel
- extends java.lang.Object
- implements java.lang.Cloneable
An activity comprising a sequence of steps which are applied to each
subject. A TrialActivityModel
has the following properties:
-
a display name that appears in forms
-
a data storage name which corresponds to the name of a MySQL table
which stores the data for an activity
-
a primary key field which identifies a subject. It is an instance of
TextFieldModel
.
-
a collection of date fields which represent activity steps. The date
fields are instances of
DateFieldModel
.
-
an order position which tells the Logging Tool where the activity should
be represented in the tabbed pane of activities
-
comments - free text notes field for end-users.
-
a maximum comment length used to ensure that comment values don't exceed
the space allocated for the field in the database.
-
enforceChronology - if true, then the validation method will identify
errors when the sequence of dates do not appear in non-descending order.
-
useStrictValidation - if true, then the validation method will identify
errors when blank date fields appear before filled date fields.
The class has the following major duties:
-
behave as a data container object which holds values for date fields
and free-text comments
-
indicate whether the the activity record is complete. This is used by the
Logging Tool's filter feature for showing complete or incomplete records.
-
detect changes in the fields or comments between two instances of
TrialActivityModel
. This is used to generate instances of
TrialActivityChange
that form the audit
trail of changes made to a subject.
-
validate an instance of
TrialActivityModel
. Validation is
effected by the enforceChronology
and useStrictValidation
flags.
enforceChronology
determines whether the field dates must
appear in non-descending chronological order. useStrictValidation
determines whether a date field can be preceeded by blank field values.
-
cloning. The clone method is used by
TrialSubjectModelFactory
to create new instances of TrialSubjectModel
based on a
template instance. The clone method is also used to support the notions of
original and copy records in cst.loggingTool.DemonstrationLoggingService
.
The demonstration service uses the original and copy instances to simulate
data persistence that would normally done through a database.
Copyright 2010 Medical Research Council Unit for Lifelong Health and Ageing
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- Version:
- 1.0
- Author:
- Kevin Garwood (kgarwood@users.sourceforge.net)
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SQL_DATE_FORMAT
public static final java.text.SimpleDateFormat SQL_DATE_FORMAT
TrialActivityModel
public TrialActivityModel()
getIdentifier
public java.lang.String getIdentifier()
setIdentifier
public void setIdentifier(java.lang.String identifier)
getPrimaryKeyFieldModel
public TextFieldModel getPrimaryKeyFieldModel()
setPrimaryKeyFieldModel
public void setPrimaryKeyFieldModel(TextFieldModel primaryKeyFieldModel)
getOrderPosition
public int getOrderPosition()
- Returns:
- the orderPosition
setOrderPosition
public void setOrderPosition(int orderPosition)
- Parameters:
orderPosition
- the orderPosition to set
getDisplayName
public java.lang.String getDisplayName()
- Returns:
- the displayName
setDisplayName
public void setDisplayName(java.lang.String displayName)
- Parameters:
aspectName
- the aspectName to set
getDataStorageName
public java.lang.String getDataStorageName()
- Returns:
- the dataStorageName
getDateFieldFromDataStorageName
public DateFieldModel getDateFieldFromDataStorageName(java.lang.String fieldDataStorageName)
getDateFieldValue
public java.util.Date getDateFieldValue(java.lang.String fieldDataStorageName)
setDateFieldValue
public void setDateFieldValue(java.lang.String fieldDataStorageName,
java.util.Date date)
setDataStorageName
public void setDataStorageName(java.lang.String dataStorageName)
- Parameters:
dataStorageName
- the dataStorageName to set
isCompleted
public boolean isCompleted()
sortPositionsOfDateFieldModels
public void sortPositionsOfDateFieldModels()
getDateFieldModels
public java.util.ArrayList<DateFieldModel> getDateFieldModels()
addField
public void addField(DateFieldModel dateFieldModel)
getComments
public java.lang.String getComments()
- Returns:
- the comments
setComments
public void setComments(java.lang.String comments)
- Parameters:
comments
- the comments to set
allowBlankFields
public boolean allowBlankFields()
setAllowBlankFields
public void setAllowBlankFields(boolean allowBlankFields)
enforceChronology
public boolean enforceChronology()
setEnforceChronology
public void setEnforceChronology(boolean enforceChronology)
getMaximumCommentLength
public int getMaximumCommentLength()
setMaximumCommentLength
public void setMaximumCommentLength(int maximumCommentLength)
print
public void print(java.io.PrintStream out)
detectTrialActivityChanges
public static java.util.ArrayList<TrialActivityChange> detectTrialActivityChanges(java.lang.String userID,
TrialActivityModel originalActivityModel,
TrialActivityModel revisedActivityModel,
java.lang.String dataSourceName)
validate
public static void validate(TrialActivityModel trialActivityModel)
throws CSTException
- Throws:
CSTException
clone
public java.lang.Object clone()
- Overrides:
clone
in class java.lang.Object