@Override public void add(IdentityContext identityContext, Partition partition, String configurationName) { add(identityContext, partition); // now that the partition entity is created, let`s populate the configuration name. // the configuration name is not part of the Model API, so we need to do this manually. EntityMapper entityMapper = getRootMapper(partition.getClass()); EntityManager entityManager = getEntityManager(identityContext); Object partitionEntity = getRootEntity(partition, entityManager); Property configurationNameProperty = entityMapper.getProperty(partition.getClass(), ConfigurationName.class).getValue(); configurationNameProperty.setValue(partitionEntity, configurationName); entityManager.merge(partitionEntity); }
@Override public void add(IdentityContext identityContext, Partition partition, String configurationName) { add(identityContext, partition); // now that the partition entity is created, let`s populate the configuration name. // the configuration name is not part of the Model API, so we need to do this manually. EntityMapper entityMapper = getRootMapper(partition.getClass()); EntityManager entityManager = getEntityManager(identityContext); Object partitionEntity = getRootEntity(partition, entityManager); Property configurationNameProperty = entityMapper.getProperty(partition.getClass(), ConfigurationName.class).getValue(); configurationNameProperty.setValue(partitionEntity, configurationName); entityManager.merge(partitionEntity); }
@Override protected void doPopulateIdentityInstance(Object toIdentity, Group fromGroup, JPAIdentityStore store) { store.setModelProperty(toIdentity, PROPERTY_IDENTITY_NAME, fromGroup.getName(), true); if (fromGroup.getParentGroup() != null) { Object parentIdentity = store.lookupIdentityObjectById(fromGroup.getParentGroup()); if (parentIdentity == null) { store.add(fromGroup.getParentGroup()); parentIdentity = store.lookupIdentityObjectById(fromGroup.getParentGroup()); } store.setModelProperty(toIdentity, PROPERTY_PARENT_GROUP, parentIdentity, true); } }