Skip to content

Commit

Permalink
Merge branch 'master' of github.com:CarlosZ/isolda
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosZ committed Jul 26, 2011
2 parents 0ce8e54 + f861a85 commit 2826735
Show file tree
Hide file tree
Showing 21 changed files with 600 additions and 10 deletions.
2 changes: 1 addition & 1 deletion application.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#Grails Metadata file
#Mon Jul 25 17:35:30 CST 2011
app.grails.version=1.3.7
app.name=isolda
app.servlet.version=2.4
app.version=0.1
plugins.hibernate=1.3.7
plugins.joda-time=1.2
plugins.searchable=0.6.1
plugins.spring-security-core=1.1.3
plugins.tomcat=1.3.7
12 changes: 12 additions & 0 deletions grails-app/conf/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,15 @@ log4j = {

warn 'org.mortbay.log'
}

// Added by the Joda-Time plugin:
grails.gorm.default.mapping = {
"user-type" type: org.joda.time.contrib.hibernate.PersistentDateTime, class: org.joda.time.DateTime
"user-type" type: org.joda.time.contrib.hibernate.PersistentDuration, class: org.joda.time.Duration
"user-type" type: org.joda.time.contrib.hibernate.PersistentInstant, class: org.joda.time.Instant
"user-type" type: org.joda.time.contrib.hibernate.PersistentInterval, class: org.joda.time.Interval
"user-type" type: org.joda.time.contrib.hibernate.PersistentLocalDate, class: org.joda.time.LocalDate
"user-type" type: org.joda.time.contrib.hibernate.PersistentLocalTimeAsString, class: org.joda.time.LocalTime
"user-type" type: org.joda.time.contrib.hibernate.PersistentLocalDateTime, class: org.joda.time.LocalDateTime
"user-type" type: org.joda.time.contrib.hibernate.PersistentPeriod, class: org.joda.time.Period
}
47 changes: 47 additions & 0 deletions grails-app/domain/com/clm/isolda/Address.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,54 @@
package com.clm.isolda

import org.apache.commons.lang.builder.ToStringBuilder

class Address {

String address1
String address2
String phoneNumber1
String phoneNumber2
String phoneNumber3

static constraints = {
}

@Override
def boolean equals(o) {
if (this.is(o)) return true
if (!o instanceof Address) return false

Address address = (Address) o

if (address1 != address.address1) return false
if (address2 != address.address2) return false
if (phoneNumber1 != address.phoneNumber1) return false
if (phoneNumber2 != address.phoneNumber2) return false
if (phoneNumber3 != address.phoneNumber3) return false

return true
}

@Override
def int hashCode() {
int result = 17
result = 31 * result + (address1 != null ? address1.hashCode() : 0)
result = 31 * result + (address2 != null ? address2.hashCode() : 0)
result = 31 * result + (phoneNumber1 != null ? phoneNumber1.hashCode() : 0)
result = 31 * result + (phoneNumber2 != null ? phoneNumber2.hashCode() : 0)
result = 31 * result + (phoneNumber3 != null ? phoneNumber3.hashCode() : 0)
return result
}

@Override
def String toString() {
return new ToStringBuilder(this).
append("address1", address1).
append("address2", address2).
append("phoneNumber1", phoneNumber1).
append("phoneNumber2", phoneNumber2).
append("phoneNumber3", phoneNumber3).
toString()
}

}
63 changes: 63 additions & 0 deletions grails-app/domain/com/clm/isolda/Appointment.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,70 @@
package com.clm.isolda

import org.apache.commons.lang.builder.ToStringBuilder
import org.joda.time.LocalDateTime
import org.joda.time.contrib.hibernate.PersistentLocalDateTime

class Appointment {

LocalDateTime date
AppointmentStatus status
String notes
MeasurementSet measurements
String recommendations
Objective objective

static belongsTo = [patient: Patient]

static constraints = {
}

static mapping = {
date(type: PersistentLocalDateTime, lazy: false)
}

@Override
def boolean equals(o) {
if (this.is(o)) return true
if (getClass() != o.class) return false

Appointment that = (Appointment) o

if (date != that.date) return false
if (measurements != that.measurements) return false
if (notes != that.notes) return false
if (objective != that.objective) return false
if (recommendations != that.recommendations) return false
if (status != that.status) return false
if (patient != that.patient) return false

return true
}

@Override
def int hashCode() {
int result = 17
result = 31 + result + (date != null ? date.hashCode() : 0)
result = 31 * result + (status != null ? status.hashCode() : 0)
result = 31 * result + (notes != null ? notes.hashCode() : 0)
result = 31 * result + (measurements != null ? measurements.hashCode() : 0)
result = 31 * result + (recommendations != null ? recommendations.hashCode() : 0)
result = 31 * result + (objective != null ? objective.hashCode() : 0)
result = 31 * result + (patient != null ? patient.hashCode() : 0)
return result
}


@Override
def String toString() {
return new ToStringBuilder(this).
append("date", date).
append("status", status).
append("notes", notes).
append("measurements", measurements).
append("recommendations", recommendations).
append("objective", objective).
append("patient", patient).
toString()
}

}
57 changes: 57 additions & 0 deletions grails-app/domain/com/clm/isolda/DietaryProgram.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,64 @@
package com.clm.isolda

import org.apache.commons.lang.builder.ToStringBuilder
import org.joda.time.LocalDate
import org.joda.time.contrib.hibernate.PersistentLocalDate

