Klasse SellbackRepository
java.lang.Object
de.delinkedde.areashopreborn.persistence.SellbackRepository
Persists sellback journals and their atomic ownership transition.
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungReads one sellback journal in its current durable state.findLatestPurchasePrice(UUID regionId) Finds the gross amount of the most recent completed purchase for a region.Lists sellback journals whose cross-system workflow did not reach a terminal state.findNonTerminal(int limit) Lists a bounded oldest-first batch of nonterminal sellback journals.voidinsert(SellbackTransaction transaction) Creates a durable sellback journal before any economy mutation occurs.voidpersistOwnership(SellbackTransaction transaction) Atomically transfers a sold parcel, removes access grants, and advances its journal.voidquarantine(UUID transactionId, UUID regionId, String failureDetail) Atomically quarantines an ambiguous sellback journal and its region.voidreleaseReservation(SellbackTransaction transaction, TransactionState terminalState, String failureDetail) Atomically releases an uncommitted ownership reservation and closes its journal.booleanreserve(SellbackTransaction transaction) Atomically reserves seller ownership and creates the journal before Vault is touched.voidresolvePayoutConfirmed(SellbackTransaction transaction, UUID administratorId, String evidence, Instant resolvedAt) Completes a quarantined sellback after an administrator verifies the external payout.voidresolveRefundConfirmed(SellbackTransaction transaction, UUID administratorId, String evidence, Instant resolvedAt) Restores a quarantined sellback after an administrator verifies the payout reversal.voidupdateState(UUID id, TransactionState state, String failureDetail) Updates a journal after completion, compensation, or a failure requiring review.
-
Konstruktordetails
-
SellbackRepository
Creates the sellback repository.- Parameter:
database- database connection provider
-
-
Methodendetails
-
findLatestPurchasePrice
Finds the gross amount of the most recent completed purchase for a region.- Parameter:
regionId- region identifier- Gibt zurück:
- reference price when the parcel has purchase history
- Löst aus:
SQLException- when the query fails
-
findNonTerminal
Lists sellback journals whose cross-system workflow did not reach a terminal state.- Gibt zurück:
- oldest incomplete sellbacks first
- Löst aus:
SQLException- when the query fails
-
findNonTerminal
Lists a bounded oldest-first batch of nonterminal sellback journals.- Parameter:
limit- maximum journals returned- Gibt zurück:
- oldest nonterminal sellbacks first
- Löst aus:
SQLException- when the query fails
-
insert
Creates a durable sellback journal before any economy mutation occurs.- Parameter:
transaction- journal snapshot- Löst aus:
SQLException- when insertion fails
-
reserve
Atomically reserves seller ownership and creates the journal before Vault is touched.- Parameter:
transaction- prepared sellback journal- Gibt zurück:
trueonly when the seller still owns a sold parcel- Löst aus:
SQLException- when persistence fails
-
releaseReservation
public void releaseReservation(SellbackTransaction transaction, TransactionState terminalState, String failureDetail) throws SQLException Atomically releases an uncommitted ownership reservation and closes its journal.- Parameter:
transaction- reserved transactionterminalState-FAILEDorCOMPENSATEDfailureDetail- bounded diagnostic detail- Löst aus:
SQLException- when either compare-and-set transition fails
-
persistOwnership
Atomically transfers a sold parcel, removes access grants, and advances its journal.- Parameter:
transaction- transaction to persist- Löst aus:
SQLException- when ownership changed concurrently or persistence fails
-
updateState
Updates a journal after completion, compensation, or a failure requiring review.- Parameter:
id- transaction identifierstate- new durable statefailureDetail- optional diagnostic detail- Löst aus:
SQLException- when the update fails
-
quarantine
Atomically quarantines an ambiguous sellback journal and its region.- Parameter:
transactionId- sellback journal identifierregionId- affected region identifierfailureDetail- bounded diagnostic detail- Löst aus:
SQLException- when either required state transition cannot be persisted
-
resolvePayoutConfirmed
public void resolvePayoutConfirmed(SellbackTransaction transaction, UUID administratorId, String evidence, Instant resolvedAt) throws SQLException Completes a quarantined sellback after an administrator verifies the external payout.- Parameter:
transaction- expected manual-review journaladministratorId- resolving administratorevidence- external payout referenceresolvedAt- resolution timestamp- Löst aus:
SQLException- when ownership or journal state changed concurrently
-
resolveRefundConfirmed
public void resolveRefundConfirmed(SellbackTransaction transaction, UUID administratorId, String evidence, Instant resolvedAt) throws SQLException Restores a quarantined sellback after an administrator verifies the payout reversal.- Parameter:
transaction- expected manual-review journaladministratorId- resolving administratorevidence- external refund referenceresolvedAt- resolution timestamp- Löst aus:
SQLException- when seller ownership or journal state changed concurrently
-
findById
Reads one sellback journal in its current durable state.- Parameter:
id- transaction identifier- Gibt zurück:
- current transaction snapshot when present
- Löst aus:
SQLException- when the query fails
-