コード例 #1
0
 @Override
 public ProjectDetails getProjectDetails(ProjectId projectId) throws UnknownProjectException {
   ProjectInstance pi = metaproject.getProject(projectId.getId());
   if (pi == null) {
     throw new UnknownProjectException(projectId);
   }
   return createProjectDetailsFromProjectInstance(pi);
 }
コード例 #2
0
 private ProjectInstance getProjectInstance(ProjectId projectId) throws UnknownProjectException {
   try {
     READ_LOCK.lock();
     MetaProject metaProject = getMetaProject();
     ProjectInstance pi = metaProject.getProject(projectId.getId());
     if (pi == null) {
       throw new UnknownProjectException(projectId);
     }
     return pi;
   } finally {
     READ_LOCK.unlock();
   }
 }
コード例 #3
0
 /**
  * Detemines if the signed in user is the owner of the specified project
  *
  * @param projectId The project id
  * @return <code>true</code> if the project exists AND there is a user signed in AND the signed in
  *     user is the owner of the project, otherwise <code>false</code>.
  */
 protected boolean isSignedInUserProjectOwner(ProjectId projectId) {
   UserId userId = getUserInSession();
   if (userId.isGuest()) {
     return false;
   }
   MetaProjectManager mpm = getMetaProjectManager();
   MetaProject metaProject = mpm.getMetaProject();
   ProjectInstance project = metaProject.getProject(projectId.getId());
   if (project == null) {
     return false;
   }
   User owner = project.getOwner();
   return owner != null && userId.getUserName().equals(owner.getName());
 }