Search in sources :

Example 1 with ILinkDeletion

use of org.jowidgets.cap.common.api.link.ILinkDeletion 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);
    }
}
Also used : IBeanKey(org.jowidgets.cap.common.api.bean.IBeanKey) ILinkDeletion(org.jowidgets.cap.common.api.link.ILinkDeletion)

Example 2 with ILinkDeletion

use of org.jowidgets.cap.common.api.link.ILinkDeletion in project jo-client-platform by jo-source.

the class LinkDeleterServiceImpl method deleteInverseDirectLinks.

private void deleteInverseDirectLinks(final Collection<? extends ILinkDeletion> linksDeletions, final IExecutionCallback executionCallback) {
    for (final ILinkDeletion linkDeletion : linksDeletions) {
        final IBeanKey sourceKey = linkDeletion.getSourceKey();
        resetDirectLink(destinationProperties, sourceKey, sourceBeanAccess, executionCallback);
    }
}
Also used : IBeanKey(org.jowidgets.cap.common.api.bean.IBeanKey) ILinkDeletion(org.jowidgets.cap.common.api.link.ILinkDeletion)

Example 3 with ILinkDeletion

use of org.jowidgets.cap.common.api.link.ILinkDeletion in project jo-client-platform by jo-source.

the class LinkDeleterServiceImpl method deleteStandardLinks.

private void deleteStandardLinks(final Collection<? extends ILinkDeletion> linksDeletions, final IExecutionCallback executionCallback) {
    final List<IBeanKey> sourceKeys = new LinkedList<IBeanKey>();
    final List<IBeanKey> destinationKeys = new LinkedList<IBeanKey>();
    final IFilterFactory filterFactory = CapCommonToolkit.filterFactory();
    final IBooleanFilterBuilder linkReaderFilterBuilder = filterFactory.booleanFilterBuilder();
    linkReaderFilterBuilder.setOperator(BooleanOperator.OR);
    for (final ILinkDeletion linkDeletion : linksDeletions) {
        final IBeanKey sourceKey = linkDeletion.getSourceKey();
        final IBeanKey destinationKey = linkDeletion.getDestinationKey();
        if (linkDeletion.deleteSource()) {
            sourceKeys.add(sourceKey);
        }
        if (linkDeletion.deleteDestination()) {
            destinationKeys.add(destinationKey);
        }
        linkReaderFilterBuilder.addFilter(createLinkFilter(sourceKey, destinationKey));
        if (symmetric) {
            linkReaderFilterBuilder.addFilter(createLinkFilter(destinationKey, sourceKey));
        }
    }
    if (!linkReaderFilterBuilder.isEmpty()) {
        deleteLinks(linkReaderFilterBuilder.build(), linksDeletions.size() * 10, executionCallback);
    }
    deleteKeys(destinationKeys, linkedDeleterService, executionCallback);
    deleteKeys(sourceKeys, sourceDeleterService, executionCallback);
}
Also used : IBooleanFilterBuilder(org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder) IBeanKey(org.jowidgets.cap.common.api.bean.IBeanKey) IFilterFactory(org.jowidgets.cap.common.api.filter.IFilterFactory) ILinkDeletion(org.jowidgets.cap.common.api.link.ILinkDeletion) LinkedList(java.util.LinkedList)

Aggregations

IBeanKey (org.jowidgets.cap.common.api.bean.IBeanKey)3 ILinkDeletion (org.jowidgets.cap.common.api.link.ILinkDeletion)3 LinkedList (java.util.LinkedList)1 IBooleanFilterBuilder (org.jowidgets.cap.common.api.filter.IBooleanFilterBuilder)1 IFilterFactory (org.jowidgets.cap.common.api.filter.IFilterFactory)1