0
저는 클래스의 각 객체에 대해 클로저를 호출 한 다음 클로저에 의해 반환 된 객체를 표시하려고합니다. 폐쇄입니다 : 내가 만든클래스의 각 객체에 대한 클로저
def activitiesPlanned={
cal.set(this.plannedStartDate)
def planDateMonth=cal.get(Calendar.MONTH)
def planDateYear=cal.get(Calendar.YEAR)
}
호출은 다음과 같습니다
def getActivitiesPlanned(int month,int year){
countActivitiesPlanned=ProgressData.each{it.activitiesPlanned.findAllWhere(planDateMonth:month,planDateYear:year).count()}
println countActivitiesPlanned
}
도메인 클래스 // 나는 점점하지 오전
package main
class ProgressData {
//String milestoneName
String taskId //Added later
String taskDescription
String taskCategory
Integer plannedHours
Integer actualHours
Date plannedStartDate
Date actualStartDate
Date plannedEndDate
Date actualEndDate
Integer stepsCreated=0
Integer stepsExecuted=0
String status //Originally Completed
String assignedTo
//String unplanned
String accepted //Added later
def ProgressData(){}
static constraints = {
//milestoneName(blank:false)
taskDescription(blank:false)
taskCategory(blank:false)
plannedHours(blank:false)
actualHours(blank:false)
id generator:"assigned",name:"taskId"
}
Calendar cal=Calendar.getInstance()
def activitiesPlanned={
cal.set(this.plannedStartDate)
def planDateMonth=cal.get(Calendar.MONTH)
def planDateYear=cal.get(Calendar.YEAR)
}
static hasMany=[defects:DefectData]
}
편집 : "그런 속성을 : 클래스의 activitiesPlanned : main.ProgressData 가능한 해결책 : activitiesPlanned ". 어떤 문제가있을 수 있습니까?
Progressdata가 도메인 클래스입니까? 전체 코드 예제를 게시 할 수 있습니다. – matcauthon
예. ProgressData는 제 도메인 클래스입니다. 나는 도메인 클래스 코드를 게시 할 것이다. –