import org.apache.commons.collections.list.LazyList;
import org.apache.commons.collections.FactoryUtils;

class TaskProcedure {

    Task parentTask
    List maintenanceActions = new ArrayList()
    static hasMany = [tasks: Task, maintenanceActions: MaintenanceAction]

    static mappedBy = [tasks:"taskProcedure"]

    static mapping = {
        maintenanceActions cascade:"all,delete-orphan"
    }

//     static belongsTo = []

    static constraints = {
    }

    String toString() {
        "${this.id}"
    }

    def getExpandableMaintenanceActionList() {
        return LazyList.decorate(maintenanceActions, FactoryUtils.instantiateFactory(MaintenanceAction.class))
    }
}
