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