use of org.jowidgets.cap.common.api.service.IUpdaterService in project jo-client-platform by jo-source.
the class JpaEntityService method createServicesProvider.
private <T extends IBean> IBeanServicesProvider createServicesProvider(final Class<? extends IBean> beanInterface, final Class<T> beanType, final IBeanDtoDescriptor descriptor) {
final IBeanServicesProviderBuilder builder = CapServiceToolkit.beanServicesProviderBuilder(SpringServiceProvider.getInstance(), IEntityService.ID, beanType, beanInterface);
final List<String> propertyNames = new LinkedList<String>();
for (final IProperty property : descriptor.getProperties()) {
propertyNames.add(property.getName());
}
final IJpaServiceFactory serviceFactory = JpaServiceToolkit.serviceFactory();
final TransactionProxyFactory tpf = new TransactionProxyFactory(transactionManager);
final ICreatorService creatorService = serviceFactory.creatorService(beanType, propertyNames);
builder.setCreatorService(tpf.createProxy(creatorService, "create"));
final IDeleterService deleterService = serviceFactory.deleterService(beanType);
builder.setDeleterService(tpf.createProxy(deleterService, "delete"));
// TODO: MvR -> Check genericity...
final ICriteriaQueryCreatorBuilder<Void> queryBuilder = JpaQueryToolkit.criteriaQueryCreatorBuilder(beanType);
if (ParentLinkHelper.hasParent(beanType)) {
queryBuilder.setParentPropertyName("parent");
}
final IReaderService<Void> readerService = serviceFactory.readerService(beanType, queryBuilder.build(), propertyNames);
builder.setReaderService(readerService);
final IBeanAccess<T> beanAccess = serviceFactory.beanAccess(beanType);
builder.setRefreshService(CapServiceToolkit.refreshServiceBuilder(beanAccess).setBeanDtoFactory(propertyNames).build());
final IUpdaterService updaterService = CapServiceToolkit.updaterServiceBuilder(beanAccess).setBeanDtoFactoryAndBeanModifier(propertyNames).build();
builder.setUpdaterService(tpf.createProxy(updaterService, "update"));
return builder.build();
}
use of org.jowidgets.cap.common.api.service.IUpdaterService in project jo-client-platform by jo-source.
the class UpdaterServiceBuilderImpl method build.
@Override
public IUpdaterService build() {
final IAdapterFactoryProvider afp = CapServiceToolkit.adapterFactoryProvider();
final IAdapterFactory<IUpdaterService, ISyncUpdaterService> adapterFactory = afp.updater();
return adapterFactory.createAdapter(buildSyncService());
}
Aggregations