use of com.qcadoo.model.api.EntityTree in project qcadoo by qcadoo.
the class DetachedEntityTreeImplTest method shouldThrowExceptionWhenTryingToGetSearchCriteria.
@Test(expected = UnsupportedOperationException.class)
public final void shouldThrowExceptionWhenTryingToGetSearchCriteria() throws Exception {
// given
Entity entity1 = mock(Entity.class);
Entity entity2 = mock(Entity.class);
Entity entity3 = mock(Entity.class);
when(entity1.getId()).thenReturn(1L);
when(entity2.getId()).thenReturn(2L);
when(entity3.getId()).thenReturn(3L);
when(entity1.getField("parent")).thenReturn(null);
when(entity2.getField("parent")).thenReturn(1L);
when(entity3.getField("parent")).thenReturn(2L);
when(entity1.getBelongsToField("parent")).thenReturn(null);
when(entity2.getBelongsToField("parent")).thenReturn(entity1);
when(entity3.getBelongsToField("parent")).thenReturn(entity2);
EntityTree tree = new DetachedEntityTreeImpl(Lists.newArrayList(entity1, entity2, entity3));
// when
tree.find();
}
use of com.qcadoo.model.api.EntityTree in project qcadoo by qcadoo.
the class TreeNumberingServiceImpl method generateNumbersAndUpdateTree.
@Override
public final void generateNumbersAndUpdateTree(final DataDefinition dd, final String joinFieldName, final Long belongsToEntityId) {
EntityTree tree = new EntityTreeImpl(dd, joinFieldName, belongsToEntityId);
generateNumbersAndUpdateTree(tree);
}
Aggregations