-
Notifications
You must be signed in to change notification settings - Fork 188
/
RefinedObjectClassDefinition.java
212 lines (145 loc) · 6.82 KB
/
RefinedObjectClassDefinition.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
/*
* Copyright (c) 2010-2016 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.common.refinery;
import com.evolveum.midpoint.common.ResourceObjectPattern;
import com.evolveum.midpoint.prism.ComplexTypeDefinition;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.PrismObjectDefinition;
import com.evolveum.midpoint.prism.util.ItemPathUtil;
import com.evolveum.midpoint.schema.ResourceShadowDiscriminator;
import com.evolveum.midpoint.schema.processor.ObjectClassComplexTypeDefinition;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.CapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.PagedSearchCapabilityType;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;
import org.jetbrains.annotations.NotNull;
import javax.xml.namespace.QName;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author mederly
*/
public interface RefinedObjectClassDefinition extends ObjectClassComplexTypeDefinition {
//region General attribute definitions ========================================================
/**
* Returns definitions of all attributes as an unmodifiable collection.
* Note: content of this is exactly the same as for getDefinitions
*/
@NotNull
@Override
Collection<? extends RefinedAttributeDefinition<?>> getAttributeDefinitions();
default boolean containsAttributeDefinition(ItemPathType pathType) {
QName segmentQName = ItemPathUtil.getOnlySegmentQName(pathType);
return containsAttributeDefinition(segmentQName);
}
default boolean containsAttributeDefinition(QName attributeName) {
return findAttributeDefinition(attributeName) != null;
}
Collection<? extends QName> getNamesOfAttributesWithOutboundExpressions();
Collection<? extends QName> getNamesOfAttributesWithInboundExpressions();
//endregion
//region Special attribute definitions ========================================================
// Note that these are simply type-narrowed versions of methods in ObjectClassComplexTypeDefinition
@NotNull
@Override
Collection<? extends RefinedAttributeDefinition<?>> getPrimaryIdentifiers();
@NotNull
@Override
Collection<? extends RefinedAttributeDefinition<?>> getSecondaryIdentifiers();
@Override
default Collection<? extends RefinedAttributeDefinition<?>> getAllIdentifiers() {
return Stream.concat(getPrimaryIdentifiers().stream(), getSecondaryIdentifiers().stream())
.collect(Collectors.toList());
}
<X> RefinedAttributeDefinition<X> getDescriptionAttribute();
<X> RefinedAttributeDefinition<X> getNamingAttribute();
<X> RefinedAttributeDefinition<X> getDisplayNameAttribute();
//endregion
//region General association definitions ========================================================
/**
* Returns definitions of all associations as an unmodifiable collection.
* Note: these items are _not_ included in getDefinitions. (BTW, RefinedAssociationDefinition
* is not a subtype of ItemDefinition, not even of Definition.)
*/
@NotNull
Collection<RefinedAssociationDefinition> getAssociationDefinitions();
Collection<RefinedAssociationDefinition> getAssociationDefinitions(ShadowKindType kind);
default Collection<RefinedAssociationDefinition> getEntitlementAssociationDefinitions() {
return getAssociationDefinitions(ShadowKindType.ENTITLEMENT);
}
RefinedAssociationDefinition findAssociationDefinition(QName name);
RefinedAssociationDefinition findEntitlementAssociationDefinition(QName name);
Collection<QName> getNamesOfAssociations();
Collection<? extends QName> getNamesOfAssociationsWithOutboundExpressions();
//endregion
//region General information ========================================================
String getDescription();
ObjectClassComplexTypeDefinition getObjectClassDefinition();
ResourceType getResourceType();
String getResourceNamespace();
boolean isDefault();
ResourceObjectReferenceType getBaseContext();
String getHumanReadableName();
//endregion
//region Generating and matching artifacts ========================================================
PrismObjectDefinition<ShadowType> getObjectDefinition();
default PrismObject<ShadowType> createBlankShadow() {
return createBlankShadow(this);
}
PrismObject<ShadowType> createBlankShadow(RefinedObjectClassDefinition definition);
ResourceShadowDiscriminator getShadowDiscriminator();
boolean matches(ShadowType shadowType);
//endregion
//region Accessing parts of schema handling ========================================================
@NotNull
Collection<RefinedObjectClassDefinition> getAuxiliaryObjectClassDefinitions();
boolean hasAuxiliaryObjectClass(QName expectedObjectClassName);
Collection<ResourceObjectPattern> getProtectedObjectPatterns();
ResourcePasswordDefinitionType getPasswordDefinition();
List<MappingType> getPasswordInbound();
MappingType getPasswordOutbound();
AttributeFetchStrategyType getPasswordFetchStrategy();
ObjectReferenceType getPasswordPolicy();
ResourceActivationDefinitionType getActivationSchemaHandling();
ResourceBidirectionalMappingType getActivationBidirectionalMappingType(QName propertyName);
AttributeFetchStrategyType getActivationFetchStrategy(QName propertyName);
//endregion
//region Capabilities ========================================================
<T extends CapabilityType> T getEffectiveCapability(Class<T> capabilityClass);
PagedSearchCapabilityType getPagedSearches();
boolean isPagedSearchEnabled();
boolean isObjectCountingEnabled();
//endregion
//region Cloning ========================================================
@NotNull
@Override
RefinedObjectClassDefinition clone();
@NotNull
@Override
RefinedObjectClassDefinition deepClone(Map<QName, ComplexTypeDefinition> ctdMap);
//endregion
LayerRefinedObjectClassDefinition forLayer(@NotNull LayerType layerType);
//region Type variance ========================================================
<X> RefinedAttributeDefinition<X> findAttributeDefinition(@NotNull QName name);
default <X> RefinedAttributeDefinition<X> findAttributeDefinition(String name) {
return findAttributeDefinition(new QName(getTypeName().getNamespaceURI(), name));
}
//endregion
String getDebugDumpClassName();
}