Passed
Push — 2.x ( ac9ec3...712fca )
by Jordi
07:17
created

senaite.core.interfaces   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 514
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 14
eloc 103
dl 0
loc 514
rs 10
c 0
b 0
f 0

14 Methods

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