class DietaryProgram {

LocalDate startDate
LocalDate endDate
Map<Nutrient, String> nutrientToQuantity

static belongsTo = [patient: Patient]

static hasMany = [possibleRecipes: Recipe]

static constraints = {
}

static mapping = {
startDate(type: PersistentLocalDate, lazy: false)
endDate(type: PersistentLocalDate, lazy: false)
}

@Override
def boolean equals(o) {
if (this.is(o)) return true
if (getClass() != o.class) return false

DietaryProgram that = (DietaryProgram) o

if (endDate != that.endDate) return false
if (nutrientToQuantity != that.nutrientToQuantity) return false
if (possibleRecipes != that.possibleRecipes) return false
if (startDate != that.startDate) return false
if (patient != that.patient) return false

return true
}

@Override
def int hashCode() {
int result
result = (startDate != null ? startDate.hashCode() : 0)
result = 31 * result + (endDate != null ? endDate.hashCode() : 0)
result = 31 * result + (nutrientToQuantity != null ? nutrientToQuantity.hashCode() : 0)
result = 31 * result + (possibleRecipes != null ? possibleRecipes.hashCode() : 0)
result = 31 * result + (patient != null ? patient.hashCode() : 0)
return result
}


@Override
def String toString() {
return new ToStringBuilder(this).
append("endDate", endDate).
append("startDate", startDate).
append("nutrientToQuantity", nutrientToQuantity).
append("possibleRecipes", possibleRecipes).
append("patient", patient).
toString()
}

}
40 changes: 40 additions & 0 deletions grails-app/domain/com/clm/isolda/Measurement.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,47 @@
package com.clm.isolda

import org.apache.commons.lang.builder.ToStringBuilder

class Measurement {

String name
String unit
String value

static constraints = {
}

@Override
def boolean equals(o) {
if (this.is(o)) return true
if (getClass() != o.class) return false

Measurement that = (Measurement) o

if (name != that.name) return false
if (unit != that.unit) return false
if (value != that.value) return false

return true
}

@Override
def int hashCode() {
int result = 17
result = 31 * result + (name != null ? name.hashCode() : 0)
result = 31 * result + (unit != null ? unit.hashCode() : 0)
result = 31 * result + (value != null ? value.hashCode() : 0)
return result
}


@Override
def String toString() {
return new ToStringBuilder(this).
append("name", name).
append("unit", unit).
append("value", value).
toString()
}

}
59 changes: 59 additions & 0 deletions grails-app/domain/com/clm/isolda/MeasurementSet.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,66 @@
package com.clm.isolda

import org.apache.commons.lang.builder.ToStringBuilder

class MeasurementSet {

Measurement weight
Measurement bodyMassIndex
Measurement fat
Measurement chest
Measurement waist
Measurement belly
Measurement arms
Measurement legs

static constraints = {
}

@Override
def boolean equals(o) {
if (this.is(o)) return true
if (getClass() != o.class) return false

MeasurementSet that = (MeasurementSet) o

if (arms != that.arms) return false
if (belly != that.belly) return false
if (bodyMassIndex != that.bodyMassIndex) return false
if (chest != that.chest) return false
if (fat != that.fat) return false
if (legs != that.legs) return false
if (waist != that.waist) return false
if (weight != that.weight) return false

return true
}

@Override
def int hashCode() {
int result = 17
result = 31 * result + (weight != null ? weight.hashCode() : 0)
result = 31 * result + (bodyMassIndex != null ? bodyMassIndex.hashCode() : 0)
result = 31 * result + (fat != null ? fat.hashCode() : 0)
result = 31 * result + (chest != null ? chest.hashCode() : 0)
result = 31 * result + (waist != null ? waist.hashCode() : 0)
result = 31 * result + (belly != null ? belly.hashCode() : 0)
result = 31 * result + (arms != null ? arms.hashCode() : 0)
result = 31 * result + (legs != null ? legs.hashCode() : 0)
return result
}


@Override
def String toString() {
return new ToStringBuilder(this).
append("arms", arms).
append("weight", weight).
append("bodyMassIndex", bodyMassIndex).
append("fat", fat).
append("chest", chest).
append("waist", waist).
append("belly", belly).
append("legs", legs).
toString()
}
}
39 changes: 39 additions & 0 deletions grails-app/domain/com/clm/isolda/Nutrient.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,46 @@
package com.clm.isolda

import org.apache.commons.lang.builder.ToStringBuilder

class Nutrient {

String name
String description
Map<String, Double> equivalences

static constraints = {
}

@Override
def boolean equals(o) {
if (this.is(o)) return true
if (getClass() != o.class) return false

Nutrient nutrient = (Nutrient) o

if (description != nutrient.description) return false
if (equivalences != nutrient.equivalences) return false
if (name != nutrient.name) return false

return true
}

@Override
def int hashCode() {
int result = 17
result = 31 * result + (name != null ? name.hashCode() : 0)
result = 31 * result + (description != null ? description.hashCode() : 0)
result = 31 * result + (equivalences != null ? equivalences.hashCode() : 0)
return result
}

@Override
def String toString() {
return new ToStringBuilder(this).
append("description", description).
append("name", name).
append("equivalences", equivalences).
toString()
}

}
Loading

0 comments on commit 2826735

Please sign in to comment.