private <T extends Partition> void loadAttributes(final IdentityContext context, final T partition) { AttributeStore<?> attributeStore = getStoreSelector().getStoreForAttributeOperation(context); if (attributeStore != null) { attributeStore.loadAttributes(context, partition); } }
private <T extends Partition> void loadAttributes(final IdentityContext context, final T partition) { AttributeStore<?> attributeStore = getStoreSelector().getStoreForAttributeOperation(context); if (attributeStore != null) { attributeStore.loadAttributes(context, partition); } }
@Override protected void doUpdate(Partition attributedType) { checkPartitionManagementSupported(); IdentityContext identityContext = getIdentityContext(); getStoreSelector().getStoreForPartitionOperation(identityContext, attributedType.getClass()).update(identityContext, attributedType); }
@Override protected void doUpdate(Partition attributedType) { checkPartitionManagementSupported(); IdentityContext identityContext = getIdentityContext(); getStoreSelector().getStoreForPartitionOperation(identityContext, attributedType.getClass()).update(identityContext, attributedType); }
@Override public <T extends Partition> List<T> getPartitions(Class<T> partitionClass) { if (partitionClass == null) { throw MESSAGES.nullArgument("Partition class"); } List<T> partitions = new ArrayList<T>(); if (!getConfiguration().supportsPartition()) { partitions.add((T) createDefaultPartition()); } else { try { IdentityContext identityContext = getIdentityContext(); partitions.addAll(getStoreSelector().getStoreForPartitionOperation(identityContext, partitionClass).<T>get(identityContext, partitionClass)); for (T partition : partitions) { loadAttributes(identityContext, partition); } } catch (Exception e) { throw MESSAGES.partitionGetFailed(partitionClass, "not specified", e); } } return partitions; }
@Override public <T extends Partition> List<T> getPartitions(Class<T> partitionClass) { if (partitionClass == null) { throw MESSAGES.nullArgument("Partition class"); } List<T> partitions = new ArrayList<T>(); if (!getConfiguration().supportsPartition()) { partitions.add((T) createDefaultPartition()); } else { try { IdentityContext identityContext = getIdentityContext(); partitions.addAll(getStoreSelector().getStoreForPartitionOperation(identityContext, partitionClass).<T>get(identityContext, partitionClass)); for (T partition : partitions) { loadAttributes(identityContext, partition); } } catch (Exception e) { throw MESSAGES.partitionGetFailed(partitionClass, "not specified", e); } } return partitions; }
@Override protected void doRemove(Partition attributedType) { checkPartitionManagementSupported(); IdentityManager identityManager = createIdentityManager(attributedType); IdentityQueryBuilder queryBuilder = identityManager.getQueryBuilder(); IdentityQuery<IdentityType> query = queryBuilder.createIdentityQuery(IdentityType.class); for (IdentityType identityType : query.getResultList()) { identityManager.remove(identityType); } IdentityContext identityContext = getIdentityContext(); getStoreSelector().getStoreForPartitionOperation(identityContext, attributedType.getClass()).remove(identityContext, attributedType); }
@Override protected void doRemove(Partition attributedType) { checkPartitionManagementSupported(); IdentityManager identityManager = createIdentityManager(attributedType); IdentityQueryBuilder queryBuilder = identityManager.getQueryBuilder(); IdentityQuery<IdentityType> query = queryBuilder.createIdentityQuery(IdentityType.class); for (IdentityType identityType : query.getResultList()) { identityManager.remove(identityType); } IdentityContext identityContext = getIdentityContext(); getStoreSelector().getStoreForPartitionOperation(identityContext, attributedType.getClass()).remove(identityContext, attributedType); }
public ContextualPermissionManager(Partition partition, DefaultPartitionManager defaultPartitionManager) { this.identityContext = new DefaultIdentityContext(partition, defaultPartitionManager.getEventBridge(), defaultPartitionManager.getIdGenerator(), defaultPartitionManager.getConfiguration().getPermissionHandlerPolicy()); this.storeSelector = defaultPartitionManager.getStoreSelector(); this.partitionManager = defaultPartitionManager; if (this.storeSelector.getStoreForPermissionOperation(identityContext) == null) { throw IDMInternalMessages.MESSAGES.permissionUnsupportedOperation(); } }
public ContextualPermissionManager(Partition partition, DefaultPartitionManager defaultPartitionManager) { this.identityContext = new DefaultIdentityContext(partition, defaultPartitionManager.getEventBridge(), defaultPartitionManager.getIdGenerator(), defaultPartitionManager.getConfiguration().getPermissionHandlerPolicy()); this.storeSelector = defaultPartitionManager.getStoreSelector(); this.partitionManager = defaultPartitionManager; if (this.storeSelector.getStoreForPermissionOperation(identityContext) == null) { throw IDMInternalMessages.MESSAGES.permissionUnsupportedOperation(); } }
@Override public void add(Partition partition, String configurationName) throws IdentityManagementException { checkPartitionManagementSupported(); if (partition == null) { throw MESSAGES.nullArgument("Partition"); } if (isNullOrEmpty(configurationName)) { configurationName = getConfiguration().getDefaultConfigurationName(); } if (getConfiguration().getConfigurationByName(configurationName) != null) { checkUniqueness(partition); try { IdentityContext identityContext = getIdentityContext(); getStoreSelector().getStoreForPartitionOperation(identityContext, partition.getClass()).add(identityContext, partition, configurationName); addAttributes(identityContext, partition); fireEvent(new PartitionCreatedEvent(partition, this)); } catch (Exception e) { throw MESSAGES.partitionAddFailed(partition, configurationName, e); } } }
@Override public <T extends Partition> T getPartition(Class<T> partitionClass, String name) { if (partitionClass == null) { throw MESSAGES.nullArgument("Partition class"); } if (isNullOrEmpty(name)) { throw MESSAGES.nullArgument("Partition name"); } if (!getConfiguration().supportsPartition()) { return (T) createDefaultPartition(); } try { IdentityContext identityContext = getIdentityContext(); T partition = getStoreSelector().getStoreForPartitionOperation(identityContext, partitionClass).<T>get(identityContext, partitionClass, name); if (partition != null) { loadAttributes(identityContext, (T) partition); } return partition; } catch (Exception e) { throw MESSAGES.partitionGetFailed(partitionClass, name, e); } }
@Override public void add(Partition partition, String configurationName) throws IdentityManagementException { checkPartitionManagementSupported(); if (partition == null) { throw MESSAGES.nullArgument("Partition"); } if (isNullOrEmpty(configurationName)) { configurationName = getConfiguration().getDefaultConfigurationName(); } if (getConfiguration().getConfigurationByName(configurationName) != null) { checkUniqueness(partition); try { IdentityContext identityContext = getIdentityContext(); getStoreSelector().getStoreForPartitionOperation(identityContext, partition.getClass()).add(identityContext, partition, configurationName); addAttributes(identityContext, partition); fireEvent(new PartitionCreatedEvent(partition, this)); } catch (Exception e) { throw MESSAGES.partitionAddFailed(partition, configurationName, e); } } }
@Override public <T extends Partition> T getPartition(Class<T> partitionClass, String name) { if (partitionClass == null) { throw MESSAGES.nullArgument("Partition class"); } if (isNullOrEmpty(name)) { throw MESSAGES.nullArgument("Partition name"); } if (!getConfiguration().supportsPartition()) { return (T) createDefaultPartition(); } try { IdentityContext identityContext = getIdentityContext(); T partition = getStoreSelector().getStoreForPartitionOperation(identityContext, partitionClass).<T>get(identityContext, partitionClass, name); if (partition != null) { loadAttributes(identityContext, (T) partition); } return partition; } catch (Exception e) { throw MESSAGES.partitionGetFailed(partitionClass, name, e); } }
@Override public <T extends Partition> T lookupById(final Class<T> partitionClass, final String id) { if (partitionClass == null) { throw MESSAGES.nullArgument("Partition class"); } if (isNullOrEmpty(id)) { throw MESSAGES.nullArgument("Partition identifier"); } if (!getConfiguration().supportsPartition()) { return (T) createDefaultPartition(); } try { IdentityContext identityContext = getIdentityContext(); T partition = getStoreSelector().getStoreForPartitionOperation(identityContext, partitionClass).<T>lookupById(identityContext, partitionClass, id); if (partition != null) { loadAttributes(identityContext, (T) partition); } return partition; } catch (Exception e) { throw MESSAGES.partitionGetFailed(partitionClass, id, e); } }
@Override public <T extends Partition> T lookupById(final Class<T> partitionClass, final String id) { if (partitionClass == null) { throw MESSAGES.nullArgument("Partition class"); } if (isNullOrEmpty(id)) { throw MESSAGES.nullArgument("Partition identifier"); } if (!getConfiguration().supportsPartition()) { return (T) createDefaultPartition(); } try { IdentityContext identityContext = getIdentityContext(); T partition = getStoreSelector().getStoreForPartitionOperation(identityContext, partitionClass).<T>lookupById(identityContext, partitionClass, id); if (partition != null) { loadAttributes(identityContext, (T) partition); } return partition; } catch (Exception e) { throw MESSAGES.partitionGetFailed(partitionClass, id, e); } }