@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()); } }
/** * <p> * Disables an user. * </p> * * @throws Exception */ @Test public void testDisable() throws Exception { T enabledIdentityTypeInstance = getIdentityType(true); assertTrue(enabledIdentityTypeInstance.isEnabled()); enabledIdentityTypeInstance.setEnabled(false); updateIdentityType(enabledIdentityTypeInstance); T disabledIdentityTypeInstance = getIdentityType(false); assertFalse(disabledIdentityTypeInstance.isEnabled()); disabledIdentityTypeInstance.setEnabled(true); updateIdentityType(disabledIdentityTypeInstance); enabledIdentityTypeInstance = getIdentityType(false); assertTrue(enabledIdentityTypeInstance.isEnabled()); }
/** * <p> * Updated the common properties for a specific {@link IdentityType} instance from another instance. * </p> * * @param fromIdentityType * @param toIdentityType */ private void updateCommonProperties(IdentityType fromIdentityType, IdentityType toIdentityType) { toIdentityType.setEnabled(fromIdentityType.isEnabled()); toIdentityType.setCreatedDate(fromIdentityType.getCreatedDate()); toIdentityType.setExpirationDate(fromIdentityType.getExpirationDate()); for (Object object : toIdentityType.getAttributes().toArray()) { Attribute<? extends Serializable> attribute = (Attribute<? extends Serializable>) object; toIdentityType.removeAttribute(attribute.getName()); } for (Attribute<? extends Serializable> attrib : fromIdentityType.getAttributes()) { toIdentityType.setAttribute(attrib); } }
clonedIdentityType.setExpirationDate(identityType.getExpirationDate()); clonedIdentityType.setCreatedDate(identityType.getCreatedDate()); clonedIdentityType.setEnabled(identityType.isEnabled()); } else if (Relationship.class.isInstance(attributedType)) { Relationship relationship = (Relationship) attributedType;
clonedIdentityType.setExpirationDate(identityType.getExpirationDate()); clonedIdentityType.setCreatedDate(identityType.getCreatedDate()); clonedIdentityType.setEnabled(identityType.isEnabled()); } else if (Relationship.class.isInstance(attributedType)) { Relationship relationship = (Relationship) attributedType;
/** * <p> * Populates the given {@link Object} argument representing a Identity Class (from the config) with the information from the * specified {@link IdentityType}. * </p> * * @param toIdentity * @param fromIdentityType */ protected void populateIdentityInstance(Realm realm, Object toIdentity, T fromIdentityType, JPAIdentityStore store) { // populate the common properties from IdentityType String identityDiscriminator = store.getConfig().getIdentityDiscriminator(fromIdentityType.getClass()); store.setModelProperty(toIdentity, PROPERTY_IDENTITY_DISCRIMINATOR, identityDiscriminator, true); store.setModelProperty(toIdentity, PROPERTY_IDENTITY_KEY, fromIdentityType.getKey(), true); store.setModelProperty(toIdentity, PROPERTY_IDENTITY_ENABLED, fromIdentityType.isEnabled(), true); store.setModelProperty(toIdentity, PROPERTY_IDENTITY_CREATED, fromIdentityType.getCreatedDate(), true); store.setModelProperty(toIdentity, PROPERTY_IDENTITY_EXPIRES, fromIdentityType.getExpirationDate()); if (realm != null) { store.setModelProperty(toIdentity, PROPERTY_IDENTITY_PARTITION, store.lookupPartitionObject(realm)); } doPopulateIdentityInstance(toIdentity, fromIdentityType, store); }
if (!isQueryParameterEquals(identityQuery.getParameters(), IdentityType.ENABLED, storedIdentityType.isEnabled())) { continue;