Passed
Push — master ( 70be41...e1228c )
by Ramon
11:12
created

bika.lims.interfaces   A

Complexity

Total Complexity 25

Size/Duplication

Total Lines 1082
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 25
eloc 188
dl 0
loc 1082
rs 10
c 0
b 0
f 0

25 Methods

Rating   Name   Duplication   Size   Complexity  
A IGuardAdapter.guard() 0 2 1
A IFrontPageAdapter.get_front_page_url() 0 2 1
A IHaveInstrument.getInstrument() 0 2 1
A IClientAwareMixin.getClient() 0 2 1
A IReferenceWidgetVocabulary.__call__() 0 2 1
A IResultOutOfRange.__call() 0 2 1
A IHavePrice.getTotalPrice() 0 2 1
A ISampleTypeAwareMixin.getSampleTypeTitle() 0 2 1
A ISampleTypeAwareMixin.getSampleTypeUID() 0 2 1
A IAddSampleObjectInfo.get_object_info() 0 2 1
A IATWidgetVisibility.__call__() 0 2 1
A IIdServer.generate_id() 0 2 1
A ISampleTypeAwareMixin.getSampleType() 0 2 1
A IHavePrice.getPrice() 0 2 1
A IJSONReadExtender.__call__() 0 2 1
A IDisplayListVocabulary.__call__() 0 2 1
A IFieldIcons.__call__() 0 2 1
A IAddSampleFieldsFlush.get_flush_settings() 0 2 1
A IClientAwareMixin.getClientUID() 0 2 1
A IHeaderTableFieldRenderer.__call__() 0 2 1
A IHaveDepartment.getDepartment() 0 2 1
A IOrganisation.getName() 0 2 1
A IHaveAnalysisCategory.getCategory() 0 2 1
A IHaveAnalysisCategory.getCategoryUID() 0 2 1
A IHaveAnalysisCategory.getCategoryTitle() 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-2019 by it's authors.
19
# Some rights reserved, see README and LICENSE.
20
21
from zope.interface import Interface
22
23
24
class ISenaiteSiteRoot(Interface):
25
    """Marker interface for the Senaite Site Root
26
    """
27
28
29
class IBikaLIMS(Interface):
30
    """Marker interface that defines a Zope 3 browser layer.
31
32
    N.B. Please use ISenaiteSite interface
33
    """
34
35
36
class ISenaiteSite(IBikaLIMS):
37
    """Marker interface for Zope 3 browser layers.
38
    """
39
40
41
class IAutoGenerateID(Interface):
42
    """Auto-generate ID with ID server
43
    """
44
45
46
class IActionHandlerPool(Interface):
47
    """Marker interface for the ActionHandlerPool utility
48
    """
49
50
51
class IAuditLog(Interface):
52
    """Marker interface for Audit Log
53
    """
54
55
56
class IAuditable(Interface):
57
    """Marker inteface for auditable contents
58
    """
59
60
61
class IDoNotSupportSnapshots(Interface):
62
    """Marker inteface for non-auditable contents
63
    """
64
65
66
class IAuditLogCatalog(Interface):
67
    """Audit Log Catalog
68
    """
69
70
71
class IGenerateID(Interface):
72
    """Marker Interface to generate an ID
73
    """
74
75
76
class IHaveNoBreadCrumbs(Interface):
77
    """Items which do not display breadcrumbs
78
    """
79
80
81
class IClientFolder(Interface):
82
    """Client folder
83
    """
84
85
86
class IClient(Interface):
87
    """Client
88
    """
89
90
91
class IBatchFolder(Interface):
92
    """Batch folder
93
    """
94
95
96
class IBatch(Interface):
97
    """Batch
98
    """
99
100
101
class IBatchLabels(Interface):
102
    """Batch label
103
    """
104
105
106
class IAnalysisRequest(Interface):
107
    """Analysis Request
108
    """
109
110
111
class IAnalysisRequestPartition(Interface):
112
    """Marker interface for Analysis Requests that are also Partitions
113
    """
