114 |
* @param retAttrs array or attribute type to be specifically included in the result entry(s) |
* @param retAttrs array or attribute type to be specifically included in the result entry(s) |
115 |
* @throws NamingException if there are problems accessing subentries |
* @throws NamingException if there are problems accessing subentries |
116 |
*/ |
*/ |
117 |
private void addCollectiveAttributes( LdapDN normName, ServerEntry entry, String[] retAttrs ) throws Exception |
private void addCollectiveAttributes( LdapDN normName, ClonedServerEntry entry, String[] retAttrs ) throws Exception |
118 |
{ |
{ |
119 |
EntryAttribute caSubentries; |
EntryAttribute collectiveAttributeSubentries = |
120 |
|
entry.getOriginalEntry().get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ); |
|
//noinspection StringEquality |
|
|
if ( ( retAttrs == null ) || ( retAttrs.length != 1 ) || ( retAttrs[0] != SchemaConstants.ALL_USER_ATTRIBUTES ) ) |
|
|
{ |
|
|
ServerEntry entryWithCAS = nexus.lookup( new LookupOperationContext( registries, normName, new String[] { |
|
|
SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT_OID } ) ); |
|
|
caSubentries = entryWithCAS.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ); |
|
|
} |
|
|
else |
|
|
{ |
|
|
caSubentries = entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT ); |
|
|
} |
|
121 |
|
|
122 |
/* |
/* |
123 |
* If there are no collective attribute subentries referenced |
* If there are no collective attribute subentries referenced then we |
124 |
* then we have no collective attributes to inject to this entry. |
* have no collective attributes to inject to this entry. |
125 |
*/ |
*/ |
126 |
if ( caSubentries == null ) |
if ( collectiveAttributeSubentries == null ) |
127 |
{ |
{ |
128 |
return; |
return; |
129 |
} |
} |
130 |
|
|
131 |
/* |
/* |
132 |
* Before we proceed we need to lookup the exclusions within the |
* Before we proceed we need to lookup the exclusions within the entry |
133 |
* entry and build a set of exclusions for rapid lookup. We use |
* and build a set of exclusions for rapid lookup. We use OID values |
134 |
* OID values in the exclusions set instead of regular names that |
* in the exclusions set instead of regular names that may have case |
135 |
* may have case variance. |
* variance. |
136 |
*/ |
*/ |
137 |
EntryAttribute collectiveExclusions = entry.get( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT ); |
EntryAttribute collectiveExclusions = |
138 |
|
entry.getOriginalEntry().get( SchemaConstants.COLLECTIVE_EXCLUSIONS_AT ); |
139 |
Set<String> exclusions = new HashSet<String>(); |
Set<String> exclusions = new HashSet<String>(); |
140 |
|
|
141 |
if ( collectiveExclusions != null ) |
if ( collectiveExclusions != null ) |
142 |
{ |
{ |
143 |
if ( collectiveExclusions.contains( SchemaConstants.EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT_OID ) |
if ( collectiveExclusions.contains( SchemaConstants.EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT_OID ) |
144 |
|| collectiveExclusions.contains( SchemaConstants.EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT ) ) |
|| |
145 |
|
collectiveExclusions.contains( SchemaConstants.EXCLUDE_ALL_COLLECTIVE_ATTRIBUTES_AT ) ) |
146 |
{ |
{ |
147 |
/* |
/* |
148 |
* This entry does not allow any collective attributes |
* This entry does not allow any collective attributes |
193 |
* attributes of the subentry and copy collective attributes from the |
* attributes of the subentry and copy collective attributes from the |
194 |
* subentry into the entry. |
* subentry into the entry. |
195 |
*/ |
*/ |
196 |
for ( Value<?> value:caSubentries ) |
for ( Value<?> value:collectiveAttributeSubentries ) |
197 |
{ |
{ |
198 |
String subentryDnStr = ( String ) value.get(); |
String subentryDnStr = ( String ) value.get(); |
199 |
LdapDN subentryDn = new LdapDN( subentryDnStr ); |
LdapDN subentryDn = new LdapDN( subentryDnStr ); |