use of com.qcadoo.model.api.EntityList in project mes by qcadoo.
the class WorkPlansColumnFiller method fillProductNames.
private void fillProductNames(final Entity technology, final Map<Entity, Map<String, String>> valuesMap) {
EntityTree operationComponents = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS);
for (Entity operationComponent : operationComponents) {
EntityList operationProductInComponents = operationComponent.getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_IN_COMPONENTS);
EntityList operationProductOutComponents = operationComponent.getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS);
for (Entity operationProductInComponent : operationProductInComponents) {
initMap(valuesMap, operationProductInComponent);
valuesMap.get(operationProductInComponent).put(L_PRODUCT_NAME, getProductNameAndNumber(operationProductInComponent));
}
for (Entity operationProductOutComponent : operationProductOutComponents) {
initMap(valuesMap, operationProductOutComponent);
valuesMap.get(operationProductOutComponent).put(L_PRODUCT_NAME, getProductNameAndNumber(operationProductOutComponent));
}
}
}
use of com.qcadoo.model.api.EntityList in project mes by qcadoo.
the class WorkPlansColumnFiller method fillPlannedQuantities.
private void fillPlannedQuantities(final Entity technology, final OperationProductComponentWithQuantityContainer productQuantities, final Map<Entity, Map<String, String>> valuesMap) {
EntityTree operationComponents = technology.getTreeField(TechnologyFields.OPERATION_COMPONENTS);
for (Entity operationComponent : operationComponents) {
EntityList operationProductInComponents = operationComponent.getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_IN_COMPONENTS);
EntityList operationProductOutComponents = operationComponent.getHasManyField(TechnologyOperationComponentFields.OPERATION_PRODUCT_OUT_COMPONENTS);
for (Entity operationProductInComponent : operationProductInComponents) {
initMap(valuesMap, operationProductInComponent);
valuesMap.get(operationProductInComponent).put(L_PLANNED_QUANTITY, getProductQuantityAndUnit(operationProductInComponent, productQuantities));
}
for (Entity operationProductOutComponent : operationProductOutComponents) {
initMap(valuesMap, operationProductOutComponent);
valuesMap.get(operationProductOutComponent).put(L_PLANNED_QUANTITY, getProductQuantityAndUnit(operationProductOutComponent, productQuantities));
}
}
}
use of com.qcadoo.model.api.EntityList in project mes by qcadoo.
the class ShiftTest method init.
@Before
public final void init() {
MockitoAnnotations.initMocks(this);
given(shiftEntity.copy()).willReturn(shiftEntity);
EntityList emptyEntityList = mockEntityList(Lists.<Entity>newArrayList());
given(shiftEntity.getHasManyField(Mockito.anyString())).willReturn(emptyEntityList);
}
use of com.qcadoo.model.api.EntityList in project mes by qcadoo.
the class ShiftTest method mockEntityList.
private EntityList mockEntityList(final List<Entity> entities) {
EntityList entityList = mock(EntityList.class);
given(entityList.iterator()).willReturn(entities.iterator());
given(entityList.isEmpty()).willReturn(entities.isEmpty());
return entityList;
}
use of com.qcadoo.model.api.EntityList in project mes by qcadoo.
the class CatNumbersInDeliveriesServiceImplTest method mockEntityList.
private static EntityList mockEntityList(final List<Entity> entities) {
final EntityList entitiesList = mock(EntityList.class);
given(entitiesList.iterator()).willAnswer(new Answer<Iterator<Entity>>() {
@Override
public Iterator<Entity> answer(final InvocationOnMock invocation) throws Throwable {
return ImmutableList.copyOf(entities).iterator();
}
});
given(entitiesList.isEmpty()).willReturn(entities.isEmpty());
return entitiesList;
}
Aggregations