Support gwtorm 1.2
In 1.2 gwtorm requires accessor @Query methods to be unique names within the interface. This means the arguments must not be overloaded, and required fixing up a few interfaces that relied on method overloading to select the right query statement. 1.2 also requires a unique id number for each relation in the schema interface, similar to how earlier versions have a unique column number in each entity. These can be used by NoSQL based systems for unique identity, specially the protobuf backend that exists to support the NoSQL backends of gwtorm. Change-Id: I19421b966e336ee0e89e6743d79e989860d8c470
This commit is contained in:
@@ -128,7 +128,7 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
|
||||
byKey.put(p.getKey(), p);
|
||||
}
|
||||
|
||||
for (final PatchLineComment c : db.patchComments().published(psIdNew)) {
|
||||
for (final PatchLineComment c : db.patchComments().publishedByPatchSet(psIdNew)) {
|
||||
final Patch p = byKey.get(c.getKey().getParentKey());
|
||||
if (p != null) {
|
||||
p.setCommentCount(p.getCommentCount() + 1);
|
||||
@@ -148,7 +148,7 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
|
||||
// quickly locate where they have pending drafts, and review them.
|
||||
//
|
||||
final Account.Id me = ((IdentifiedUser) user).getAccountId();
|
||||
for (final PatchLineComment c : db.patchComments().draft(psIdNew, me)) {
|
||||
for (final PatchLineComment c : db.patchComments().draftByPatchSetAuthor(psIdNew, me)) {
|
||||
final Patch p = byKey.get(c.getKey().getParentKey());
|
||||
if (p != null) {
|
||||
p.setDraftCount(p.getDraftCount() + 1);
|
||||
|
@@ -84,7 +84,7 @@ final class PatchSetPublishDetailFactory extends Handler<PatchSetPublishDetail>
|
||||
final ChangeControl control = changeControlFactory.validateFor(changeId);
|
||||
change = control.getChange();
|
||||
patchSetInfo = infoFactory.get(patchSetId);
|
||||
drafts = db.patchComments().draft(patchSetId, user.getAccountId()).toList();
|
||||
drafts = db.patchComments().draftByPatchSetAuthor(patchSetId, user.getAccountId()).toList();
|
||||
|
||||
aic.want(change.getOwner());
|
||||
|
||||
|
@@ -287,7 +287,7 @@ class PatchScriptFactory extends Handler<PatchScript> {
|
||||
|
||||
private void loadPublished(final Map<Patch.Key, Patch> byKey,
|
||||
final AccountInfoCacheFactory aic, final String file) throws OrmException {
|
||||
for (PatchLineComment c : db.patchComments().published(changeId, file)) {
|
||||
for (PatchLineComment c : db.patchComments().publishedByChangeFile(changeId, file)) {
|
||||
if (comments.include(c)) {
|
||||
aic.want(c.getAuthor());
|
||||
}
|
||||
@@ -303,7 +303,7 @@ class PatchScriptFactory extends Handler<PatchScript> {
|
||||
private void loadDrafts(final Map<Patch.Key, Patch> byKey,
|
||||
final AccountInfoCacheFactory aic, final Account.Id me, final String file)
|
||||
throws OrmException {
|
||||
for (PatchLineComment c : db.patchComments().draft(changeId, file, me)) {
|
||||
for (PatchLineComment c : db.patchComments().draftByChangeFileAuthor(changeId, file, me)) {
|
||||
if (comments.include(c)) {
|
||||
aic.want(me);
|
||||
}
|
||||
|
@@ -30,35 +30,39 @@ public interface PatchLineCommentAccess extends
|
||||
|
||||
@Query("WHERE key.patchKey = ? AND status = '"
|
||||
+ PatchLineComment.STATUS_PUBLISHED + "' ORDER BY lineNbr,writtenOn")
|
||||
ResultSet<PatchLineComment> published(Patch.Key patch) throws OrmException;
|
||||
ResultSet<PatchLineComment> publishedByPatch(Patch.Key patch)
|
||||
throws OrmException;
|
||||
|
||||
@Query("WHERE key.patchKey.patchSetId.changeId = ?"
|
||||
+ " AND key.patchKey.fileName = ? AND status = '"
|
||||
+ PatchLineComment.STATUS_PUBLISHED + "' ORDER BY lineNbr,writtenOn")
|
||||
ResultSet<PatchLineComment> published(Change.Id id, String file)
|
||||
ResultSet<PatchLineComment> publishedByChangeFile(Change.Id id, String file)
|
||||
throws OrmException;
|
||||
|
||||
@Query("WHERE key.patchKey.patchSetId = ? AND status = '"
|
||||
+ PatchLineComment.STATUS_PUBLISHED + "'")
|
||||
ResultSet<PatchLineComment> published(PatchSet.Id patchset)
|
||||
ResultSet<PatchLineComment> publishedByPatchSet(PatchSet.Id patchset)
|
||||
throws OrmException;
|
||||
|
||||
@Query("WHERE key.patchKey.patchSetId = ? AND status = '"
|
||||
+ PatchLineComment.STATUS_DRAFT
|
||||
+ "' AND author = ? ORDER BY key.patchKey,lineNbr,writtenOn")
|
||||
ResultSet<PatchLineComment> draft(PatchSet.Id patchset, Account.Id author)
|
||||
ResultSet<PatchLineComment> draftByPatchSetAuthor
|
||||
(PatchSet.Id patchset, Account.Id author)
|
||||
throws OrmException;
|
||||
|
||||
@Query("WHERE key.patchKey = ? AND status = '"
|
||||
+ PatchLineComment.STATUS_DRAFT
|
||||
+ "' AND author = ? ORDER BY lineNbr,writtenOn")
|
||||
ResultSet<PatchLineComment> draft(Patch.Key patch, Account.Id author)
|
||||
ResultSet<PatchLineComment> draftByPatchAuthor
|
||||
(Patch.Key patch, Account.Id author)
|
||||
throws OrmException;
|
||||
|
||||
@Query("WHERE key.patchKey.patchSetId.changeId = ?"
|
||||
+ " AND key.patchKey.fileName = ? AND author = ? AND status = '"
|
||||
+ PatchLineComment.STATUS_DRAFT + "' ORDER BY lineNbr,writtenOn")
|
||||
ResultSet<PatchLineComment> draft(Change.Id id, String file, Account.Id author)
|
||||
ResultSet<PatchLineComment> draftByChangeFileAuthor
|
||||
(Change.Id id, String file, Account.Id author)
|
||||
throws OrmException;
|
||||
|
||||
@Query("WHERE status = '" + PatchLineComment.STATUS_DRAFT
|
||||
|
@@ -32,85 +32,85 @@ import com.google.gwtorm.client.Sequence;
|
||||
public interface ReviewDb extends Schema {
|
||||
/* If you change anything, update SchemaVersion.C to use a new version. */
|
||||
|
||||
@Relation
|
||||
@Relation(id = 1)
|
||||
SchemaVersionAccess schemaVersion();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 2)
|
||||
SystemConfigAccess systemConfig();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 3)
|
||||
ApprovalCategoryAccess approvalCategories();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 4)
|
||||
ApprovalCategoryValueAccess approvalCategoryValues();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 5)
|
||||
ContributorAgreementAccess contributorAgreements();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 6)
|
||||
AccountAccess accounts();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 7)
|
||||
AccountExternalIdAccess accountExternalIds();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 8)
|
||||
AccountSshKeyAccess accountSshKeys();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 9)
|
||||
AccountAgreementAccess accountAgreements();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 10)
|
||||
AccountGroupAccess accountGroups();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 11)
|
||||
AccountGroupNameAccess accountGroupNames();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 12)
|
||||
AccountGroupMemberAccess accountGroupMembers();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 13)
|
||||
AccountGroupMemberAuditAccess accountGroupMembersAudit();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 14)
|
||||
AccountGroupIncludeAccess accountGroupIncludes();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 15)
|
||||
AccountGroupIncludeAuditAccess accountGroupIncludesAudit();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 16)
|
||||
AccountGroupAgreementAccess accountGroupAgreements();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 17)
|
||||
AccountDiffPreferenceAccess accountDiffPreferences();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 18)
|
||||
StarredChangeAccess starredChanges();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 19)
|
||||
AccountProjectWatchAccess accountProjectWatches();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 20)
|
||||
AccountPatchReviewAccess accountPatchReviews();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 21)
|
||||
ChangeAccess changes();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 22)
|
||||
PatchSetApprovalAccess patchSetApprovals();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 23)
|
||||
ChangeMessageAccess changeMessages();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 24)
|
||||
PatchSetAccess patchSets();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 25)
|
||||
PatchSetAncestorAccess patchSetAncestors();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 26)
|
||||
PatchLineCommentAccess patchComments();
|
||||
|
||||
@Relation
|
||||
@Relation(id = 27)
|
||||
TrackingIdAccess trackingIds();
|
||||
|
||||
/** Create the next unique id for an {@link Account}. */
|
||||
|
@@ -280,7 +280,7 @@ public class PublishComments implements Callable<VoidResult> {
|
||||
}
|
||||
|
||||
private List<PatchLineComment> drafts() throws OrmException {
|
||||
return db.patchComments().draft(patchSetId, user.getAccountId()).toList();
|
||||
return db.patchComments().draftByPatchSetAuthor(patchSetId, user.getAccountId()).toList();
|
||||
}
|
||||
|
||||
private void email() {
|
||||
|
2
pom.xml
2
pom.xml
@@ -47,7 +47,7 @@ limitations under the License.
|
||||
|
||||
<properties>
|
||||
<jgitVersion>1.0.0.201106090707-r.19-g8d88a84</jgitVersion>
|
||||
<gwtormVersion>1.1.5</gwtormVersion>
|
||||
<gwtormVersion>1.2-SNAPSHOT</gwtormVersion>
|
||||
<gwtjsonrpcVersion>1.2.5</gwtjsonrpcVersion>
|
||||
<gwtexpuiVersion>1.2.4</gwtexpuiVersion>
|
||||
<gwtVersion>2.3.0</gwtVersion>
|
||||
|
Reference in New Issue
Block a user