class EventType(Base): """Event types""" event_type = models.CharField(_("Event type"), max_length=8, help_text=_("Event type code."), choices=get_dict_choice('EVNT')) entity_type = models.CharField(_("Entity type"), max_length=8, help_text=_("Entity type code."), choices=get_dict_choice("ENTT")) class Meta: db_table = "evt_event_type" verbose_name = _("Event type") def __str__(self): return "{}::{}".format(self.event_type, self.entity_type) @property def event_type_raw(self): return self.event_type @property def entity_type_raw(self): return self.entity_type
class EventObject(Base): """Objects awaiting processing by subscribers.""" event = models.ForeignKey('Event', on_delete=models.CASCADE, help_text=_("Reference to event.")) procedure_name = models.CharField( _("Procedure name"), max_length=200, help_text=_("Subscriber procedure name.")) content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE, help_text=_("Business-entity type.")) object_id = models.PositiveIntegerField(_("Reference to the object.")) content_object = GenericForeignKey('content_type', 'object_id') eff_date = models.DateTimeField(_("Effective date"), help_text=_("Event effective date")) session = models.ForeignKey('prc.Session', related_name=_("Session"), help_text=_("Session identifier."), on_delete=models.CASCADE) split_hash = models.PositiveIntegerField( _("Split hash"), default=-1, help_text=_("Hash value to split further processing.")) status = models.CharField(_("Status"), help_text=_("Event status"), max_length=8, choices=get_dict_choice('EVST')) class Meta: db_table = "evt_event_object" verbose_name = _("Event object")
class Scale(BaseLang): """Scales by which attributes can be parametrised""" # inst = models.ForeignKey(Institution, help_text=_('Owner institution identifier'), default=9999) scale_type = models.CharField(_("Scale type"), max_length=8, choices=get_dict_choice("SCTP"), help_text=_("Category of scale")) class Meta: verbose_name = _("Modifier scale") db_table = "rul_mod_scale"
class RuleSet(BaseLang): """Sets of rules""" category = models.CharField(_("Category"), max_length=8, choices=get_dict_choice("RLCG"), help_text=_("Category of rules set (RLCG key)")) class Meta: verbose_name = _("Rule set") db_table = "rul_rule_set" def __str__(self): return "{}::{}".format(self.pk, self.name)
class ModifierParameter(BaseLang): """Parameters which can be used in scales to parametrise attributes""" name = models.CharField(_("Parameter name"), max_length=200) data_type = models.CharField(_("Data type"), max_length=8, choices=get_dict_choice("DTTP"), help_text=_("Parameter data type")) lov = models.ForeignKey("com.Lov", on_delete=models.SET_NULL, null=True, blank=True, help_text=_("List of Values identifier")) class Meta: db_table = 'rul_mod_param' verbose_name = _("Modifier Parameter")
class Procedure(BaseLang): """List of procedures used in rules""" proc_name = models.CharField(_("Procedure name"), max_length=200, help_text=_("Procedure name")) category = models.CharField(_("Category"), max_length=8, help_text=_("Category of procedure usage"), choices=get_dict_choice("RLCG")) class Meta: verbose_name = _("Rule procedure") db_table = "rul_proc" def __str__(self): return "{}::{}".format(self.pk, self.proc_name)