use of org.jowidgets.cap.common.api.bean.IBeanData in project jo-client-platform by jo-source.
the class BeanListSaveDelegate method create.
private void create(final Runnable finishedCallback) {
final Set<IBeanProxy<BEAN_TYPE>> beansToCreate = beansStateTracker.getBeansToCreate();
if (!EmptyCheck.isEmpty(beansToCreate)) {
if (creatorService == null) {
throw new IllegalStateException("No creator service set. Could not create transient beans");
}
final BeanListExecutionHelper<BEAN_TYPE> executionHelper = new BeanListExecutionHelper<BEAN_TYPE>(CREATION_FAILED.get(), listModel, beansToCreate, beanExecutionPolicy, exceptionConverter, true, fireBeansChanged);
final List<List<IBeanProxy<BEAN_TYPE>>> preparedExecutions = executionHelper.prepareExecutions(true, executionContext);
final CountDownRunnable countDownRunnable = new CountDownRunnable(finishedCallback, preparedExecutions.size());
for (final List<IBeanProxy<BEAN_TYPE>> preparedBeans : preparedExecutions) {
if (preparedBeans.size() > 0) {
final IExecutionTask executionTask = preparedBeans.get(0).getExecutionTask();
if (executionTask != null) {
executionTask.setDescription(CREATE.get());
final List<IBeanData> beansData = new LinkedList<IBeanData>();
for (final IBeanProxy<BEAN_TYPE> bean : preparedBeans) {
beansData.add(createBeanData(bean));
}
final IResultCallback<List<IBeanDto>> helperCallback = executionHelper.createResultCallback(preparedBeans, countDownRunnable);
creatorService.create(helperCallback, parentBeansProvider.get(), beansData, executionTask);
}
}
}
} else {
finishedCallback.run();
}
}
Aggregations