|
@@ -0,0 +1,128 @@
|
|
1
|
+#-*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+from component import EmComponent
|
|
4
|
+
|
|
5
|
+class EmType(EmComponent):
|
|
6
|
+ """ Represents type of documents
|
|
7
|
+
|
|
8
|
+ A type is a specialisation of a class, it can select optional field,
|
|
9
|
+ they have hooks, are organized in hierarchy and linked to other
|
|
10
|
+ EmType with special fields called relation_to_type fields
|
|
11
|
+ @see EmComponent
|
|
12
|
+ """
|
|
13
|
+
|
|
14
|
+ def __init__(id_or_name):
|
|
15
|
+ """ Instanciate an EmType with data fetched from db
|
|
16
|
+ @param id_or_name str|int: Identify the EmType by name or by global_id
|
|
17
|
+ @throw TypeError
|
|
18
|
+ @see EmComponent::__init__()
|
|
19
|
+ """
|
|
20
|
+ super(EmType, self).__init__()
|
|
21
|
+ pass
|
|
22
|
+
|
|
23
|
+ @staticmethod
|
|
24
|
+ def create(name, em_class, ml_repr = None, ml_help = None, icon = None, sort_field = None):
|
|
25
|
+ """ Create a new EmType and instanciate it
|
|
26
|
+
|
|
27
|
+ @param name str: The name of the new type
|
|
28
|
+ @param em_class EmClass: The class that the new type will specialize
|
|
29
|
+ @param ml_repr MlString: Multilingual representation of the type
|
|
30
|
+ @param ml_help MlString: Multilingual help for the type
|
|
31
|
+ @param icon str|None: The filename of the icon
|
|
32
|
+ @param sort_field EmField|None: The field used to sort by default
|
|
33
|
+
|
|
34
|
+ @see EmComponent::__init__()
|
|
35
|
+
|
|
36
|
+ @todo Change the icon param type
|
|
37
|
+ @todo change staticmethod to classmethod
|
|
38
|
+ """
|
|
39
|
+ pass
|
|
40
|
+
|
|
41
|
+ def field_groups():
|
|
42
|
+ """ Get the list of associated fieldgroups
|
|
43
|
+ @return A list of EmFieldGroup
|
|
44
|
+ """
|
|
45
|
+ pass
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+ def fields():
|
|
49
|
+ """ Get the list of associated fields
|
|
50
|
+ @return A list of EmField
|
|
51
|
+ """
|
|
52
|
+ pass
|
|
53
|
+
|
|
54
|
+ def select_field(field):
|
|
55
|
+ """ Indicate that an optionnal field is used
|
|
56
|
+
|
|
57
|
+ @param field EmField: The optional field to select
|
|
58
|
+ @throw ValueError, TypeError
|
|
59
|
+ @todo change exception type and define return value and raise condition
|
|
60
|
+ """
|
|
61
|
+ pass
|
|
62
|
+
|
|
63
|
+ def unselect_field(field):
|
|
64
|
+ """ Indicate that an optionnal field will not be used
|
|
65
|
+ @param field EmField: The optional field to unselect
|
|
66
|
+ @throw ValueError, TypeError
|
|
67
|
+ @todo change exception type and define return value and raise condition
|
|
68
|
+ """
|
|
69
|
+ pass
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+ def hooks():
|
|
73
|
+ """Get the list of associated hooks"""
|
|
74
|
+ pass
|
|
75
|
+
|
|
76
|
+ def add_hook(hook):
|
|
77
|
+ """ Add a new hook
|
|
78
|
+ @param hook EmHook: A EmHook instance
|
|
79
|
+ @throw TypeError
|
|
80
|
+ """
|
|
81
|
+ pass
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+ def del_hook(hook):
|
|
85
|
+ """ Delete a hook
|
|
86
|
+ @param hook EmHook: A EmHook instance
|
|
87
|
+ @throw TypeError
|
|
88
|
+ @todo Maybe we don't need a EmHook instance but just a hook identifier
|
|
89
|
+ """
|
|
90
|
+ pass
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+ def superiors():
|
|
94
|
+ """ Get the list of superiors EmType in the type hierarchy
|
|
95
|
+ @return A list of EmType
|
|
96
|
+ """
|
|
97
|
+ pass
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+ def add_superior(em_type, relation_nature):
|
|
101
|
+ """ Add a superior in the type hierarchy
|
|
102
|
+
|
|
103
|
+ @param em_type EmType: An EmType instance
|
|
104
|
+ @param relation_nature str: The name of the relation's nature
|
|
105
|
+ @throw TypeError
|
|
106
|
+ @todo define return value and raise condition
|
|
107
|
+ """
|
|
108
|
+ pass
|
|
109
|
+
|
|
110
|
+ def del_superior(em_type):
|
|
111
|
+ """ Delete a superior in the type hierarchy
|
|
112
|
+
|
|
113
|
+ @param em_type EmType: An EmType instance
|
|
114
|
+ @throw TypeError
|
|
115
|
+ @todo define return value and raise condition
|
|
116
|
+ """
|
|
117
|
+ pass
|
|
118
|
+
|
|
119
|
+ def linked_types():
|
|
120
|
+ """ Get the list of linked type
|
|
121
|
+
|
|
122
|
+ Types are linked with special fields called relation_to_type fields
|
|
123
|
+
|
|
124
|
+ @return a list of EmType
|
|
125
|
+ @see EmFields
|
|
126
|
+ """
|
|
127
|
+ pass
|
|
128
|
+
|