Add project watch support and cleanup SSH key management UI

We now import the "watched projects" from Gerrit 1, the list of projects
the user wants to know if there are new changes in.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2008-12-29 15:41:37 -08:00
parent e77e6fc878
commit 55d5e7c701
24 changed files with 833 additions and 23 deletions

View File

@@ -0,0 +1,71 @@
// Copyright 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.client.reviewdb;
import com.google.gwtorm.client.Column;
import com.google.gwtorm.client.CompoundKey;
/** An {@link Account} interested in a {@link Project}. */
public final class AccountProjectWatch {
public static class Key extends CompoundKey<Account.Id> {
@Column
protected Account.Id accountId;
@Column
protected Project.Id projectId;
protected Key() {
accountId = new Account.Id();
projectId = new Project.Id();
}
public Key(final Account.Id a, final Project.Id g) {
accountId = a;
projectId = g;
}
@Override
public Account.Id getParentKey() {
return accountId;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {projectId};
}
}
@Column(name = Column.NONE)
protected Key key;
protected AccountProjectWatch() {
}
public AccountProjectWatch(final AccountProjectWatch.Key k) {
key = k;
}
public AccountProjectWatch.Key getKey() {
return key;
}
public Account.Id getAccountId() {
return key.accountId;
}
public Project.Id getProjectId() {
return key.projectId;
}
}

View File

@@ -0,0 +1,30 @@
// Copyright 2008 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.client.reviewdb;
import com.google.gwtorm.client.Access;
import com.google.gwtorm.client.OrmException;
import com.google.gwtorm.client.PrimaryKey;
import com.google.gwtorm.client.Query;
import com.google.gwtorm.client.ResultSet;
public interface AccountProjectWatchAccess extends
Access<AccountProjectWatch, AccountProjectWatch.Key> {
@PrimaryKey("key")
AccountProjectWatch get(AccountProjectWatch.Key key) throws OrmException;
@Query("WHERE key.accountId = ?")
ResultSet<AccountProjectWatch> byAccount(Account.Id id) throws OrmException;
}

View File

@@ -30,4 +30,8 @@ public interface ProjectAccess extends Access<Project, Project.NameKey> {
@Query("ORDER BY name")
ResultSet<Project> all() throws OrmException;
@Query("WHERE name.name >= ? AND name.name <= ? ORDER BY name LIMIT ?")
ResultSet<Project> suggestByName(String nameA, String nameB, int limit)
throws OrmException;
}

View File

@@ -53,6 +53,9 @@ public interface ReviewDb extends Schema {
@Relation
StarredChangeAccess starredChanges();
@Relation
AccountProjectWatchAccess accountProjectWatches();
@Relation
ProjectAccess projects();