WorkspaceId workspaceId) throws NoSuchWorkspaceException {
String projectSlug =
workspaceId.getProjectIterationId().getProjectSlug();
String iterationSlug =
workspaceId.getProjectIterationId().getIterationSlug();
HProjectIteration projectIteration =
getProjectIterationDAO().getBySlug(projectSlug, iterationSlug);
if (projectIteration == null) {
throw new NoSuchWorkspaceException("Invalid workspace Id");
}
HProject project = projectIteration.getProject();
if (project.getStatus() == EntityStatus.OBSOLETE) {
throw new NoSuchWorkspaceException("Project is obsolete");
}
if (projectIteration.getStatus() == EntityStatus.OBSOLETE) {
throw new NoSuchWorkspaceException("Project Iteration is obsolete");
}
HLocale locale =
getLocaleService().getByLocaleId(workspaceId.getLocaleId());
if (locale == null) {
throw new NoSuchWorkspaceException("Invalid Workspace Locale");
}
if (!locale.isActive()) {
throw new NoSuchWorkspaceException("Locale '"
+ locale.retrieveDisplayName() + "' disabled in server");
}
String workspaceName =
project.getName() + " (" + projectIteration.getSlug() + ")";
String localeDisplayName =
ULocale.getDisplayName(workspaceId.getLocaleId().toJavaName(),
ULocale.ENGLISH);
return new WorkspaceContext(workspaceId, workspaceName,