Commit 8c7342e9 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

project data is updated in the cached data after update

parent 945048bf
Pipeline #4221 passed with stage
in 1 minute and 7 seconds
......@@ -446,7 +446,7 @@ public class ProjectRestImpl extends BaseRestImpl {
if (project == null) {
throw new ObjectNotFoundException("Project with given id doesn't exist");
}
boolean canModify = getUserService().userHasPrivilege(token, PrivilegeType.ADD_MAP);
boolean canModify = getUserService().userHasPrivilege(token, PrivilegeType.PROJECT_MANAGEMENT);
if (!canModify) {
throw new SecurityException("You cannot update projects");
}
......@@ -486,7 +486,7 @@ public class ProjectRestImpl extends BaseRestImpl {
throw new QueryException("Unknown field: " + fieldName);
}
}
getProjectService().updateProject(project);
getProjectService().updateProject(project, token);
return getProject(projectId, token);
}
......
......@@ -1310,7 +1310,7 @@ public class ProjectService implements IProjectService {
}
/**
* Sends email about unsuccessfull project creation.
* Sends email about unsuccessful project creation.
*
* @param projectName
* name of the project
......@@ -1332,7 +1332,7 @@ public class ProjectService implements IProjectService {
}
/**
* Sends email about successfull project creation.
* Sends email about successful project creation.
*
* @param originalModel
* model that was created
......@@ -1346,13 +1346,16 @@ public class ProjectService implements IProjectService {
}
@Override
public void updateProject(Project project) {
public void updateProject(Project project, String token) throws SecurityException {
projectDao.update(project);
if (token != null) {
modelService.getLastModelByProjectId(project.getProjectId(), token).setProject(project);
}
}
/**
* This method handles situation when sever db error appeard during uploading of
* the project into database.
* This method handles situation when sever db error appeared during uploading
* of the project into database.
*
* @param params
* parameters used to create project
......
......@@ -118,8 +118,9 @@ public interface IProjectService {
*
* @param project
* project to update
* @throws SecurityException
*/
void updateProject(Project project);
void updateProject(Project project, String token) throws SecurityException;
UserAnnotationSchema prepareUserAnnotationSchema(User user);
......
......@@ -119,7 +119,7 @@ public class StartupBean {
+ ").";
project.setStatus(ProjectStatus.FAIL);
project.setErrors(errors);
projectService.updateProject(project);
projectService.updateProject(project, null);
logger.info("Status of project: " + project.getProjectId() + " changed to fail. Errors: " + errors);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment