Search in sources :

Example 1 with NodeGroupChannelWindow

use of org.jumpmind.symmetric.model.NodeGroupChannelWindow in project symmetric-ds by JumpMind.

the class OutgoingBatchService method inTimeWindow.

/**
     * If {@link NodeGroupChannelWindow}s are defined for this channel, then
     * check to see if the time (according to the offset passed in) is within on
     * of the configured windows.
     */
public boolean inTimeWindow(List<NodeGroupChannelWindow> windows, String targetNodeId) {
    if (windows != null && windows.size() > 0) {
        for (NodeGroupChannelWindow window : windows) {
            String timezoneOffset = null;
            List<NodeHost> hosts = nodeService.findNodeHosts(targetNodeId);
            if (hosts.size() > 0) {
                timezoneOffset = hosts.get(0).getTimezoneOffset();
            } else {
                timezoneOffset = AppUtils.getTimezoneOffset();
            }
            if (window.inTimeWindow(timezoneOffset)) {
                return true;
            }
        }
        return false;
    } else {
        return true;
    }
}
Also used : NodeGroupChannelWindow(org.jumpmind.symmetric.model.NodeGroupChannelWindow) NodeHost(org.jumpmind.symmetric.model.NodeHost)

Aggregations

NodeGroupChannelWindow (org.jumpmind.symmetric.model.NodeGroupChannelWindow)1 NodeHost (org.jumpmind.symmetric.model.NodeHost)1