114
115
116
class IAnalysisRequestRetest(Interface):
117
    """Marker interface for Analysis Requests that are Retests
118
    """
119
120
121
class IAnalysisRequestSecondary(Interface):
122
    """Marker interface for Secondary Analysis Requests
123
    """
124
125
126
class IAnalysisRequestAddView(Interface):
127
    """AR Add view
128
    """
129
130
131
class IAnalysisRequestsFolder(Interface):
132
    """AnalysisRequests Folder
133
    """
134
135
136
class IInvoiceView(Interface):
137
    """Invoice View
138
    """
139
140
141
class IAnalysis(Interface):
142
    """Analysis
143
    """
144
145
146
class IRoutineAnalysis(Interface):
147
    """This adapter distinguishes normal analyses from Duplicates, References,
148
    Rejections, etc.
149
    """
150
151
152
class IAnalysisSpec(Interface):
153
    """Analysis Specs
154
    """
155
156
157
class IDuplicateAnalysis(Interface):
158
    """DuplicateAnalysis
159
    """
160
161
162
class IReferenceAnalysis(Interface):
163
    """Reference Analyses
164
    """
165
166
167
class IRejectAnalysis(Interface):
168
    """This adapter distinguishes normal analyses from Duplicates, References,
169
    Rejections, etc.
170
    """
171
172
173
class IReportFolder(Interface):
174
    """Report folder
175
    """
176
177
# TODO Remove in >v1.3.0
178
class ISample(Interface):
179
    """Sample
180
    """
181
182
183
class ISampleCondition(Interface):
184
    """Sample Condition
185
    """
186
187
188
class ISampleConditions(Interface):
189
    """Sample Conditions
190
    """
191
192
193
class ISampleMatrix(Interface):
194
    """Sample Matrix
195
    """
196
197
198
class ISampleMatrices(Interface):
199
    """Sample Matrices
200
    """
201
202
203
class ISamplePartition(Interface):
204
    """Sample
205
    """
206
207
208
class ISamplesFolder(Interface):
209
    """Samples Folder
210
    """
211
212
213
class ISamplingDeviation(Interface):
214
    """Sampling Deviation
215
    """
216
217
218
class ISamplingDeviations(Interface):
219
    """Sampling Deviations
220
    """
221
222
223
class IWorksheetFolder(Interface):
224
    """WorksheetFolder
225
    """
226
227
228
class IWorksheet(Interface):
229
    """Worksheet
230
    """
231
232
233
class IReferenceSample(Interface):
234
    """Reference Sample
235
    """
236
237
238
class IReferenceSamplesFolder(Interface):
239
    """Reference Samples Folder
240
    """
241
242
243
class IReportsFolder(Interface):
244
    """Reports Folder
245
    """
246
247
248
class IInvoice(Interface):
249
    """Invoice
250
    """
251
252
253
class IInvoiceBatch(Interface):
254
    """Invoice Batch
255
    """
256
257
258
class IInvoiceFolder(Interface):
259
    """Invoices Folder
260
    """
261
262
263
class IBikaSetup(Interface):
264
    """Marker interface for the LIMS Setup
265
    """
266
267
268
class IAnalysisCategory(Interface):
269
    """Marker interface for an Analysis Category
270
    """
271
272
273
class IAnalysisCategories(Interface):
274
    """Marker interface for Analysis Categories
275
    """
276
277
278
class IBaseAnalysis(Interface):
279
    """Marker interface for base Analysis
280
    """
281
282
283
class IAnalysisService(Interface):
284
    """Marker interface for Analysis Service
285
    """
286
287
288
class IAnalysisServices(Interface):
289
    """Marker interface for Analysis Services
290
    """
291
292
293
class IAttachmentTypes(Interface):
294
    """Marker interface for Attachment types
295
    """
296
297
298
class ICalculation(Interface):
299
    """Marker interface for a Calculation
300
    """
301
302
303
class ICalculations(Interface):
304
    """Marker interface for Calculations
305
    """
306
307
308
class IContacts(Interface):
309
    """Marker interface for Contacts
310
    """
311
312
313
class IContact(Interface):
314
    """Marker interface for a single Contact
315
    """
