plan_data.jdl

@Description("Scenario type used to store data for a plan")
scenarioType PlanData {
   import TransactionalData
   import MasterData
   import DeliveryData
}

entity Schedule {
  // DOM  [primary.keys] : [start, end]
  start Instant required,
  end Instant required
}

entity ResourceUsagePerDay {
  // DOM  [primary.keys] : [day]
  day Integer,
  numberOfHours Integer,
}

entity SolutionSummary {
  // DOM  [single.row] : [true]
  start Instant,
  end Instant,
  timespan Integer
}

// Plant are sending resources to other plants
entity ResourceDelivery {
    start LocalDateTime,
    end LocalDateTime
}

@Description("Calendar with cycle")
entity Calendar {
  // DOM  [java.collectionName] : [Calendars]
  // DOM  [primary.keys] : [id]
  id String required
}


relationship ManyToOne {
  // DOM  [affects.primary.key] : [true]
  ResourceDelivery{resource} to Resource{deliveries}

  // DOM  [affects.primary.key] : [true]
  ResourceDelivery{from} to Plant{shippings}

  // DOM  [affects.primary.key] : [true]
  ResourceDelivery{to} to Plant{deliveries}

  // DOM  [affects.primary.key] : [true]
  ResourceDelivery{route} to TruckRoute{deliveries}

  // DOM  [affects.primary.key] : [true]
  Schedule{resource} to Resource{schedules}

  // DOM  [affects.primary.key] : [true]
  Schedule{activity} to Activity{schedules}

  // DOM  [affects.primary.key] : [true]
  ResourceUsagePerDay{resource} to Resource{usagePerDay}


  Calendar{parentCalendar} to Calendar{subCalendars},

  // DOM  [affects.primary.key] : [true]
  Calendar{schedule} to Schedule{schedules}
}