use of fi.otavanopisto.muikku.model.workspace.WorkspaceSettings in project muikku by otavanopisto.
the class WorkspaceSettingsDAO method findByWorkspaceEntity.
public WorkspaceSettings findByWorkspaceEntity(WorkspaceEntity workspaceEntity) {
EntityManager entityManager = getEntityManager();
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery<WorkspaceSettings> criteria = criteriaBuilder.createQuery(WorkspaceSettings.class);
Root<WorkspaceSettings> root = criteria.from(WorkspaceSettings.class);
criteria.select(root);
criteria.where(criteriaBuilder.equal(root.get(WorkspaceSettings_.workspaceEntity), workspaceEntity));
return getSingleResult(entityManager.createQuery(criteria));
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceSettings in project muikku by otavanopisto.
the class WorkspaceSettingsDAO method create.
public WorkspaceSettings create(WorkspaceEntity workspaceEntity, WorkspaceRoleEntity defaultUserRole) {
WorkspaceSettings courseSettings = new WorkspaceSettings();
courseSettings.setWorkspaceEntity(workspaceEntity);
courseSettings.setDefaultWorkspaceUserRole(defaultUserRole);
getEntityManager().persist(courseSettings);
return courseSettings;
}
use of fi.otavanopisto.muikku.model.workspace.WorkspaceSettings in project muikku by otavanopisto.
the class WorkspaceController method deleteWorkspaceEntity.
private void deleteWorkspaceEntity(WorkspaceEntity workspaceEntity) {
// Delete settings
WorkspaceSettings workspaceSettings = findWorkspaceSettings(workspaceEntity);
if (workspaceSettings != null) {
workspaceSettingsDAO.delete(workspaceSettings);
}
// Workspace Users
List<WorkspaceUserEntity> workspaceUserEntities = workspaceUserEntityDAO.listByWorkspaceEntity(workspaceEntity);
for (WorkspaceUserEntity workspaceUserEntity : workspaceUserEntities) {
workspaceUserEntityDAO.delete(workspaceUserEntity);
}
workspaceEntityDAO.delete(workspaceEntity);
}
Aggregations