Klasse RentalRepository
java.lang.Object
de.delinkedde.areashopreborn.persistence.RentalRepository
Persists rental listings, exclusive reservations, contracts, and payment journal entries.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic final recordMinimal durable context required to quarantine an interrupted rental payment.static final recordImmutable context for resolving a quarantined initial rental or extension payment. -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidactivate(RentalContract contract, UUID paymentId) Activates a paid contract and closes its reserved listing.voidactivateExtension(RentalContract contract, UUID paymentId, int periods) Commits a paid extension.booleanend(RentalContract contract, RentalState terminalState) Ends a contract and republishes its original rental listing.findActiveByRegion(UUID regionId) Finds the active rental contract for a region.Lists contracts whose expiration time has been reached.Lists at most one bounded scheduler batch of expired contracts.Lists rental payment journals whose external money outcome is not terminal.findNonTerminalPayments(int limit) Lists a bounded oldest-first batch of nonterminal rental payment journals.findRecoveryPayment(UUID paymentId) Loads the complete context required for an evidence-based rental payment resolution.Finds duration terms attached to a rental listing.voidpublish(Listing listing, RentalTerms terms) Atomically publishes a rental listing and its duration terms.voidquarantinePayment(UUID contractId, UUID regionId, UUID paymentId, String detail) Atomically quarantines an ambiguous rental payment and its affected estate state.voidrelease(RentalContract contract, UUID paymentId, TransactionState paymentState, String detail) Releases an initial rental reservation with an explicit payment outcome.voidrelease(RentalContract contract, UUID paymentId, String detail) Releases an unpaid reservation and records its failure.voidreleaseExtension(UUID contractId, UUID paymentId, TransactionState paymentState, String detail) Restores an active contract and closes its extension payment with an explicit outcome.voidreleaseExtension(UUID contractId, UUID paymentId, String detail) Restores an active contract after an extension payment failure and closes the payment journal as failed.booleanreserve(Listing listing, RentalContract contract, UUID paymentId, BigDecimal totalAmount) Exclusively reserves a rental listing and creates pending contract and payment journals.booleanreserveExtension(RentalContract contract, UUID paymentId, int periods, BigDecimal amount) Reserves a contract extension and inserts its payment journal.voidresolvePaymentConfirmed(RentalRepository.RentalRecoveryPayment recovery, UUID administratorId, String evidence, Instant resolvedAt) Resolves a quarantined rental after an administrator verifies the external payment.voidresolveRefundConfirmed(RentalRepository.RentalRecoveryPayment recovery, UUID administratorId, String evidence, Instant resolvedAt) Resolves a quarantined rental after an administrator verifies the external refund.booleansetAutoExtend(UUID contractId, UUID renterId, boolean enabled) Updates automatic extension for a renter-owned active contract.
-
Konstruktordetails
-
RentalRepository
Creates the rental repository.- Parameter:
database- database connection provider
-
-
Methodendetails
-
findTerms
Finds duration terms attached to a rental listing.- Parameter:
listingId- listing identifier- Gibt zurück:
- terms when present
- Löst aus:
SQLException- when the query fails
-
findActiveByRegion
Finds the active rental contract for a region.- Parameter:
regionId- region identifier- Gibt zurück:
- active contract when present
- Löst aus:
SQLException- when the query fails
-
findNonTerminalPayments
Lists rental payment journals whose external money outcome is not terminal.- Gibt zurück:
- oldest incomplete payments with their contract and region identifiers
- Löst aus:
SQLException- when the query fails
-
findNonTerminalPayments
public List<RentalRepository.IncompleteRentalPayment> findNonTerminalPayments(int limit) throws SQLException Lists a bounded oldest-first batch of nonterminal rental payment journals.- Parameter:
limit- maximum payments returned- Gibt zurück:
- oldest incomplete payment contexts
- Löst aus:
SQLException- when the query fails
-
findRecoveryPayment
public Optional<RentalRepository.RentalRecoveryPayment> findRecoveryPayment(UUID paymentId) throws SQLException Loads the complete context required for an evidence-based rental payment resolution.- Parameter:
paymentId- quarantined payment identifier- Gibt zurück:
- recovery context when the payment exists
- Löst aus:
SQLException- when the query fails
-
findDue
Lists contracts whose expiration time has been reached.- Parameter:
now- cutoff time- Gibt zurück:
- expired active contracts
- Löst aus:
SQLException- when the query fails
-
findDue
Lists at most one bounded scheduler batch of expired contracts.- Parameter:
now- cutoff timelimit- positive maximum number of returned contracts- Gibt zurück:
- oldest expired active contracts up to the limit
- Löst aus:
SQLException- when the query fails
-
reserveExtension
public boolean reserveExtension(RentalContract contract, UUID paymentId, int periods, BigDecimal amount) throws SQLException Reserves a contract extension and inserts its payment journal.- Parameter:
contract- current contract snapshotpaymentId- payment identifierperiods- additional periodsamount- total charge- Gibt zurück:
- whether the active contract was reserved
- Löst aus:
SQLException- when persistence fails
-
activateExtension
public void activateExtension(RentalContract contract, UUID paymentId, int periods) throws SQLException Commits a paid extension.- Parameter:
contract- previous contract snapshotpaymentId- payment identifierperiods- additional periods- Löst aus:
SQLException- when the pending contract changed concurrently
-
releaseExtension
Restores an active contract after an extension payment failure and closes the payment journal as failed.- Parameter:
contractId- pending contract identifierpaymentId- failed extension payment identifierdetail- diagnostic failure detail- Löst aus:
SQLException- when the atomic recovery update fails
-
releaseExtension
public void releaseExtension(UUID contractId, UUID paymentId, TransactionState paymentState, String detail) throws SQLException Restores an active contract and closes its extension payment with an explicit outcome.- Parameter:
contractId- pending contract identifierpaymentId- extension payment identifierpaymentState-TransactionState.FAILEDorTransactionState.COMPENSATEDdetail- diagnostic failure detail- Löst aus:
SQLException- when the outcome is invalid or persistence fails
-
setAutoExtend
Updates automatic extension for a renter-owned active contract.- Parameter:
contractId- contract identifierrenterId- expected renter used for authorization at the database boundaryenabled- desired automatic extension state- Gibt zurück:
truewhen an active matching contract was updated- Löst aus:
SQLException- when the update fails
-
end
Ends a contract and republishes its original rental listing.- Parameter:
contract- active contractterminalState- cancellation or expiration state- Gibt zurück:
- whether the contract was ended
- Löst aus:
SQLException- when persistence fails
-
publish
Atomically publishes a rental listing and its duration terms.- Parameter:
listing- rental listingterms- duration constraints- Löst aus:
SQLException- when the parcel is not a draft or persistence fails
-
reserve
public boolean reserve(Listing listing, RentalContract contract, UUID paymentId, BigDecimal totalAmount) throws SQLException Exclusively reserves a rental listing and creates pending contract and payment journals.- Parameter:
listing- listing being rentedcontract- proposed contractpaymentId- initial payment identifiertotalAmount- full initial charge- Gibt zurück:
truewhen this caller acquired the listing- Löst aus:
SQLException- when persistence fails
-
activate
Activates a paid contract and closes its reserved listing.- Parameter:
contract- contract to activatepaymentId- payment journal identifier- Löst aus:
SQLException- when the reservation no longer exists
-
release
Releases an unpaid reservation and records its failure.- Parameter:
contract- pending contractpaymentId- payment journal identifierdetail- diagnostic failure detail- Löst aus:
SQLException- when persistence fails
-
release
public void release(RentalContract contract, UUID paymentId, TransactionState paymentState, String detail) throws SQLException Releases an initial rental reservation with an explicit payment outcome.- Parameter:
contract- pending contractpaymentId- payment journal identifierpaymentState-TransactionState.FAILEDorTransactionState.COMPENSATEDdetail- diagnostic failure detail- Löst aus:
SQLException- when the outcome is invalid or persistence fails
-
quarantinePayment
public void quarantinePayment(UUID contractId, UUID regionId, UUID paymentId, String detail) throws SQLException Atomically quarantines an ambiguous rental payment and its affected estate state.The listing deliberately remains reserved or closed. Administrators must inspect the external Vault state before making the parcel available again.
- Parameter:
contractId- affected rental contractregionId- affected estate regionpaymentId- ambiguous payment journaldetail- bounded diagnostic detail- Löst aus:
SQLException- when any required journal or contract row is missing
-
resolvePaymentConfirmed
public void resolvePaymentConfirmed(RentalRepository.RentalRecoveryPayment recovery, UUID administratorId, String evidence, Instant resolvedAt) throws SQLException Resolves a quarantined rental after an administrator verifies the external payment.- Parameter:
recovery- expected recovery snapshotadministratorId- resolving administratorevidence- external payment referenceresolvedAt- resolution timestamp- Löst aus:
SQLException- when any compare-and-set no longer matches
-
resolveRefundConfirmed
public void resolveRefundConfirmed(RentalRepository.RentalRecoveryPayment recovery, UUID administratorId, String evidence, Instant resolvedAt) throws SQLException Resolves a quarantined rental after an administrator verifies the external refund.- Parameter:
recovery- expected recovery snapshotadministratorId- resolving administratorevidence- external refund referenceresolvedAt- resolution timestamp- Löst aus:
SQLException- when any compare-and-set no longer matches
-