private Object resolveInPartition(ELContext context, Partition partition, String property) { Object value = null; if ("id".equals(property)) { context.setPropertyResolved(true); value = partition.getId(); } else if ("name".equals(property)) { context.setPropertyResolved(true); value = partition.getName(); } else if ("attributes".equals(property)) { context.setPropertyResolved(true); value = getAttributes(partition); } return value; }
/** * <p>Return a formatted string representing the reference to the given {@link org.picketlink.idm.model.IdentityType}.</p> * * @param identityType * * @return */ public static String formatId(final IdentityType identityType) { return identityType.getClass().getName() + ID_SEPARATOR + identityType.getPartition().getId() + ID_SEPARATOR + identityType.getId(); }
private Object resolveInPartition(ELContext context, Partition partition, String property) { Object value = null; if ("id".equals(property)) { context.setPropertyResolved(true); value = partition.getId(); } else if ("name".equals(property)) { context.setPropertyResolved(true); value = partition.getName(); } else if ("attributes".equals(property)) { context.setPropertyResolved(true); value = getAttributes(partition); } return value; }
private Object resolveInPartition(ELContext context, Partition partition, String property) { Object value = null; if ("id".equals(property)) { context.setPropertyResolved(true); value = partition.getId(); } else if ("name".equals(property)) { context.setPropertyResolved(true); value = partition.getName(); } else if ("attributes".equals(property)) { context.setPropertyResolved(true); value = getAttributes(partition); } return value; }
/** * <p>Return a formatted string representing the reference to the given {@link org.picketlink.idm.model.IdentityType}.</p> * * @param identityType * * @return */ public static String formatId(final IdentityType identityType) { return identityType.getClass().getName() + ID_SEPARATOR + identityType.getPartition().getId() + ID_SEPARATOR + identityType.getId(); }
@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 List<FileCredentialStorage> getCredentials(Account account, Class<? extends CredentialStorage> storageType) { Partition partition = account.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, List<FileCredentialStorage>> agentCredentials = filePartition.getCredentials().get(account.getId()); if (agentCredentials == null) { agentCredentials = new ConcurrentHashMap<String, List<FileCredentialStorage>>(); this.fileDataSource.getPartitions().get(partition.getId()).getCredentials().put(account.getId(), agentCredentials); } List<FileCredentialStorage> credentials = agentCredentials.get(storageType.getName()); if (credentials == null) { credentials = Collections.synchronizedList(new ArrayList<FileCredentialStorage>()); } agentCredentials.put(storageType.getName(), credentials); return credentials; }
private List<FileCredentialStorage> getCredentials(Account account, Class<? extends CredentialStorage> storageType) { Partition partition = account.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, List<FileCredentialStorage>> agentCredentials = filePartition.getCredentials().get(account.getId()); if (agentCredentials == null) { agentCredentials = new ConcurrentHashMap<String, List<FileCredentialStorage>>(); this.fileDataSource.getPartitions().get(partition.getId()).getCredentials().put(account.getId(), agentCredentials); } List<FileCredentialStorage> credentials = agentCredentials.get(storageType.getName()); if (credentials == null) { credentials = Collections.synchronizedList(new ArrayList<FileCredentialStorage>()); } agentCredentials.put(storageType.getName(), credentials); return credentials; }
@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 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 public String getConfigurationName(IdentityContext identityContext, Partition partition) { EntityMapper entityMapper = getRootMapper(partition.getClass()); EntityManager entityManager = getEntityManager(identityContext); Object partitionEntity = entityManager.find(entityMapper.getEntityType(), partition.getId()); Property configurationNameProperty = entityMapper.getProperty(partition.getClass(), ConfigurationName.class).getValue(); String configurationName = configurationNameProperty.getValue(partitionEntity).toString(); if (isNullOrEmpty(configurationName)) { throw MESSAGES.partitionWithNoConfigurationName(partition); } return configurationName; }
@Override public String getConfigurationName(IdentityContext identityContext, Partition partition) { EntityMapper entityMapper = getRootMapper(partition.getClass()); EntityManager entityManager = getEntityManager(identityContext); Object partitionEntity = entityManager.find(entityMapper.getEntityType(), partition.getId()); Property configurationNameProperty = entityMapper.getProperty(partition.getClass(), ConfigurationName.class).getValue(); String configurationName = configurationNameProperty.getValue(partitionEntity).toString(); if (isNullOrEmpty(configurationName)) { throw MESSAGES.partitionWithNoConfigurationName(partition); } return configurationName; }
@Override protected void doPopulateProperties(Map<String, Serializable> properties) throws Exception { super.doPopulateProperties(properties); IdentityType identityType = getEntry(); if (identityType.getPartition() == null) { throw new IllegalStateException("Partition Null"); } if (identityType.getPartition().getId() == null) { throw new IllegalStateException("Partition ID Null"); } properties.put("partitionId", identityType.getPartition().getId()); properties.put("partitionType", identityType.getPartition().getClass().getName()); properties.put("createdDate", identityType.getCreatedDate()); if (identityType.getExpirationDate() != null) { properties.put("expirationDate", identityType.getExpirationDate()); } properties.put("enabled", identityType.isEnabled()); } }
@Override protected void doPopulateProperties(Map<String, Serializable> properties) throws Exception { super.doPopulateProperties(properties); IdentityType identityType = getEntry(); if (identityType.getPartition() == null) { throw new IllegalStateException("Partition Null"); } if (identityType.getPartition().getId() == null) { throw new IllegalStateException("Partition ID Null"); } properties.put("partitionId", identityType.getPartition().getId()); properties.put("partitionType", identityType.getPartition().getClass().getName()); properties.put("createdDate", identityType.getCreatedDate()); if (identityType.getExpirationDate() != null) { properties.put("expirationDate", identityType.getExpirationDate()); } properties.put("enabled", identityType.isEnabled()); } }
@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(); }
@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(); }
preparedStatement.setTimestamp(4, null); preparedStatement.setString(5, role.getPartition().getId()); if (role.isEnabled()) { preparedStatement.setString(6, "y");
@Override public void add(IdentityContext identityContext, Partition partition, String configurationName) { PartitionJdbcType partitionJdbcType = new PartitionJdbcType(partition.getName()); partitionJdbcType.setDataSource(dataSource); if (partition.getId() == null) { if (partition instanceof Realm) { partitionJdbcType.setId(Realm.DEFAULT_REALM); } else { partitionJdbcType.setId(identityContext.getIdGenerator().generate()); } } partitionJdbcType.setConfigurationName(configurationName).setTypeName(partition.getClass().getName()); partitionJdbcType.persist(partitionJdbcType); }
@Override public void add(IdentityContext identityContext, Partition partition, String configurationName) { PartitionJdbcType partitionJdbcType = new PartitionJdbcType(partition.getName()); partitionJdbcType.setDataSource(dataSource); if (partition.getId() == null) { if (partition instanceof Realm) { partitionJdbcType.setId(Realm.DEFAULT_REALM); } else { partitionJdbcType.setId(identityContext.getIdGenerator().generate()); } } partitionJdbcType.setConfigurationName(configurationName).setTypeName(partition.getClass().getName()); partitionJdbcType.persist(partitionJdbcType); }