Minor ORM cleanups to support other backends

Change-Id: I788da58dffd81dc9b7b0344b304491b4f38d459a
This commit is contained in:
Shawn O. Pearce
2011-10-19 17:01:36 -07:00
parent 4041cdff67
commit 2d82b4a84e
11 changed files with 61 additions and 17 deletions

View File

@@ -45,6 +45,10 @@ public final class AccountAgreement implements AbstractAgreement {
return accountId;
}
public ContributorAgreement.Id getContributorAgreementId() {
return claId;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {claId};

View File

@@ -47,6 +47,10 @@ public final class AccountGroupAgreement implements AbstractAgreement {
return groupId;
}
public ContributorAgreement.Id getContributorAgreementId() {
return claId;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {claId};

View File

@@ -49,6 +49,14 @@ public final class AccountGroupIncludeAudit {
return groupId;
}
public AccountGroup.Id getIncludedId() {
return includeId;
}
public Timestamp getAddedOn() {
return addedOn;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {includeId};

View File

@@ -49,6 +49,14 @@ public final class AccountGroupMemberAudit {
return accountId;
}
public AccountGroup.Id getGroupId() {
return groupId;
}
public Timestamp getAddedOn() {
return addedOn;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {groupId};

View File

@@ -27,7 +27,7 @@ public interface AccountGroupNameAccess extends
AccountGroupName get(AccountGroup.NameKey name) throws OrmException;
@Query("ORDER BY name")
ResultSet<AccountGroupName> all();
ResultSet<AccountGroupName> all() throws OrmException;
@Query("WHERE name.name >= ? AND name.name <= ? ORDER BY name LIMIT ?")
ResultSet<AccountGroupName> suggestByName(String nameA, String nameB,

View File

@@ -56,6 +56,14 @@ public final class AccountProjectWatch {
return accountId;
}
public Project.NameKey getProjectName() {
return projectName;
}
public Filter getFilter() {
return filter;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {projectName, filter};

View File

@@ -28,11 +28,6 @@ public interface PatchLineCommentAccess extends
@Query("WHERE key.patchKey.patchSetId.changeId = ?")
ResultSet<PatchLineComment> byChange(Change.Id id) throws OrmException;
@Query("WHERE key.patchKey = ? AND status = '"
+ PatchLineComment.STATUS_PUBLISHED + "' ORDER BY lineNbr,writtenOn")
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")
@@ -51,13 +46,6 @@ public interface PatchLineCommentAccess extends
(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> 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")

View File

@@ -27,10 +27,6 @@ public interface PatchSetAccess extends Access<PatchSet, PatchSet.Id> {
@Query("WHERE id.changeId = ? ORDER BY id.patchSetId")
ResultSet<PatchSet> byChange(Change.Id id) throws OrmException;
@Query("WHERE id.changeId = ? AND revision = ?")
ResultSet<PatchSet> byChangeRevision(Change.Id id, RevId rev)
throws OrmException;
@Query("WHERE revision = ? LIMIT 2")
ResultSet<PatchSet> byRevision(RevId rev) throws OrmException;

View File

@@ -51,6 +51,14 @@ public final class PatchSetApproval {
return patchSetId;
}
public Account.Id getAccountId() {
return accountId;
}
public ApprovalCategory.Id getCategoryId() {
return categoryId;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {accountId, categoryId};

View File

@@ -43,6 +43,10 @@ public class StarredChange {
return accountId;
}
public Change.Id getChangeId() {
return changeId;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {changeId};
@@ -59,6 +63,10 @@ public class StarredChange {
key = k;
}
public StarredChange.Key getKey() {
return key;
}
public Account.Id getAccountId() {
return key.accountId;
}

View File

@@ -102,6 +102,14 @@ public final class TrackingId {
return changeId;
}
public TrackingId.Id getTrackingId() {
return trackingId;
}
public TrackingId.System getTrackingSystem() {
return trackingSystem;
}
@Override
public com.google.gwtorm.client.Key<?>[] members() {
return new com.google.gwtorm.client.Key<?>[] {trackingId, trackingSystem};
@@ -123,6 +131,10 @@ public final class TrackingId {
key = new Key(ch, new TrackingId.Id(id), new TrackingId.System(s));
}
public TrackingId.Key getKey() {
return key;
}
public Change.Id getChangeId() {
return key.changeId;
}