use of edu.stanford.bmir.protege.web.shared.project.NewProjectSettings in project webprotege by protegeproject.
the class CreateNewProjectActionHandler method execute.
@Nonnull
@Override
public CreateNewProjectResult execute(@Nonnull CreateNewProjectAction action, @Nonnull ExecutionContext executionContext) {
try {
UserId userId = executionContext.getUserId();
if (!accessManager.hasPermission(forUser(userId), ApplicationResource.get(), CREATE_EMPTY_PROJECT)) {
throw new PermissionDeniedException("You do not have permission to create new projects", userInSessionFactory.getUserInSession(userId));
}
NewProjectSettings newProjectSettings = action.getNewProjectSettings();
if (newProjectSettings.hasSourceDocument()) {
if (!accessManager.hasPermission(forUser(userId), ApplicationResource.get(), UPLOAD_PROJECT)) {
throw new PermissionDeniedException("You do not have permission to upload projects", userInSessionFactory.getUserInSession(userId));
}
}
ProjectId projectId = pm.createNewProject(newProjectSettings);
if (!projectDetailsManager.isExistingProject(projectId)) {
projectDetailsManager.registerProject(projectId, newProjectSettings);
applyDefaultPermissions(projectId, userId);
}
return new CreateNewProjectResult(projectDetailsManager.getProjectDetails(projectId));
} catch (OWLOntologyCreationException | OWLOntologyStorageException | IOException e) {
throw new RuntimeException(e);
}
}
Aggregations