use of com.qcadoo.model.internal.ProxyEntity in project qcadoo by qcadoo.
the class ManyToManyIntegrationTest method checkProxyCollection.
private void checkProxyCollection(final Collection<Entity> proxyEntitiesSet, final List<Entity> entitiesList) {
Set<Entity> loadedEntities = Sets.newHashSet();
for (Entity proxyEntity : proxyEntitiesSet) {
assertTrue(proxyEntity instanceof ProxyEntity);
assertTrue(proxyEntity.isValid());
loadedEntities.add(fromDb(proxyEntity));
}
assertEquals(entitiesList.size(), loadedEntities.size());
assertTrue(loadedEntities.containsAll(entitiesList));
}
use of com.qcadoo.model.internal.ProxyEntity in project qcadoo by qcadoo.
the class AwesomeDynamicListModelUtilsImpl method proxyBelongsToField.
private void proxyBelongsToField(final FieldDefinition fieldDefinition, final Entity entity) {
Long belongsToEntityId = getBelongsToEntityId(entity.getField(fieldDefinition.getName()));
if (belongsToEntityId == null) {
return;
}
DataDefinition belongsToDataDefinition = ((BelongsToType) fieldDefinition.getType()).getDataDefinition();
Entity belongsToEntity = new ProxyEntity(belongsToDataDefinition, belongsToEntityId);
entity.setField(fieldDefinition.getName(), belongsToEntity);
}
Aggregations