Search in sources :

Example 1 with ProxyEntity

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));
}
Also used : Entity(com.qcadoo.model.api.Entity) ProxyEntity(com.qcadoo.model.internal.ProxyEntity) ProxyEntity(com.qcadoo.model.internal.ProxyEntity)

Example 2 with ProxyEntity

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);
}
Also used : Entity(com.qcadoo.model.api.Entity) ProxyEntity(com.qcadoo.model.internal.ProxyEntity) BelongsToType(com.qcadoo.model.api.types.BelongsToType) ProxyEntity(com.qcadoo.model.internal.ProxyEntity) DataDefinition(com.qcadoo.model.api.DataDefinition)

Aggregations

Entity (com.qcadoo.model.api.Entity)2 ProxyEntity (com.qcadoo.model.internal.ProxyEntity)2 DataDefinition (com.qcadoo.model.api.DataDefinition)1 BelongsToType (com.qcadoo.model.api.types.BelongsToType)1