Search in sources :

Example 6 with SchoolDataSource

use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.

the class WorkspaceRoleEntityController method findWorkspaceRoleEntityByDataSourceAndIdentifier.

public WorkspaceRoleEntity findWorkspaceRoleEntityByDataSourceAndIdentifier(String dataSource, String identifier) {
    SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(dataSource);
    if (schoolDataSource == null) {
        logger.severe("Could not find datasource " + dataSource);
        return null;
    }
    RoleSchoolDataIdentifier roleIdentifier = roleSchoolDataIdentifierDAO.findByDataSourceAndIdentifier(schoolDataSource, identifier);
    if (roleIdentifier != null) {
        RoleEntity roleEntity = roleIdentifier.getRoleEntity();
        if (roleEntity != null && roleEntity.getType() == UserRoleType.WORKSPACE) {
            return (WorkspaceRoleEntity) roleEntity;
        }
    }
    return null;
}
Also used : WorkspaceRoleEntity(fi.otavanopisto.muikku.model.workspace.WorkspaceRoleEntity) RoleEntity(fi.otavanopisto.muikku.model.users.RoleEntity) RoleSchoolDataIdentifier(fi.otavanopisto.muikku.model.users.RoleSchoolDataIdentifier) SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource) WorkspaceRoleEntity(fi.otavanopisto.muikku.model.workspace.WorkspaceRoleEntity)

Example 7 with SchoolDataSource

use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.

the class WorkspaceRoleEntityController method createWorkspaceRoleEntity.

public WorkspaceRoleEntity createWorkspaceRoleEntity(String dataSource, String identifier, WorkspaceRoleArchetype archetype, String name) {
    SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(dataSource);
    if (schoolDataSource == null) {
        logger.severe("Could not find datasource " + dataSource);
        return null;
    }
    WorkspaceRoleEntity workspaceRoleEntity = workspaceRoleEntityDAO.create(archetype, name);
    roleSchoolDataIdentifierDAO.create(schoolDataSource, identifier, workspaceRoleEntity);
    return workspaceRoleEntity;
}
Also used : SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource) WorkspaceRoleEntity(fi.otavanopisto.muikku.model.workspace.WorkspaceRoleEntity)

Example 8 with SchoolDataSource

use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.

the class CourseIdentifierEntityController method findCourseIdentifierEntityBySchoolDataSourceAndIdentifier.

public CourseIdentifierEntity findCourseIdentifierEntityBySchoolDataSourceAndIdentifier(String dataSource, String identifier) {
    SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(dataSource);
    if (dataSource == null) {
        logger.severe("Could not find datasource " + dataSource);
        return null;
    }
    CourseIdentifierSchoolDataIdentifier schoolDataIdentifier = courseIdentifierSchoolDataIdentifierDAO.findByDataSourceAndIdentifier(schoolDataSource, identifier);
    if (schoolDataIdentifier != null) {
        return schoolDataIdentifier.getCourseIdentifierEntity();
    }
    return null;
}
Also used : SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource) CourseIdentifierSchoolDataIdentifier(fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierSchoolDataIdentifier)

Example 9 with SchoolDataSource

use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.

the class EnvironmentRoleEntityController method findEnvironmentRoleEntity.

public EnvironmentRoleEntity findEnvironmentRoleEntity(String dataSource, String identifier) {
    SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(dataSource);
    if (schoolDataSource == null) {
        logger.severe("Could not find datasource " + dataSource);
        return null;
    }
    RoleSchoolDataIdentifier roleIdentifier = roleSchoolDataIdentifierDAO.findByDataSourceAndIdentifier(schoolDataSource, identifier);
    if (roleIdentifier != null) {
        RoleEntity roleEntity = roleIdentifier.getRoleEntity();
        if (roleEntity != null && roleEntity.getType() == UserRoleType.ENVIRONMENT) {
            return (EnvironmentRoleEntity) roleEntity;
        }
    }
    return null;
}
Also used : RoleEntity(fi.otavanopisto.muikku.model.users.RoleEntity) EnvironmentRoleEntity(fi.otavanopisto.muikku.model.users.EnvironmentRoleEntity) RoleSchoolDataIdentifier(fi.otavanopisto.muikku.model.users.RoleSchoolDataIdentifier) SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource) EnvironmentRoleEntity(fi.otavanopisto.muikku.model.users.EnvironmentRoleEntity)

Example 10 with SchoolDataSource

use of fi.otavanopisto.muikku.model.base.SchoolDataSource in project muikku by otavanopisto.

the class GradingSchoolDataController method listAssessmentRequestsByStudent.

public List<WorkspaceAssessmentRequest> listAssessmentRequestsByStudent(String schoolDataSource, String studentIdentifier) {
    SchoolDataSource dataSource = schoolDataSourceDAO.findByIdentifier(schoolDataSource);
    GradingSchoolDataBridge schoolDataBridge = getGradingBridge(dataSource);
    if (schoolDataBridge != null) {
        return schoolDataBridge.listAssessmentRequestsByStudent(studentIdentifier);
    } else {
        logger.log(Level.SEVERE, "School Data Bridge could not be found for data source: " + dataSource.getIdentifier());
    }
    return null;
}
Also used : SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource)

Aggregations

SchoolDataSource (fi.otavanopisto.muikku.model.base.SchoolDataSource)35 RoleSchoolDataIdentifier (fi.otavanopisto.muikku.model.users.RoleSchoolDataIdentifier)4 RoleEntity (fi.otavanopisto.muikku.model.users.RoleEntity)3 WorkspaceRoleEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceRoleEntity)3 EnvironmentRoleEntity (fi.otavanopisto.muikku.model.users.EnvironmentRoleEntity)2 UserEntity (fi.otavanopisto.muikku.model.users.UserEntity)2 WorkspaceEntity (fi.otavanopisto.muikku.model.workspace.WorkspaceEntity)2 LoginEvent (fi.otavanopisto.muikku.events.LoginEvent)1 CourseIdentifierEntity (fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity)1 CourseIdentifierSchoolDataIdentifier (fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierSchoolDataIdentifier)1 UserSchoolDataIdentifier (fi.otavanopisto.muikku.model.users.UserSchoolDataIdentifier)1 UserPendingPasswordChange (fi.otavanopisto.muikku.plugins.user.UserPendingPasswordChange)1 RESTPermitUnimplemented (fi.otavanopisto.muikku.rest.RESTPermitUnimplemented)1 SchoolDataBridgeUnauthorizedException (fi.otavanopisto.muikku.schooldata.SchoolDataBridgeUnauthorizedException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Locale (java.util.Locale)1 Set (java.util.Set)1 EntityManager (javax.persistence.EntityManager)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1