316
317
318
class IDepartments(Interface):
319
    """Marker interface for a Departments
320
    """
321
322
323
class IContainers(Interface):
324
    """Marker interface for Containers
325
    """
326
327
328
class IContainerTypes(Interface):
329
    """Marker interface for Container types
330
    """
331
332
333
class IIdentifierTypes(Interface):
334
    """TODO: Remove in senaite.core 1.3.3
335
    """
336
337
338
class IHaveIdentifiers(Interface):
339
    """TODO: Remove in senaite.core 1.3.3
340
    """
341
342
343
class IInstrument(Interface):
344
    """Marker interface for an Instrument
345
    """
346
347
348
class IInstruments(Interface):
349
    """Marker interface for Instruments
350
    """
351
352
353
class IInstrumentType(Interface):
354
    """Marker interface for an instrument type
355
    """
356
357
358
class IInstrumentTypes(Interface):
359
    """Marker interface for instrument types
360
    """
361
362
363
class IInstrumentLocation(Interface):
364
    """A physical place, where instruments can be located
365
    """
366
367
368
class IInstrumentLocations(Interface):
369
    """Physical places, where instruments can be located
370
    """
371
372
373
class IInstrumentCalibration(Interface):
374
    """Instrument Calibration
375
    """
376
377
378
class IInstrumentCertification(Interface):
379
    """Instrument Certification
380
    """
381
382
383
class IInstrumentValidation(Interface):
384
    """Instrument Validation
385
    """
386
387
388
class IAnalysisSpecs(Interface):
389
    """Marker interface for Analysis Specs
390
    """
391
392
393
class IAnalysisProfile(Interface):
394
    """Marker interface for an Analysis Profile
395
    """
396
397
398
class IAnalysisProfiles(Interface):
399
    """Marker interface for analysis profiles
400
    """
401
402
403
class IARTemplate(Interface):
404
    """Marker interface for an AR Template
405
    """
406
407
408
class IARTemplates(Interface):
409
    """Marker interface for AR templates
410
    """
411
412
413
class ILaboratory(Interface):
414
    """Marker interface for Laboratory
415
    """
416
417
418
class ILabContacts(Interface):
419
    """Marker interface for Lab contacts
420
    """
421
422
423
class ILabContact(Interface):
424
    """Marker interface for a lab contact
425
    """
426
427
428
class IManufacturer(Interface):
429
    """Marker interface for Manufacturer
430
    """
431
432
433
class IManufacturers(Interface):
434
    """Marker interface for Manufacturers
435
    """
436
437
438
class IMethods(Interface):
439
    """Marker interface for Methods
440
    """
441
442
443
class IMethod(Interface):
444
    """Marker interface for Method
445
    """
446
447
448
class IMultifile(Interface):
449
    """Marker interface for a Multifile
450
    """
451
452
453
class ILabProducts(Interface):
454
    """Marker interface for Lab Products
455
    """
456
457
class ILabProduct(Interface):
458
    """Marker interface for a LabProduct
459
    """
460
461
class ISamplePoint(Interface):
462
    """Marker interface for a Sample Point
463
    """
464
465
466
class ISamplePoints(Interface):
467
    """Marker interface for Sample Points
468
    """
469
470
471
class IStorageLocation(Interface):
472
    """Marker interface for a Storage Location
473
    """
474
475
476
class IStorageLocations(Interface):
477
    """Marker interface for Storage Location
478
    """
479
480
481
class ISampleType(Interface):
482
    """Marker interface for a Sample Type
483
    """
484
485
486
class ISampleTypes(Interface):
487
    """Marker interface for Sample Types
488
    """
489
490
491
class ISamplingRoundTemplates(Interface):
492
    """Marker interface for Sampling Round Templates
493
    """
494
495
496
class ISamplingRoundTemplate(Interface):
497
    """Marker interface for a Sampling Round Template
498
    """
499
500
501
class ISupplier(Interface):
502
    """Marker interface for a Supplier
503
    """
504
505
506
class ISuppliers(Interface):
507
    """Marker interface for Suplliers
508
    """
