Package com.google.gerrit.server
Class StarredChangesUtil
- java.lang.Object
-
- com.google.gerrit.server.StarredChangesUtil
-
public class StarredChangesUtil extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
StarredChangesUtil.IllegalLabelException
static class
StarredChangesUtil.InvalidLabelsException
static class
StarredChangesUtil.MutuallyExclusiveLabelsException
static class
StarredChangesUtil.StarField
static class
StarredChangesUtil.StarRef
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_LABEL
static com.google.common.collect.ImmutableSortedSet<String>
DEFAULT_LABELS
static String
IGNORE_LABEL
static String
REVIEWED_LABEL
static String
UNREVIEWED_LABEL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.common.collect.ImmutableMap<Account.Id,StarredChangesUtil.StarRef>
byChange(Change.Id changeId)
com.google.common.collect.ImmutableListMultimap<Account.Id,String>
byChangeFromIndex(Change.Id changeId)
com.google.common.collect.ImmutableSortedSet<String>
getLabels(Account.Id accountId, Change.Id changeId)
org.eclipse.jgit.lib.ObjectId
getObjectId(Account.Id accountId, Change.Id changeId)
static Set<Integer>
getStarredPatchSets(Set<String> labels, String label)
void
ignore(ChangeResource rsrc)
boolean
isIgnored(ChangeResource rsrc)
boolean
isIgnoredBy(Change.Id changeId, Account.Id accountId)
void
markAsReviewed(ChangeResource rsrc)
void
markAsUnreviewed(ChangeResource rsrc)
static StarredChangesUtil.StarRef
readLabels(org.eclipse.jgit.lib.Repository repo, String refName)
static StarredChangesUtil.StarRef
readLabels(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.Ref ref)
com.google.common.collect.ImmutableSortedSet<String>
star(Account.Id accountId, Project.NameKey project, Change.Id changeId, Set<String> labelsToAdd, Set<String> labelsToRemove)
void
unignore(ChangeResource rsrc)
void
unstarAllForChangeDeletion(Change.Id changeId)
Unstar the given change for all users.static org.eclipse.jgit.lib.ObjectId
writeLabels(org.eclipse.jgit.lib.Repository repo, Collection<String> labels)
-
-
-
Field Detail
-
DEFAULT_LABEL
public static final String DEFAULT_LABEL
- See Also:
- Constant Field Values
-
IGNORE_LABEL
public static final String IGNORE_LABEL
- See Also:
- Constant Field Values
-
REVIEWED_LABEL
public static final String REVIEWED_LABEL
- See Also:
- Constant Field Values
-
UNREVIEWED_LABEL
public static final String UNREVIEWED_LABEL
- See Also:
- Constant Field Values
-
DEFAULT_LABELS
public static final com.google.common.collect.ImmutableSortedSet<String> DEFAULT_LABELS
-
-
Method Detail
-
getLabels
public com.google.common.collect.ImmutableSortedSet<String> getLabels(Account.Id accountId, Change.Id changeId)
-
star
public com.google.common.collect.ImmutableSortedSet<String> star(Account.Id accountId, Project.NameKey project, Change.Id changeId, Set<String> labelsToAdd, Set<String> labelsToRemove) throws StarredChangesUtil.IllegalLabelException
-
unstarAllForChangeDeletion
public void unstarAllForChangeDeletion(Change.Id changeId) throws IOException
Unstar the given change for all users.Intended for use only when we're about to delete a change. For that reason, the change is not reindexed.
- Parameters:
changeId
- change ID.- Throws:
IOException
- if an error occurred.
-
byChange
public com.google.common.collect.ImmutableMap<Account.Id,StarredChangesUtil.StarRef> byChange(Change.Id changeId)
-
byChangeFromIndex
public com.google.common.collect.ImmutableListMultimap<Account.Id,String> byChangeFromIndex(Change.Id changeId)
-
getObjectId
public org.eclipse.jgit.lib.ObjectId getObjectId(Account.Id accountId, Change.Id changeId)
-
ignore
public void ignore(ChangeResource rsrc) throws StarredChangesUtil.IllegalLabelException
-
unignore
public void unignore(ChangeResource rsrc) throws StarredChangesUtil.IllegalLabelException
-
isIgnoredBy
public boolean isIgnoredBy(Change.Id changeId, Account.Id accountId)
-
isIgnored
public boolean isIgnored(ChangeResource rsrc)
-
markAsReviewed
public void markAsReviewed(ChangeResource rsrc) throws StarredChangesUtil.IllegalLabelException
-
markAsUnreviewed
public void markAsUnreviewed(ChangeResource rsrc) throws StarredChangesUtil.IllegalLabelException
-
readLabels
public static StarredChangesUtil.StarRef readLabels(org.eclipse.jgit.lib.Repository repo, String refName) throws IOException
- Throws:
IOException
-
readLabels
public static StarredChangesUtil.StarRef readLabels(org.eclipse.jgit.lib.Repository repo, org.eclipse.jgit.lib.Ref ref) throws IOException
- Throws:
IOException
-
writeLabels
public static org.eclipse.jgit.lib.ObjectId writeLabels(org.eclipse.jgit.lib.Repository repo, Collection<String> labels) throws IOException, StarredChangesUtil.InvalidLabelsException
-
-