Search in sources :

Example 51 with EntityTree

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();
}
Also used : Entity(com.qcadoo.model.api.Entity) EntityTree(com.qcadoo.model.api.EntityTree) Test(org.junit.Test)

Example 52 with EntityTree

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

Aggregations

EntityTree (com.qcadoo.model.api.EntityTree)52 Entity (com.qcadoo.model.api.Entity)44 Test (org.junit.Test)14 DataDefinition (com.qcadoo.model.api.DataDefinition)10 FormComponent (com.qcadoo.view.api.components.FormComponent)10 BigDecimal (java.math.BigDecimal)8 Map (java.util.Map)7 EntityList (com.qcadoo.model.api.EntityList)6 List (java.util.List)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 Service (org.springframework.stereotype.Service)6 EntityTreeNode (com.qcadoo.model.api.EntityTreeNode)5 WindowComponent (com.qcadoo.view.api.components.WindowComponent)4 Set (java.util.Set)4 Sets (com.google.common.collect.Sets)3 ProductQuantitiesService (com.qcadoo.mes.technologies.ProductQuantitiesService)3 Date (java.util.Date)3 Locale (java.util.Locale)3 Lists (com.google.common.collect.Lists)2 Maps (com.google.common.collect.Maps)2