509
510
511
class ISupplyOrder(Interface):
512
    """Marker interface for a Supplier Order
513
    """
514
515
516
class ISupplyOrderFolder(Interface):
517
    """Marker interface for Supply Order Folder
518
    """
519
520
521
class ISubGroups(Interface):
522
    """Sub-groups configuration folder
523
    """
524
525
526
class ISubGroup(Interface):
527
    """Sub-Group
528
    """
529
530
531
class IPreservations(Interface):
532
    """Marker interface for Preservations
533
    """
534
535
536
class IReferenceDefinitions(Interface):
537
    """Marker interface for Reference Definitions
538
    """
539
540
541
class IWorksheetTemplates(Interface):
542
    """Marker interface for Worksheet Templates
543
    """
544
545
class IWorksheetTemplate(Interface):
546
    """Marker interface for Worksheet Template
547
    """
548
549
class IBikaCatalog(Interface):
550
    """Marker interface for bika_catalog
551
    """
552
553
554
class IBikaAnalysisCatalog(Interface):
555
    """Marker interface for bika_analysis_catalog
556
    """
557
558
559
class IBikaSetupCatalog(Interface):
560
    """Marker interface for bika_setup_catalog
561
    """
562
563
564
class IBikaCatalogAnalysisRequestListing(Interface):
565
    """Marker interface for bika_catalog_analysisrequest_listing
566
    """
567
568
569
class IBikaCatalogAutoImportLogsListing(Interface):
570
    """Marker interface for bika_catalog_autoimportlogs_listing
571
    """
572
573
574
class IBikaCatalogWorksheetListing(Interface):
575
    """Marker interface for bika_catalog_worksheet_listing
576
    """
577
578
579
class IBikaCatalogReport(Interface):
580
    """Marker interface for bika_catalog_report
581
    """
582
583
584
class IIdServer(Interface):
585
    """Marker Interface for ID server
586
    """
587
588
    def generate_id(self, portal_type, batch_size=None):
589
        """Generate a new id for 'portal_type'
590
        """
591
592
593
class IReferenceWidgetVocabulary(Interface):
594
    """Return values for reference widgets in AR contexts
595
    """
596
597
    def __call__(**kwargs):
598
        """Call method
599
        """
600
601
602
class IDisplayListVocabulary(Interface):
603
    """Make vocabulary from catalog query.
604
605
    Return a DisplayList.
606
    kwargs are added to contentFilter.
607
    """
608
609
    def __call__(**kwargs):
610
        """Call method
611
        """
612
613
614
class IFieldIcons(Interface):
615
    """Used to signal an analysis result out of range alert
616
    """
617
618
    def __call__(self, result=None, **kwargs):
619
        """Returns a dictionary: with the keys 'field', 'icon', 'message'.
620
621
        If result is specified, it's checked instead of the database.  This
622
        is for form validations.
623
624
        Analysis range checkers can include a 'specification' in kwargs to
625
        override the spec derived from the context. It should be a dict
626
        w/ 'min', 'max', and 'error' keys.
627
        """
628
629
630
class IResultOutOfRange(Interface):
631
    """Any code which wants to check some condition and flag an Analysis as
632
    out of range, uses this interface
633
    """
634
    def __call(result=None):
635
        """The adapter must return a dictionary to indicate range out of bounds:
636
        {
637
         out_of_range: boolean - the result is out of bounds,
638
         acceptable: boolean - the result is in acceptable error margin,
639
         spec_values: dict - the min/max/error values for the failed spec
640
        }
641
642
        If the adapter returns a value that resolves to boolean False, the
643
        analysis is assumed not to have triggered the out of range conditions
644
645
        If a result is present in the request, it is passed here to be checked.
646
        if result is None, the value from the database is checked.
647
648
        """
