use of de.tudarmstadt.ukp.clarin.webanno.support.wicket.DecoratedObject in project webanno by webanno.
the class AnnotationPage method getAllowedProjects.
private IModel<List<DecoratedObject<Project>>> getAllowedProjects() {
return LambdaModel.of(() -> {
User user = userRepository.getCurrentUser();
List<DecoratedObject<Project>> allowedProject = new ArrayList<>();
for (Project project : projectService.listProjects()) {
if (isAnnotator(project, projectService, user) && WebAnnoConst.PROJECT_TYPE_ANNOTATION.equals(project.getMode())) {
allowedProject.add(DecoratedObject.of(project));
}
}
return allowedProject;
});
}
use of de.tudarmstadt.ukp.clarin.webanno.support.wicket.DecoratedObject in project webanno by webanno.
the class CurationPage method getAllowedProjects.
private IModel<List<DecoratedObject<Project>>> getAllowedProjects() {
return new LoadableDetachableModel<List<DecoratedObject<Project>>>() {
private static final long serialVersionUID = -2518743298741342852L;
@Override
protected List<DecoratedObject<Project>> load() {
User user = userRepository.get(SecurityContextHolder.getContext().getAuthentication().getName());
List<DecoratedObject<Project>> allowedProject = new ArrayList<>();
List<Project> projectsWithFinishedAnnos = projectService.listProjectsWithFinishedAnnos();
for (Project project : projectService.listProjects()) {
if (SecurityUtil.isCurator(project, projectService, user)) {
DecoratedObject<Project> dp = DecoratedObject.of(project);
if (projectsWithFinishedAnnos.contains(project)) {
dp.setColor("green");
} else {
dp.setColor("red");
}
allowedProject.add(dp);
}
}
return allowedProject;
}
};
}
use of de.tudarmstadt.ukp.clarin.webanno.support.wicket.DecoratedObject in project webanno by webanno.
the class CorrectionPage method getAllowedProjects.
private IModel<List<DecoratedObject<Project>>> getAllowedProjects() {
return new LoadableDetachableModel<List<DecoratedObject<Project>>>() {
private static final long serialVersionUID = -2518743298741342852L;
@Override
protected List<DecoratedObject<Project>> load() {
User user = userRepository.get(SecurityContextHolder.getContext().getAuthentication().getName());
List<DecoratedObject<Project>> allowedProject = new ArrayList<>();
for (Project project : projectService.listProjects()) {
if (SecurityUtil.isAnnotator(project, projectService, user) && WebAnnoConst.PROJECT_TYPE_CORRECTION.equals(project.getMode())) {
allowedProject.add(DecoratedObject.of(project));
}
}
return allowedProject;
}
};
}
use of de.tudarmstadt.ukp.clarin.webanno.support.wicket.DecoratedObject in project webanno by webanno.
the class AutomationPage method getAllowedProjects.
private IModel<List<DecoratedObject<Project>>> getAllowedProjects() {
return LambdaModel.of(() -> {
User user = userRepository.getCurrentUser();
List<DecoratedObject<Project>> allowedProject = new ArrayList<>();
for (Project project : projectService.listProjects()) {
if (SecurityUtil.isAnnotator(project, projectService, user) && WebAnnoConst.PROJECT_TYPE_AUTOMATION.equals(project.getMode())) {
allowedProject.add(DecoratedObject.of(project));
}
}
return allowedProject;
});
}
Aggregations