use of org.jowidgets.cap.common.api.bean.IBeanDto in project jo-client-platform by jo-source.
the class LinkCreatorServiceImpl method createSyncImpl.
private List<IBeanDto> createSyncImpl(final Collection<? extends ILinkCreation> links, final IExecutionCallback executionCallback) {
final Set<IBeanDto> result = new LinkedHashSet<IBeanDto>();
for (final ILinkCreation link : links) {
CapServiceToolkit.checkCanceled(executionCallback);
result.addAll(createLinks(link, executionCallback));
}
return new LinkedList<IBeanDto>(result);
}
use of org.jowidgets.cap.common.api.bean.IBeanDto in project jo-client-platform by jo-source.
the class LinkCreatorServiceImpl method createDirectLinks.
private List<IBeanDto> createDirectLinks(final ILinkCreation link, final IExecutionCallback executionCallback) {
final List<IBeanDto> result = new LinkedList<IBeanDto>();
final List<IBeanDto> sourceBeans = createSourceBeans(link, executionCallback);
final List<IBeanDto> linkedBeans = createDirectLinkedBeans(sourceBeans, link, executionCallback);
if (EmptyCheck.isEmpty(linkedBeans)) {
// no linked beans, so create links from additional properties
for (final IBeanDto sourceBean : sourceBeans) {
result.add(createLink(sourceBean, null, link.getAdditionalLinkProperties(), executionCallback));
}
} else {
// direct link with linked beans
result.addAll(linkedBeans);
}
return result;
}
use of org.jowidgets.cap.common.api.bean.IBeanDto in project jo-client-platform by jo-source.
the class LinkCreatorServiceImpl method createStandardLinks.
private List<IBeanDto> createStandardLinks(final ILinkCreation link, final IExecutionCallback executionCallback) {
final List<IBeanDto> result = new LinkedList<IBeanDto>();
final List<IBeanDto> sourceBeans = createSourceBeans(link, executionCallback);
final List<IBeanDto> linkedBeans = createLinkedBeans(link, executionCallback);
for (final IBeanDto sourceBean : sourceBeans) {
for (final IBeanDto linkedBean : linkedBeans) {
result.add(createLink(sourceBean, linkedBean, link.getAdditionalLinkProperties(), executionCallback));
}
}
return result;
}
use of org.jowidgets.cap.common.api.bean.IBeanDto in project jo-client-platform by jo-source.
the class LinkCreatorServiceImpl method createDirectLinkSourceBeans.
private List<IBeanDto> createDirectLinkSourceBeans(final List<IBeanDto> linkedBeans, final ILinkCreation link, final IExecutionCallback executionCallback) {
if (linkedBeans.size() == 1) {
final IBeanDto linkedBean = linkedBeans.iterator().next();
final List<IBeanDto> result = getBeans(linkedBean, destinationProperties, link.getSourceBeans(), sourceBeanAccess, sourceDtoFactory, executionCallback);
result.addAll(createInverseDirectLinkBeans(linkedBean, link.getTransientSourceBeans(), sourceCreatorService, executionCallback));
return result;
} else {
throw new IllegalArgumentException("A inverse direct link must have exactly one linked bean!");
}
}
use of org.jowidgets.cap.common.api.bean.IBeanDto in project jo-client-platform by jo-source.
the class AbstractSimpleBeanReader method read.
@Override
public final List<BEAN_TYPE> read(final List<? extends IBeanKey> parentBeans, final IFilter filter, final List<? extends ISort> sortedProperties, final int firstRow, final int maxRows, final PARAM_TYPE parameter, final IExecutionCallback executionCallback) {
final IFilter decoratedFilter = getDecoratedFilter(filter);
if (decoratedFilter == null && (sortedProperties == null || sortedProperties.size() == 0)) {
return getBeans(parentBeans, parameter, firstRow, maxRows, executionCallback);
} else {
final List<BEAN_TYPE> beans = getBeans(parentBeans, parameter, firstRow, maxRows, executionCallback);
ArrayList<IBeanDto> result = createBeanDtos(beans, executionCallback);
if (decoratedFilter != null) {
result = CapServiceToolkit.beanDtoCollectionFilter().filter(result, decoratedFilter, executionCallback);
}
if (sortedProperties != null && sortedProperties.size() > 0) {
result = collectionSorter.sort(result, sortedProperties, executionCallback);
}
if (result.size() >= firstRow) {
return createBeansSubList(result, firstRow, Math.min(firstRow + maxRows, result.size()), executionCallback);
} else {
return Collections.emptyList();
}
}
}
Aggregations