649
650
651
class IATWidgetVisibility(Interface):
652
    """Adapter to modify the default list of fields to show on each view.
653
654
    Archetypes uses a widget attribute called 'visible' to decide which fields
655
    are editable or viewable in different contexts (view and edit).
656
657
    This adapter lets you create/use arbitrary keys in the field.widget.visible
658
    attribute, or or any other condition to decide if a particular field is
659
    displayed or not.
660
661
    an attribute named 'sort', if present, is an integer.
662
    It is used to allow some adapters to take preference over others.
663
    It's default is '1000', other lower values will take preference over higher
664
    values.
665
    """
666
667
    def __call__(widget, instance, mode, vis_dict, default=None, field=None):
668
        """Returns the visibility attribute for this particular field, in the
669
        current context.
670
671
        :arg field: the AT schema field object
672
        :arg mode: 'edit', 'view', or some custom mode, eg 'add', 'secondary'
673
        :arg vis_dict: the original schema value of field.widget.visible
674
        :arg default: value returned by the base Archetypes.Widget.isVisible
675
676
        In default Archetypes the value for the attribute on the field may
677
        either be a dict with a mapping for edit and view::
678
679
            visible = { 'edit' :'hidden', 'view': 'invisible' }
680
681
        Or a single value for all modes::
682
683
            True/1:  'visible'
684
            False/0: 'invisible'
685
            -1:      'hidden'
686
687
        visible: The field is shown in the view/edit screen
688
        invisible: The field is skipped when rendering the visVisibleiew/edit
689
                   screen
690
        hidden: The field is added as <input type="hidden" />
691
        The default state is 'visible'.
692
693
        The default rules are always applied, but any IATWidgetVisibility
694
        adapters found are called and permitted to modify the value.
695
        """
696
697
698
class ISetupDataSetList(Interface):
699
    """Allow products to register distributed setup datasets (xlsx files).
700
701
    Each ISetupDataSetList adapter returns a list of values to be included in
702
    the load_setup_data view
703
    """
704
705
706
class IJSONReadExtender(Interface):
707
    """This interface allows an adapter to modify an object's data before
708
    it is sent to the HTTP response.
709
    """
710
711
    def __call__(obj_data):
712
        """obj_data is the current python dictionary that will go to json.
713
        it should be modified in place, there is no need to return a value.
714
        """
715
716
717
class ISetupDataImporter(Interface):
718
    """ISetupDataImporter adapters are responsible for importing sections of
719
    the load_setup_data xlsx workbooks.
720
    """
721
722
723
class IARImportFolder(Interface):
724
    """Marker interface for a folder that contains ARImports
725
    """
726
727
728
class IARImport(Interface):
729
    """Marker interface for an ARImport
730
    """
731
732
733
class IPricelist(Interface):
734
    """Folder view marker for Pricelist
735
    """
736
737
738
class IPricelistFolder(Interface):
739
    """Folder view marker for PricelistFolder instance
740
    """
741
742
743
class IProductivityReport(Interface):
744
    """Reports are enumerated manually in reports/*.pt - but addional reports
745
    can be added to this list by extension packages using this adapter.
746
747
    The adapter must return a dictionary:
748
749
    {
750
     title: text (i18n translated),
751
     description: text (i18n translated),
752
     query_form: html <fieldset> of controls used to enter report
753
                 parameters (excluding <form> tags and <submit> button)
754
     module: The name of the module containing a class named "Report"
755
             an instance of this class will be used to create the report
756
    }
757
    """
758
759
760
class IAdministrationReport(Interface):
761
    """Reports are enumerated manually in reports/*.pt - but addional reports
762
    can be added to this list by extension packages using this adapter.
763
764
    The adapter must return a dictionary:
765
766
    {
767
     title: text (i18n translated),
768
     description: text (i18n translated),
769
     query_form: html <fieldset> of controls used to enter report
770
                 parameters (excluding <form> tags and <submit> button)
771
     module: The name of the module containing a class named "Report"
772
             an instance of this class will be used to create the report
773
    }
774
    """
