Move toProject into PageLinks for reuse
This way its part of the common package and the server code can reuse it to generate a link into a project. Change-Id: Ia02adb4165e079aaf62be0c64126eeb6aa312762 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -18,6 +18,8 @@ import com.google.gerrit.common.data.AccountInfo;
|
||||
import com.google.gerrit.common.data.ChangeInfo;
|
||||
import com.google.gerrit.reviewdb.Account;
|
||||
import com.google.gerrit.reviewdb.Change;
|
||||
import com.google.gerrit.reviewdb.Project;
|
||||
import com.google.gerrit.reviewdb.Change.Status;
|
||||
import com.google.gwtorm.client.KeyUtil;
|
||||
|
||||
public class PageLinks {
|
||||
@@ -63,6 +65,21 @@ public class PageLinks {
|
||||
return "q," + KeyUtil.encode(query) + "," + TOP;
|
||||
}
|
||||
|
||||
public static String toProject(final Project.NameKey proj, Status status) {
|
||||
switch (status) {
|
||||
case ABANDONED:
|
||||
return "project,abandoned," + proj.toString() + ",n,z";
|
||||
|
||||
case MERGED:
|
||||
return "project,merged," + proj.toString() + ",n,z";
|
||||
|
||||
case NEW:
|
||||
case SUBMITTED:
|
||||
default:
|
||||
return "project,open," + proj.toString() + ",n,z";
|
||||
}
|
||||
}
|
||||
|
||||
protected PageLinks() {
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user