Ignore:
Timestamp:
Jan 27, 2010, 9:58:59 AM (10 years ago)
Author:
keesvb
Message:

changed domain model for events and protocol parameters, and for template field storage, added NuGO PPS3 events, added searchable plugin for full text queries, corrected a few HTML errors in create study

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/dbnp/studycapturing/Event.groovy

    r124 r139  
    22
    33import groovy.time.*
    4 
    54
    65/**
     
    1110class Event {
    1211
    13     Subject subject
    14     EventDescription eventDescription
    15     Date startTime
    16     Date endTime
     12        Subject subject
     13        EventDescription eventDescription
     14        Date startTime
     15        Date endTime
     16        Map parameterStringValues
     17        Map parameterIntegerValues
     18        Map parameterFloatValues
     19
     20        static hasMany = [
     21                parameterStringValues : String, // stores both STRING and STRINGLIST items (latter should be checked against the list)
     22                parameterIntegerValues : int,
     23                parameterFloatValues : float
     24        ]
     25
     26        // static constraints = { }
     27
     28        def getDuration() {
     29                //endTime - startTime  // this is not documented and does not work either
     30                // so, it's useless.
     31                // thus, do this manually as follows
     32
     33                def timeMillis = (endTime.getTime() - startTime.getTime()).abs()
     34                def days = (timeMillis / (1000 * 60 * 60 * 24)).toInteger()
     35                def hours = (timeMillis / (1000 * 60 * 60)).toInteger()
     36                def minutes = (timeMillis / (1000 * 60)).toInteger()
     37                def seconds = (timeMillis / 1000).toInteger()
     38                def millis = (timeMillis % 1000).toInteger()
     39
     40                return new Duration(days, hours, minutes, seconds, millis)
     41        }
    1742
    1843
    19     // static constraints = { }
    20     def getDuration() {
    21         //endTime - startTime  // this is not documented and does not work either
    22                                // so, it's useless.
    23                                // thus, do this manually as follows
    24 
    25         def timeMillis = (endTime.getTime() - startTime.getTime()).abs()
    26         def days    = (timeMillis/(1000*60*60*24)).toInteger()
    27         def hours   = (timeMillis/(1000*60*60)).toInteger()
    28         def minutes = (timeMillis/(1000*60)).toInteger()
    29         def seconds = (timeMillis/1000).toInteger()
    30         def millis  = (timeMillis%1000).toInteger()
    31 
    32         return new Duration(days,hours,minutes,seconds,millis)
    33     }
    34 
    35 
    36     def getDurationString()
    37     {
    38         def d = getDuration()
    39         return  "${d.days} days, ${d.hours} hrs, ${d.minutes} min, ${d.seconds} sec."
    40     }
     44        def getDurationString() {
     45                def d = getDuration()
     46                return "${d.days} days, ${d.hours} hrs, ${d.minutes} min, ${d.seconds} sec."
     47        }
    4148
    4249
Note: See TracChangeset for help on using the changeset viewer.