chartletv0.21.0chartlet.casoon.de

← All examples

Orders and their invoices

Orders and their invoices in two packages. The diagram runs top down, but the Billing package sets "orientation": "landscape", so invoice, invoice lines and tax rate lie side by side as one block that the diagram places like a class; relations from outside meet the block where their class lies. The reminder stays outside both packages.

Orders and their invoices

examples/invoice-model.json
{
  "schemaVersion": 1,
  "type": "classes",
  "title": "Orders and their invoices",
  "source": "Illustrative domain model",
  "width": 900,
  "height": 760,
  "classes": {
    "orientation": "portrait",
    "packages": [
      {
        "id": "sales",
        "label": "Sales"
      },
      {
        "id": "billing",
        "label": "Billing",
        "orientation": "landscape"
      }
    ],
    "classes": [
      {
        "id": "customer",
        "label": "Customer",
        "attributes": [
          "+ id: Int",
          "+ name: String"
        ],
        "in": "sales"
      },
      {
        "id": "order",
        "label": "Order",
        "attributes": [
          "+ id: Int",
          "+ placedAt: Date"
        ],
        "methods": [
          "+ total(): Money"
        ],
        "in": "sales"
      },
      {
        "id": "invoice",
        "label": "Invoice",
        "attributes": [
          "+ number: String",
          "+ issuedAt: Date"
        ],
        "methods": [
          "+ total(): Money"
        ],
        "in": "billing"
      },
      {
        "id": "line",
        "label": "InvoiceLine",
        "attributes": [
          "+ quantity: Int",
          "+ net: Money"
        ],
        "in": "billing"
      },
      {
        "id": "tax",
        "label": "TaxRate",
        "attributes": [
          "+ code: String",
          "+ percent: Decimal"
        ],
        "in": "billing"
      },
      {
        "id": "reminder",
        "label": "Reminder",
        "attributes": [
          "+ level: Int",
          "+ sentAt: Date"
        ]
      }
    ],
    "relations": [
      {
        "from": "customer",
        "to": "order",
        "fromCardinality": "1",
        "toCardinality": "0..*",
        "label": "places"
      },
      {
        "from": "order",
        "to": "invoice",
        "fromCardinality": "1",
        "toCardinality": "1..*",
        "label": "billed as"
      },
      {
        "from": "invoice",
        "to": "line",
        "kind": "composition",
        "fromCardinality": "1",
        "toCardinality": "1..*",
        "label": "lists"
      },
      {
        "from": "line",
        "to": "tax",
        "fromCardinality": "*",
        "toCardinality": "1",
        "label": "taxed at"
      },
      {
        "from": "invoice",
        "to": "reminder",
        "fromCardinality": "1",
        "toCardinality": "0..3",
        "label": "dunned by"
      }
    ]
  }
}
Focus
Orders and their invoices
Orders and their invoicesClass diagram with 6 classes and 5 relations in 2 packages. Sales: Customer, Order. Billing: Invoice, InvoiceLine, TaxRate. Most connected: Invoice (3 connections). Bottleneck: Invoice; without it the diagram falls apart. Customer: 2 attributes, 0 methods. Customer is associated with Order (1 : 0..*) [places]. Order: 2 attributes, 1 method. Order is associated with Invoice (1 : 1..*) [billed as]. Invoice: 2 attributes, 1 method. Invoice is composed of InvoiceLine (1 : 1..*) [lists]; is associated with Reminder (1 : 0..3) [dunned by]. InvoiceLine: 2 attributes, 0 methods. InvoiceLine is associated with TaxRate (* : 1) [taxed at]. TaxRate: 2 attributes, 0 methods. Reminder: 2 attributes, 0 methods.SalesCustomer → Order: places0..*1Order → Invoice: billed as1..*1Invoice → Reminder: dunned by0..31placesbilled asdunned byCustomerCustomer+ id: Int+ name: StringOrderOrder+ id: Int+ placedAt: Date+ total(): MoneyBillingInvoice → InvoiceLine: lists1..*1InvoiceLine → TaxRate: taxed at1*liststaxed atInvoiceInvoice+ number: String+ issuedAt: Date+ total(): MoneyInvoiceLineInvoiceLine+ quantity: Int+ net: MoneyTaxRateTaxRate+ code: String+ percent: DecimalReminderReminder+ level: Int+ sentAt: Date

Source: Illustrative domain model

Show chart data
Data for Orders and their invoices
ItemKindPackageAttributesMethodsRelations
CustomerClassSales+ id: Int; + name: Stringis associated with Order (1 : 0..*) [places]
OrderClassSales+ id: Int; + placedAt: Date+ total(): Moneyis associated with Invoice (1 : 1..*) [billed as]
InvoiceClassBilling+ number: String; + issuedAt: Date+ total(): Moneyis composed of InvoiceLine (1 : 1..*) [lists]; is associated with Reminder (1 : 0..3) [dunned by]
InvoiceLineClassBilling+ quantity: Int; + net: Moneyis associated with TaxRate (* : 1) [taxed at]
TaxRateClassBilling+ code: String; + percent: Decimal
ReminderClass+ level: Int; + sentAt: Date
  • Class diagram with an oriented package
  • Lay out one part of a model its own way