@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 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 Partition createDefaultPartition() { Partition storedPartition = new Realm(Realm.DEFAULT_REALM); storedPartition.setId(Realm.DEFAULT_REALM); return storedPartition; }
/** * <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(); }
/** * <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 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 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; }
@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; }
private Partition createDefaultPartition() { Partition storedPartition = new Realm(Realm.DEFAULT_REALM); storedPartition.setId(Realm.DEFAULT_REALM); return storedPartition; }
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 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; }
@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 IdentityType doPopulateEntry(Map<String, Serializable> properties) throws Exception { IdentityType identityType = super.doPopulateEntry(properties); String partitionType = properties.get("partitionType").toString(); String partitionId = properties.get("partitionId").toString(); Partition partition = (Partition) Class.forName(partitionType).getConstructor(new Class[]{String.class}).newInstance(""); partition.setId(partitionId); identityType.setPartition(partition); identityType.setCreatedDate((Date) properties.get("createdDate")); identityType.setExpirationDate((Date) properties.get("expirationDate")); identityType.setEnabled((Boolean) properties.get("enabled")); return identityType; }
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 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 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 IdentityType doPopulateEntry(Map<String, Serializable> properties) throws Exception { IdentityType identityType = super.doPopulateEntry(properties); String partitionType = properties.get("partitionType").toString(); String partitionId = properties.get("partitionId").toString(); Partition partition = (Partition) Class.forName(partitionType).getConstructor(new Class[]{String.class}).newInstance(""); partition.setId(partitionId); identityType.setPartition(partition); identityType.setCreatedDate((Date) properties.get("createdDate")); identityType.setExpirationDate((Date) properties.get("expirationDate")); identityType.setEnabled((Boolean) properties.get("enabled")); return identityType; }
@Override protected void doPopulateProperties(Map<String, Serializable> properties) throws Exception { super.doPopulateProperties(properties); Partition partition = getEntry(); properties.put("name", partition.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())); }
@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()); } }