| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kim.service.impl; |
| 17 | |
|
| 18 | |
import org.apache.commons.lang.exception.ExceptionUtils; |
| 19 | |
import org.apache.log4j.Logger; |
| 20 | |
import org.kuali.rice.core.api.mo.common.Attributes; |
| 21 | |
import org.kuali.rice.core.util.AttributeSet; |
| 22 | |
import org.kuali.rice.core.util.MaxAgeSoftReference; |
| 23 | |
import org.kuali.rice.core.util.MaxSizeMap; |
| 24 | |
import org.kuali.rice.kim.api.entity.Type; |
| 25 | |
import org.kuali.rice.kim.api.entity.TypeContract; |
| 26 | |
import org.kuali.rice.kim.api.entity.principal.Principal; |
| 27 | |
import org.kuali.rice.kim.api.entity.principal.PrincipalContract; |
| 28 | |
import org.kuali.rice.kim.api.entity.services.IdentityService; |
| 29 | |
import org.kuali.rice.kim.api.group.Group; |
| 30 | |
import org.kuali.rice.kim.api.group.GroupService; |
| 31 | |
import org.kuali.rice.kim.api.group.GroupUpdateService; |
| 32 | |
import org.kuali.rice.kim.api.responsibility.Responsibility; |
| 33 | |
import org.kuali.rice.kim.api.responsibility.ResponsibilityAction; |
| 34 | |
import org.kuali.rice.kim.api.responsibility.ResponsibilityService; |
| 35 | |
import org.kuali.rice.kim.api.services.IdentityManagementService; |
| 36 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
| 37 | |
import org.kuali.rice.kim.bo.entity.KimEntity; |
| 38 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityDefaultInfo; |
| 39 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityInfo; |
| 40 | |
import org.kuali.rice.kim.bo.reference.dto.AffiliationTypeInfo; |
| 41 | |
import org.kuali.rice.kim.bo.reference.dto.EmploymentStatusInfo; |
| 42 | |
import org.kuali.rice.kim.bo.reference.dto.EmploymentTypeInfo; |
| 43 | |
import org.kuali.rice.kim.bo.reference.dto.EntityNameTypeInfo; |
| 44 | |
import org.kuali.rice.kim.bo.reference.dto.ExternalIdentifierTypeInfo; |
| 45 | |
import org.kuali.rice.kim.bo.reference.dto.KimCodeInfoBase; |
| 46 | |
import org.kuali.rice.kim.bo.role.dto.KimPermissionInfo; |
| 47 | |
import org.kuali.rice.kim.bo.role.dto.PermissionAssigneeInfo; |
| 48 | |
import org.kuali.rice.kim.impl.entity.EntityTypeBo; |
| 49 | |
import org.kuali.rice.kim.impl.entity.address.EntityAddressTypeBo; |
| 50 | |
import org.kuali.rice.kim.impl.entity.citizenship.EntityCitizenshipStatusBo; |
| 51 | |
import org.kuali.rice.kim.impl.entity.email.EntityEmailTypeBo; |
| 52 | |
import org.kuali.rice.kim.impl.entity.phone.EntityPhoneTypeBo; |
| 53 | |
import org.kuali.rice.kim.service.AuthenticationService; |
| 54 | |
import org.kuali.rice.kim.service.IdentityUpdateService; |
| 55 | |
import org.kuali.rice.kim.service.PermissionService; |
| 56 | |
import org.kuali.rice.kim.util.KIMWebServiceConstants; |
| 57 | |
import org.springframework.beans.factory.InitializingBean; |
| 58 | |
|
| 59 | |
import javax.jws.WebService; |
| 60 | |
import java.util.ArrayList; |
| 61 | |
import java.util.Collections; |
| 62 | |
import java.util.HashMap; |
| 63 | |
import java.util.Iterator; |
| 64 | |
import java.util.List; |
| 65 | |
import java.util.Map; |
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
@WebService(endpointInterface = KIMWebServiceConstants.IdentityManagementService.INTERFACE_CLASS, serviceName = KIMWebServiceConstants.IdentityManagementService.WEB_SERVICE_NAME, portName = KIMWebServiceConstants.IdentityManagementService.WEB_SERVICE_PORT, targetNamespace = KIMWebServiceConstants.MODULE_TARGET_NAMESPACE) |
| 70 | 0 | public class IdentityManagementServiceImpl implements IdentityManagementService, InitializingBean { |
| 71 | 0 | private static final Logger LOG = Logger.getLogger( IdentityManagementServiceImpl.class ); |
| 72 | |
|
| 73 | |
private AuthenticationService authenticationService; |
| 74 | |
private PermissionService permissionService; |
| 75 | |
private ResponsibilityService responsibilityService; |
| 76 | |
private IdentityService identityService; |
| 77 | |
private GroupService groupService; |
| 78 | |
private GroupUpdateService groupUpdateService; |
| 79 | |
private IdentityUpdateService identityUpdateService; |
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | 0 | protected int entityPrincipalCacheMaxSize = 200; |
| 84 | 0 | protected int entityPrincipalCacheMaxAgeSeconds = 30; |
| 85 | 0 | protected int groupCacheMaxSize = 200; |
| 86 | 0 | protected int groupCacheMaxAgeSeconds = 30; |
| 87 | 0 | protected int permissionCacheMaxSize = 200; |
| 88 | 0 | protected int permissionCacheMaxAgeSeconds = 30; |
| 89 | 0 | protected int responsibilityCacheMaxSize = 200; |
| 90 | 0 | protected int responsibilityCacheMaxAgeSeconds = 30; |
| 91 | |
|
| 92 | |
protected Map<String,MaxAgeSoftReference<KimEntityDefaultInfo>> entityDefaultInfoCache; |
| 93 | |
protected Map<String,MaxAgeSoftReference<KimEntity>> entityCache; |
| 94 | |
protected Map<String,MaxAgeSoftReference<KimEntityInfo>> entityInfoCache; |
| 95 | |
protected Map<String,MaxAgeSoftReference<Principal>> principalByIdCache; |
| 96 | |
protected Map<String,MaxAgeSoftReference<Principal>> principalByNameCache; |
| 97 | |
protected Map<String,MaxAgeSoftReference<Group>> groupByIdCache; |
| 98 | |
protected Map<String,MaxAgeSoftReference<Group>> groupByNameCache; |
| 99 | |
protected Map<String,MaxAgeSoftReference<List<String>>> groupIdsForPrincipalCache; |
| 100 | |
protected Map<String,MaxAgeSoftReference<List<? extends Group>>> groupsForPrincipalCache; |
| 101 | |
protected Map<String,MaxAgeSoftReference<Boolean>> isMemberOfGroupCache; |
| 102 | |
protected Map<String,MaxAgeSoftReference<Boolean>> isGroupMemberOfGroupCache; |
| 103 | |
protected Map<String,MaxAgeSoftReference<List<String>>> groupMemberPrincipalIdsCache; |
| 104 | |
protected Map<String,MaxAgeSoftReference<Boolean>> hasPermissionCache; |
| 105 | |
protected Map<String,MaxAgeSoftReference<Boolean>> hasPermissionByTemplateCache; |
| 106 | |
protected Map<String,MaxAgeSoftReference<Boolean>> isAuthorizedCache; |
| 107 | |
protected Map<String,MaxAgeSoftReference<Boolean>> isAuthorizedByTemplateNameCache; |
| 108 | |
protected Map<String,MaxAgeSoftReference<Boolean>> isPermissionDefinedForTemplateNameCache; |
| 109 | |
|
| 110 | 0 | protected HashMap<String,KimCodeInfoBase> kimReferenceTypeCache = new HashMap<String, KimCodeInfoBase>(); |
| 111 | 0 | protected HashMap<String,TypeContract> kimReferenceTypeCacheMap = new HashMap<String, TypeContract>(); |
| 112 | |
|
| 113 | |
public void afterPropertiesSet() throws Exception { |
| 114 | 0 | entityDefaultInfoCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<KimEntityDefaultInfo>>( entityPrincipalCacheMaxSize ) ); |
| 115 | 0 | entityCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<KimEntity>>( entityPrincipalCacheMaxSize ) ); |
| 116 | 0 | entityInfoCache = Collections.synchronizedMap( new MaxSizeMap<String, MaxAgeSoftReference<KimEntityInfo>>(entityPrincipalCacheMaxSize)); |
| 117 | 0 | principalByIdCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Principal>>( entityPrincipalCacheMaxSize ) ); |
| 118 | 0 | principalByNameCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Principal>>( entityPrincipalCacheMaxSize ) ); |
| 119 | 0 | groupByIdCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Group>>( groupCacheMaxSize ) ); |
| 120 | 0 | groupByNameCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Group>>( groupCacheMaxSize ) ); |
| 121 | 0 | groupIdsForPrincipalCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<List<String>>>( groupCacheMaxSize ) ); |
| 122 | 0 | groupsForPrincipalCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<List<? extends Group>>>( groupCacheMaxSize ) ); |
| 123 | 0 | isMemberOfGroupCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Boolean>>( groupCacheMaxSize ) ); |
| 124 | 0 | groupMemberPrincipalIdsCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<List<String>>>( groupCacheMaxSize ) ); |
| 125 | 0 | hasPermissionCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Boolean>>( permissionCacheMaxSize ) ); |
| 126 | 0 | hasPermissionByTemplateCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Boolean>>( permissionCacheMaxSize ) ); |
| 127 | 0 | isPermissionDefinedForTemplateNameCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Boolean>>( permissionCacheMaxSize ) ); |
| 128 | 0 | isAuthorizedByTemplateNameCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Boolean>>( permissionCacheMaxSize ) ); |
| 129 | 0 | isAuthorizedCache = Collections.synchronizedMap( new MaxSizeMap<String,MaxAgeSoftReference<Boolean>>( permissionCacheMaxSize ) ); |
| 130 | 0 | } |
| 131 | |
|
| 132 | |
public void flushAllCaches() { |
| 133 | 0 | flushEntityPrincipalCaches(); |
| 134 | 0 | flushGroupCaches(); |
| 135 | 0 | flushPermissionCaches(); |
| 136 | 0 | flushResponsibilityCaches(); |
| 137 | 0 | } |
| 138 | |
|
| 139 | |
public void flushEntityPrincipalCaches() { |
| 140 | 0 | entityDefaultInfoCache.clear(); |
| 141 | 0 | entityCache.clear(); |
| 142 | 0 | principalByIdCache.clear(); |
| 143 | 0 | principalByNameCache.clear(); |
| 144 | 0 | } |
| 145 | |
|
| 146 | |
public void flushGroupCaches() { |
| 147 | 0 | groupByIdCache.clear(); |
| 148 | 0 | groupByNameCache.clear(); |
| 149 | 0 | groupIdsForPrincipalCache.clear(); |
| 150 | 0 | groupsForPrincipalCache.clear(); |
| 151 | 0 | isMemberOfGroupCache.clear(); |
| 152 | 0 | groupMemberPrincipalIdsCache.clear(); |
| 153 | 0 | } |
| 154 | |
|
| 155 | |
public void flushPermissionCaches() { |
| 156 | 0 | hasPermissionCache.clear(); |
| 157 | 0 | hasPermissionByTemplateCache.clear(); |
| 158 | 0 | isPermissionDefinedForTemplateNameCache.clear(); |
| 159 | 0 | isAuthorizedByTemplateNameCache.clear(); |
| 160 | 0 | isAuthorizedCache.clear(); |
| 161 | 0 | } |
| 162 | |
|
| 163 | |
public void flushResponsibilityCaches() { |
| 164 | |
|
| 165 | 0 | } |
| 166 | |
|
| 167 | |
protected KimEntityDefaultInfo getEntityDefaultInfoFromCache( String entityId ) { |
| 168 | 0 | MaxAgeSoftReference<KimEntityDefaultInfo> entityRef = entityDefaultInfoCache.get( "entityId="+entityId ); |
| 169 | 0 | if ( entityRef != null ) { |
| 170 | 0 | return entityRef.get(); |
| 171 | |
} |
| 172 | 0 | return null; |
| 173 | |
} |
| 174 | |
|
| 175 | |
protected KimEntityDefaultInfo getEntityDefaultInfoFromCacheByPrincipalId( String principalId ) { |
| 176 | 0 | MaxAgeSoftReference<KimEntityDefaultInfo> entityRef = entityDefaultInfoCache.get( "principalId="+principalId ); |
| 177 | 0 | if ( entityRef != null ) { |
| 178 | 0 | return entityRef.get(); |
| 179 | |
} |
| 180 | 0 | return null; |
| 181 | |
} |
| 182 | |
|
| 183 | |
protected KimEntityDefaultInfo getEntityDefaultInfoFromCacheByPrincipalName( String principalName ) { |
| 184 | 0 | MaxAgeSoftReference<KimEntityDefaultInfo> entityRef = entityDefaultInfoCache.get( "principalName="+principalName ); |
| 185 | 0 | if ( entityRef != null ) { |
| 186 | 0 | return entityRef.get(); |
| 187 | |
} |
| 188 | 0 | return null; |
| 189 | |
} |
| 190 | |
|
| 191 | |
protected KimEntityInfo getEntityInfoFromCache( String entityId ) { |
| 192 | 0 | MaxAgeSoftReference<KimEntityInfo> entityRef = entityInfoCache.get( "entityId="+entityId ); |
| 193 | 0 | if ( entityRef != null ) { |
| 194 | 0 | return entityRef.get(); |
| 195 | |
} |
| 196 | 0 | return null; |
| 197 | |
} |
| 198 | |
|
| 199 | |
protected KimEntityInfo getEntityInfoFromCacheByPrincipalId( String principalId ) { |
| 200 | 0 | MaxAgeSoftReference<KimEntityInfo> entityRef = entityInfoCache.get( "principalId="+principalId ); |
| 201 | 0 | if ( entityRef != null ) { |
| 202 | 0 | return entityRef.get(); |
| 203 | |
} |
| 204 | 0 | return null; |
| 205 | |
} |
| 206 | |
|
| 207 | |
protected KimEntityInfo getEntityInfoFromCacheByPrincipalName( String principalName ) { |
| 208 | 0 | MaxAgeSoftReference<KimEntityInfo> entityRef = entityInfoCache.get( "principalName="+principalName ); |
| 209 | 0 | if ( entityRef != null ) { |
| 210 | 0 | return entityRef.get(); |
| 211 | |
} |
| 212 | 0 | return null; |
| 213 | |
} |
| 214 | |
|
| 215 | |
protected KimEntity getEntityFromCache( String entityId ) { |
| 216 | 0 | MaxAgeSoftReference<KimEntity> entityRef = entityCache.get( "entityId="+entityId ); |
| 217 | 0 | if ( entityRef != null ) { |
| 218 | 0 | return entityRef.get(); |
| 219 | |
} |
| 220 | 0 | return null; |
| 221 | |
} |
| 222 | |
|
| 223 | |
protected KimEntity getEntityFromCacheByPrincipalId( String principalId ) { |
| 224 | 0 | MaxAgeSoftReference<KimEntity> entityRef = entityCache.get( "principalId="+principalId ); |
| 225 | 0 | if ( entityRef != null ) { |
| 226 | 0 | return entityRef.get(); |
| 227 | |
} |
| 228 | 0 | return null; |
| 229 | |
} |
| 230 | |
|
| 231 | |
protected KimEntity getEntityFromCacheByPrincipalName( String principalName ) { |
| 232 | 0 | MaxAgeSoftReference<KimEntity> entityRef = entityCache.get( "principalName="+principalName ); |
| 233 | 0 | if ( entityRef != null ) { |
| 234 | 0 | return entityRef.get(); |
| 235 | |
} |
| 236 | 0 | return null; |
| 237 | |
} |
| 238 | |
|
| 239 | |
protected Principal getPrincipalByIdCache( String principalId ) { |
| 240 | 0 | MaxAgeSoftReference<Principal> principalRef = principalByIdCache.get( principalId ); |
| 241 | 0 | if ( principalRef != null ) { |
| 242 | 0 | return principalRef.get(); |
| 243 | |
} |
| 244 | 0 | return null; |
| 245 | |
} |
| 246 | |
|
| 247 | |
protected Principal getPrincipalByNameCache( String principalName ) { |
| 248 | 0 | MaxAgeSoftReference<Principal> principalRef = principalByNameCache.get( principalName ); |
| 249 | 0 | if ( principalRef != null ) { |
| 250 | 0 | return principalRef.get(); |
| 251 | |
} |
| 252 | 0 | return null; |
| 253 | |
} |
| 254 | |
|
| 255 | |
protected Group getGroupByIdCache( String groupId ) { |
| 256 | 0 | MaxAgeSoftReference<Group> groupRef = groupByIdCache.get( groupId ); |
| 257 | 0 | if ( groupRef != null ) { |
| 258 | 0 | return groupRef.get(); |
| 259 | |
} |
| 260 | 0 | return null; |
| 261 | |
} |
| 262 | |
|
| 263 | |
protected Group getGroupByNameCache( String groupName ) { |
| 264 | 0 | MaxAgeSoftReference<Group> groupRef = groupByNameCache.get( groupName ); |
| 265 | 0 | if ( groupRef != null ) { |
| 266 | 0 | return groupRef.get(); |
| 267 | |
} |
| 268 | 0 | return null; |
| 269 | |
} |
| 270 | |
|
| 271 | |
protected List<String> getGroupIdsForPrincipalCache( String principalId ) { |
| 272 | 0 | MaxAgeSoftReference<List<String>> groupIdsRef = groupIdsForPrincipalCache.get( principalId ); |
| 273 | 0 | if ( groupIdsRef != null ) { |
| 274 | 0 | return groupIdsRef.get(); |
| 275 | |
} |
| 276 | 0 | return null; |
| 277 | |
} |
| 278 | |
|
| 279 | |
protected List<? extends Group> getGroupsForPrincipalCache( String principalId ) { |
| 280 | 0 | MaxAgeSoftReference<List<? extends Group>> groupsRef = groupsForPrincipalCache.get( principalId ); |
| 281 | 0 | if ( groupsRef != null ) { |
| 282 | 0 | return groupsRef.get(); |
| 283 | |
} |
| 284 | 0 | return null; |
| 285 | |
} |
| 286 | |
|
| 287 | |
protected Boolean getIsMemberOfGroupCache( String principalId, String groupId ) { |
| 288 | 0 | MaxAgeSoftReference<Boolean> isMemberRef = isMemberOfGroupCache.get( principalId + "-" + groupId ); |
| 289 | 0 | if ( isMemberRef != null ) { |
| 290 | 0 | return isMemberRef.get(); |
| 291 | |
} |
| 292 | 0 | return null; |
| 293 | |
} |
| 294 | |
|
| 295 | |
protected Boolean getIsGroupMemberOfGroupCache( String potentialMemberId, String potentialParentId ) |
| 296 | |
{ |
| 297 | 0 | MaxAgeSoftReference<Boolean> isMemberRef = isGroupMemberOfGroupCache.get( potentialMemberId + "-" + potentialParentId ); |
| 298 | 0 | if ( isMemberRef != null ) { |
| 299 | 0 | return isMemberRef.get(); |
| 300 | |
} |
| 301 | 0 | return null; |
| 302 | |
} |
| 303 | |
|
| 304 | |
protected List<String> getGroupMemberPrincipalIdsCache( String groupId ) { |
| 305 | 0 | MaxAgeSoftReference<List<String>> memberIdsRef = groupMemberPrincipalIdsCache.get( groupId ); |
| 306 | 0 | if ( memberIdsRef != null ) { |
| 307 | 0 | return memberIdsRef.get(); |
| 308 | |
} |
| 309 | 0 | return null; |
| 310 | |
} |
| 311 | |
|
| 312 | |
protected Boolean getHasPermissionCache( String key ) { |
| 313 | 0 | MaxAgeSoftReference<Boolean> hasPermissionRef = hasPermissionCache.get( key ); |
| 314 | 0 | if ( hasPermissionRef != null ) { |
| 315 | 0 | return hasPermissionRef.get(); |
| 316 | |
} |
| 317 | 0 | return null; |
| 318 | |
} |
| 319 | |
|
| 320 | |
protected Boolean getHasPermissionByTemplateCache( String key ) { |
| 321 | 0 | MaxAgeSoftReference<Boolean> hasPermissionRef = hasPermissionByTemplateCache.get( key ); |
| 322 | 0 | if ( hasPermissionRef != null ) { |
| 323 | 0 | return hasPermissionRef.get(); |
| 324 | |
} |
| 325 | 0 | return null; |
| 326 | |
} |
| 327 | |
|
| 328 | |
protected Boolean getIsAuthorizedByTemplateNameFromCache( String key ) { |
| 329 | 0 | MaxAgeSoftReference<Boolean> cacheEntryRef = isAuthorizedByTemplateNameCache.get( key ); |
| 330 | 0 | if ( cacheEntryRef != null ) { |
| 331 | 0 | return cacheEntryRef.get(); |
| 332 | |
} |
| 333 | 0 | return null; |
| 334 | |
} |
| 335 | |
|
| 336 | |
protected Boolean getIsAuthorizedFromCache( String key ) { |
| 337 | 0 | MaxAgeSoftReference<Boolean> cacheEntryRef = isAuthorizedCache.get( key ); |
| 338 | 0 | if ( cacheEntryRef != null ) { |
| 339 | 0 | return cacheEntryRef.get(); |
| 340 | |
} |
| 341 | 0 | return null; |
| 342 | |
} |
| 343 | |
|
| 344 | |
protected void addEntityToCache( KimEntity entity ) { |
| 345 | 0 | if ( entity != null ) { |
| 346 | 0 | entityCache.put( "entityId="+entity.getEntityId(), new MaxAgeSoftReference<KimEntity>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 347 | 0 | for ( PrincipalContract p : entity.getPrincipals() ) { |
| 348 | 0 | entityCache.put( "principalId="+p.getPrincipalId(), new MaxAgeSoftReference<KimEntity>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 349 | 0 | entityCache.put( "principalName="+p.getPrincipalName(), new MaxAgeSoftReference<KimEntity>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 350 | |
} |
| 351 | |
} |
| 352 | 0 | } |
| 353 | |
|
| 354 | |
protected void addEntityDefaultInfoToCache( KimEntityDefaultInfo entity ) { |
| 355 | 0 | if ( entity != null ) { |
| 356 | 0 | entityDefaultInfoCache.put( "entityId="+entity.getEntityId(), new MaxAgeSoftReference<KimEntityDefaultInfo>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 357 | 0 | for ( PrincipalContract p : entity.getPrincipals() ) { |
| 358 | 0 | entityDefaultInfoCache.put( "principalId="+p.getPrincipalId(), new MaxAgeSoftReference<KimEntityDefaultInfo>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 359 | 0 | entityDefaultInfoCache.put( "principalName="+p.getPrincipalName(), new MaxAgeSoftReference<KimEntityDefaultInfo>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 360 | |
} |
| 361 | |
} |
| 362 | 0 | } |
| 363 | |
|
| 364 | |
protected void addEntityInfoToCache( KimEntityInfo entity ) { |
| 365 | 0 | if ( entity != null ) { |
| 366 | 0 | entityInfoCache.put( "entityId="+entity.getEntityId(), new MaxAgeSoftReference<KimEntityInfo>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 367 | 0 | for ( PrincipalContract p : entity.getPrincipals() ) { |
| 368 | 0 | entityInfoCache.put( "principalId="+p.getPrincipalId(), new MaxAgeSoftReference<KimEntityInfo>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 369 | 0 | entityInfoCache.put( "principalName="+p.getPrincipalName(), new MaxAgeSoftReference<KimEntityInfo>( entityPrincipalCacheMaxAgeSeconds, entity ) ); |
| 370 | |
} |
| 371 | |
} |
| 372 | 0 | } |
| 373 | |
|
| 374 | |
protected void addPrincipalToCache( Principal principal ) { |
| 375 | 0 | if ( principal != null ) { |
| 376 | 0 | principalByNameCache.put( principal.getPrincipalName(), new MaxAgeSoftReference<Principal>( entityPrincipalCacheMaxAgeSeconds, principal ) ); |
| 377 | 0 | principalByIdCache.put( principal.getPrincipalId(), new MaxAgeSoftReference<Principal>( entityPrincipalCacheMaxAgeSeconds, principal ) ); |
| 378 | |
} |
| 379 | 0 | } |
| 380 | |
|
| 381 | |
protected void addGroupToCache( Group group ) { |
| 382 | 0 | if ( group != null ) { |
| 383 | 0 | groupByNameCache.put( group.getName(), new MaxAgeSoftReference<Group>( groupCacheMaxAgeSeconds, group ) ); |
| 384 | 0 | groupByIdCache.put( group.getId(), new MaxAgeSoftReference<Group>( groupCacheMaxAgeSeconds, group ) ); |
| 385 | |
} |
| 386 | 0 | } |
| 387 | |
|
| 388 | |
protected void addGroupIdsForPrincipalToCache( String principalId, List<String> ids ) { |
| 389 | 0 | if ( ids != null ) { |
| 390 | 0 | groupIdsForPrincipalCache.put(principalId, new MaxAgeSoftReference<List<String>>(groupCacheMaxAgeSeconds, ids)); |
| 391 | |
} |
| 392 | 0 | } |
| 393 | |
|
| 394 | |
protected void addGroupsForPrincipalToCache( String principalId, List<? extends Group> groups ) { |
| 395 | 0 | if ( groups != null ) { |
| 396 | 0 | groupsForPrincipalCache.put( principalId, new MaxAgeSoftReference<List<? extends Group>>( groupCacheMaxAgeSeconds, groups ) ); |
| 397 | 0 | List<String> groupIds = new ArrayList<String>( groups.size() ); |
| 398 | 0 | for ( Group group : groups ) { |
| 399 | 0 | groupIds.add( group.getId() ); |
| 400 | |
} |
| 401 | 0 | addGroupIdsForPrincipalToCache( principalId, groupIds ); |
| 402 | |
} |
| 403 | 0 | } |
| 404 | |
|
| 405 | |
protected void addIsMemberOfGroupToCache( String principalId, String groupId, boolean member ) { |
| 406 | 0 | isMemberOfGroupCache.put( principalId + "-" + groupId, new MaxAgeSoftReference<Boolean>( groupCacheMaxAgeSeconds, member ) ); |
| 407 | 0 | } |
| 408 | |
|
| 409 | |
protected void addIsGroupMemberOfGroupToCache( String potentialMemberId, String potentialParentId, boolean member ) |
| 410 | |
{ |
| 411 | 0 | isMemberOfGroupCache.put( potentialMemberId + "-" + potentialParentId, new MaxAgeSoftReference<Boolean>( groupCacheMaxAgeSeconds, member ) ); |
| 412 | 0 | } |
| 413 | |
|
| 414 | |
protected void addGroupMemberPrincipalIdsToCache( String groupId, List<String> ids ) { |
| 415 | 0 | if ( ids != null ) { |
| 416 | 0 | groupMemberPrincipalIdsCache.put( groupId, new MaxAgeSoftReference<List<String>>( groupCacheMaxAgeSeconds, ids ) ); |
| 417 | |
} |
| 418 | 0 | } |
| 419 | |
|
| 420 | |
protected void addHasPermissionToCache( String key, boolean hasPerm ) { |
| 421 | 0 | hasPermissionCache.put( key, new MaxAgeSoftReference<Boolean>( permissionCacheMaxAgeSeconds, hasPerm ) ); |
| 422 | 0 | } |
| 423 | |
|
| 424 | |
protected void addHasPermissionByTemplateToCache( String key, boolean hasPerm ) { |
| 425 | 0 | hasPermissionByTemplateCache.put( key, new MaxAgeSoftReference<Boolean>( permissionCacheMaxAgeSeconds, hasPerm ) ); |
| 426 | 0 | } |
| 427 | |
|
| 428 | |
protected void addIsAuthorizedByTemplateNameToCache( String key, boolean authorized ) { |
| 429 | 0 | isAuthorizedByTemplateNameCache.put( key, new MaxAgeSoftReference<Boolean>( permissionCacheMaxAgeSeconds, authorized ) ); |
| 430 | 0 | } |
| 431 | |
|
| 432 | |
protected void addIsAuthorizedToCache( String key, boolean authorized ) { |
| 433 | 0 | isAuthorizedCache.put( key, new MaxAgeSoftReference<Boolean>( permissionCacheMaxAgeSeconds, authorized ) ); |
| 434 | 0 | } |
| 435 | |
|
| 436 | |
|
| 437 | |
|
| 438 | |
public boolean hasPermission(String principalId, String namespaceCode, String permissionName, AttributeSet permissionDetails) { |
| 439 | 0 | if ( LOG.isDebugEnabled() ) { |
| 440 | 0 | logHasPermissionCheck("Permission", principalId, namespaceCode, permissionName, permissionDetails); |
| 441 | |
} |
| 442 | 0 | StringBuffer cacheKey = new StringBuffer(); |
| 443 | 0 | cacheKey.append( principalId ).append( '/' ); |
| 444 | 0 | cacheKey.append( namespaceCode ).append( '-' ).append(permissionName).append( '/' ); |
| 445 | 0 | addAttributeSetToKey(permissionDetails, cacheKey); |
| 446 | 0 | String key = cacheKey.toString(); |
| 447 | 0 | Boolean hasPerm = getHasPermissionCache(key); |
| 448 | 0 | if (hasPerm == null) { |
| 449 | 0 | hasPerm = getPermissionService().hasPermission(principalId, namespaceCode, permissionName, permissionDetails); |
| 450 | 0 | addHasPermissionToCache(key, hasPerm); |
| 451 | 0 | if ( LOG.isDebugEnabled() ) { |
| 452 | 0 | LOG.debug( "Result: " + hasPerm ); |
| 453 | |
} |
| 454 | |
} else { |
| 455 | 0 | if ( LOG.isDebugEnabled() ) { |
| 456 | 0 | LOG.debug( "Result Found in cache using key: " + key + "\nResult: " + hasPerm ); |
| 457 | |
} |
| 458 | |
} |
| 459 | 0 | return hasPerm; |
| 460 | |
} |
| 461 | |
|
| 462 | |
public boolean isAuthorized(String principalId, String namespaceCode, String permissionName, AttributeSet permissionDetails, AttributeSet qualification ) { |
| 463 | 0 | if ( qualification == null || qualification.isEmpty() ) { |
| 464 | 0 | return hasPermission( principalId, namespaceCode, permissionName, permissionDetails ); |
| 465 | |
} |
| 466 | 0 | if ( LOG.isDebugEnabled() ) { |
| 467 | 0 | logAuthorizationCheck("Permission", principalId, namespaceCode, permissionName, permissionDetails, qualification); |
| 468 | |
} |
| 469 | 0 | StringBuffer cacheKey = new StringBuffer(); |
| 470 | 0 | cacheKey.append(principalId).append( '/' ); |
| 471 | 0 | cacheKey.append( namespaceCode ).append( '-' ).append( permissionName ).append('/'); |
| 472 | 0 | addAttributeSetToKey( permissionDetails, cacheKey ); |
| 473 | 0 | cacheKey.append( '/' ); |
| 474 | 0 | addAttributeSetToKey( qualification, cacheKey ); |
| 475 | 0 | String key = cacheKey.toString(); |
| 476 | 0 | Boolean isAuthorized = getIsAuthorizedFromCache( key ); |
| 477 | 0 | if ( isAuthorized == null ) { |
| 478 | 0 | isAuthorized = getPermissionService().isAuthorized(principalId, namespaceCode, permissionName, permissionDetails, qualification); |
| 479 | 0 | addIsAuthorizedToCache(key, isAuthorized); |
| 480 | 0 | if ( LOG.isDebugEnabled() ) { |
| 481 | 0 | LOG.debug( "Result: " + isAuthorized ); |
| 482 | |
} |
| 483 | |
} else { |
| 484 | 0 | if ( LOG.isDebugEnabled() ) { |
| 485 | 0 | LOG.debug( "Result Found in cache using key: " + key + "\nResult: " + isAuthorized ); |
| 486 | |
} |
| 487 | |
} |
| 488 | 0 | return isAuthorized; |
| 489 | |
} |
| 490 | |
|
| 491 | |
public boolean hasPermissionByTemplateName(String principalId, String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails) { |
| 492 | 0 | if ( LOG.isDebugEnabled() ) { |
| 493 | 0 | logHasPermissionCheck("Perm Templ", principalId, namespaceCode, permissionTemplateName, permissionDetails); |
| 494 | |
} |
| 495 | 0 | StringBuffer cacheKey = new StringBuffer(); |
| 496 | 0 | cacheKey.append( principalId ).append( '/' ); |
| 497 | 0 | cacheKey.append( namespaceCode ).append( '-' ).append(permissionTemplateName).append( '/' ); |
| 498 | 0 | addAttributeSetToKey(permissionDetails, cacheKey); |
| 499 | 0 | String key = cacheKey.toString(); |
| 500 | 0 | Boolean hasPerm = getHasPermissionByTemplateCache(key); |
| 501 | 0 | if (hasPerm == null) { |
| 502 | 0 | hasPerm = getPermissionService().hasPermissionByTemplateName(principalId, namespaceCode, permissionTemplateName, permissionDetails); |
| 503 | 0 | addHasPermissionByTemplateToCache(key, hasPerm); |
| 504 | 0 | if ( LOG.isDebugEnabled() ) { |
| 505 | 0 | LOG.debug( "Result: " + hasPerm ); |
| 506 | |
} |
| 507 | |
} else { |
| 508 | 0 | if ( LOG.isDebugEnabled() ) { |
| 509 | 0 | LOG.debug( "Result Found in cache using key: " + key + "\nResult: " + hasPerm ); |
| 510 | |
} |
| 511 | |
} |
| 512 | 0 | return hasPerm; |
| 513 | |
} |
| 514 | |
|
| 515 | |
public boolean isAuthorizedByTemplateName(String principalId, String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails, AttributeSet qualification ) { |
| 516 | 0 | if ( qualification == null || qualification.isEmpty() ) { |
| 517 | 0 | return hasPermissionByTemplateName( principalId, namespaceCode, permissionTemplateName, permissionDetails ); |
| 518 | |
} |
| 519 | 0 | if ( LOG.isDebugEnabled() ) { |
| 520 | 0 | logAuthorizationCheck("Perm Templ", principalId, namespaceCode, permissionTemplateName, permissionDetails, qualification); |
| 521 | |
} |
| 522 | 0 | StringBuffer cacheKey = new StringBuffer(); |
| 523 | 0 | cacheKey.append( principalId ).append( '/' ); |
| 524 | 0 | cacheKey.append( namespaceCode ).append( '-' ).append( permissionTemplateName ).append( '/' ); |
| 525 | 0 | addAttributeSetToKey( permissionDetails, cacheKey ); |
| 526 | 0 | cacheKey.append( '/' ); |
| 527 | 0 | addAttributeSetToKey( qualification, cacheKey ); |
| 528 | 0 | String key = cacheKey.toString(); |
| 529 | 0 | Boolean isAuthorized = getIsAuthorizedByTemplateNameFromCache( key ); |
| 530 | 0 | if ( isAuthorized == null ) { |
| 531 | 0 | isAuthorized = getPermissionService().isAuthorizedByTemplateName( principalId, namespaceCode, permissionTemplateName, permissionDetails, qualification ); |
| 532 | 0 | addIsAuthorizedByTemplateNameToCache( key, isAuthorized ); |
| 533 | 0 | if ( LOG.isDebugEnabled() ) { |
| 534 | 0 | LOG.debug( "Result: " + isAuthorized ); |
| 535 | |
} |
| 536 | |
} else { |
| 537 | 0 | if ( LOG.isDebugEnabled() ) { |
| 538 | 0 | LOG.debug( "Result Found in cache using key: " + key + "\nResult: " + isAuthorized ); |
| 539 | |
} |
| 540 | |
} |
| 541 | 0 | return isAuthorized; |
| 542 | |
} |
| 543 | |
|
| 544 | |
private void addAttributeSetToKey(AttributeSet attributes, StringBuffer key) { |
| 545 | 0 | if ( attributes != null ) { |
| 546 | 0 | for ( Map.Entry<String, String> entry : attributes.entrySet() ) { |
| 547 | 0 | key.append( entry.getKey() ).append( '=' ).append( entry.getValue() ).append('|'); |
| 548 | |
} |
| 549 | |
} else { |
| 550 | 0 | key.append( "[null]" ); |
| 551 | |
} |
| 552 | 0 | } |
| 553 | |
|
| 554 | |
|
| 555 | |
|
| 556 | |
|
| 557 | |
public List<? extends KimPermissionInfo> getAuthorizedPermissions(String principalId, |
| 558 | |
String namespaceCode, String permissionName, AttributeSet permissionDetails, AttributeSet qualification) { |
| 559 | 0 | return getPermissionService().getAuthorizedPermissions(principalId, namespaceCode, permissionName, permissionDetails, qualification); |
| 560 | |
} |
| 561 | |
|
| 562 | |
public List<? extends KimPermissionInfo> getAuthorizedPermissionsByTemplateName(String principalId, |
| 563 | |
String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails, AttributeSet qualification) { |
| 564 | 0 | return getPermissionService().getAuthorizedPermissionsByTemplateName(principalId, namespaceCode, permissionTemplateName, permissionDetails, qualification); |
| 565 | |
} |
| 566 | |
|
| 567 | |
public boolean isPermissionDefinedForTemplateName(String namespaceCode, String permissionTemplateName, AttributeSet permissionDetails) { |
| 568 | 0 | StringBuffer key = new StringBuffer(); |
| 569 | 0 | key.append( namespaceCode ).append( '-' ).append( permissionTemplateName ).append( '/' ); |
| 570 | 0 | addAttributeSetToKey(permissionDetails, key); |
| 571 | 0 | MaxAgeSoftReference<Boolean> resultEntry = isPermissionDefinedForTemplateNameCache.get(key.toString()); |
| 572 | 0 | if ( resultEntry != null ) { |
| 573 | 0 | Boolean result = resultEntry.get(); |
| 574 | 0 | if ( result != null ) { |
| 575 | 0 | return result; |
| 576 | |
} |
| 577 | |
} |
| 578 | 0 | boolean result = getPermissionService().isPermissionDefinedForTemplateName(namespaceCode, permissionTemplateName, permissionDetails); |
| 579 | 0 | isPermissionDefinedForTemplateNameCache.put(key.toString(),new MaxAgeSoftReference<Boolean>( permissionCacheMaxAgeSeconds, result )); |
| 580 | 0 | return result; |
| 581 | |
} |
| 582 | |
|
| 583 | |
|
| 584 | |
public List<PermissionAssigneeInfo> getPermissionAssignees(String namespaceCode, |
| 585 | |
String permissionName, AttributeSet permissionDetails, AttributeSet qualification) { |
| 586 | 0 | return this.permissionService.getPermissionAssignees(namespaceCode, permissionName, |
| 587 | |
permissionDetails, qualification); |
| 588 | |
} |
| 589 | |
|
| 590 | |
public List<PermissionAssigneeInfo> getPermissionAssigneesForTemplateName(String namespaceCode, |
| 591 | |
String permissionTemplateName, AttributeSet permissionDetails, |
| 592 | |
AttributeSet qualification) { |
| 593 | 0 | return this.permissionService.getPermissionAssigneesForTemplateName( namespaceCode, |
| 594 | |
permissionTemplateName, permissionDetails, qualification ); |
| 595 | |
} |
| 596 | |
|
| 597 | |
|
| 598 | |
|
| 599 | |
public boolean isMemberOfGroup(String principalId, String groupId) { |
| 600 | 0 | Boolean isMember = getIsMemberOfGroupCache(principalId, groupId); |
| 601 | 0 | if (isMember != null) { |
| 602 | 0 | return isMember; |
| 603 | |
} |
| 604 | 0 | isMember = getGroupService().isMemberOfGroup(principalId, groupId); |
| 605 | 0 | addIsMemberOfGroupToCache(principalId, groupId, isMember); |
| 606 | 0 | return isMember; |
| 607 | |
} |
| 608 | |
|
| 609 | |
public boolean isMemberOfGroup(String principalId, String namespaceCode, String groupName) { |
| 610 | 0 | Group group = getGroupByName(namespaceCode, groupName); |
| 611 | 0 | if ( group == null ) { |
| 612 | 0 | return false; |
| 613 | |
} |
| 614 | 0 | return isMemberOfGroup(principalId, group.getId()); |
| 615 | |
} |
| 616 | |
|
| 617 | |
public boolean isGroupMemberOfGroup(String potentialMemberId, String potentialParentId) |
| 618 | |
{ |
| 619 | 0 | Boolean isMember = getIsGroupMemberOfGroupCache(potentialMemberId, potentialParentId); |
| 620 | 0 | if(isMember != null) |
| 621 | |
{ |
| 622 | 0 | return isMember; |
| 623 | |
} |
| 624 | |
else |
| 625 | |
{ |
| 626 | 0 | isMember = getGroupService() |
| 627 | |
.isGroupMemberOfGroup(potentialMemberId, potentialParentId); |
| 628 | |
} |
| 629 | 0 | addIsGroupMemberOfGroupToCache(potentialMemberId, potentialParentId, isMember); |
| 630 | 0 | return isMember; |
| 631 | |
} |
| 632 | |
public List<String> getGroupMemberPrincipalIds(String groupId) { |
| 633 | 0 | List<String> ids = getGroupMemberPrincipalIdsCache(groupId); |
| 634 | 0 | if (ids != null) { |
| 635 | 0 | return ids; |
| 636 | |
} |
| 637 | 0 | ids = getGroupService().getMemberPrincipalIds(groupId); |
| 638 | 0 | addGroupMemberPrincipalIdsToCache(groupId, ids); |
| 639 | 0 | return ids; |
| 640 | |
} |
| 641 | |
|
| 642 | |
public List<String> getDirectGroupMemberPrincipalIds(String groupId) { |
| 643 | 0 | return getGroupService().getDirectMemberPrincipalIds(groupId); |
| 644 | |
} |
| 645 | |
|
| 646 | |
public List<String> getGroupIdsForPrincipal(String principalId) { |
| 647 | 0 | List<String> ids = getGroupIdsForPrincipalCache(principalId); |
| 648 | 0 | if (ids != null) { |
| 649 | 0 | return ids; |
| 650 | |
} |
| 651 | 0 | ids = getGroupService().getGroupIdsForPrincipal(principalId); |
| 652 | 0 | addGroupIdsForPrincipalToCache(principalId, ids); |
| 653 | 0 | return ids; |
| 654 | |
} |
| 655 | |
|
| 656 | |
public List<String> getGroupIdsForPrincipal(String principalId, String namespaceCode ) { |
| 657 | 0 | return getGroupService().getGroupIdsForPrincipalByNamespace(principalId, namespaceCode ); |
| 658 | |
} |
| 659 | |
|
| 660 | |
public List<? extends Group> getGroupsForPrincipal(String principalId) { |
| 661 | 0 | List<? extends Group> groups = getGroupsForPrincipalCache(principalId); |
| 662 | 0 | if (groups != null) { |
| 663 | 0 | return groups; |
| 664 | |
} |
| 665 | 0 | groups = getGroupService().getGroupsForPrincipal(principalId); |
| 666 | 0 | addGroupsForPrincipalToCache(principalId, groups); |
| 667 | 0 | return groups; |
| 668 | |
} |
| 669 | |
|
| 670 | |
public List<? extends Group> getGroupsForPrincipal(String principalId, String namespaceCode ) { |
| 671 | 0 | List<? extends Group> groups = getGroupsForPrincipalCache(principalId + "-" + namespaceCode); |
| 672 | 0 | if (groups != null) { |
| 673 | 0 | return groups; |
| 674 | |
} |
| 675 | 0 | groups = getGroupService().getGroupsForPrincipalByNamespace(principalId, namespaceCode ); |
| 676 | 0 | addGroupsForPrincipalToCache(principalId, groups); |
| 677 | 0 | return groups; |
| 678 | |
} |
| 679 | |
|
| 680 | |
public List<String> getMemberGroupIds(String groupId) { |
| 681 | 0 | return getGroupService().getMemberGroupIds(groupId); |
| 682 | |
} |
| 683 | |
|
| 684 | |
public List<String> getDirectMemberGroupIds(String groupId) { |
| 685 | 0 | return getGroupService().getDirectMemberGroupIds(groupId); |
| 686 | |
} |
| 687 | |
|
| 688 | |
public Group getGroup(String groupId) { |
| 689 | 0 | Group group = getGroupByIdCache(groupId); |
| 690 | 0 | if (group != null) { |
| 691 | 0 | return group; |
| 692 | |
} |
| 693 | 0 | group = getGroupService().getGroup(groupId); |
| 694 | 0 | addGroupToCache(group); |
| 695 | 0 | return group; |
| 696 | |
} |
| 697 | |
|
| 698 | |
public Group getGroupByName(String namespaceCode, String groupName) { |
| 699 | 0 | Group group = getGroupByNameCache(namespaceCode + "-" + groupName); |
| 700 | 0 | if (group != null) { |
| 701 | 0 | return group; |
| 702 | |
} |
| 703 | 0 | group = getGroupService().getGroupByName( namespaceCode, groupName ); |
| 704 | 0 | addGroupToCache(group); |
| 705 | 0 | return group; |
| 706 | |
} |
| 707 | |
|
| 708 | |
public List<String> getParentGroupIds(String groupId) { |
| 709 | 0 | return getGroupService().getParentGroupIds(groupId); |
| 710 | |
} |
| 711 | |
|
| 712 | |
public List<String> getDirectParentGroupIds(String groupId) { |
| 713 | 0 | return getGroupService().getDirectParentGroupIds( groupId ); |
| 714 | |
} |
| 715 | |
|
| 716 | |
protected void clearGroupCachesForPrincipalAndGroup( String principalId, String groupId ) { |
| 717 | 0 | if ( principalId != null ) { |
| 718 | 0 | groupIdsForPrincipalCache.remove(principalId); |
| 719 | 0 | groupsForPrincipalCache.remove(principalId); |
| 720 | 0 | isMemberOfGroupCache.remove(principalId + "-" + groupId); |
| 721 | |
} else { |
| 722 | |
|
| 723 | 0 | synchronized (isMemberOfGroupCache) { |
| 724 | 0 | Iterator<String> keys = isMemberOfGroupCache.keySet().iterator(); |
| 725 | 0 | while ( keys.hasNext() ) { |
| 726 | 0 | String key = keys.next(); |
| 727 | 0 | if ( key.endsWith("-"+groupId) ) { |
| 728 | 0 | keys.remove(); |
| 729 | |
} |
| 730 | 0 | } |
| 731 | 0 | } |
| 732 | |
|
| 733 | |
|
| 734 | |
} |
| 735 | 0 | groupMemberPrincipalIdsCache.remove(groupId); |
| 736 | 0 | } |
| 737 | |
|
| 738 | |
|
| 739 | |
public boolean addGroupToGroup(String childId, String parentId) { |
| 740 | 0 | clearGroupCachesForPrincipalAndGroup(null, parentId); |
| 741 | 0 | return getGroupUpdateService().addGroupToGroup(childId, parentId); |
| 742 | |
} |
| 743 | |
|
| 744 | |
public boolean addPrincipalToGroup(String principalId, String groupId) { |
| 745 | 0 | clearGroupCachesForPrincipalAndGroup(principalId, groupId); |
| 746 | 0 | return getGroupUpdateService().addPrincipalToGroup(principalId, groupId); |
| 747 | |
} |
| 748 | |
|
| 749 | |
public boolean removeGroupFromGroup(String childId, String parentId) { |
| 750 | 0 | clearGroupCachesForPrincipalAndGroup(null, parentId); |
| 751 | 0 | return getGroupUpdateService().removeGroupFromGroup(childId, parentId); |
| 752 | |
} |
| 753 | |
|
| 754 | |
public boolean removePrincipalFromGroup(String principalId, String groupId) { |
| 755 | 0 | clearGroupCachesForPrincipalAndGroup(principalId, groupId); |
| 756 | 0 | return getGroupUpdateService().removePrincipalFromGroup(principalId, groupId); |
| 757 | |
} |
| 758 | |
|
| 759 | |
|
| 760 | |
|
| 761 | |
|
| 762 | |
|
| 763 | |
|
| 764 | |
|
| 765 | |
|
| 766 | |
public Group createGroup(Group group) { |
| 767 | 0 | clearGroupCachesForPrincipalAndGroup(null,group.getId()); |
| 768 | 0 | return getGroupUpdateService().createGroup(group); |
| 769 | |
} |
| 770 | |
|
| 771 | |
|
| 772 | |
|
| 773 | |
|
| 774 | |
|
| 775 | |
|
| 776 | |
|
| 777 | |
public void removeAllMembers(String groupId) { |
| 778 | 0 | clearGroupCachesForPrincipalAndGroup(null, groupId); |
| 779 | 0 | getGroupUpdateService().removeAllMembers(groupId); |
| 780 | 0 | } |
| 781 | |
|
| 782 | |
|
| 783 | |
|
| 784 | |
|
| 785 | |
|
| 786 | |
|
| 787 | |
|
| 788 | |
|
| 789 | |
|
| 790 | |
public Group updateGroup(String groupId, Group group) { |
| 791 | 0 | clearGroupCachesForPrincipalAndGroup(null, groupId); |
| 792 | 0 | return getGroupUpdateService().updateGroup(groupId, group); |
| 793 | |
} |
| 794 | |
|
| 795 | |
|
| 796 | |
|
| 797 | |
|
| 798 | |
public Principal getPrincipal(String principalId) { |
| 799 | 0 | Principal principal = getPrincipalByIdCache(principalId); |
| 800 | 0 | if (principal != null) { |
| 801 | 0 | return principal; |
| 802 | |
} |
| 803 | 0 | principal = getIdentityService().getPrincipal(principalId); |
| 804 | 0 | addPrincipalToCache(principal); |
| 805 | 0 | return principal; |
| 806 | |
} |
| 807 | |
|
| 808 | |
public Principal getPrincipalByPrincipalName(String principalName) { |
| 809 | 0 | Principal principal = getPrincipalByNameCache(principalName); |
| 810 | 0 | if (principal != null) { |
| 811 | 0 | return principal; |
| 812 | |
} |
| 813 | 0 | principal = getIdentityService().getPrincipalByPrincipalName(principalName); |
| 814 | 0 | addPrincipalToCache(principal); |
| 815 | 0 | return principal; |
| 816 | |
} |
| 817 | |
|
| 818 | |
|
| 819 | |
|
| 820 | |
|
| 821 | |
public Principal getPrincipalByPrincipalNameAndPassword(String principalName, String password) { |
| 822 | |
|
| 823 | 0 | return getIdentityService().getPrincipalByPrincipalNameAndPassword( principalName, password ); |
| 824 | |
} |
| 825 | |
|
| 826 | |
|
| 827 | |
|
| 828 | |
|
| 829 | |
|
| 830 | |
|
| 831 | |
public KimEntityDefaultInfo getEntityDefaultInfo(String entityId) { |
| 832 | 0 | KimEntityDefaultInfo entity = getEntityDefaultInfoFromCache(entityId); |
| 833 | 0 | if ( entity == null ) { |
| 834 | 0 | entity = getIdentityService().getEntityDefaultInfo(entityId); |
| 835 | 0 | addEntityDefaultInfoToCache( entity ); |
| 836 | |
} |
| 837 | 0 | return entity; |
| 838 | |
} |
| 839 | |
|
| 840 | |
|
| 841 | |
|
| 842 | |
|
| 843 | |
|
| 844 | |
|
| 845 | |
public KimEntityDefaultInfo getEntityDefaultInfoByPrincipalId( |
| 846 | |
String principalId) { |
| 847 | 0 | KimEntityDefaultInfo entity = getEntityDefaultInfoFromCacheByPrincipalId(principalId); |
| 848 | 0 | if ( entity == null ) { |
| 849 | 0 | entity = getIdentityService().getEntityDefaultInfoByPrincipalId(principalId); |
| 850 | 0 | addEntityDefaultInfoToCache( entity ); |
| 851 | |
} |
| 852 | 0 | return entity; |
| 853 | |
} |
| 854 | |
|
| 855 | |
|
| 856 | |
|
| 857 | |
|
| 858 | |
|
| 859 | |
|
| 860 | |
public KimEntityDefaultInfo getEntityDefaultInfoByPrincipalName( |
| 861 | |
String principalName) { |
| 862 | 0 | KimEntityDefaultInfo entity = getEntityDefaultInfoFromCacheByPrincipalName( principalName ); |
| 863 | 0 | if ( entity == null ) { |
| 864 | 0 | entity = getIdentityService().getEntityDefaultInfoByPrincipalName(principalName); |
| 865 | 0 | addEntityDefaultInfoToCache( entity ); |
| 866 | |
} |
| 867 | 0 | return entity; |
| 868 | |
} |
| 869 | |
|
| 870 | |
|
| 871 | |
|
| 872 | |
|
| 873 | |
|
| 874 | |
|
| 875 | |
public List<? extends KimEntityDefaultInfo> lookupEntityDefaultInfo( |
| 876 | |
Map<String, String> searchCriteria, boolean unbounded) { |
| 877 | 0 | return getIdentityService().lookupEntityDefaultInfo(searchCriteria, unbounded); |
| 878 | |
} |
| 879 | |
|
| 880 | |
|
| 881 | |
|
| 882 | |
|
| 883 | |
|
| 884 | |
public KimEntityInfo getEntityInfo(String entityId) { |
| 885 | 0 | KimEntityInfo entity = getEntityInfoFromCache(entityId); |
| 886 | 0 | if ( entity == null ) { |
| 887 | 0 | entity = getIdentityService().getEntityInfo(entityId); |
| 888 | 0 | addEntityInfoToCache( entity ); |
| 889 | |
} |
| 890 | 0 | return entity; |
| 891 | |
} |
| 892 | |
|
| 893 | |
|
| 894 | |
|
| 895 | |
|
| 896 | |
public KimEntityInfo getEntityInfoByPrincipalId(String principalId) { |
| 897 | 0 | KimEntityInfo entity = getEntityInfoFromCacheByPrincipalId(principalId); |
| 898 | 0 | if ( entity == null ) { |
| 899 | 0 | entity = getIdentityService().getEntityInfoByPrincipalId(principalId); |
| 900 | 0 | addEntityInfoToCache( entity ); |
| 901 | |
} |
| 902 | 0 | return entity; |
| 903 | |
} |
| 904 | |
|
| 905 | |
|
| 906 | |
|
| 907 | |
|
| 908 | |
|
| 909 | |
|
| 910 | |
public KimEntityInfo getEntityInfoByPrincipalName(String principalName) { |
| 911 | 0 | KimEntityInfo entity = getEntityInfoFromCacheByPrincipalName( principalName ); |
| 912 | 0 | if ( entity == null ) { |
| 913 | 0 | entity = getIdentityService().getEntityInfoByPrincipalName( principalName ); |
| 914 | 0 | addEntityInfoToCache( entity ); |
| 915 | |
} |
| 916 | 0 | return entity; |
| 917 | |
} |
| 918 | |
|
| 919 | |
|
| 920 | |
|
| 921 | |
|
| 922 | |
public List<KimEntityInfo> lookupEntityInfo( |
| 923 | |
Map<String, String> searchCriteria, boolean unbounded) { |
| 924 | 0 | return getIdentityService().lookupEntityInfo(searchCriteria, unbounded); |
| 925 | |
} |
| 926 | |
|
| 927 | |
|
| 928 | |
|
| 929 | |
|
| 930 | |
public int getMatchingEntityCount(Map<String,String> searchCriteria) { |
| 931 | 0 | return getIdentityService().getMatchingEntityCount( searchCriteria ); |
| 932 | |
} |
| 933 | |
|
| 934 | |
public Type getAddressType( String code ) { |
| 935 | 0 | Type type = (Type)kimReferenceTypeCacheMap.get(EntityAddressTypeBo.class.getSimpleName()+"-"+code); |
| 936 | 0 | if ( type == null ) { |
| 937 | 0 | type = getIdentityService().getAddressType(code); |
| 938 | 0 | kimReferenceTypeCacheMap.put(EntityAddressTypeBo.class.getSimpleName()+"-"+code, type); |
| 939 | |
} |
| 940 | 0 | return type; |
| 941 | |
} |
| 942 | |
public Type getEmailType( String code ) { |
| 943 | 0 | Type type = (Type)kimReferenceTypeCacheMap.get(EntityEmailTypeBo.class.getSimpleName()+"-"+code); |
| 944 | 0 | if ( type == null ) { |
| 945 | 0 | type = Type.Builder.create(getIdentityService().getEmailType(code)).build(); |
| 946 | 0 | kimReferenceTypeCacheMap.put(EntityEmailTypeBo.class.getSimpleName()+"-"+code, type); |
| 947 | |
} |
| 948 | 0 | return type; |
| 949 | |
} |
| 950 | |
public AffiliationTypeInfo getAffiliationType( String code ) { |
| 951 | 0 | AffiliationTypeInfo type = (AffiliationTypeInfo)kimReferenceTypeCache.get(AffiliationTypeInfo.class.getSimpleName()+"-"+code); |
| 952 | 0 | if ( type == null ) { |
| 953 | 0 | type = getIdentityService().getAffiliationType(code); |
| 954 | 0 | kimReferenceTypeCache.put(AffiliationTypeInfo.class.getSimpleName()+"-"+code, type); |
| 955 | |
} |
| 956 | 0 | return type; |
| 957 | |
} |
| 958 | |
public Type getCitizenshipStatus( String code ) { |
| 959 | 0 | Type type = (Type)kimReferenceTypeCacheMap.get(EntityCitizenshipStatusBo.class.getSimpleName()+"-"+code); |
| 960 | 0 | if ( type == null ) { |
| 961 | 0 | type = Type.Builder.create(getIdentityService().getCitizenshipStatus(code)).build(); |
| 962 | 0 | kimReferenceTypeCacheMap.put(EntityCitizenshipStatusBo.class.getSimpleName()+"-"+code, type); |
| 963 | |
} |
| 964 | 0 | return type; |
| 965 | |
} |
| 966 | |
|
| 967 | |
public EmploymentStatusInfo getEmploymentStatus( String code ) { |
| 968 | 0 | EmploymentStatusInfo type = (EmploymentStatusInfo)kimReferenceTypeCache.get(EmploymentStatusInfo.class.getSimpleName()+"-"+code); |
| 969 | 0 | if ( type == null ) { |
| 970 | 0 | type = getIdentityService().getEmploymentStatus(code); |
| 971 | 0 | kimReferenceTypeCache.put(EmploymentStatusInfo.class.getSimpleName()+"-"+code, type); |
| 972 | |
} |
| 973 | 0 | return type; |
| 974 | |
} |
| 975 | |
public EmploymentTypeInfo getEmploymentType( String code ) { |
| 976 | 0 | EmploymentTypeInfo type = (EmploymentTypeInfo)kimReferenceTypeCache.get(EmploymentTypeInfo.class.getSimpleName()+"-"+code); |
| 977 | 0 | if ( type == null ) { |
| 978 | 0 | type = getIdentityService().getEmploymentType(code); |
| 979 | 0 | kimReferenceTypeCache.put(EmploymentTypeInfo.class.getSimpleName()+"-"+code, type); |
| 980 | |
} |
| 981 | 0 | return type; |
| 982 | |
} |
| 983 | |
public EntityNameTypeInfo getEntityNameType( String code ) { |
| 984 | 0 | EntityNameTypeInfo type = (EntityNameTypeInfo)kimReferenceTypeCache.get(EntityNameTypeInfo.class.getSimpleName()+"-"+code); |
| 985 | 0 | if ( type == null ) { |
| 986 | 0 | type = getIdentityService().getEntityNameType(code); |
| 987 | 0 | kimReferenceTypeCache.put(EntityNameTypeInfo.class.getSimpleName()+"-"+code, type); |
| 988 | |
} |
| 989 | 0 | return type; |
| 990 | |
} |
| 991 | |
public Type getEntityType( String code ) { |
| 992 | 0 | Type type = (Type)kimReferenceTypeCacheMap.get(EntityTypeBo.class.getSimpleName()+"-"+code); |
| 993 | 0 | if ( type == null ) { |
| 994 | 0 | type = Type.Builder.create(getIdentityService().getEntityType(code)).build(); |
| 995 | 0 | kimReferenceTypeCacheMap.put(EntityTypeBo.class.getSimpleName()+"-"+code, type); |
| 996 | |
} |
| 997 | 0 | return type; |
| 998 | |
} |
| 999 | |
public ExternalIdentifierTypeInfo getExternalIdentifierType( String code ) { |
| 1000 | 0 | ExternalIdentifierTypeInfo type = (ExternalIdentifierTypeInfo)kimReferenceTypeCache.get(ExternalIdentifierTypeInfo.class.getSimpleName()+"-"+code); |
| 1001 | 0 | if ( type == null ) { |
| 1002 | 0 | type = getIdentityService().getExternalIdentifierType(code); |
| 1003 | 0 | kimReferenceTypeCache.put(ExternalIdentifierTypeInfo.class.getSimpleName()+"-"+code, type); |
| 1004 | |
} |
| 1005 | 0 | return type; |
| 1006 | |
} |
| 1007 | |
public Type getPhoneType( String code ) { |
| 1008 | 0 | TypeContract type = kimReferenceTypeCacheMap.get(EntityPhoneTypeBo.class.getSimpleName()+"-"+code); |
| 1009 | 0 | if ( type == null ) { |
| 1010 | 0 | type = Type.Builder.create(getIdentityService().getPhoneType(code)).build(); |
| 1011 | 0 | kimReferenceTypeCacheMap.put(EntityPhoneTypeBo.class.getSimpleName()+"-"+code, type); |
| 1012 | |
} |
| 1013 | 0 | return Type.Builder.create(type).build(); |
| 1014 | |
} |
| 1015 | |
|
| 1016 | |
|
| 1017 | |
|
| 1018 | |
public IdentityService getIdentityService() { |
| 1019 | 0 | if ( identityService == null ) { |
| 1020 | 0 | identityService = KimApiServiceLocator.getIdentityService(); |
| 1021 | |
} |
| 1022 | 0 | return identityService; |
| 1023 | |
} |
| 1024 | |
|
| 1025 | |
public GroupService getGroupService() { |
| 1026 | 0 | if ( groupService == null ) { |
| 1027 | 0 | groupService = KimApiServiceLocator.getGroupService(); |
| 1028 | |
} |
| 1029 | 0 | return groupService; |
| 1030 | |
} |
| 1031 | |
|
| 1032 | |
public PermissionService getPermissionService() { |
| 1033 | 0 | if ( permissionService == null ) { |
| 1034 | 0 | permissionService = KimApiServiceLocator.getPermissionService(); |
| 1035 | |
} |
| 1036 | 0 | return permissionService; |
| 1037 | |
} |
| 1038 | |
|
| 1039 | |
public ResponsibilityService getResponsibilityService() { |
| 1040 | 0 | if ( responsibilityService == null ) { |
| 1041 | 0 | responsibilityService = KimApiServiceLocator.getResponsibilityService(); |
| 1042 | |
} |
| 1043 | 0 | return responsibilityService; |
| 1044 | |
} |
| 1045 | |
|
| 1046 | |
|
| 1047 | |
|
| 1048 | |
|
| 1049 | |
|
| 1050 | |
|
| 1051 | |
|
| 1052 | |
|
| 1053 | |
public Responsibility getResponsibility(String responsibilityId) { |
| 1054 | 0 | return getResponsibilityService().getResponsibility( responsibilityId ); |
| 1055 | |
} |
| 1056 | |
|
| 1057 | |
|
| 1058 | |
|
| 1059 | |
|
| 1060 | |
public boolean hasResponsibility(String principalId, String namespaceCode, |
| 1061 | |
String responsibilityName, AttributeSet qualification, |
| 1062 | |
AttributeSet responsibilityDetails) { |
| 1063 | 0 | return getResponsibilityService().hasResponsibility( principalId, namespaceCode, responsibilityName, Attributes.fromMap(qualification), Attributes.fromMap(responsibilityDetails) ); |
| 1064 | |
} |
| 1065 | |
|
| 1066 | |
public List<Responsibility> getResponsibilitiesByName( String namespaceCode, String responsibilityName) { |
| 1067 | 0 | return getResponsibilityService().findRespsByNamespaceCodeAndName(namespaceCode, responsibilityName); |
| 1068 | |
} |
| 1069 | |
|
| 1070 | |
public List<ResponsibilityAction> getResponsibilityActions( String namespaceCode, String responsibilityName, |
| 1071 | |
AttributeSet qualification, AttributeSet responsibilityDetails) { |
| 1072 | 0 | return getResponsibilityService().getResponsibilityActions( namespaceCode, responsibilityName, Attributes.fromMap(qualification), Attributes.fromMap(responsibilityDetails) ); |
| 1073 | |
} |
| 1074 | |
|
| 1075 | |
|
| 1076 | |
|
| 1077 | |
|
| 1078 | |
|
| 1079 | |
|
| 1080 | |
public List<ResponsibilityAction> getResponsibilityActionsByTemplateName( |
| 1081 | |
String namespaceCode, String responsibilityTemplateName, |
| 1082 | |
AttributeSet qualification, AttributeSet responsibilityDetails) { |
| 1083 | 0 | return getResponsibilityService().getResponsibilityActionsByTemplateName(namespaceCode, responsibilityTemplateName, Attributes.fromMap(qualification), Attributes.fromMap(responsibilityDetails)); |
| 1084 | |
} |
| 1085 | |
|
| 1086 | |
|
| 1087 | |
|
| 1088 | |
|
| 1089 | |
|
| 1090 | |
|
| 1091 | |
public boolean hasResponsibilityByTemplateName(String principalId, |
| 1092 | |
String namespaceCode, String responsibilityTemplateName, |
| 1093 | |
AttributeSet qualification, AttributeSet responsibilityDetails) { |
| 1094 | 0 | return getResponsibilityService().hasResponsibilityByTemplateName(principalId, namespaceCode, responsibilityTemplateName, Attributes.fromMap(qualification), Attributes.fromMap(responsibilityDetails)); |
| 1095 | |
} |
| 1096 | |
|
| 1097 | |
public void setEntityPrincipalCacheMaxSize(int entityPrincipalCacheMaxSize) { |
| 1098 | 0 | this.entityPrincipalCacheMaxSize = entityPrincipalCacheMaxSize; |
| 1099 | 0 | } |
| 1100 | |
|
| 1101 | |
public void setEntityPrincipalCacheMaxAgeSeconds(int entityPrincipalCacheMaxAge) { |
| 1102 | 0 | this.entityPrincipalCacheMaxAgeSeconds = entityPrincipalCacheMaxAge; |
| 1103 | 0 | } |
| 1104 | |
|
| 1105 | |
public void setGroupCacheMaxSize(int groupCacheMaxSize) { |
| 1106 | 0 | this.groupCacheMaxSize = groupCacheMaxSize; |
| 1107 | 0 | } |
| 1108 | |
|
| 1109 | |
public void setGroupCacheMaxAgeSeconds(int groupCacheMaxAge) { |
| 1110 | 0 | this.groupCacheMaxAgeSeconds = groupCacheMaxAge; |
| 1111 | 0 | } |
| 1112 | |
|
| 1113 | |
public void setPermissionCacheMaxSize(int permissionCacheMaxSize) { |
| 1114 | 0 | this.permissionCacheMaxSize = permissionCacheMaxSize; |
| 1115 | 0 | } |
| 1116 | |
|
| 1117 | |
public void setPermissionCacheMaxAgeSeconds(int permissionCacheMaxAge) { |
| 1118 | 0 | this.permissionCacheMaxAgeSeconds = permissionCacheMaxAge; |
| 1119 | 0 | } |
| 1120 | |
|
| 1121 | |
public void setResponsibilityCacheMaxSize(int responsibilityCacheMaxSize) { |
| 1122 | 0 | this.responsibilityCacheMaxSize = responsibilityCacheMaxSize; |
| 1123 | 0 | } |
| 1124 | |
|
| 1125 | |
public void setResponsibilityCacheMaxAgeSeconds(int responsibilityCacheMaxAge) { |
| 1126 | 0 | this.responsibilityCacheMaxAgeSeconds = responsibilityCacheMaxAge; |
| 1127 | 0 | } |
| 1128 | |
|
| 1129 | |
protected void logAuthorizationCheck(String checkType, String principalId, String namespaceCode, String permissionName, AttributeSet permissionDetails, AttributeSet qualification ) { |
| 1130 | 0 | StringBuilder sb = new StringBuilder(); |
| 1131 | 0 | sb.append( '\n' ); |
| 1132 | 0 | sb.append( "Is AuthZ for " ).append( checkType ).append( ": " ).append( namespaceCode ).append( "/" ).append( permissionName ).append( '\n' ); |
| 1133 | 0 | sb.append( " Principal: " ).append( principalId ); |
| 1134 | 0 | if ( principalId != null ) { |
| 1135 | 0 | Principal principal = getPrincipal( principalId ); |
| 1136 | 0 | if ( principal != null ) { |
| 1137 | 0 | sb.append( " (" ).append( principal.getPrincipalName() ).append( ')' ); |
| 1138 | |
} |
| 1139 | |
} |
| 1140 | 0 | sb.append( '\n' ); |
| 1141 | 0 | sb.append( " Details:\n" ); |
| 1142 | 0 | if ( permissionDetails != null ) { |
| 1143 | 0 | sb.append( permissionDetails.formattedDump( 25 ) ); |
| 1144 | |
} else { |
| 1145 | 0 | sb.append( " [null]\n" ); |
| 1146 | |
} |
| 1147 | 0 | sb.append( " Qualifiers:\n" ); |
| 1148 | 0 | if ( qualification != null && !qualification.isEmpty() ) { |
| 1149 | 0 | sb.append( qualification.formattedDump( 25 ) ); |
| 1150 | |
} else { |
| 1151 | 0 | sb.append( " [null]\n" ); |
| 1152 | |
} |
| 1153 | 0 | if (LOG.isTraceEnabled()) { |
| 1154 | 0 | LOG.trace( sb.append(ExceptionUtils.getStackTrace(new Throwable()))); |
| 1155 | |
} else { |
| 1156 | 0 | LOG.debug(sb.toString()); |
| 1157 | |
} |
| 1158 | 0 | } |
| 1159 | |
|
| 1160 | |
protected void logHasPermissionCheck(String checkType, String principalId, String namespaceCode, String permissionName, AttributeSet permissionDetails ) { |
| 1161 | 0 | StringBuilder sb = new StringBuilder(); |
| 1162 | 0 | sb.append( '\n' ); |
| 1163 | 0 | sb.append( "Has Perm for " ).append( checkType ).append( ": " ).append( namespaceCode ).append( "/" ).append( permissionName ).append( '\n' ); |
| 1164 | 0 | sb.append( " Principal: " ).append( principalId ); |
| 1165 | 0 | if ( principalId != null ) { |
| 1166 | 0 | Principal principal = getPrincipal( principalId ); |
| 1167 | 0 | if ( principal != null ) { |
| 1168 | 0 | sb.append( " (" ).append( principal.getPrincipalName() ).append( ')' ); |
| 1169 | |
} |
| 1170 | |
} |
| 1171 | 0 | sb.append( '\n' ); |
| 1172 | 0 | sb.append( " Details:\n" ); |
| 1173 | 0 | if ( permissionDetails != null ) { |
| 1174 | 0 | sb.append( permissionDetails.formattedDump( 25 ) ); |
| 1175 | |
} else { |
| 1176 | 0 | sb.append( " [null]\n" ); |
| 1177 | |
} |
| 1178 | 0 | if (LOG.isTraceEnabled()) { |
| 1179 | 0 | LOG.trace( sb.append( ExceptionUtils.getStackTrace(new Throwable())) ); |
| 1180 | |
} else { |
| 1181 | 0 | LOG.debug(sb.toString()); |
| 1182 | |
} |
| 1183 | 0 | } |
| 1184 | |
|
| 1185 | |
public GroupUpdateService getGroupUpdateService() { |
| 1186 | |
try { |
| 1187 | 0 | if ( groupUpdateService == null ) { |
| 1188 | 0 | groupUpdateService = KimApiServiceLocator.getGroupUpdateService(); |
| 1189 | 0 | if ( groupUpdateService == null ) { |
| 1190 | 0 | throw new UnsupportedOperationException( "null returned for GroupUpdateService, unable to update group data"); |
| 1191 | |
} |
| 1192 | |
} |
| 1193 | 0 | } catch ( Exception ex ) { |
| 1194 | 0 | throw new UnsupportedOperationException( "unable to obtain a GroupUpdateService, unable to update group data", ex); |
| 1195 | 0 | } |
| 1196 | 0 | return groupUpdateService; |
| 1197 | |
} |
| 1198 | |
|
| 1199 | |
public IdentityUpdateService getIdentityUpdateService() { |
| 1200 | |
try { |
| 1201 | 0 | if ( identityUpdateService == null ) { |
| 1202 | 0 | identityUpdateService = KimApiServiceLocator.getIdentityUpdateService(); |
| 1203 | 0 | if ( identityUpdateService == null ) { |
| 1204 | 0 | throw new UnsupportedOperationException( "null returned for IdentityUpdateService, unable to update identity data"); |
| 1205 | |
} |
| 1206 | |
} |
| 1207 | 0 | } catch ( Exception ex ) { |
| 1208 | 0 | throw new UnsupportedOperationException( "unable to obtain an IdentityUpdateService, unable to update identity data", ex); |
| 1209 | 0 | } |
| 1210 | 0 | return identityUpdateService; |
| 1211 | |
} |
| 1212 | |
} |