IGroupEnrolmentStrategyFactory enrolmentGroupPolicyStrategyFactory = GroupEnrolmentStrategyFactory.getInstance();
IGroupEnrolmentStrategy strategy = enrolmentGroupPolicyStrategyFactory.getGroupEnrolmentStrategyInstance(groupProperties);
if (!strategy.checkStudentInGrouping(groupProperties, username)) {
throw new NotAuthorizedException();
}
if (!checkStudentInStudentGroup(registration, studentGroup)) {
throw new InvalidSituationServiceException();
}