mirror of
https://github.com/google/nomulus.git
synced 2025-05-31 09:44:03 +02:00
Move "WithLongVKey" to BillingEvent subclasses (#821)
When loading the VKeys for the BillingEvents hierarchy, it is necessary to restore the original concrete class for the type, otherwise we end up with a different (and incompatible) VKey. As part of this, convert the cancellation matching billing event to VKey<Recurring>, which seems like the only thing it actually can be.
This commit is contained in:
parent
71fa12f773
commit
77fabe4dc4
3 changed files with 11 additions and 5 deletions
|
@ -67,7 +67,6 @@ import org.joda.time.DateTime;
|
||||||
|
|
||||||
/** A billable event in a domain's lifecycle. */
|
/** A billable event in a domain's lifecycle. */
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
@WithLongVKey
|
|
||||||
public abstract class BillingEvent extends ImmutableObject
|
public abstract class BillingEvent extends ImmutableObject
|
||||||
implements Buildable, TransferServerApproveEntity {
|
implements Buildable, TransferServerApproveEntity {
|
||||||
|
|
||||||
|
@ -292,6 +291,7 @@ public abstract class BillingEvent extends ImmutableObject
|
||||||
@javax.persistence.Index(columnList = "allocation_token_id")
|
@javax.persistence.Index(columnList = "allocation_token_id")
|
||||||
})
|
})
|
||||||
@AttributeOverride(name = "id", column = @Column(name = "billing_event_id"))
|
@AttributeOverride(name = "id", column = @Column(name = "billing_event_id"))
|
||||||
|
@WithLongVKey
|
||||||
public static class OneTime extends BillingEvent implements DatastoreAndSqlEntity {
|
public static class OneTime extends BillingEvent implements DatastoreAndSqlEntity {
|
||||||
|
|
||||||
/** The billable value. */
|
/** The billable value. */
|
||||||
|
@ -327,7 +327,7 @@ public abstract class BillingEvent extends ImmutableObject
|
||||||
* Cancellation}s.
|
* Cancellation}s.
|
||||||
*/
|
*/
|
||||||
@Column(name = "cancellation_matching_billing_recurrence_id")
|
@Column(name = "cancellation_matching_billing_recurrence_id")
|
||||||
VKey<? extends BillingEvent> cancellationMatchingBillingEvent;
|
VKey<Recurring> cancellationMatchingBillingEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link AllocationToken} used in the creation of this event, or null if one was not used.
|
* The {@link AllocationToken} used in the creation of this event, or null if one was not used.
|
||||||
|
@ -409,7 +409,7 @@ public abstract class BillingEvent extends ImmutableObject
|
||||||
}
|
}
|
||||||
|
|
||||||
public Builder setCancellationMatchingBillingEvent(
|
public Builder setCancellationMatchingBillingEvent(
|
||||||
VKey<? extends BillingEvent> cancellationMatchingBillingEvent) {
|
VKey<Recurring> cancellationMatchingBillingEvent) {
|
||||||
getInstance().cancellationMatchingBillingEvent = cancellationMatchingBillingEvent;
|
getInstance().cancellationMatchingBillingEvent = cancellationMatchingBillingEvent;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -468,6 +468,7 @@ public abstract class BillingEvent extends ImmutableObject
|
||||||
@javax.persistence.Index(columnList = "recurrence_time_of_year")
|
@javax.persistence.Index(columnList = "recurrence_time_of_year")
|
||||||
})
|
})
|
||||||
@AttributeOverride(name = "id", column = @Column(name = "billing_recurrence_id"))
|
@AttributeOverride(name = "id", column = @Column(name = "billing_recurrence_id"))
|
||||||
|
@WithLongVKey
|
||||||
public static class Recurring extends BillingEvent implements DatastoreAndSqlEntity {
|
public static class Recurring extends BillingEvent implements DatastoreAndSqlEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -562,6 +563,7 @@ public abstract class BillingEvent extends ImmutableObject
|
||||||
@javax.persistence.Index(columnList = "billingTime")
|
@javax.persistence.Index(columnList = "billingTime")
|
||||||
})
|
})
|
||||||
@AttributeOverride(name = "id", column = @Column(name = "billing_cancellation_id"))
|
@AttributeOverride(name = "id", column = @Column(name = "billing_cancellation_id"))
|
||||||
|
@WithLongVKey
|
||||||
public static class Cancellation extends BillingEvent implements DatastoreAndSqlEntity {
|
public static class Cancellation extends BillingEvent implements DatastoreAndSqlEntity {
|
||||||
|
|
||||||
/** The billing time of the charge that is being cancelled. */
|
/** The billing time of the charge that is being cancelled. */
|
||||||
|
@ -682,6 +684,7 @@ public abstract class BillingEvent extends ImmutableObject
|
||||||
/** An event representing a modification of an existing one-time billing event. */
|
/** An event representing a modification of an existing one-time billing event. */
|
||||||
@ReportedOn
|
@ReportedOn
|
||||||
@Entity
|
@Entity
|
||||||
|
@WithLongVKey
|
||||||
public static class Modification extends BillingEvent implements DatastoreAndSqlEntity {
|
public static class Modification extends BillingEvent implements DatastoreAndSqlEntity {
|
||||||
|
|
||||||
/** The change in cost that should be applied to the original billing event. */
|
/** The change in cost that should be applied to the original billing event. */
|
||||||
|
|
|
@ -94,7 +94,10 @@
|
||||||
<class>google.registry.persistence.converter.ZonedDateTimeConverter</class>
|
<class>google.registry.persistence.converter.ZonedDateTimeConverter</class>
|
||||||
|
|
||||||
<!-- Generated converters for VKey -->
|
<!-- Generated converters for VKey -->
|
||||||
<class>google.registry.model.billing.VKeyConverter_BillingEvent</class>
|
<class>google.registry.model.billing.VKeyConverter_Cancellation</class>
|
||||||
|
<class>google.registry.model.billing.VKeyConverter_Modification</class>
|
||||||
|
<class>google.registry.model.billing.VKeyConverter_OneTime</class>
|
||||||
|
<class>google.registry.model.billing.VKeyConverter_Recurring</class>
|
||||||
<class>google.registry.model.contact.VKeyConverter_ContactResource</class>
|
<class>google.registry.model.contact.VKeyConverter_ContactResource</class>
|
||||||
<class>google.registry.model.domain.VKeyConverter_DomainBase</class>
|
<class>google.registry.model.domain.VKeyConverter_DomainBase</class>
|
||||||
<class>google.registry.model.domain.token.VKeyConverter_AllocationToken</class>
|
<class>google.registry.model.domain.token.VKeyConverter_AllocationToken</class>
|
||||||
|
|
|
@ -41,7 +41,7 @@ class google.registry.model.billing.BillingEvent$OneTime {
|
||||||
@Id java.lang.Long id;
|
@Id java.lang.Long id;
|
||||||
@Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent;
|
@Parent com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> parent;
|
||||||
google.registry.model.billing.BillingEvent$Reason reason;
|
google.registry.model.billing.BillingEvent$Reason reason;
|
||||||
google.registry.persistence.VKey<? extends google.registry.model.billing.BillingEvent> cancellationMatchingBillingEvent;
|
google.registry.persistence.VKey<google.registry.model.billing.BillingEvent$Recurring> cancellationMatchingBillingEvent;
|
||||||
google.registry.persistence.VKey<google.registry.model.domain.token.AllocationToken> allocationToken;
|
google.registry.persistence.VKey<google.registry.model.domain.token.AllocationToken> allocationToken;
|
||||||
java.lang.Integer periodYears;
|
java.lang.Integer periodYears;
|
||||||
java.lang.String clientId;
|
java.lang.String clientId;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue