/
MidpointFunctions.java
1142 lines (1033 loc) · 54.9 KB
/
MidpointFunctions.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2010-2017 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.evolveum.midpoint.model.api.expr;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
import com.evolveum.midpoint.prism.Item;
import com.evolveum.midpoint.prism.PrismValue;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.LocalizableMessage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.jetbrains.annotations.NotNull;
import com.evolveum.midpoint.model.api.ModelExecuteOptions;
import com.evolveum.midpoint.model.api.WorkflowService;
import com.evolveum.midpoint.model.api.context.ModelContext;
import com.evolveum.midpoint.model.api.context.ModelElementContext;
import com.evolveum.midpoint.model.api.context.ModelProjectionContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.crypto.EncryptionException;
import com.evolveum.midpoint.prism.crypto.Protector;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.ResultHandler;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.security.api.MidPointPrincipal;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.exception.CommunicationException;
import com.evolveum.midpoint.util.exception.ConfigurationException;
import com.evolveum.midpoint.util.exception.ExpressionEvaluationException;
import com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException;
import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.PolicyViolationException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SecurityViolationException;
import com.evolveum.midpoint.util.exception.SystemException;
import com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;
/**
* @author mederly
*/
@SuppressWarnings("unused")
public interface MidpointFunctions {
/**
* <p>
* Creates empty prism object of specified type in memory. This is used to construct
* Java instances of object before they are added to the repository.
* </p>
* <p>
* Please note that this method constructs the object <b>in memory only</b>. If you
* intend to create an object in repository or on the resource you need to populate
* this object with data and then invoke the addObject or executeChanges method.
* </p>
* @param type Class of the object to create
* @return empty object in memory
* @throws SchemaException schema error instantiating the object (e.g. attempt to
* instantiate abstract type).
*/
<T extends ObjectType> T createEmptyObject(Class<T> type) throws SchemaException;
/**
* <p>
* Creates empty prism object of specified type and with specified name in memory.
* This is used to construct Java instances of object before they are added to the
* repository. The 'name' property of the new object will be set to a specified value.
* </p>
* <p>
* Please note that this method constructs the object <b>in memory only</b>. If you
* intend to create an object in repository or on the resource you need to populate
* this object with data and then invoke the addObject or executeChanges method.
* </p>
* @param type Class of the object to create
* @param name Name of the object
* @return empty object in memory
* @throws SchemaException schema error instantiating the object (e.g. attempt to
* instantiate abstract type).
*/
<T extends ObjectType> T createEmptyObjectWithName(Class<T> type, String name) throws SchemaException;
/**
* <p>
* Creates empty prism object of specified type and with specified name in memory.
* This is used to construct Java instances of object before they are added to the
* repository. The 'name' property of the new object will be set to a specified value.
* </p>
* <p>
* Please note that this method constructs the object <b>in memory only</b>. If you
* intend to create an object in repository or on the resource you need to populate
* this object with data and then invoke the addObject or executeChanges method.
* </p>
* @param type Class of the object to create
* @param name Name of the object
* @return empty object in memory
* @throws SchemaException schema error instantiating the object (e.g. attempt to
* instantiate abstract type).
*/
<T extends ObjectType> T createEmptyObjectWithName(Class<T> type, PolyString name) throws SchemaException;
/**
* <p>
* Creates empty prism object of specified type and with specified name in memory.
* This is used to construct Java instances of object before they are added to the
* repository. The 'name' property of the new object will be set to a specified value.
* </p>
* <p>
* Please note that this method constructs the object <b>in memory only</b>. If you
* intend to create an object in repository or on the resource you need to populate
* this object with data and then invoke the addObject or executeChanges method.
* </p>
* @param type Class of the object to create
* @param name Name of the object
* @return empty object in memory
* @throws SchemaException schema error instantiating the object (e.g. attempt to
* instantiate abstract type).
*/
<T extends ObjectType> T createEmptyObjectWithName(Class<T> type, PolyStringType name) throws SchemaException;
<T extends ObjectType> T resolveReference(ObjectReferenceType reference)
throws ObjectNotFoundException, SchemaException,
CommunicationException, ConfigurationException,
SecurityViolationException, ExpressionEvaluationException;
<T extends ObjectType> T resolveReferenceIfExists(ObjectReferenceType reference)
throws SchemaException,
CommunicationException, ConfigurationException,
SecurityViolationException, ExpressionEvaluationException;
/**
* <p>
* Returns object for provided OID. It retrieves the object from an appropriate source
* for an object type (e.g. internal repository, resource or both), merging data as necessary,
* processing any policies, caching mechanisms, etc. This can be influenced by using options.
* </p>
* <p>
* Fails if object with the OID does not exists.
* </p>
*
* @param type
* (class) of an object to get
* @param oid
* OID of the object to get
* @param options
* options influencing the retrieval and processing of the object
* @return Retrieved object
* @throws ObjectNotFoundException
* requested object does not exist
* @throws SchemaException
* the object is not schema compliant
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* missing required parameter, wrong OID format, etc.
* @throws ClassCastException
* OID represents object of a type incompatible with requested
* type
* @throws SystemException
* unknown error from underlying layers or other unexpected
* state
*/
<T extends ObjectType> T getObject(Class<T> type, String oid, Collection<SelectorOptions<GetOperationOptions>> options)
throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException;
/**
* <p>
* Returns object for provided OID. It retrieves the object from an appropriate source
* for an object type (e.g. internal repository, resource or both), merging data as necessary,
* processing any policies, caching mechanisms, etc.
* </p>
* <p>
* Fails if object with the OID does not exists.
* </p>
*
* @param type
* (class) of an object to get
* @param oid
* OID of the object to get
* @return Retrieved object
* @throws ObjectNotFoundException
* requested object does not exist
* @throws SchemaException
* the object is not schema compliant
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* missing required parameter, wrong OID format, etc.
* @throws ClassCastException
* OID represents object of a type incompatible with requested
* type
* @throws SystemException
* unknown error from underlying layers or other unexpected
* state
*/
<T extends ObjectType> T getObject(Class<T> type, String oid)
throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException;
/**
* <p>
* Execute the provided object deltas.
* </p>
* <p>
* The operation executes the provided object deltas. All deltas must relate to analogous objects (e.g. user
* and linked accounts). The implementation may throw an error if the objects are not analogous. The implementation
* also implicitly links the objects (mark them to be analogous) if such a link is part of the data model.
* E.g. the implementation links all accounts to the user if they are passed in a single delta collection.
* This is especially useful if the account deltas are ADD deltas without OID and therefore cannot be linked
* explicitly.
* </p>
* <p>
* There must be no more than one delta for each object.
* The order of execution is not defined and the implementation is free to determine the correct or most suitable ordering.
* </p>
* <p>
* The OID provided in ADD deltas may be empty. In that case the OID
* will be assigned by the implementation and the OIDs will be set in the
* deltas after the operation is completed.
* </p>
* <p>
* Execution of ADD deltas should fail if such object already exists (if object with
* the provided OID already exists). Execution of MODIFY and DELETE deltas should fail if
* such objects do not exist.
* </p>
* <p>
* The operation may fail if provided OIDs are in an unusable format for the
* storage. Generating own OIDs and providing them to this method is not
* recommended for normal operation.
* </p>
* <p>
* There are no explicit atomicity guarantees for the operations. Some of the operations may pass, some may fail
* or even fail partially. The consistency of the data and state are not based on operation atomicity but rather
* a data model that can "repair" inconsistencies.
* </p>
* <p>
* The operation may fail if any of the objects to be created or modified does not conform to
* the underlying schema of the storage system or the schema enforced by the implementation.
* </p>
*
* @param deltas
* Collection of object deltas to execute
* @param options
* options influencing processing of the deltas
* @throws ObjectAlreadyExistsException
* object with specified identifiers already exists, cannot add
* @throws ObjectNotFoundException
* object required to complete the operation was not found (e.g.
* appropriate connector or resource definition)
* @throws SchemaException
* error dealing with resource schema, e.g. created object does
* not conform to schema
* @throws ExpressionEvaluationException
* evaluation of expression associated with the object has failed
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws PolicyViolationException
* Policy violation was detected during processing of the object
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws IllegalArgumentException
* wrong OID format, etc.
* @throws SystemException
* unknown error from underlying layers or other unexpected state
*/
void executeChanges(Collection<ObjectDelta<? extends ObjectType>> deltas, ModelExecuteOptions options)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
/**
* <p>
* Execute the provided object deltas.
* </p>
* <p>
* The operation executes the provided object deltas. All deltas must relate to analogous objects (e.g. user
* and linked accounts). The implementation may throw an error if the objects are not analogous. The implementation
* also implicitly links the objects (mark them to be analogous) if such a link is part of the data model.
* E.g. the implementation links all accounts to the user if they are passed in a single delta collection.
* This is especially useful if the account deltas are ADD deltas without OID and therefore cannot be linked
* explicitly.
* </p>
* <p>
* There must be no more than one delta for each object.
* The order of execution is not defined and the implementation is free to determine the correct or most suitable ordering.
* </p>
* <p>
* The OID provided in ADD deltas may be empty. In that case the OID
* will be assigned by the implementation and the OIDs will be set in the
* deltas after the operation is completed.
* </p>
* <p>
* Execution of ADD deltas should fail if such object already exists (if object with
* the provided OID already exists). Execution of MODIFY and DELETE deltas should fail if
* such objects do not exist.
* </p>
* <p>
* The operation may fail if provided OIDs are in an unusable format for the
* storage. Generating own OIDs and providing them to this method is not
* recommended for normal operation.
* </p>
* <p>
* There are no explicit atomicity guarantees for the operations. Some of the operations may pass, some may fail
* or even fail partially. The consistency of the data and state are not based on operation atomicity but rather
* a data model that can "repair" inconsistencies.
* </p>
* <p>
* The operation may fail if any of the objects to be created or modified does not conform to
* the underlying schema of the storage system or the schema enforced by the implementation.
* </p>
*
* @param deltas
* Collection of object deltas to execute
* @throws ObjectAlreadyExistsException
* object with specified identifiers already exists, cannot add
* @throws ObjectNotFoundException
* object required to complete the operation was not found (e.g.
* appropriate connector or resource definition)
* @throws SchemaException
* error dealing with resource schema, e.g. created object does
* not conform to schema
* @throws ExpressionEvaluationException
* evaluation of expression associated with the object has failed
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws PolicyViolationException
* Policy violation was detected during processing of the object
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws IllegalArgumentException
* wrong OID format, etc.
* @throws SystemException
* unknown error from underlying layers or other unexpected state
*/
void executeChanges(Collection<ObjectDelta<? extends ObjectType>> deltas)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
/**
* <p>
* Execute the provided object deltas.
* </p>
* <p>
* The operation executes the provided object deltas. All deltas must relate to analogous objects (e.g. user
* and linked accounts). The implementation may throw an error if the objects are not analogous. The implementation
* also implicitly links the objects (mark them to be analogous) if such a link is part of the data model.
* E.g. the implementation links all accounts to the user if they are passed in a single delta collection.
* This is especially useful if the account deltas are ADD deltas without OID and therefore cannot be linked
* explicitly.
* </p>
* <p>
* There must be no more than one delta for each object.
* The order of execution is not defined and the implementation is free to determine the correct or most suitable ordering.
* </p>
* <p>
* The OID provided in ADD deltas may be empty. In that case the OID
* will be assigned by the implementation and the OIDs will be set in the
* deltas after the operation is completed.
* </p>
* <p>
* Execution of ADD deltas should fail if such object already exists (if object with
* the provided OID already exists). Execution of MODIFY and DELETE deltas should fail if
* such objects do not exist.
* </p>
* <p>
* The operation may fail if provided OIDs are in an unusable format for the
* storage. Generating own OIDs and providing them to this method is not
* recommended for normal operation.
* </p>
* <p>
* There are no explicit atomicity guarantees for the operations. Some of the operations may pass, some may fail
* or even fail partially. The consistency of the data and state are not based on operation atomicity but rather
* a data model that can "repair" inconsistencies.
* </p>
* <p>
* The operation may fail if any of the objects to be created or modified does not conform to
* the underlying schema of the storage system or the schema enforced by the implementation.
* </p>
*
* @param deltas
* Collection of object deltas to execute
* @throws ObjectAlreadyExistsException
* object with specified identifiers already exists, cannot add
* @throws ObjectNotFoundException
* object required to complete the operation was not found (e.g.
* appropriate connector or resource definition)
* @throws SchemaException
* error dealing with resource schema, e.g. created object does
* not conform to schema
* @throws ExpressionEvaluationException
* evaluation of expression associated with the object has failed
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws PolicyViolationException
* Policy violation was detected during processing of the object
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws IllegalArgumentException
* wrong OID format, etc.
* @throws SystemException
* unknown error from underlying layers or other unexpected state
*/
@SuppressWarnings("unchecked")
void executeChanges(ObjectDelta<? extends ObjectType>... deltas)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
<T extends ObjectType> String addObject(PrismObject<T> newObject, ModelExecuteOptions options)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
<T extends ObjectType> String addObject(PrismObject<T> newObject)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
<T extends ObjectType> String addObject(T newObject, ModelExecuteOptions options)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
<T extends ObjectType> String addObject(T newObject)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
<T extends ObjectType> void modifyObject(ObjectDelta<T> modifyDelta, ModelExecuteOptions options)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
<T extends ObjectType> void modifyObject(ObjectDelta<T> modifyDelta)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
<T extends ObjectType> void deleteObject(Class<T> type, String oid, ModelExecuteOptions options)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
<T extends ObjectType> void deleteObject(Class<T> type, String oid)
throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException;
/**
* Recomputes focal object with the specified OID. The operation considers all the applicable policies and
* mapping and tries to re-apply them as necessary.
*
* @param type type (class) of an object to recompute
* @param oid OID of the object to recompute
*/
<F extends FocusType> void recompute(Class<F> type, String oid)
throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException;
/**
* <p>
* Returns the User object representing owner of specified account (account
* shadow).
* </p>
* <p>
* May return null if there is no owner specified for the account.
* </p>
* <p>
* Implements the backward "owns" association between account shadow and
* user. Forward association is implemented by property "account" of user
* object.
* </p>
*
* @param accountOid
* OID of the account to look for an owner
* @return owner of the account or null
* @throws ObjectNotFoundException
* specified account was not found
* @throws SchemaException
* todo
* @throws SecurityViolationException
* todo
* @throws CommunicationException
* todo
* @throws IllegalArgumentException
* wrong OID format, described change is not applicable
* @throws SystemException
* unknown error from underlying layers or other unexpected
* state
*/
PrismObject<UserType> findShadowOwner(String accountOid) throws ObjectNotFoundException, SecurityViolationException, SchemaException, ConfigurationException, ExpressionEvaluationException, CommunicationException;
/**
* <p>
* Search for objects.
* </p>
* <p>
* Searches through all object of a specified type. Returns a list of objects that match
* search criteria.
* </p>
* <p>
* Note that this method has a very limited scaling capability
* as all the results are stored in the memory. DO NOT USE on large datasets.
* Recommended usage is only when using queries that cannot return large number
* of results (e.g. queries for unique values) or when combined with paging capability.
* For other cases use searchObjectsIterative instead.
* </p>
* <p>
* Returns empty list if object type is correct but there are no objects of
* that type. Fails if object type is wrong. Should fail if unknown property is
* specified in the query.
* </p>
*
* @param type
* (class) of an object to search
* @param query
* search query
* @param options
* options influencing the retrieval and processing of the objects
* @return all objects of specified type that match search criteria (subject
* to paging)
*
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> List<T> searchObjects(Class<T> type, ObjectQuery query,
Collection<SelectorOptions<GetOperationOptions>> options) throws SchemaException,
ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException;
/**
* <p>
* Search for objects.
* </p>
* <p>
* Searches through all object of a specified type. Returns a list of objects that match
* search criteria.
* </p>
* <p>
* Note that this method has a very limited scaling capability
* as all the results are stored in the memory. DO NOT USE on large datasets.
* Recommended usage is only when using queries that cannot return large number
* of results (e.g. queries for unique values) or when combined with paging capability.
* For other cases use searchObjectsIterative instead.
* </p>
* <p>
* Returns empty list if object type is correct but there are no objects of
* that type. Fails if object type is wrong. Should fail if unknown property is
* specified in the query.
* </p>
*
* @param type
* (class) of an object to search
* @param query
* search query
* @return all objects of specified type that match search criteria (subject
* to paging)
*
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> List<T> searchObjects(Class<T> type, ObjectQuery query) throws SchemaException,
ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException;
/**
* <p>
* Search for objects in iterative fashion (using callback).
* </p>
* <p>
* Searches through all object of a specified type. A handler is invoked for each object found.
* </p>
* <p>
* The handler is not called at all if object type is correct but there are no objects of
* that type. Fails if object type is wrong. Should fail if unknown property is
* specified in the query.
* </p>
*
* @param type
* (class) of an object to search
* @param query
* search query
* @param handler
* callback handler that will be called for each found object
* @param options
* options influencing the retrieval and processing of the objects
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> void searchObjectsIterative(Class<T> type, ObjectQuery query,
ResultHandler<T> handler, Collection<SelectorOptions<GetOperationOptions>> options) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException;
/**
* <p>
* Search for objects in iterative fashion (using callback).
* </p>
* <p>
* Searches through all object of a specified type. A handler is invoked for each object found.
* </p>
* <p>
* The handler is not called at all if object type is correct but there are no objects of
* that type. Fails if object type is wrong. Should fail if unknown property is
* specified in the query.
* </p>
*
* @param type
* (class) of an object to search
* @param query
* search query
* @param handler
* callback handler that will be called for each found object
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> void searchObjectsIterative(Class<T> type, ObjectQuery query, ResultHandler<T> handler)
throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException;
/**
* <p>
* Search for objects by name.
* </p>
* <p>
* Searches through all object of a specified type for an object with specified name.
* Returns that object if it is found, return null otherwise. The method fails if more than
* one object is found therefore it cannot be reliably used on types with non-unique names
* (such as Shadows).
* </p>
*
* @param type
* (class) of an object to search
* @param name
* Name of the object to look for
* @return an object of specified type with a matching name or null
*
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> T searchObjectByName(Class<T> type, String name) throws SecurityViolationException,
ObjectNotFoundException, CommunicationException, ConfigurationException, SchemaException, ExpressionEvaluationException;
/**
* <p>
* Search for objects by name.
* </p>
* <p>
* Searches through all object of a specified type for an object with specified name.
* Returns that object if it is found, return null otherwise. The method fails if more than
* one object is found therefore it cannot be reliably used on types with non-unique names
* (such as Shadows).
* </p>
*
* @param type
* (class) of an object to search
* @param name
* Name of the object to look for
* @return an object of specified type with a matching name or null
*
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> T searchObjectByName(Class<T> type, PolyString name) throws SecurityViolationException,
ObjectNotFoundException, CommunicationException, ConfigurationException, SchemaException, ExpressionEvaluationException;
/**
* <p>
* Search for objects by name.
* </p>
* <p>
* Searches through all object of a specified type for an object with specified name.
* Returns that object if it is found, return null otherwise. The method fails if more than
* one object is found therefore it cannot be reliably used on types with non-unique names
* (such as Shadows).
* </p>
*
* @param type
* (class) of an object to search
* @param name
* Name of the object to look for
* @return an object of specified type with a matching name or null
*
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> T searchObjectByName(Class<T> type, PolyStringType name) throws SecurityViolationException,
ObjectNotFoundException, CommunicationException, ConfigurationException, SchemaException, ExpressionEvaluationException;
/**
* <p>
* Count objects.
* </p>
* <p>
* Searches through all object of a specified type and returns a count of such objects.
* This method is usually much more efficient than equivalent search method. It is used mostly for
* presentation purposes, e.g. displaying correct number of pages in the GUI listings.
* </p>
*
* @param type
* (class) of an object to search
* @param query
* search query
* @param options
* options influencing the retrieval and processing of the objects
* @return number of objects of specified type that match search criteria (subject
* to paging)
*
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options)
throws SchemaException, ObjectNotFoundException, SecurityViolationException, ConfigurationException, CommunicationException, ExpressionEvaluationException;
/**
* <p>
* Count objects.
* </p>
* <p>
* Searches through all object of a specified type and returns a count of such objects.
* This method is usually much more efficient than equivalent search method. It is used mostly for
* presentation purposes, e.g. displaying correct number of pages in the GUI listings.
* </p>
*
* @param type
* (class) of an object to search
* @param query
* search query
* @return number of objects of specified type that match search criteria (subject
* to paging)
*
* @throws SchemaException
* unknown property used in search query
* @throws ObjectNotFoundException
* object required for a search was not found (e.g. resource definition)
* @throws CommunicationException
* Communication (network) error during retrieval. E.g. error communicating with the resource
* @throws SecurityViolationException
* Security violation during operation execution. May be caused either by midPoint internal
* security mechanism but also by external mechanism (e.g. on the resource)
* @throws ConfigurationException
* Configuration error. E.g. misconfigured resource parameters, invalid policies, etc.
* @throws IllegalArgumentException
* wrong query format
*/
<T extends ObjectType> int countObjects(Class<T> type, ObjectQuery query)
throws SchemaException, ObjectNotFoundException, SecurityViolationException, ConfigurationException, CommunicationException, ExpressionEvaluationException;
/**
* <p>
* Test the resource connection and basic resource connector functionality.
* </p>
* <p>
* This operation will NOT throw exception in case the resource connection
* fails. It such case it will indicate the failure in the return message,
* but the operation itself succeeds. The operations fails only if the
* provided arguments are wrong, in case of system error, system
* misconfiguration, etc.
* </p>
* <p>
* This returns OperationResult instead of taking it as in/out argument.
* This is different from the other methods. The testResource method is not
* using OperationResult to track its own execution but rather to track the
* execution of resource tests (that in fact happen in provisioning).
* </p>
*
* @param resourceOid
* OID of resource to test
* @return results of executed tests
* @throws ObjectNotFoundException
* specified object does not exist
* @throws IllegalArgumentException
* wrong OID format
*/
OperationResult testResource(String resourceOid) throws ObjectNotFoundException;
List<String> toList(String... s);
Collection<String> getManagersOids(UserType user) throws SchemaException, ObjectNotFoundException, SecurityViolationException;
Collection<String> getManagersOidsExceptUser(UserType user) throws SchemaException, ObjectNotFoundException, SecurityViolationException, ExpressionEvaluationException;
Collection<String> getManagersOidsExceptUser(@NotNull Collection<ObjectReferenceType> userRefList)
throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ExpressionEvaluationException,
ConfigurationException;
Collection<UserType> getManagers(UserType user) throws SchemaException, ObjectNotFoundException, SecurityViolationException;
Collection<UserType> getManagersByOrgType(UserType user, String orgType) throws SchemaException, ObjectNotFoundException, SecurityViolationException;
Collection<UserType> getManagers(UserType user, String orgType, boolean allowSelf) throws SchemaException, ObjectNotFoundException, SecurityViolationException;
UserType getUserByOid(String oid) throws ObjectNotFoundException, SchemaException;
// todo here we could select "functional" org.units in order to filter out e.g. project managers from the list of managers
// however, the syntax of orgType attribute is not standardized
Collection<String> getOrgUnits(UserType user);
Collection<String> getOrgUnits(UserType user, QName relation);
OrgType getOrgByOid(String oid) throws SchemaException;
OrgType getOrgByName(String name) throws SchemaException, SecurityViolationException;
/**
* Returns parent orgs of the specified object that have a specific relation and orgType.
* @param object base object
* @param relation local part of the relation (in the String form)
* @param orgType orgType to select
* @return parent orgs of the specified object that have a specific relation and orgType
* @throws SchemaException Internal schema error
* @throws SecurityViolationException Security violation
*/
Collection<OrgType> getParentOrgs(ObjectType object, String relation, String orgType) throws SchemaException, SecurityViolationException;
/**
* Returns parent orgs of the specified object that have a specific relation and orgType.
* @param object base object
* @param relation relation in the QName form
* @param orgType orgType to select
* @return parent orgs of the specified object that have a specific relation and orgType
* @throws SchemaException Internal schema error
* @throws SecurityViolationException Security violation
*/
Collection<OrgType> getParentOrgs(ObjectType object, QName relation, String orgType) throws SchemaException, SecurityViolationException;
/**
* Returns parent orgs of the specified object that have a specific orgType.
* @param object base object
* @param orgType orgType to select
* @return parent orgs of the specified object that have a specific orgType
* @throws SchemaException Internal schema error
* @throws SecurityViolationException Security violation
*/
OrgType getParentOrgByOrgType(ObjectType object, String orgType) throws SchemaException, SecurityViolationException;
/**
* Returns parent orgs of the specified object that have a specific relation.
* @param object base object
* @param relation relation in the QName form
* @return parent orgs of the specified object that have a specific relation
* @throws SchemaException Internal schema error
* @throws SecurityViolationException Security violation
*/
Collection<OrgType> getParentOrgsByRelation(ObjectType object, QName relation) throws SchemaException, SecurityViolationException;
/**
* Returns parent orgs of the specified object that have a specific relation.
* @param object base object
* @param relation local part of the relation (in the String form)
* @return parent orgs of the specified object that have a specific relation
* @throws SchemaException Internal schema error
* @throws SecurityViolationException Security violation
*/
Collection<OrgType> getParentOrgsByRelation(ObjectType object, String relation) throws SchemaException, SecurityViolationException;
/**
* Returns all parent orgs of the specified object.
* @param object base object
* @return all parent orgs
* @throws SchemaException Internal schema error
* @throws SecurityViolationException Security violation
*/
Collection<OrgType> getParentOrgs(ObjectType object) throws SchemaException, SecurityViolationException;
Collection<UserType> getManagersOfOrg(String orgOid) throws SchemaException, SecurityViolationException;
/**
* Returns true if user is a manager of specified organizational unit.
*/
boolean isManagerOf(UserType user, String orgOid);
/**
* Returns true if user is a manager of any organizational unit.
*/
boolean isManager(UserType user);
boolean isManagerOfOrgType(UserType user, String orgType) throws SchemaException;
boolean isMemberOf(UserType user, String orgOid);
String getPlaintextUserPassword(UserType user) throws EncryptionException;
String getPlaintext(ProtectedStringType user) throws EncryptionException;
String getPlaintextAccountPassword(ShadowType account) throws EncryptionException;