775
776
777
class IHeaderTableFieldRenderer(Interface):
778
    """
779
    Allows an adapter to return the HTML content of the rendered field view,
780
    in header_table listings. The adapter must be registered with
781
    name=FieldName.
782
783
    If the field is a Reference, and the user has View permission on the
784
    target object, the field is rendered as <a href="absolute_url">Title</a>.
785
786
    If no adapter is found, and the field is not a reference, it is rendered
787
    with the normal AT field view machine.
788
789
    In a ZCML somewhere:
790
791
        <adapter
792
          for="bika.lims.interfaces.IAnalysisRequest"
793
          factory="package.module.spanner"
794
          provides="bika.lims.interfaces.IHeaderTableFieldRenderer"
795
          name="NameOfArchetypesField"
796
        />
797
798
    and the callable:
799
800
        class spanner:
801
            def __init__(self, context):
802
                self.context = context
803
            def __call__(self, field):
804
                field_content = field.get(self.context)
805
                return "<span>%"+field_content+"</span>"
806
807
    """
808
809
    def __call__(field):
810
        """
811
        Accepts an Archetypes Field, returns HTML.
812
        """
813
814
815
class IReflexRule(Interface):
816
    """Marker interface for a Reflex Rule
817
    """
818
819
820
class IReflexRuleFolder(Interface):
821
    """Marker interface for the Reflex Rule Folder
822
    """
823
824
825
class IDepartment(Interface):
826
    """Marker interface for a Department
827
    """
828
829
830
class IProxyField(Interface):
831
    """A field that proxies transparently to the field of another object.
832
    Mainly needed for AnalysisRequest fields that are actually stored on the
833
    Sample.
834
    """
835
836
837
class IRemarksField(Interface):
838
    """An append-only TextField which saves information about each edit
839
    """
840
841
842
class IARAnalysesField(Interface):
843
    """A field that manages AR Analyses
844
    """
845
846
847
class IFrontPageAdapter(Interface):
848
    """Front Page Url Finder Adapter's Interface
849
    """
850
851
    def get_front_page_url(self):
852
        """Get url of necessary front-page
853
        """
854
855
856
class INumberGenerator(Interface):
857
    """A utility to generates unique numbers by key
858
    """
859
860
861
class ITopRightHTMLComponentsHook(Interface):
862
    """Marker interface to hook html components in bikalisting
863
    """
864
865
866
class ITopLeftHTMLComponentsHook(Interface):
867
    """Marker interface to hook html components in bikalisting
868
    """
869
870
871
class ITopWideHTMLComponentsHook(Interface):
872
    """Marker interface to hook html components in bikalisting
873
    """
874
875
876
class IGetDefaultFieldValueARAddHook(Interface):
877
    """Marker interface to hook default
878
    """
879
880
881
class IGetStickerTemplates(Interface):
882
    """Marker interface to get stickers for a specific content type.
883
884
    An IGetStickerTemplates adapter should return a result with the
885
    following format:
886
887
    :return: [{'id': <template_id>,
888
             'title': <template_title>}, ...]
889
    """
890
891
892
class IARReport(Interface):
893
    """Marker interface for published AR Reports
894
    """
895
896
897
class ICancellable(Interface):
898
    """Marker for those objects that can be cancelled (have state "cancelled")
899
    """
900
901
902
class IDeactivable(Interface):
903
    """Marker for those objects that can be deactivated (have state "inactive")
904
    """
905
906
907
class IWorkflowActionAdapter(Interface):
908
    """Marker for adapters in charge of processing workflow action requests
909
    from views
910
    """
911
912
913
class IWorkflowActionUIDsAdapter(IWorkflowActionAdapter):
914
    """Marker for adapters in charge of processing workflow action requests
915
    from views, but meant for redirection only
916
    """
917
918
919
class IVerified(Interface):
920
    """Marker interface for verified objects
921
    """
922
923
924
class ISubmitted(Interface):
925
    """Marker interface for submitted objects
926
    """
927
928
929
class IReceived(Interface):
930
    """Marker interface for received objects
931
    """
932
933
934
class IInternalUse(Interface):
935
    """Marker interface for objects only lab personnel must have access
936
    """
937
938
939
class IDetachedPartition(Interface):
940
    """Marker interface for samples that have been detached from its primary
941
    """
