use of com.google.gerrit.reviewdb.client.Change.Status in project gerrit by GerritCodeReview.
the class ChangeScreen method renderChangeInfo.
private void renderChangeInfo(ChangeInfo info) {
RevisionInfo revisionInfo = info.revision(revision);
changeInfo = info;
lastDisplayedUpdate = info.updated();
labels.set(info);
renderOwner(info);
renderUploader(info, revisionInfo);
renderActionTextDate(info);
renderDiffBaseListBox(info);
initReplyButton(info, revision);
initIncludedInAction(info);
initDownloadAction(info, revision);
initProjectLinks(info);
initBranchLink(info);
initEditMode(info, revision);
actions.display(info, revision);
star.setValue(info.starred());
permalink.setHref(ChangeLink.permalink(changeId));
permalink.setText(String.valueOf(info.legacyId()));
topic.set(info, revision);
commit.set(commentLinkProcessor, info, revision);
related.set(info, revision);
reviewers.set(info);
assignee.set(info);
if (Gerrit.isNoteDbEnabled()) {
hashtags.set(info, revision);
} else {
setVisible(hashtagTableRow, false);
}
StringBuilder sb = new StringBuilder();
sb.append(Util.M.changeScreenTitleId(info.idAbbreviated()));
if (info.subject() != null) {
sb.append(": ");
sb.append(info.subject());
}
setWindowTitle(sb.toString());
// render it faster.
if (!info.status().isOpen() || !revision.equals(info.currentRevision()) || revisionInfo.isEdit()) {
setVisible(strategy, false);
}
// Properly render revision actions initially while waiting for
// the callback to populate them correctly.
NativeMap<ActionInfo> emptyMap = NativeMap.<ActionInfo>create();
initRevisionsAction(info, revision, emptyMap);
quickApprove.setVisible(false);
actions.reloadRevisionActions(emptyMap);
boolean current = revision.equals(info.currentRevision()) && !revisionInfo.isEdit();
if (revisionInfo.isEdit()) {
statusText.setInnerText(Util.C.changeEdit());
} else if (!current) {
statusText.setInnerText(Util.C.notCurrent());
labels.setVisible(false);
} else {
Status s = info.revision(revision).draft() ? Status.DRAFT : info.status();
statusText.setInnerText(Util.toLongString(s));
}
if (info.isPrivate()) {
privateText.setInnerText(Util.C.isPrivate());
}
if (info.isWorkInProgress()) {
wipText.setInnerText(Util.C.isWorkInProgress());
}
if (Gerrit.isSignedIn()) {
replyAction = new ReplyAction(info, revision, hasDraftComments, style, commentLinkProcessor, reply, quickApprove);
}
history.set(commentLinkProcessor, replyAction, changeId, info);
if (current && info.status().isOpen()) {
quickApprove.set(info, revision, replyAction);
renderSubmitType(info.status(), isSubmittable(info), info.submitType());
} else {
quickApprove.setVisible(false);
}
}
use of com.google.gerrit.reviewdb.client.Change.Status in project gerrit by GerritCodeReview.
the class Schema_108 method getOpenChangesByProject.
private SetMultimap<Project.NameKey, Change.Id> getOpenChangesByProject(ReviewDb db, UpdateUI ui) throws OrmException {
SortedSet<NameKey> projects = repoManager.list();
SortedSet<NameKey> nonExistentProjects = Sets.newTreeSet();
SetMultimap<Project.NameKey, Change.Id> openByProject = MultimapBuilder.hashKeys().hashSetValues().build();
for (Change c : db.changes().all()) {
Status status = c.getStatus();
if (status != null && status.isClosed()) {
continue;
}
NameKey projectKey = c.getProject();
if (!projects.contains(projectKey)) {
nonExistentProjects.add(projectKey);
} else {
// The old "submitted" state is not supported anymore
// (thus status is null) but it was an opened state and needs
// to be migrated as such
openByProject.put(projectKey, c.getId());
}
}
if (!nonExistentProjects.isEmpty()) {
ui.message("Detected open changes referring to the following non-existent projects:");
ui.message(Joiner.on(", ").join(nonExistentProjects));
ui.message("It is highly recommended to remove\n" + "the obsolete open changes, comments and patch-sets from your DB.\n");
}
return openByProject;
}
Aggregations