1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
# |
3
|
|
|
# This file is part of SENAITE.CORE. |
4
|
|
|
# |
5
|
|
|
# SENAITE.CORE is free software: you can redistribute it and/or modify it under |
6
|
|
|
# the terms of the GNU General Public License as published by the Free Software |
7
|
|
|
# Foundation, version 2. |
8
|
|
|
# |
9
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT |
10
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
11
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
12
|
|
|
# details. |
13
|
|
|
# |
14
|
|
|
# You should have received a copy of the GNU General Public License along with |
15
|
|
|
# this program; if not, write to the Free Software Foundation, Inc., 51 |
16
|
|
|
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17
|
|
|
# |
18
|
|
|
# Copyright 2018-2024 by it's authors. |
19
|
|
|
# Some rights reserved, see README and LICENSE. |
20
|
|
|
|
21
|
|
|
from plone.app.z3cform.interfaces import IPloneFormLayer |
22
|
|
|
from plone.protect.interfaces import IDisableCSRFProtection |
23
|
|
|
from senaite.core.interfaces.catalog import * # noqa:F401,F403 |
24
|
|
|
from senaite.core.interfaces.datamanager import IDataManager # noqa:F401 |
25
|
|
|
from senaite.core.interfaces.widget import * # noqa:F401,F403 |
26
|
|
|
from zope.interface import Interface |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
class ISenaiteCore(IDisableCSRFProtection): |
30
|
|
|
"""Marker interface that defines a Zope 3 browser layer. |
31
|
|
|
|
32
|
|
|
NOTE: We disable CSRF protection site-wide. |
33
|
|
|
""" |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
class ISenaiteFormLayer(IPloneFormLayer): |
37
|
|
|
"""Used to override plone.app.z3cform forms |
38
|
|
|
|
39
|
|
|
Inherits from `z3c.form.interfaces.IFormLayer` |
40
|
|
|
""" |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
class ISenaiteRegistryFactory(Interface): |
44
|
|
|
"""Marker interface for factory registry records |
45
|
|
|
""" |
46
|
|
|
|
47
|
|
|
|
48
|
|
|
class IShowDisplayMenu(Interface): |
49
|
|
|
"""Marker interface that can be applied for contents that should display |
50
|
|
|
the "Display" menu |
51
|
|
|
""" |
52
|
|
|
|
53
|
|
|
|
54
|
|
|
class IShowFactoriesMenu(Interface): |
55
|
|
|
"""Marker interface that can be applied for contents that should display |
56
|
|
|
the "Add" menu |
57
|
|
|
""" |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
class IHideActionsMenu(Interface): |
61
|
|
|
"""Marker interface that can be applied for contents that should not |
62
|
|
|
display the content actions menu |
63
|
|
|
""" |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
class IAjaxEditForm(Interface): |
67
|
|
|
"""Ajax edit form adapter |
68
|
|
|
""" |
69
|
|
|
|
70
|
|
|
def initialized(data): |
71
|
|
|
"""Called once after the edit form was rendered |
72
|
|
|
|
73
|
|
|
:param data: JSON payload of the edit form. |
74
|
|
|
Contains at least `form`, `name`, `value` |
75
|
|
|
:returns: A dictionary with update instructions for the frontend logic |
76
|
|
|
""" |
77
|
|
|
|
78
|
|
|
def modified(data): |
79
|
|
|
"""Called for each field modification |
80
|
|
|
|
81
|
|
|
:param data: JSON payload of the edit form. |
82
|
|
|
Contains at least `form`, `name`, `value` |
83
|
|
|
:returns: A dictionary with update instructions for the frontend logic |
84
|
|
|
""" |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
class IMultiCatalogBehavior(Interface): |
88
|
|
|
"""Support multiple catalogs for Dexterity contents |
89
|
|
|
""" |
90
|
|
|
|
91
|
|
|
|
92
|
|
|
class IAutoGenerateID(Interface): |
93
|
|
|
"""Auto-generate ID with ID server |
94
|
|
|
""" |
95
|
|
|
|
96
|
|
|
|
97
|
|
|
class IIdServer(Interface): |
98
|
|
|
"""Marker Interface for ID server |
99
|
|
|
""" |
100
|
|
|
|
101
|
|
|
def generate_id(self, portal_type, batch_size=None): |
102
|
|
|
"""Generate a new id for 'portal_type' |
103
|
|
|
""" |
104
|
|
|
|
105
|
|
|
|
106
|
|
|
class IIdServerVariables(Interface): |
107
|
|
|
"""Marker interfaces for variables generator for ID Server |
108
|
|
|
""" |
109
|
|
|
|
110
|
|
|
def get_variables(self, **kw): |
111
|
|
|
"""Returns a dict with variables |
112
|
|
|
""" |
113
|
|
|
|
114
|
|
|
|
115
|
|
|
class IIdServerTypeID(Interface): |
116
|
|
|
"""Marker interface for type id resolution for ID Server |
117
|
|
|
""" |
118
|
|
|
|
119
|
|
|
def get_type_id(self, **kw): |
120
|
|
|
"""Returns the type id for the context passed in the constructor, that |
121
|
|
|
is used for custom ID formatting, regardless of the real portal type of |
122
|
|
|
the context. Return None if no type id can be resolved by this adapter |
123
|
|
|
""" |
124
|
|
|
|
125
|
|
|
|
126
|
|
|
class INumberGenerator(Interface): |
127
|
|
|
"""A utility to generates unique numbers by key |
128
|
|
|
""" |
129
|
|
|
|
130
|
|
|
|
131
|
|
|
class IContainer(Interface): |
132
|
|
|
"""SENAITE Base Container |
133
|
|
|
""" |
134
|
|
|
|
135
|
|
|
|
136
|
|
|
class IItem(Interface): |
137
|
|
|
"""SENAITE Base Item |
138
|
|
|
""" |
139
|
|
|
|
140
|
|
|
|
141
|
|
|
class ITemporaryObject(Interface): |
142
|
|
|
"""Marker interface for temporary objects |
143
|
|
|
|
144
|
|
|
This is similar to the `creationFlag`, but skips indexing for any object |
145
|
|
|
that implements this interface. |
146
|
|
|
|
147
|
|
|
Also see: `senaite.core.patches.catalog.catlog_object` |
148
|
|
|
""" |
149
|
|
|
|
150
|
|
|
|
151
|
|
|
class ISetup(Interface): |
152
|
|
|
"""Marker interface for setup folder |
153
|
|
|
""" |
154
|
|
|
|
155
|
|
|
|
156
|
|
|
class ISamples(Interface): |
157
|
|
|
"""Marker interface for samples main folder |
158
|
|
|
""" |
159
|
|
|
|
160
|
|
|
|
161
|
|
|
class ISamplesView(Interface): |
162
|
|
|
"""Marker interface for samples listing view |
163
|
|
|
""" |
164
|
|
|
|
165
|
|
|
|
166
|
|
|
class IHaveUIDReferences(Interface): |
167
|
|
|
"""Marker interface when the object contains UID references |
168
|
|
|
""" |
169
|
|
|
|
170
|
|
|
|
171
|
|
|
class IAnalysisProfile(Interface): |
172
|
|
|
"""Marker interface for analysis profiles |
173
|
|
|
""" |
174
|
|
|
|
175
|
|
|
|
176
|
|
|
class IAnalysisProfiles(Interface): |
177
|
|
|
"""Marker interface for analysis profiles setup folder |
178
|
|
|
""" |
179
|
|
|
|
180
|
|
|
|
181
|
|
|
class IAnalysisCategory(Interface): |
182
|
|
|
"""Marker interface for an Analysis Category |
183
|
|
|
""" |
184
|
|
|
|
185
|
|
|
|
186
|
|
|
class IAnalysisCategories(Interface): |
187
|
|
|
"""Marker interface for Analysis Categories |
188
|
|
|
""" |
189
|
|
|
|
190
|
|
|
|
191
|
|
|
class IHaveAnalysisCategory(Interface): |
192
|
|
|
"""Marker interface for objects that have AnalysisCategory(ies) assigned |
193
|
|
|
""" |
194
|
|
|
|
195
|
|
|
def getCategory(self): |
196
|
|
|
"""Returns the category(ies) assigned to this instance |
197
|
|
|
""" |
198
|
|
|
|
199
|
|
|
def getCategoryUID(self): |
200
|
|
|
"""Returns the UID of the category(ies) assigned to this instance |
201
|
|
|
""" |
202
|
|
|
|
203
|
|
|
def getCategoryTitle(self): |
204
|
|
|
"""Returns the title of the category(ies) assigned to this instance |
205
|
|
|
""" |
206
|
|
|
|
207
|
|
|
|
208
|
|
|
class IAttachmentType(Interface): |
209
|
|
|
"""Marker interface for attachment type |
210
|
|
|
""" |
211
|
|
|
|
212
|
|
|
|
213
|
|
|
class IAttachmentTypes(Interface): |
214
|
|
|
"""Marker interface for attachment types setup folder |
215
|
|
|
""" |
216
|
|
|
|
217
|
|
|
|
218
|
|
|
class ISampleContainers(Interface): |
219
|
|
|
"""Marker interface for sample container setup folder |
220
|
|
|
""" |
221
|
|
|
|
222
|
|
|
|
223
|
|
|
class ISampleContainer(Interface): |
224
|
|
|
"""Marker interface for sample containers |
225
|
|
|
""" |
226
|
|
|
|
227
|
|
|
|
228
|
|
|
class IDepartments(Interface): |
229
|
|
|
"""Marker interface for departments setup folder |
230
|
|
|
""" |
231
|
|
|
|
232
|
|
|
|
233
|
|
|
class IDepartment(Interface): |
234
|
|
|
"""Marker interface for departments |
235
|
|
|
""" |
236
|
|
|
|
237
|
|
|
|
238
|
|
|
class ISampleConditions(Interface): |
239
|
|
|
"""Marker interface for sample conditions setup folder |
240
|
|
|
""" |
241
|
|
|
|
242
|
|
|
|
243
|
|
|
class ISampleCondition(Interface): |
244
|
|
|
"""Marker interface for sample conditions |
245
|
|
|
""" |
246
|
|
|
|
247
|
|
|
|
248
|
|
|
class ISamplePoint(Interface): |
249
|
|
|
"""Marker interface for sample points |
250
|
|
|
""" |
251
|
|
|
|
252
|
|
|
|
253
|
|
|
class ISamplePoints(Interface): |
254
|
|
|
"""Marker interface for sample points setup folder |
255
|
|
|
""" |
256
|
|
|
|
257
|
|
|
|
258
|
|
|
class ISamplePreservations(Interface): |
259
|
|
|
"""Marker interface for preservations setup folder |
260
|
|
|
""" |
261
|
|
|
|
262
|
|
|
|
263
|
|
|
class ISamplePreservation(Interface): |
264
|
|
|
"""Marker interface for preservations |
265
|
|
|
""" |
266
|
|
|
|
267
|
|
|
|
268
|
|
|
class ISampleMatrices(Interface): |
269
|
|
|
"""Marker interface for sample matrices setup folder |
270
|
|
|
""" |
271
|
|
|
|
272
|
|
|
|
273
|
|
|
class ISampleMatrix(Interface): |
274
|
|
|
"""Marker interface for sample matrices |
275
|
|
|
""" |
276
|
|
|
|
277
|
|
|
|
278
|
|
|
class ISampleTemplates(Interface): |
279
|
|
|
"""Marker interface for sample templates setup folder |
280
|
|
|
""" |
281
|
|
|
|
282
|
|
|
|
283
|
|
|
class ISampleTemplate(Interface): |
284
|
|
|
"""Marker interface for sample template |
285
|
|
|
""" |
286
|
|
|
|
287
|
|
|
|
288
|
|
|
class ISubGroup(Interface): |
289
|
|
|
"""Marker interface for subgroup |
290
|
|
|
""" |
291
|
|
|
|
292
|
|
|
|
293
|
|
|
class ISubGroups(Interface): |
294
|
|
|
"""Marker interface for subgroups setup folder |
295
|
|
|
""" |
296
|
|
|
|
297
|
|
|
|
298
|
|
|
class ISamplingDeviation(Interface): |
299
|
|
|
"""Sampling Deviation |
300
|
|
|
""" |
301
|
|
|
|
302
|
|
|
|
303
|
|
|
class ISamplingDeviations(Interface): |
304
|
|
|
"""Sampling Deviations |
305
|
|
|
""" |
306
|
|
|
|
307
|
|
|
|
308
|
|
|
class IContentMigrator(Interface): |
309
|
|
|
"""Marker interface for content migrator |
310
|
|
|
""" |
311
|
|
|
|
312
|
|
|
|
313
|
|
|
class IFieldMigrator(Interface): |
314
|
|
|
"""Marker interface for field migrator |
315
|
|
|
""" |
316
|
|
|
|
317
|
|
|
|
318
|
|
|
class IDynamicLocalRoles(Interface): |
319
|
|
|
"""Marker interface for objects with dynamic assignment of local roles |
320
|
|
|
""" |
321
|
|
|
|
322
|
|
|
|
323
|
|
|
class IInterpretationTemplate(Interface): |
324
|
|
|
"""Marker interface for interpretation template objects |
325
|
|
|
""" |
326
|
|
|
|
327
|
|
|
|
328
|
|
|
class IInterpretationTemplates(Interface): |
329
|
|
|
"""Marker interface for interpretation templates objects |
330
|
|
|
""" |
331
|
|
|
|
332
|
|
|
|
333
|
|
|
class ILabels(Interface): |
334
|
|
|
"""Marker interface for labels container |
335
|
|
|
""" |
336
|
|
|
|
337
|
|
|
|
338
|
|
|
class ILabel(Interface): |
339
|
|
|
"""Marker interface for labels |
340
|
|
|
""" |
341
|
|
|
|
342
|
|
|
|
343
|
|
|
class ICanHaveLabels(Interface): |
344
|
|
|
"""Marker interface for labeled capable objects |
345
|
|
|
""" |
346
|
|
|
|
347
|
|
|
|
348
|
|
|
class IHaveLabels(ICanHaveLabels): |
349
|
|
|
"""Marker interface for labeled objects |
350
|
|
|
|
351
|
|
|
NOTE: We inherit from `ICanHaveLabels` to always show the schema extended |
352
|
|
|
fields for already labeled objects |
353
|
|
|
""" |
354
|
|
|
|
355
|
|
|
|
356
|
|
|
class IManufacturers(Interface): |
357
|
|
|
"""Marker interface for manufacturers container |
358
|
|
|
""" |
359
|
|
|
|
360
|
|
|
|
361
|
|
|
class IManufacturer(Interface): |
362
|
|
|
"""Marker interface for manufacturers |
363
|
|
|
""" |
364
|
|
|
|
365
|
|
|
|
366
|
|
|
class IInstrumentType(Interface): |
367
|
|
|
"""Marker interface for an instrument type |
368
|
|
|
""" |
369
|
|
|
|
370
|
|
|
|
371
|
|
|
class IInstrumentTypes(Interface): |
372
|
|
|
"""Marker interface for instrument types |
373
|
|
|
""" |
374
|
|
|
|
375
|
|
|
|
376
|
|
|
class IInstrumentLocation(Interface): |
377
|
|
|
"""Marker interface for a physical place, where instruments can be located |
378
|
|
|
""" |
379
|
|
|
|
380
|
|
|
|
381
|
|
|
class IInstrumentLocations(Interface): |
382
|
|
|
"""Marker interface for instrument locations folder |
383
|
|
|
""" |
384
|
|
|
|
385
|
|
|
|
386
|
|
|
class IStorageLocations(Interface): |
387
|
|
|
"""Marker interface for storage locations setup folder |
388
|
|
|
""" |
389
|
|
|
|
390
|
|
|
|
391
|
|
|
class IStorageLocation(Interface): |
392
|
|
|
"""Marker interface for storage locations |
393
|
|
|
""" |
394
|
|
|
|
395
|
|
|
|
396
|
|
|
class IBatchLabel(Interface): |
397
|
|
|
"""Marker interface for Batch Label |
398
|
|
|
""" |
399
|
|
|
|
400
|
|
|
|
401
|
|
|
class IBatchLabels(Interface): |
402
|
|
|
"""Marker interface for Batch Labels container |
403
|
|
|
""" |
404
|
|
|
|
405
|
|
|
|
406
|
|
|
class IASTMImporter(Interface): |
407
|
|
|
"""Marker interface for ASTM Wrappers |
408
|
|
|
""" |
409
|
|
|
|
410
|
|
|
def import_data(data): |
411
|
|
|
"""Import the processed JSON data from the wrapper |
412
|
|
|
""" |
413
|
|
|
|
414
|
|
|
|
415
|
|
|
class IClientAwareMixin(Interface): |
416
|
|
|
"""Marker interface for objects that can be bound to a Client, either |
417
|
|
|
because they can be added inside a Client folder or because it can be |
418
|
|
|
assigned through a Reference field |
419
|
|
|
""" |
420
|
|
|
|
421
|
|
|
def getClient(self): |
422
|
|
|
"""Returns the client this object is bound to, if any |
423
|
|
|
""" |
424
|
|
|
|
425
|
|
|
def getClientUID(self): |
426
|
|
|
"""Returns the client UID this object is bound to, if any |
427
|
|
|
""" |
428
|
|
|
|
429
|
|
|
|
430
|
|
|
class IContainerTypes(Interface): |
431
|
|
|
"""Marker interface for container types setup folder |
432
|
|
|
""" |
433
|
|
|
|
434
|
|
|
|
435
|
|
|
class IContainerType(Interface): |
436
|
|
|
"""Marker interface for container type |
437
|
|
|
""" |
438
|
|
|
|
439
|
|
|
|
440
|
|
|
class IDynamicAnalysisSpec(Interface): |
441
|
|
|
"""Marker interface for Dynamic analysis spec item |
442
|
|
|
""" |
443
|
|
|
|
444
|
|
|
|
445
|
|
|
class IDynamicAnalysisSpecs(Interface): |
446
|
|
|
"""Marker interface for Dynamic analysis specs folder |
447
|
|
|
""" |
448
|
|
|
|
449
|
|
|
|
450
|
|
|
class ILabProduct(Interface): |
451
|
|
|
"""Marker interface for lab product |
452
|
|
|
""" |
453
|
|
|
|
454
|
|
|
|
455
|
|
|
class ILabProducts(Interface): |
456
|
|
|
"""Marker interface for lab products folder |
457
|
|
|
""" |
458
|
|
|
|
459
|
|
|
|
460
|
|
|
class IHavePrice(Interface): |
461
|
|
|
"""Marker interface for objects that have a Price |
462
|
|
|
""" |
463
|
|
|
|
464
|
|
|
def getPrice(self): |
465
|
|
|
"""Returns the price of the instance |
466
|
|
|
""" |
467
|
|
|
|
468
|
|
|
def getTotalPrice(self): |
469
|
|
|
"""Returns the total price of the instance |
470
|
|
|
""" |
471
|
|
|
|