return project.getComponent(ReviewManager.class).getReviews();
}
private void execute(CreateReviewDialog dialog, RevuProjectSettingsForm form)
{
Review review = new Review();
review.setStatus(ReviewStatus.DRAFT);
review.setFile(dialog.getReviewFile());
review.setName(dialog.getReviewName());
review.setShared(shared);
switch (dialog.getImportType())
{
case COPY:
// Copy only referential
review.getDataReferential().copyFrom(dialog.getImportedReview().getDataReferential());
break;
case LINK:
review.setExtendedReview(dialog.getImportedReview());
break;
}
User currentUser = RevuUtils.getCurrentUser();
if (currentUser != null)
{
User reviewCurrentUser = review.getDataReferential().getUser(currentUser.getLogin(), false);
if (reviewCurrentUser == null)
{
for (User.Role role : User.Role.values())
{
currentUser.addRole(role);
}
review.getDataReferential().addUser(currentUser);
}
else
{
if (!reviewCurrentUser.hasRole(User.Role.ADMIN))
{
reviewCurrentUser.addRole(User.Role.ADMIN);
}
}
}
History history = new History();
Date now = new Date();
history.setCreatedBy(currentUser);
history.setCreatedOn(now);
history.setLastUpdatedBy(currentUser);
history.setLastUpdatedOn(now);
review.setHistory(history);
if (fromChangeList != null)
{
review.getFileScope().setVcsAfterRev(String.valueOf(fromChangeList.getNumber()));
}
form.addItem(review);
}