public class ExternalIdsUpdate
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ExternalIdsUpdate.Server
Factory to create an ExternalIdsUpdate instance for updating external IDs by the Gerrit server.
|
static class |
ExternalIdsUpdate.User |
Constructor and Description |
---|
ExternalIdsUpdate(AccountCache accountCache) |
Modifier and Type | Method and Description |
---|---|
static Account.Id |
checkSameAccount(java.lang.Iterable<ExternalId> extIds)
Checks that all specified external IDs belong to the same account.
|
static Account.Id |
checkSameAccount(java.lang.Iterable<ExternalId> extIds,
Account.Id accountId)
Checks that all specified external IDs belong to specified account.
|
void |
delete(ReviewDb db,
Account.Id accountId,
java.util.Collection<ExternalId.Key> extIdKeys)
Delete external IDs by external ID key.
|
void |
delete(ReviewDb db,
Account.Id accountId,
ExternalId.Key extIdKey)
Delete an external ID by key.
|
void |
delete(ReviewDb db,
java.util.Collection<ExternalId> extIds)
Deletes external IDs.
|
void |
delete(ReviewDb db,
ExternalId extId)
Deletes an external ID.
|
void |
deleteAll(ReviewDb db,
Account.Id accountId)
Deletes all external IDs of the specified account.
|
void |
insert(ReviewDb db,
java.util.Collection<ExternalId> extIds)
Inserts new external IDs.
|
void |
insert(ReviewDb db,
ExternalId extId)
Inserts a new external ID.
|
void |
replace(ReviewDb db,
Account.Id accountId,
java.util.Collection<ExternalId.Key> toDelete,
java.util.Collection<ExternalId> toAdd)
Replaces external IDs for an account by external ID keys.
|
void |
replace(ReviewDb db,
java.util.Collection<ExternalId> toDelete,
java.util.Collection<ExternalId> toAdd)
Replaces external IDs.
|
void |
replace(ReviewDb db,
ExternalId toDelete,
ExternalId toAdd)
Replaces an external ID.
|
static com.github.rholder.retry.RetryerBuilder<java.lang.Void> |
retryerBuilder() |
void |
upsert(ReviewDb db,
java.util.Collection<ExternalId> extIds)
Inserts or updates external IDs.
|
void |
upsert(ReviewDb db,
ExternalId extId)
Inserts or updates an external ID.
|
public ExternalIdsUpdate(AccountCache accountCache)
public static com.github.rholder.retry.RetryerBuilder<java.lang.Void> retryerBuilder()
public void insert(ReviewDb db, ExternalId extId) throws java.io.IOException, com.google.gwtorm.server.OrmException
If the external ID already exists, the insert fails with OrmDuplicateKeyException
.
java.io.IOException
com.google.gwtorm.server.OrmException
public void insert(ReviewDb db, java.util.Collection<ExternalId> extIds) throws java.io.IOException, com.google.gwtorm.server.OrmException
If any of the external ID already exists, the insert fails with OrmDuplicateKeyException
.
java.io.IOException
com.google.gwtorm.server.OrmException
public void upsert(ReviewDb db, ExternalId extId) throws java.io.IOException, com.google.gwtorm.server.OrmException
If the external ID already exists, it is overwritten, otherwise it is inserted.
java.io.IOException
com.google.gwtorm.server.OrmException
public void upsert(ReviewDb db, java.util.Collection<ExternalId> extIds) throws java.io.IOException, com.google.gwtorm.server.OrmException
If any of the external IDs already exists, it is overwritten. New external IDs are inserted.
java.io.IOException
com.google.gwtorm.server.OrmException
public void delete(ReviewDb db, ExternalId extId) throws java.io.IOException, com.google.gwtorm.server.OrmException
The deletion fails with IllegalStateException
if there is an existing external ID
that has the same key, but otherwise doesn't match the specified external ID.
java.io.IOException
com.google.gwtorm.server.OrmException
public void delete(ReviewDb db, java.util.Collection<ExternalId> extIds) throws java.io.IOException, com.google.gwtorm.server.OrmException
The deletion fails with IllegalStateException
if there is an existing external ID
that has the same key as any of the external IDs that should be deleted, but otherwise doesn't
match the that external ID.
java.io.IOException
com.google.gwtorm.server.OrmException
public void delete(ReviewDb db, Account.Id accountId, ExternalId.Key extIdKey) throws java.io.IOException, com.google.gwtorm.server.OrmException
The external ID is only deleted if it belongs to the specified account. If it belongs to
another account the deletion fails with IllegalStateException
.
java.io.IOException
com.google.gwtorm.server.OrmException
public void delete(ReviewDb db, Account.Id accountId, java.util.Collection<ExternalId.Key> extIdKeys) throws java.io.IOException, com.google.gwtorm.server.OrmException
The external IDs are only deleted if they belongs to the specified account. If any of the
external IDs belongs to another account the deletion fails with IllegalStateException
.
java.io.IOException
com.google.gwtorm.server.OrmException
public void deleteAll(ReviewDb db, Account.Id accountId) throws java.io.IOException, com.google.gwtorm.server.OrmException
java.io.IOException
com.google.gwtorm.server.OrmException
public void replace(ReviewDb db, Account.Id accountId, java.util.Collection<ExternalId.Key> toDelete, java.util.Collection<ExternalId> toAdd) throws java.io.IOException, com.google.gwtorm.server.OrmException
Deletion of external IDs is done before adding the new external IDs. This means if an external ID key is specified for deletion and an external ID with the same key is specified to be added, the old external ID with that key is deleted first and then the new external ID is added (so the external ID for that key is replaced).
If any of the specified external IDs belongs to another account the replacement fails with
IllegalStateException
.
java.io.IOException
com.google.gwtorm.server.OrmException
public void replace(ReviewDb db, ExternalId toDelete, ExternalId toAdd) throws java.io.IOException, com.google.gwtorm.server.OrmException
If the specified external IDs belongs to different accounts the replacement fails with
IllegalStateException
.
java.io.IOException
com.google.gwtorm.server.OrmException
public void replace(ReviewDb db, java.util.Collection<ExternalId> toDelete, java.util.Collection<ExternalId> toAdd) throws java.io.IOException, com.google.gwtorm.server.OrmException
Deletion of external IDs is done before adding the new external IDs. This means if an external ID is specified for deletion and an external ID with the same key is specified to be added, the old external ID with that key is deleted first and then the new external ID is added (so the external ID for that key is replaced).
If the specified external IDs belong to different accounts the replacement fails with IllegalStateException
.
java.io.IOException
com.google.gwtorm.server.OrmException
public static Account.Id checkSameAccount(java.lang.Iterable<ExternalId> extIds)
public static Account.Id checkSameAccount(java.lang.Iterable<ExternalId> extIds, Account.Id accountId)