-
-
Save 14paxton/282d48ed20642c697315e15dffb7df2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.talentbank.core.dto.userGroup.command | |
import com.talentbank.core.enums.UserGroupType | |
import com.talentbank.core.group.GroupCompareService | |
import com.talentbank.core.group.ResultCompareService | |
import grails.validation.Validateable | |
class CompareCommand implements Serializable, Validateable { | |
GroupCompareService groupCompareService | |
ResultCompareService resultCompareService | |
Long id | |
String name | |
UserGroupType type | |
List<Long> groupIds | |
List<Long> assessmentOrderIds | |
CompareCommand() { | |
} | |
CompareCommand(String name, UserGroupType type, List<Long> groupIds, List<Long> assessmentOrderIds) { | |
this.id = id | |
this.name = name | |
this.type = type | |
this.groupIds = (groupIds && !assessmentOrderIds.isEmpty()) ? groupIds*.toLong() : null | |
this.assessmentOrderIds = (assessmentOrderIds && !assessmentOrderIds.isEmpty()) ? assessmentOrderIds*.toLong() : null | |
} | |
static constraints = { | |
id nullable: true | |
name size: 1..50 | |
type nullable: false, inList: [UserGroupType.GROUP_COMPARE, UserGroupType.RESULT_COMPARE] | |
groupIds nullable: true, validator: { val, obj -> | |
if (obj?.type == UserGroupType.GROUP_COMPARE) obj.groupCompareService.validateCommand(obj, val) | |
} | |
assessmentOrderIds nullable: true, validator: { val, obj -> | |
if (obj?.type == UserGroupType.RESULT_COMPARE) obj.resultCompareService.validateCommand(obj, val) | |
} | |
} | |
Long getId() { | |
return id | |
} | |
void setId(Long id) { | |
this.id = id | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment