Search in sources :

Example 21 with SchoolDataSource

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

the class CourseIdentifierEntityController method createCourseIdentifierEntity.

public CourseIdentifierEntity createCourseIdentifierEntity(String dataSource, String identifier) {
    SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(dataSource);
    if (dataSource == null) {
        logger.severe("Could not find datasource " + dataSource);
        return null;
    }
    CourseIdentifierEntity courseIdentifierEntity = courseIdentifierEntityDAO.create(Boolean.FALSE);
    courseIdentifierSchoolDataIdentifierDAO.create(schoolDataSource, identifier, courseIdentifierEntity);
    return courseIdentifierEntity;
}
Also used : SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource) CourseIdentifierEntity(fi.otavanopisto.muikku.model.coursemeta.CourseIdentifierEntity)

Example 22 with SchoolDataSource

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

the class SchoolDataPyramusPluginDescriptor method init.

@Override
public void init() {
    /**
     * Ensure that SchoolDataSource is defined
     */
    SchoolDataSource schoolDataSource = schoolDataController.findSchoolDataSource(SCHOOL_DATA_SOURCE);
    if (schoolDataSource == null) {
        schoolDataController.createSchoolDataSource(SCHOOL_DATA_SOURCE);
    }
    systemOauthController.deleteSystemAccessTokens();
}
Also used : SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource)

Example 23 with SchoolDataSource

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

the class UserSchoolDataController method updateUserAddress.

public void updateUserAddress(SchoolDataIdentifier studentIdentifier, SchoolDataIdentifier addressIdentifier, String street, String postalCode, String city, String country) throws SchoolDataBridgeUnauthorizedException {
    SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(addressIdentifier.getDataSource());
    if (schoolDataSource == null) {
        throw new SchoolDataBridgeInternalException(String.format("Invalid data source %s", addressIdentifier.getDataSource()));
    }
    getUserBridge(schoolDataSource).updateUserAddress(studentIdentifier, addressIdentifier, street, postalCode, city, country);
}
Also used : SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource)

Example 24 with SchoolDataSource

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

the class UserSchoolDataController method updateUser.

public void updateUser(User user) {
    SchoolDataSource schoolDataSource = schoolDataSourceDAO.findByIdentifier(user.getSchoolDataSource());
    if (schoolDataSource == null) {
        throw new SchoolDataBridgeInternalException(String.format("Invalid data source %s", user.getSchoolDataSource()));
    }
    getUserBridge(schoolDataSource).updateUser(user);
}
Also used : SchoolDataSource(fi.otavanopisto.muikku.model.base.SchoolDataSource)

Example 25 with SchoolDataSource

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

the class WorkspaceController method findWorkspaceRoleEntityByDataSourceAndIdentifier.

/* WorkspaceRoleEntity */
public WorkspaceRoleEntity findWorkspaceRoleEntityByDataSourceAndIdentifier(String schoolDataSource, String roleIdentifier) {
    SchoolDataSource dataSource = schoolDataSourceDAO.findByIdentifier(schoolDataSource);
    if (dataSource == null) {
        logger.log(Level.SEVERE, "Could not find school data source '" + schoolDataSource + "'");
        return null;
    }
    RoleSchoolDataIdentifier roleSchoolDataIdentifier = roleSchoolDataIdentifierDAO.findByDataSourceAndIdentifier(dataSource, roleIdentifier);
    if (roleSchoolDataIdentifier != null) {
        RoleEntity roleEntity = roleSchoolDataIdentifier.getRoleEntity();
        if (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)

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