942
943
944
class IGuardAdapter(Interface):
945
    """Marker interface for guard adapters
946
    """
947
948
    def guard(self, transition):
949
        """Return False if you want to block the transition
950
        """
951
952
953
class IAddSampleFieldsFlush(Interface):
954
    """Marker interface for field dependencies flush for Add Sample form
955
    """
956
957
    def get_flush_settings(self):
958
        """Returns a dict where the key is the name of the field and the value
959
        is an array dependencies as field names
960
        """
961
962
963
class IAddSampleObjectInfo(Interface):
964
    """Marker interface for objects metadata mapping
965
    """
966
967
    def get_object_info(self):
968
        """Returns the dict representation of the context object for its
969
        correct consumption by Sample Add form:
970
971
        {'id': <id_of_the_object>,
972
         'uid': <uid_of_the_object>,
973
         'title': <title_of_the_object>,
974
         'filter_queries': {
975
             <dependent_field_name>: {
976
                 <catalog_index>: <criteria>
977
             }
978
         },
979
         'field_values': {
980
             <dependent_field_name>: {
981
                <uid>: <dependent_uid>,
982
                <title>: <dependent_title>
983
            }
984
         }
985
986
        Besides the basic keys (id, uid, title), two additional keys can be
987
        provided:
988
        - filter_queries: contains the filter queries for other fields to be
989
          applied when the value of current field changes.
990
        - field_values: contains default values for other fields to be applied
991
          when the value of the current field changes.
992
        """
993
994
995
class IClientAwareMixin(Interface):
996
    """Marker interface for objects that can be bound to a Client, either
997
    because they can be added inside a Client folder or because it can be
998
    assigned through a Reference field
999
    """
1000
1001
    def getClient(self):
1002
        """Returns the client this object is bound to, if any
1003
        """
1004
1005
    def getClientUID(self):
1006
        """Returns the client UID this object is bound to, if any
1007
        """
1008
1009
1010
class ISampleTypeAwareMixin(Interface):
1011
    """Marker interface for objects that can be assigned to one, or multiple
1012
    SampleType objects through a ReferenceField
1013
    """
1014
1015
    def getSampleType(self):
1016
        """Returns the sample type(s) assigned to this object, if any
1017
        """
1018
1019
    def getSampleTypeUID(self):
1020
        """Returns the UID(s) of the Sample Type(s) assigned to this object
1021
        """
1022
1023
    def getSampleTypeTitle(self):
1024
        """Returns the title or a comma separated list of sample type titles
1025
        """
1026
1027
1028
class IHavePrice(Interface):
1029
    """Marker interface for objects that have a Price
1030
    """
1031
1032
    def getPrice(self):
1033
        """Returns the price of the instance
1034
        """
1035
1036
    def getTotalPrice(self):
1037
        """Returns the total price of the instance
1038
        """
1039
1040
1041
class IHaveInstrument(Interface):
1042
    """Marker interface for objects that have Instrument(s) assigned
1043
    """
1044
1045
    def getInstrument(self):
1046
        """Returns the instrument or instruments the instance is assigned to
1047
        """
1048
1049
1050
class IHaveDepartment(Interface):
1051
    """Marker interface for objects that have Department(s) assigned
1052
    """
1053
1054
    def getDepartment(self):
1055
        """Returns the department or departments the instance is assigned to
1056
        """
1057
1058
1059
class IOrganisation(Interface):
1060
    """Marker interface for IOrganisation object
1061
    """
1062
1063
    def getName(self):
1064
        """Returns the name of the organisation. Masks Title()
1065
        """
1066
1067
1068
class IHaveAnalysisCategory(Interface):
1069
    """Marker interface for objects that have AnalysisCategory(ies) assigned
1070
    """
1071
1072
    def getCategory(self):
1073
        """Returns the category(ies) assigned to this instance
1074
        """
1075
1076
    def getCategoryUID(self):
1077
        """Returns the UID of the category(ies) assigned to this instance
1078
        """
1079
1080
    def getCategoryTitle(self):
1081
        """Returns the title of the category(ies) assigned to this instance
1082
        """
1083