No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dynleapi.py 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. ## @author LeFactory
  2. import EditorialModel
  3. from EditorialModel import fieldtypes
  4. from EditorialModel.fieldtypes import naturerelation, char, integer, datetime, pk
  5. import leapi
  6. import leapi.lecrud
  7. import leapi.leobject
  8. import leapi.lerelation
  9. from leapi.leclass import _LeClass
  10. from leapi.letype import _LeType
  11. import DataSource.MySQL.leapidatasource
  12. ## @brief _LeCrud concret class
  13. # @see leapi.lecrud._LeCrud
  14. class LeCrud(leapi.lecrud._LeCrud):
  15. _datasource = DataSource.MySQL.leapidatasource.LeDataSourceSQL(**{})
  16. _uid_fieldtype = None
  17. ## @brief _LeObject concret class
  18. # @see leapi.leobject._LeObject
  19. class LeObject(LeCrud, leapi.leobject._LeObject):
  20. _me_uid = {1: 'Textes', 2: 'Personnes', 19: 'Numero', 5: 'Article', 6: 'Personne', 13: 'Publication', 14: 'Rubrique'}
  21. _uid_fieldtype = { 'lodel_id': EditorialModel.fieldtypes.pk.EmFieldType(**{'internal': 'automatic'}) }
  22. _leo_fieldtypes = {
  23. 'creation_date': EditorialModel.fieldtypes.datetime.EmFieldType(**{'now_on_create': True, 'internal': 'automatic'}),
  24. 'string': EditorialModel.fieldtypes.char.EmFieldType(**{'max_length': 128, 'internal': 'automatic'}),
  25. 'modification_date': EditorialModel.fieldtypes.datetime.EmFieldType(**{'now_on_update': True, 'now_on_create': True, 'internal': 'automatic'}),
  26. 'type_id': EditorialModel.fieldtypes.integer.EmFieldType(**{'internal': 'automatic'}),
  27. 'class_id': EditorialModel.fieldtypes.integer.EmFieldType(**{'internal': 'automatic'})
  28. }
  29. ## @brief _LeRelation concret class
  30. # @see leapi.lerelation._LeRelation
  31. class LeRelation(LeCrud, leapi.lerelation._LeRelation):
  32. _uid_fieldtype = { 'id_relation': EditorialModel.fieldtypes.pk.EmFieldType(**{'internal': 'automatic'}) }
  33. _rel_fieldtypes = {
  34. 'rank': EditorialModel.fieldtypes.integer.EmFieldType(**{'internal': 'automatic'}),
  35. 'nature': EditorialModel.fieldtypes.naturerelation.EmFieldType(**{}),
  36. 'depth': EditorialModel.fieldtypes.integer.EmFieldType(**{'internal': 'automatic'})
  37. }
  38. _rel_attr_fieldtypes = dict()
  39. class LeHierarch(LeRelation, leapi.lerelation._LeHierarch):
  40. _rel_attr_fieldtypes = dict()
  41. class LeRel2Type(LeRelation, leapi.lerelation._LeRel2Type):
  42. pass
  43. class LeClass(LeObject, _LeClass):
  44. pass
  45. class LeType(LeClass, _LeType):
  46. pass
  47. ## @brief EmClass Textes LeClass child class
  48. # @see leapi.leclass.LeClass
  49. class Textes(LeClass, LeObject):
  50. _class_id = 1
  51. ## @brief EmClass Personnes LeClass child class
  52. # @see leapi.leclass.LeClass
  53. class Personnes(LeClass, LeObject):
  54. _class_id = 2
  55. ## @brief EmClass Publication LeClass child class
  56. # @see leapi.leclass.LeClass
  57. class Publication(LeClass, LeObject):
  58. _class_id = 13
  59. ## @brief EmType Article LeType child class
  60. # @see leobject::letype::LeType
  61. class Article(LeType, Textes):
  62. _type_id = 5
  63. ## @brief EmType Personne LeType child class
  64. # @see leobject::letype::LeType
  65. class Personne(LeType, Personnes):
  66. _type_id = 6
  67. ## @brief EmType Rubrique LeType child class
  68. # @see leobject::letype::LeType
  69. class Rubrique(LeType, Publication):
  70. _type_id = 14
  71. ## @brief EmType Numero LeType child class
  72. # @see leobject::letype::LeType
  73. class Numero(LeType, Publication):
  74. _type_id = 19
  75. class Rel_textes2personne(LeRel2Type):
  76. _rel_attr_fieldtypes = {
  77. 'adresse': EditorialModel.fieldtypes.char.EmFieldType(**{'uniq': False, 'nullable': True, 'internal': False})
  78. }
  79. #Initialisation of Textes class attributes
  80. Textes._fieldtypes = {
  81. 'modification_date': EditorialModel.fieldtypes.datetime.EmFieldType(**{'nullable': False, 'uniq': False, 'now_on_update': True, 'now_on_create': True, 'internal': 'automatic'}),
  82. 'soustitre': EditorialModel.fieldtypes.char.EmFieldType(**{'uniq': False, 'nullable': True, 'internal': False}),
  83. 'string': EditorialModel.fieldtypes.char.EmFieldType(**{'nullable': True, 'uniq': False, 'max_length': 128, 'internal': 'automatic'}),
  84. 'titre': EditorialModel.fieldtypes.char.EmFieldType(**{'uniq': False, 'nullable': True, 'internal': False}),
  85. 'bleu': EditorialModel.fieldtypes.char.EmFieldType(**{'uniq': False, 'nullable': True, 'internal': False}),
  86. 'lodel_id': EditorialModel.fieldtypes.pk.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'}),
  87. 'type_id': EditorialModel.fieldtypes.integer.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'}),
  88. 'class_id': EditorialModel.fieldtypes.integer.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'}),
  89. 'creation_date': EditorialModel.fieldtypes.datetime.EmFieldType(**{'uniq': False, 'nullable': False, 'now_on_create': True, 'internal': 'automatic'})
  90. }
  91. Textes._linked_types = [Personne]
  92. Textes._classtype = 'entity'
  93. #Initialisation of Personnes class attributes
  94. Personnes._fieldtypes = {
  95. 'nom': EditorialModel.fieldtypes.char.EmFieldType(**{'uniq': False, 'nullable': True, 'internal': False}),
  96. 'age': EditorialModel.fieldtypes.char.EmFieldType(**{'uniq': False, 'nullable': True, 'internal': False}),
  97. 'prenom': EditorialModel.fieldtypes.char.EmFieldType(**{'uniq': False, 'nullable': True, 'internal': False}),
  98. 'string': EditorialModel.fieldtypes.char.EmFieldType(**{'nullable': True, 'uniq': False, 'max_length': 128, 'internal': 'automatic'}),
  99. 'lodel_id': EditorialModel.fieldtypes.pk.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'}),
  100. 'modification_date': EditorialModel.fieldtypes.datetime.EmFieldType(**{'nullable': False, 'uniq': False, 'now_on_update': True, 'now_on_create': True, 'internal': 'automatic'}),
  101. 'type_id': EditorialModel.fieldtypes.integer.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'}),
  102. 'class_id': EditorialModel.fieldtypes.integer.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'}),
  103. 'creation_date': EditorialModel.fieldtypes.datetime.EmFieldType(**{'uniq': False, 'nullable': False, 'now_on_create': True, 'internal': 'automatic'})
  104. }
  105. Personnes._linked_types = []
  106. Personnes._classtype = 'person'
  107. #Initialisation of Publication class attributes
  108. Publication._fieldtypes = {
  109. 'modification_date': EditorialModel.fieldtypes.datetime.EmFieldType(**{'nullable': False, 'uniq': False, 'now_on_update': True, 'now_on_create': True, 'internal': 'automatic'}),
  110. 'creation_date': EditorialModel.fieldtypes.datetime.EmFieldType(**{'uniq': False, 'nullable': False, 'now_on_create': True, 'internal': 'automatic'}),
  111. 'string': EditorialModel.fieldtypes.char.EmFieldType(**{'nullable': True, 'uniq': False, 'max_length': 128, 'internal': 'automatic'}),
  112. 'lodel_id': EditorialModel.fieldtypes.pk.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'}),
  113. 'titre': EditorialModel.fieldtypes.char.EmFieldType(**{'uniq': False, 'nullable': True, 'internal': False}),
  114. 'type_id': EditorialModel.fieldtypes.integer.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'}),
  115. 'class_id': EditorialModel.fieldtypes.integer.EmFieldType(**{'uniq': False, 'nullable': False, 'internal': 'automatic'})
  116. }
  117. Publication._linked_types = []
  118. Publication._classtype = 'entity'
  119. #Initialisation of Article class attributes
  120. Article._fields = ['titre', 'class_id', 'soustitre', 'string', 'type_id', 'lodel_id', 'modification_date', 'creation_date']
  121. Article._superiors = {'parent': [Rubrique]}
  122. Article._leclass = Textes
  123. #Initialisation of Personne class attributes
  124. Personne._fields = ['nom', 'class_id', 'prenom', 'string', 'type_id', 'lodel_id', 'modification_date', 'creation_date']
  125. Personne._superiors = {}
  126. Personne._leclass = Personnes
  127. #Initialisation of Rubrique class attributes
  128. Rubrique._fields = ['titre', 'class_id', 'string', 'type_id', 'lodel_id', 'modification_date', 'creation_date']
  129. Rubrique._superiors = {'parent': [Rubrique, Numero]}
  130. Rubrique._leclass = Publication
  131. #Initialisation of Numero class attributes
  132. Numero._fields = ['titre', 'class_id', 'string', 'type_id', 'lodel_id', 'modification_date', 'creation_date']
  133. Numero._superiors = {}
  134. Numero._leclass = Publication
  135. ## @brief Dict for getting LeClass and LeType child classes given an EM uid
  136. LeObject._me_uid = {1: Textes, 2: Personnes, 19: Numero, 5: Article, 6: Personne, 13: Publication, 14: Rubrique}