|
1 |
# Copyright (C) 2017 Entr'ouvert
|
|
2 |
#
|
|
3 |
# This program is free software: you can redistribute it and/or modify it
|
|
4 |
# under the terms of the GNU Affero General Public License as published
|
|
5 |
# by the Free Software Foundation, either version 3 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
7 |
#
|
|
8 |
# This program is distributed in the hope that it will be useful,
|
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU Affero General Public License for more details.
|
|
12 |
#
|
|
13 |
# You should have received a copy of the GNU Affero General Public License
|
|
14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15 |
|
|
16 |
|
|
17 |
class CWBaseException(Exception):
|
|
18 |
pass
|
|
19 |
|
|
20 |
|
|
21 |
class CWBaseType(object):
|
|
22 |
|
|
23 |
def serialize(self):
|
|
24 |
pass
|
|
25 |
|
|
26 |
def save(self, location):
|
|
27 |
pass
|
|
28 |
|
|
29 |
|
|
30 |
class CWBSimpleType(CWBaseType):
|
|
31 |
|
|
32 |
def __ini__(self, value):
|
|
33 |
if value not in self.values:
|
|
34 |
raise CWBaseException('Value must be in %s' % self.values)
|
|
35 |
|
|
36 |
|
|
37 |
class CWBComplexType(CWBaseType):
|
|
38 |
pass
|
|
39 |
|
|
40 |
|
|
41 |
###################################
|
|
42 |
# SIMPLE TYPES
|
|
43 |
###################################
|
|
44 |
|
|
45 |
class EventKind(CWBSimpleType):
|
|
46 |
name = 'natureEvenement'
|
|
47 |
values = ['NAIS', 'DEC', 'MAR', 'REC']
|
|
48 |
|
|
49 |
|
|
50 |
class Sexe(CWBSimpleType):
|
|
51 |
name = 'sexe'
|
|
52 |
values = ['M', 'F', 'NA']
|
|
53 |
|
|
54 |
|
|
55 |
class Gender(CWBSimpleType):
|
|
56 |
name = 'genre'
|
|
57 |
values = ['M', 'Mme', 'Mlle']
|
|
58 |
|
|
59 |
|
|
60 |
class DocumentKind(CWBSimpleType):
|
|
61 |
name = 'natureDocument'
|
|
62 |
values = ['CPI', 'EXTAF', 'EXTSF', 'EXTPL']
|
|
63 |
|
|
64 |
|
|
65 |
class Concerned(CWBSimpleType):
|
|
66 |
name = 'typeInteresse'
|
|
67 |
values = ['reconnu', 'auteur']
|
|
68 |
|
|
69 |
|
|
70 |
class Canal(CWBSimpleType):
|
|
71 |
name = 'oeigineEC'
|
|
72 |
values = ['internet', 'guichet', 'courrier']
|
|
73 |
|
|
74 |
|
|
75 |
class Date(CWBaseType):
|
|
76 |
name = 'dateCivique'
|
|
77 |
|
|
78 |
|
|
79 |
###################################
|
|
80 |
# COMPLEX TYPES
|
|
81 |
###################################
|
|
82 |
|
|
83 |
class Name(CWBComplexType):
|
|
84 |
name = 'noms'
|
|
85 |
|
|
86 |
def __init__(self, last_name=None, preferred_name=None, usage=None):
|
|
87 |
self.nomDeFamille = last_name
|
|
88 |
self.nomUsage = preferred_name
|
|
89 |
self.typeUsage = usage
|
|
90 |
|
|
91 |
|
|
92 |
class PlaceType(CWBComplexType):
|
|
93 |
name = 'lieu'
|
|
94 |
|
|
95 |
def __init__(self, city=None, district=None, country=None):
|
|
96 |
self.ville = city
|
|
97 |
self.province = district
|
|
98 |
self.pays = country
|
|
99 |
|
|
100 |
|
|
101 |
class Address(CWBComplexType):
|
|
102 |
name = 'adresse'
|
|
103 |
|
|
104 |
def __init__(self, address1=None, address2=None, zip_code=None, place=None, mail=None, tel=None):
|
|
105 |
self.ligneAdr1 = address1
|
|
106 |
self.ligneAdr2 = address2
|
|
107 |
self.codePostal = zip_code
|
|
108 |
self.lieu = place
|
|
109 |
self.mail = mail
|
|
110 |
self.tel = tel
|
|
111 |
|
|
112 |
|
|
113 |
class EventDate(CWBComplexType):
|
|
114 |
name = 'dateEvenement'
|
|
115 |
|
|
116 |
def __init__(self, start=None, end=None):
|
|
117 |
self.dateDebut = start
|
|
118 |
self.dateFin = end
|
|
119 |
|
|
120 |
|
|
121 |
class Event(CWBComplexType):
|
|
122 |
name = 'evenement'
|
|
123 |
|
|
124 |
def __init__(self, concerned, partner, event_kind, concerned_kind, date, place):
|
|
125 |
self.interesse = concerned
|
|
126 |
self.conjoint = partner
|
|
127 |
self.natureEvenement = event_kind
|
|
128 |
self.typeInteresse = concerned_kind
|
|
129 |
self.dateEvenement = date
|
|
130 |
self.lieuEvenement = place
|
|
131 |
|
|
132 |
|
|
133 |
class Person(CWBComplexType):
|
|
134 |
name = 'individu'
|
|
135 |
|
|
136 |
def __init__(self, names=None, first_names=None, title=None, address=None, sex=None,
|
|
137 |
father=None, mother=None, birth=None):
|
|
138 |
self.noms = names
|
|
139 |
self.prenoms = first_names
|
|
140 |
self.genre = title
|
|
141 |
self.adresse = address
|
|
142 |
self.sexe = sex
|
|
143 |
self.pere = father
|
|
144 |
self.mere = mother
|
|
145 |
self.naissance = birth
|
|
146 |
|
|
147 |
|
|
148 |
class Applicant(CWBComplexType):
|
|
149 |
name = 'demandeur'
|
|
150 |
|
|
151 |
def __init__(self, kind, person):
|
|
152 |
self.qualiteDemandeur = kind
|
|
153 |
self.individu = person
|
|
154 |
|
|
155 |
|
|
156 |
class CivilStatusApplication(CWBaseType):
|
|
157 |
name = 'demandeEtatCivil'
|
|
158 |
|
|
159 |
def __init__(self, application_id, applicant, document_kind, copies, datetime, event,
|
|
160 |
reason, canal, comment):
|
|
161 |
self.identifiant = application_id
|
|
162 |
self.demandeur = applicant
|
|
163 |
self.natureDocument = document_kind
|
|
164 |
self.nbExemplaire = copies
|
|
165 |
self.dateDemande = datetime
|
|
166 |
self.evenement = event
|
|
167 |
self.motif = reason
|
|
168 |
self.origine = canal
|
|
169 |
self.commentaire = comment
|
0 |
|
-
|