use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class GradingSchoolDataController method createWorkspaceAssessment.
/* WorkspaceAssessment */
public WorkspaceAssessment createWorkspaceAssessment(String schoolDataSource, String workspaceUserIdentifier, String workspaceUserSchoolDataSource, String workspaceIdentifier, String studentIdentifier, String assessingUserIdentifier, String assessingUserSchoolDataSource, String gradeIdentifier, String gradeSchoolDataSource, String gradingScaleIdentifier, String gradingScaleSchoolDataSource, String verbalAssessment, Date date) {
SchoolDataSource dataSource = schoolDataSourceDAO.findByIdentifier(schoolDataSource);
GradingSchoolDataBridge schoolDataBridge = getGradingBridge(dataSource);
if (schoolDataBridge != null) {
return schoolDataBridge.createWorkspaceAssessment(workspaceUserIdentifier, workspaceUserSchoolDataSource, workspaceIdentifier, studentIdentifier, assessingUserIdentifier, assessingUserSchoolDataSource, gradeIdentifier, gradeSchoolDataSource, gradingScaleIdentifier, gradingScaleSchoolDataSource, verbalAssessment, date);
} else {
logger.log(Level.SEVERE, "School Data Bridge could not be found for data source: " + dataSource.getIdentifier());
}
return null;
}
use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class GradingSchoolDataController method deleteWorkspaceAssessmentRequest.
public void deleteWorkspaceAssessmentRequest(String schoolDataSource, String identifier, String workspaceIdentifier, String studentIdentifier) {
SchoolDataSource dataSource = schoolDataSourceDAO.findByIdentifier(schoolDataSource);
GradingSchoolDataBridge schoolDataBridge = getGradingBridge(dataSource);
if (schoolDataBridge != null) {
schoolDataBridge.deleteWorkspaceAssessmentRequest(identifier, workspaceIdentifier, studentIdentifier);
} else {
logger.log(Level.SEVERE, "School Data Bridge could not be found for data source: " + dataSource.getIdentifier());
}
}
use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class GradingSchoolDataController method createWorkspaceAssessmentRequest.
public WorkspaceAssessmentRequest createWorkspaceAssessmentRequest(String schoolDataSource, String workspaceUserIdentifier, String workspaceUserSchoolDataSource, String workspaceIdentifier, String studentIdentifier, String requestText, Date date) {
SchoolDataSource dataSource = schoolDataSourceDAO.findByIdentifier(schoolDataSource);
GradingSchoolDataBridge schoolDataBridge = getGradingBridge(dataSource);
if (schoolDataBridge != null) {
return schoolDataBridge.createWorkspaceAssessmentRequest(workspaceUserIdentifier, workspaceUserSchoolDataSource, workspaceIdentifier, studentIdentifier, requestText, date);
} else {
logger.log(Level.SEVERE, "School Data Bridge could not be found for data source: " + dataSource.getIdentifier());
}
return null;
}
use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class AbstractAuthenticationStrategy method login.
private AuthenticationResult login(UserIdentification userIdentification, User user, boolean newAccount) {
UserEntity userEntity = userIdentification.getUser();
UserEntity loggedUser = sessionController.getLoggedUserEntity();
if ((loggedUser == null) || loggedUser.getId().equals(userEntity.getId())) {
Locale locale = null;
if (StringUtils.isNotBlank(userEntity.getLocale())) {
try {
locale = LocaleUtils.toLocale(userEntity.getLocale());
} catch (Exception e) {
logger.log(Level.SEVERE, String.format("Failed to parse locale %s for user entity %d", loggedUser.getLocale(), loggedUser.getId()));
}
}
if (locale == null) {
locale = new Locale("fi");
}
sessionController.setLocale(locale);
SchoolDataSource schoolDataSource = schoolDataController.findSchoolDataSource(user.getSchoolDataSource());
userEntityController.updateDefaultSchoolDataSource(userEntity, schoolDataSource);
userEntityController.updateDefaultIdentifier(userEntity, user.getIdentifier());
sessionController.login(schoolDataSource.getIdentifier(), user.getIdentifier(), user.getStudyEndDate() == null);
userEntityController.updateLastLogin(userEntity);
HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
userLoggedInEvent.fire(new LoginEvent(userEntity.getId(), sessionController.getLoggedUser(), this, req.getRemoteAddr()));
return new AuthenticationResult(newAccount ? Status.NEW_ACCOUNT : Status.LOGIN);
} else {
return new AuthenticationResult(Status.CONFLICT, ConflictReason.LOGGED_IN_AS_DIFFERENT_USER);
}
}
use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.
the class EnvironmentRoleEntityController method createEnvironmentRoleEntity.
/* Environment Role Entities */
public EnvironmentRoleEntity createEnvironmentRoleEntity(String dataSource, String identifier, EnvironmentRoleArchetype archetype, String name) {
SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(dataSource);
if (schoolDataSource == null) {
logger.severe("Could not find datasource " + dataSource);
return null;
}
EnvironmentRoleEntity environmentRoleEntity = environmentRoleEntityDAO.create(archetype, name);
roleSchoolDataIdentifierDAO.create(schoolDataSource, identifier, environmentRoleEntity);
return environmentRoleEntity;
}
Aggregations