次のようなドメイン 3 ドメイン クラスがあります。
Tasks.groovy
class Tasks {
static belongsTo = [ user : User ]
//other fields
Date startDate
Date endDate
}
ユーザー.groovy
class User {
//relationships. . . .
static belongsTo = [ company : Company, role : Role, resource : Resource]
static hasMany = [ holidays : Holiday, tasks : Tasks]
//other fields
}
Holiday.groovy
class Holiday {
static belongsTo = User
Date startDate
Date endDate
//other fields
}
インスタンスを作成するときに、 and が の and内に収まらないTasks
ように制約を設定したいと考えています。ある場合はスローしてエラーになります。Tasks
startDate
endDate
User
Holiday
startDate
endDate
この制約をドメイン クラス自体 (つまりTasks
) に設定する方法が必要です。
そうすることは可能ですか?
前もって感謝します。