-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
683dd7e
commit b885a7a
Showing
106 changed files
with
1,258 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_aggregate import AbstractAggregate | ||
|
||
|
||
class BookAggregate(AbstractAggregate): | ||
"""Generated class for BookAggregate, inheriting from AbstractAggregate.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_aggregate/customer_aggregate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_aggregate import AbstractAggregate | ||
|
||
|
||
class CustomerAggregate(AbstractAggregate): | ||
"""Generated class for CustomerAggregate, inheriting from AbstractAggregate.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_aggregate import AbstractAggregate | ||
|
||
|
||
class OrderAggregate(AbstractAggregate): | ||
"""Generated class for OrderAggregate, inheriting from AbstractAggregate.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_policy/order_cancellation_policy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_policy import AbstractPolicy | ||
|
||
|
||
class OrderCancellationPolicy(AbstractPolicy): | ||
"""Generated class for OrderCancellationPolicy, inheriting from AbstractPolicy.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_policy import AbstractPolicy | ||
|
||
|
||
class RefundPolicy(AbstractPolicy): | ||
"""Generated class for RefundPolicy, inheriting from AbstractPolicy.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_policy import AbstractPolicy | ||
|
||
|
||
class ShippingPolicy(AbstractPolicy): | ||
"""Generated class for ShippingPolicy, inheriting from AbstractPolicy.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_read_model/book_catalog_read_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_read_model import AbstractReadModel | ||
|
||
|
||
class BookCatalogReadModel(AbstractReadModel): | ||
"""Generated class for BookCatalogReadModel, inheriting from AbstractReadModel.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_read_model/customer_order_history_read_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_read_model import AbstractReadModel | ||
|
||
|
||
class CustomerOrderHistoryReadModel(AbstractReadModel): | ||
"""Generated class for CustomerOrderHistoryReadModel, inheriting from AbstractReadModel.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_read_model/order_summary_read_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_read_model import AbstractReadModel | ||
|
||
|
||
class OrderSummaryReadModel(AbstractReadModel): | ||
"""Generated class for OrderSummaryReadModel, inheriting from AbstractReadModel.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from typetemp.template.typed_template import TypedTemplate | ||
|
||
from typetemp.template.render_funcs import render_str | ||
|
||
from rdddy.messages import EventStormModel | ||
|
||
base_class_mapping = { | ||
"domain_event_classnames": "Event", | ||
"external_event_classnames": "Event", | ||
"command_classnames": "Command", | ||
"query_classnames": "Query", | ||
"aggregate_classnames": "AbstractAggregate", | ||
"policy_classnames": "AbstractPolicy", | ||
"read_model_classnames": "AbstractReadModel", | ||
"view_classnames": "AbstractView", | ||
"ui_event_classnames": "Event", | ||
"saga_classnames": "AbstractSaga", | ||
"integration_event_classnames": "Event", | ||
"exception_classnames": "DomainException", | ||
"value_object_classnames": "AbstractValueObject", | ||
"task_classnames": "AbstractTask", | ||
} | ||
|
||
|
||
class GenRDDDYClassTemplate(TypedTemplate): | ||
source = """from rdddy.{{ base_class_name | underscore }} import {{ base_class_name }} | ||
class {{ classname }}({{ base_class_name }}): | ||
\"\"\"Generated class for {{ classname }}, inheriting from {{ base_class_name }}.\"\"\" | ||
pass | ||
""" | ||
to = "{{ base_class_name | underscore }}/{{ classname | underscore }}.py" | ||
|
||
|
||
|
||
def generate_class_definitions(model: EventStormModel): | ||
for attr, base_class_name in base_class_mapping.items(): | ||
classnames = getattr(model, attr, []) | ||
for classname in classnames: | ||
tmpl = GenRDDDYClassTemplate(base_class_name=base_class_name, classname=classname)() | ||
|
||
# Here, instead of render_str, you render the class_definition directly | ||
# print(class_definition) # Or save to a file as needed | ||
|
||
|
||
def main(): | ||
event_storm_model_data = { | ||
"domain_event_classnames": ["OrderPlaced", "PaymentProcessed", "InventoryUpdated"], | ||
"external_event_classnames": ["ExternalPaymentConfirmation", "SupplierInventoryUpdate", "SupplierInventoryConfirmation"], | ||
"command_classnames": ["PlaceOrder", "ProcessPayment", "UpdateInventory"], | ||
"query_classnames": ["GetOrderDetails", "ListBooks", "CheckOrderStatus"], | ||
"aggregate_classnames": ["OrderAggregate", "BookAggregate", "CustomerAggregate"], | ||
"policy_classnames": ["OrderCancellationPolicy", "RefundPolicy", "ShippingPolicy"], | ||
"read_model_classnames": ["OrderSummaryReadModel", "BookCatalogReadModel", "CustomerOrderHistoryReadModel"], | ||
"view_classnames": ["OrderDetailsView", "BookListView", "CustomerProfileView"], | ||
"ui_event_classnames": ["AddToCartButtonClick", "CheckoutFormSubmitted", "OrderHistoryPageLoaded"], | ||
"saga_classnames": ["OrderFulfillmentSaga", "PaymentProcessingSaga", "BookRestockSaga"], | ||
"integration_event_classnames": ["OrderPlacedIntegrationEvent", "PaymentProcessedIntegrationEvent", | ||
"InventoryUpdatedIntegrationEvent"], | ||
"exception_classnames": ["OrderNotFoundException", "PaymentDeclinedException", "BookOutOfStockException"], | ||
"value_object_classnames": ["Address", "Price", "Quantity"], | ||
"task_classnames": ["ValidateOrder", "CalculateShippingCosts", "SendOrderConfirmationEmail"], | ||
} | ||
|
||
event_storm_model = EventStormModel.model_validate(event_storm_model_data) | ||
|
||
generate_class_definitions(event_storm_model) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_saga import AbstractSaga | ||
|
||
|
||
class BookRestockSaga(AbstractSaga): | ||
"""Generated class for BookRestockSaga, inheriting from AbstractSaga.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_saga/order_fulfillment_saga.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_saga import AbstractSaga | ||
|
||
|
||
class OrderFulfillmentSaga(AbstractSaga): | ||
"""Generated class for OrderFulfillmentSaga, inheriting from AbstractSaga.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_saga/payment_processing_saga.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_saga import AbstractSaga | ||
|
||
|
||
class PaymentProcessingSaga(AbstractSaga): | ||
"""Generated class for PaymentProcessingSaga, inheriting from AbstractSaga.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_task/calculate_shipping_costs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_task import AbstractTask | ||
|
||
|
||
class CalculateShippingCosts(AbstractTask): | ||
"""Generated class for CalculateShippingCosts, inheriting from AbstractTask.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/abstract_task/send_order_confirmation_email.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_task import AbstractTask | ||
|
||
|
||
class SendOrderConfirmationEmail(AbstractTask): | ||
"""Generated class for SendOrderConfirmationEmail, inheriting from AbstractTask.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_task import AbstractTask | ||
|
||
|
||
class ValidateOrder(AbstractTask): | ||
"""Generated class for ValidateOrder, inheriting from AbstractTask.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_value_object import AbstractValueObject | ||
|
||
|
||
class Address(AbstractValueObject): | ||
"""Generated class for Address, inheriting from AbstractValueObject.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_value_object import AbstractValueObject | ||
|
||
|
||
class Price(AbstractValueObject): | ||
"""Generated class for Price, inheriting from AbstractValueObject.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_value_object import AbstractValueObject | ||
|
||
|
||
class Quantity(AbstractValueObject): | ||
"""Generated class for Quantity, inheriting from AbstractValueObject.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_view import AbstractView | ||
|
||
|
||
class BookListView(AbstractView): | ||
"""Generated class for BookListView, inheriting from AbstractView.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_view import AbstractView | ||
|
||
|
||
class CustomerProfileView(AbstractView): | ||
"""Generated class for CustomerProfileView, inheriting from AbstractView.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.abstract_view import AbstractView | ||
|
||
|
||
class OrderDetailsView(AbstractView): | ||
"""Generated class for OrderDetailsView, inheriting from AbstractView.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.command import Command | ||
|
||
|
||
class PlaceOrder(Command): | ||
"""Generated class for PlaceOrder, inheriting from Command.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.command import Command | ||
|
||
|
||
class ProcessPayment(Command): | ||
"""Generated class for ProcessPayment, inheriting from Command.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.command import Command | ||
|
||
|
||
class UpdateInventory(Command): | ||
"""Generated class for UpdateInventory, inheriting from Command.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/domain_exception/book_out_of_stock_exception.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.domain_exception import DomainException | ||
|
||
|
||
class BookOutOfStockException(DomainException): | ||
"""Generated class for BookOutOfStockException, inheriting from DomainException.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/domain_exception/order_not_found_exception.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.domain_exception import DomainException | ||
|
||
|
||
class OrderNotFoundException(DomainException): | ||
"""Generated class for OrderNotFoundException, inheriting from DomainException.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/domain_exception/payment_declined_exception.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.domain_exception import DomainException | ||
|
||
|
||
class PaymentDeclinedException(DomainException): | ||
"""Generated class for PaymentDeclinedException, inheriting from DomainException.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.event import Event | ||
|
||
|
||
class AddToCartButtonClick(Event): | ||
"""Generated class for AddToCartButtonClick, inheriting from Event.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.event import Event | ||
|
||
|
||
class CheckoutFormSubmitted(Event): | ||
"""Generated class for CheckoutFormSubmitted, inheriting from Event.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.messages import AbstractEvent | ||
|
||
|
||
class ExternalPaymentConfirmation(AbstractEvent): | ||
"""Generated class for ExternalPaymentConfirmation, inheriting from Event.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.event import Event | ||
|
||
|
||
class InventoryUpdated(Event): | ||
"""Generated class for InventoryUpdated, inheriting from Event.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/event/inventory_updated_integration_event.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.event import Event | ||
|
||
|
||
class InventoryUpdatedIntegrationEvent(Event): | ||
"""Generated class for InventoryUpdatedIntegrationEvent, inheriting from Event.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.event import Event | ||
|
||
|
||
class OrderHistoryPageLoaded(Event): | ||
"""Generated class for OrderHistoryPageLoaded, inheriting from Event.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.event import Event | ||
|
||
|
||
class OrderPlaced(Event): | ||
"""Generated class for OrderPlaced, inheriting from Event.""" | ||
pass | ||
|
7 changes: 7 additions & 0 deletions
7
src/experiments/actor/event/order_placed_integration_event.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.event import Event | ||
|
||
|
||
class OrderPlacedIntegrationEvent(Event): | ||
"""Generated class for OrderPlacedIntegrationEvent, inheriting from Event.""" | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from rdddy.event import Event | ||
|
||
|
||
class PaymentProcessed(Event): | ||
"""Generated class for PaymentProcessed, inheriting from Event.""" | ||
pass | ||
|
Oops, something went wrong.