@Override protected void checkUniqueness(Partition attributedType) throws IdentityManagementException { Partition storedPartition = getPartition(attributedType.getClass(), attributedType.getName()); if (storedPartition != null) { throw MESSAGES.partitionAlreadyExistsWithName(attributedType.getClass(), storedPartition.getName()); } }
@Override protected void checkUniqueness(Partition attributedType) throws IdentityManagementException { Partition storedPartition = getPartition(attributedType.getClass(), attributedType.getName()); if (storedPartition != null) { throw MESSAGES.partitionAlreadyExistsWithName(attributedType.getClass(), storedPartition.getName()); } }
private FilePartition resolve(Class<? extends Partition> type, String name) throws IdentityManagementException { for (FilePartition filePartition : this.fileDataSource.getPartitions().values()) { Partition storedPartition = filePartition.getEntry(); if (storedPartition.getClass().equals(type) && storedPartition.getName().equals(name)) { return filePartition; } } throw MESSAGES.partitionNotFoundWithName(type, name); }
@Override protected void doPopulateProperties(Map<String, Serializable> properties) throws Exception { super.doPopulateProperties(properties); Partition partition = getEntry(); properties.put("name", partition.getName()); }
@Override protected void doPopulateProperties(Map<String, Serializable> properties) throws Exception { super.doPopulateProperties(properties); Partition partition = getEntry(); properties.put("name", partition.getName()); }
private FilePartition resolve(Class<? extends Partition> type, String name) throws IdentityManagementException { for (FilePartition filePartition : this.fileDataSource.getPartitions().values()) { Partition storedPartition = filePartition.getEntry(); if (storedPartition.getClass().equals(type) && storedPartition.getName().equals(name)) { return filePartition; } } throw MESSAGES.partitionNotFoundWithName(type, name); }
private Partition getStoredPartition(final Partition partition) { Partition storedPartition; if (getConfiguration().supportsPartition()) { storedPartition = getPartition(partition.getClass(), partition.getName()); } else { storedPartition = createDefaultPartition(); } if (storedPartition == null) { throw MESSAGES.partitionNotFoundWithName(partition.getClass(), partition.getName()); } return storedPartition; }
private Partition getStoredPartition(final Partition partition) { Partition storedPartition; if (getConfiguration().supportsPartition()) { storedPartition = getPartition(partition.getClass(), partition.getName()); } else { storedPartition = createDefaultPartition(); } if (storedPartition == null) { throw MESSAGES.partitionNotFoundWithName(partition.getClass(), partition.getName()); } return storedPartition; }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!getClass().isInstance(obj)) { return false; } Partition other = (Partition) obj; return (getId() != null && other.getId() != null && getId().equals(other.getId())) || (getName() != null && other.getName() != null && getName().equals(other.getName())); }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!getClass().isInstance(obj)) { return false; } Partition other = (Partition) obj; return (getId() != null && other.getId() != null && getId().equals(other.getId())) || (getName() != null && other.getName() != null && getName().equals(other.getName())); }
private void storeIdentityType(IdentityContext context, IdentityType identityType) { FilePartition filePartition = resolve(context.getPartition().getClass(), context.getPartition().getName()); Map<String, FileIdentityType> identityTypes = filePartition.getIdentityTypes().get(identityType.getClass().getName()); if (identityTypes == null) { identityTypes = new ConcurrentHashMap<String, FileIdentityType>(); filePartition.getIdentityTypes().put(identityType.getClass().getName(), identityTypes); } identityTypes.put(identityType.getId(), new FileIdentityType(identityType)); this.fileDataSource.flushAttributedTypes(filePartition); }
private void storeIdentityType(IdentityContext context, IdentityType identityType) { FilePartition filePartition = resolve(context.getPartition().getClass(), context.getPartition().getName()); Map<String, FileIdentityType> identityTypes = filePartition.getIdentityTypes().get(identityType.getClass().getName()); if (identityTypes == null) { identityTypes = new ConcurrentHashMap<String, FileIdentityType>(); filePartition.getIdentityTypes().put(identityType.getClass().getName(), identityTypes); } identityTypes.put(identityType.getId(), new FileIdentityType(identityType)); this.fileDataSource.flushAttributedTypes(filePartition); }
@Override public void remove(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); this.fileDataSource.getPartitions().remove(filePartition.getId()); this.fileDataSource.flushPartitions(); }
@Override public void remove(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); this.fileDataSource.getPartitions().remove(filePartition.getId()); this.fileDataSource.flushPartitions(); }
@Override protected void checkIfExists(Partition partition) throws IdentityManagementException { if (partition == null) { throw MESSAGES.nullArgument("Partition"); } if (lookupById(partition.getClass(), partition.getId()) == null) { throw MESSAGES.partitionNotFoundWithName(partition.getClass(), partition.getName()); } }
@Override protected void removeCredentials(IdentityContext context, Account account) { Partition partition = account.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, Map<String, List<FileCredentialStorage>>> credentials = filePartition.getCredentials(); credentials.remove(account.getId()); this.fileDataSource.flushCredentials(filePartition); }
@Override protected void removeCredentials(IdentityContext context, Account account) { Partition partition = account.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, Map<String, List<FileCredentialStorage>>> credentials = filePartition.getCredentials(); credentials.remove(account.getId()); this.fileDataSource.flushCredentials(filePartition); }
@Override public String getConfigurationName(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); if (isNullOrEmpty(filePartition.getConfigurationName())) { throw MESSAGES.partitionWithNoConfigurationName(partition); } return filePartition.getConfigurationName(); }
@Override public String getConfigurationName(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); if (isNullOrEmpty(filePartition.getConfigurationName())) { throw MESSAGES.partitionWithNoConfigurationName(partition); } return filePartition.getConfigurationName(); }
@Override public void update(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); this.fileDataSource.getPartitions().put(partition.getId(), new FilePartition(cloneAttributedType(identityContext, partition), filePartition.getConfigurationName())); this.fileDataSource.flushPartitions(); }