int projectId;
try {
projectId = (new ProjectManager()).getProjectID(command
.getProject());
} catch (NoSuchProjectException e) {
throw new NoSuchCommunityException(
"The project associated with this "
+ "community couldn't be found.");
}
if (communityId == -1) {
community = new Community();
community.setCommunityId(-1);
community.setProjectId(projectId);
} else {
community = cdao.getCommunity(communityId, projectId);
}
if ((mustBeActive) && (!community.isActive())) {
throw new NoSuchCommunityException(
"No matching, active community found.");
}
if (addMetadata) {
metadataManager.populateVBOWithMetadata(community);