use of org.jowidgets.cap.common.api.bean.IBeanKey in project jo-client-platform by jo-source.
the class BeanTabFolderModelImpl method getParentBeanKeys.
private List<IBeanKey> getParentBeanKeys() {
if (parent == null) {
return null;
}
final IBeanSelection<Object> beanSelection = parent.getBeanSelection();
List<IBeanProxy<Object>> selection = beanSelection.getSelection();
if (EmptyCheck.isEmpty(selection)) {
return null;
} else if (linkType == LinkType.SELECTION_FIRST) {
selection = selection.subList(0, 1);
}
final List<IBeanKey> beanKeys = new LinkedList<IBeanKey>();
for (final IBeanProxy<Object> proxy : selection) {
if (proxy != null && !proxy.isDummy() && !proxy.isTransient()) {
beanKeys.add(new BeanKey(proxy.getId(), proxy.getVersion()));
}
}
return beanKeys;
}
use of org.jowidgets.cap.common.api.bean.IBeanKey in project jo-client-platform by jo-source.
the class BeanKeyFactoryImpl method createKeysFromDtos.
@Override
public List<IBeanKey> createKeysFromDtos(final Collection<? extends IBeanDto> beanDtos) {
Assert.paramNotNull(beanDtos, "beanDtos");
final List<IBeanKey> result = new LinkedList<IBeanKey>();
for (final IBeanDto dto : beanDtos) {
result.add(createKeyFromDto(dto));
}
return result;
}
use of org.jowidgets.cap.common.api.bean.IBeanKey in project jo-client-platform by jo-source.
the class UniqueConstraintCheckerImpl method checkCreation.
@Override
public void checkCreation(final Collection<? extends IBeanData> beansData, final IExecutionCallback executionCallback) {
final IFilter filter = createFilter(beansData);
final SyncResultCallback<Integer> resultCallback = new SyncResultCallback<Integer>();
final List<IBeanKey> parentBeanKeys = Collections.emptyList();
this.readerService.count(resultCallback, parentBeanKeys, filter, null, executionCallback);
final Integer result = resultCallback.getResultSynchronious();
if (result != null && result.intValue() > 0) {
throw new UniqueConstraintViolationException(propertyNames);
}
}
use of org.jowidgets.cap.common.api.bean.IBeanKey in project jo-client-platform by jo-source.
the class SyncExecutorServiceImpl method checkBeans.
private void checkBeans(final Collection<? extends IBeanKey> keys, final List<BEAN_TYPE> beans, final IExecutionCallback executionCallback) {
// put beans into map to access them faster at the next step
final Map<Object, BEAN_TYPE> beanMap = new HashMap<Object, BEAN_TYPE>();
for (final BEAN_TYPE bean : beans) {
beanMap.put(getId(bean), bean);
CapServiceToolkit.checkCanceled(executionCallback);
}
// check if beans are deleted or stale
for (final IBeanKey key : keys) {
final BEAN_TYPE bean = beanMap.get(key.getId());
if (!allowDeletedBeans && bean == null) {
throw new DeletedBeanException(key.getId());
} else {
if (!allowStaleBeans && key.getVersion() != getVersion(bean)) {
throw new StaleBeanException(key.getId());
}
}
CapServiceToolkit.checkCanceled(executionCallback);
}
}
use of org.jowidgets.cap.common.api.bean.IBeanKey in project jo-client-platform by jo-source.
the class LinkDeleterServiceImpl method deleteDirectLinks.
private void deleteDirectLinks(final Collection<? extends ILinkDeletion> linksDeletions, final IExecutionCallback executionCallback) {
for (final ILinkDeletion linkDeletion : linksDeletions) {
final IBeanKey destinationKey = linkDeletion.getDestinationKey();
resetDirectLink(sourceProperties, destinationKey, linkedBeanAccess, executionCallback);
}
}
Aggregations