/** * Licensed to JumpMind Inc under one or more contributor * license agreements. See the NOTICE file distributed * with this work for additional information regarding * copyright ownership. JumpMind Inc licenses this file * to you under the GNU General Public License, version 3.0 (GPLv3) * (the "License"); you may not use this file except in compliance * with the License. * * You should have received a copy of the GNU General Public License, * version 3.0 (GPLv3) along with this library; if not, see * <http://www.gnu.org/licenses/>. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.jumpmind.symmetric.model; import java.io.Serializable; import java.util.Date; /** * A composite parent for {@link Channel} and {@link NodeChannelControl} */ public class NodeChannel implements Serializable { private static final long serialVersionUID = 1L; private Channel channel; private NodeChannelControl nodeChannelControl; public NodeChannel() { channel = new Channel(); nodeChannelControl = new NodeChannelControl(); } public NodeChannel(String channelId) { channel = new Channel(); nodeChannelControl = new NodeChannelControl(); nodeChannelControl.setChannelId(channelId); channel.setChannelId(channelId); } public String getChannelId() { return channel.getChannelId(); } public int getMaxBatchSize() { return channel.getMaxBatchSize(); } public void setMaxBatchSize(int maxBatchSize) { channel.setMaxBatchSize(maxBatchSize); } public int getMaxBatchToSend() { return channel.getMaxBatchToSend(); } public void setMaxBatchToSend(int maxBatchToSend) { channel.setMaxBatchToSend(maxBatchToSend); } public void setMaxDataToRoute(int maxDataToRoute) { channel.setMaxDataToRoute(maxDataToRoute); } public int getMaxDataToRoute() { return channel.getMaxDataToRoute(); } public void setUseOldDataToRoute(boolean useOldDataToRoute) { channel.setUseOldDataToRoute(useOldDataToRoute); } public boolean isUseOldDataToRoute() { return channel.isUseOldDataToRoute(); } public void setUseRowDataToRoute(boolean useRowDataToRoute) { channel.setUseRowDataToRoute(useRowDataToRoute); } public boolean isUseRowDataToRoute() { return channel.isUseRowDataToRoute(); } public void setUsePkDataToRoute(boolean usePkDataToRoute) { channel.setUsePkDataToRoute(usePkDataToRoute); } public boolean isUsePkDataToRoute() { return channel.isUsePkDataToRoute(); } public int getProcessingOrder() { return channel.getProcessingOrder(); } public String getBatchAlgorithm() { return channel.getBatchAlgorithm(); } public void setBatchAlgorithm(String batchAlgorithm) { channel.setBatchAlgorithm(batchAlgorithm); } public void setEnabled(boolean enabled) { channel.setEnabled(enabled); } public boolean isEnabled() { return channel.isEnabled(); } public boolean isSuspendEnabled() { return nodeChannelControl.isSuspendEnabled(); } public boolean isIgnoreEnabled() { return nodeChannelControl.isIgnoreEnabled(); } public String getNodeId() { return nodeChannelControl.getNodeId(); } public void setNodeId(String nodeId) { nodeChannelControl.setNodeId(nodeId); } public void setLastExtractTime(Date lastExtractedTime) { nodeChannelControl.setLastExtractTime(lastExtractedTime); } public Date getLastExtractTime() { return nodeChannelControl.getLastExtractTime(); } public void setIgnoreEnabled(boolean ignored) { nodeChannelControl.setIgnoreEnabled(ignored); } public void setProcessingOrder(int priority) { channel.setProcessingOrder(priority); } public void setChannelId(String id) { channel.setChannelId(id); nodeChannelControl.setChannelId(id); } public void setLastUpdateTime(Date date) { channel.setLastUpdateTime(date); } public void setCreateTime(Date date) { channel.setCreateTime(date); } public void setLastUpdateBy(String lastUpdateBy) { channel.setLastUpdateBy(lastUpdateBy); } public void setSuspendEnabled(boolean suspended) { nodeChannelControl.setSuspendEnabled(suspended); } public Channel getChannel() { return channel; } public NodeChannelControl getNodeChannelControl() { return nodeChannelControl; } public long getExtractPeriodMillis() { return channel.getExtractPeriodMillis(); } public void setExtractPeriodMillis(long extractPeriodMillis) { channel.setExtractPeriodMillis(extractPeriodMillis); } public void setContainsBigLob(boolean containsBigLobs) { this.channel.setContainsBigLob(containsBigLobs); } public boolean isContainsBigLob() { return this.channel.isContainsBigLob(); } public void setDataLoaderType(String type) { channel.setDataLoaderType(type); } public String getDataLoaderType() { return channel.getDataLoaderType(); } public void setReloadFlag(boolean value) { this.channel.setReloadFlag(value); } public boolean isReloadFlag() { return this.channel.isReloadFlag(); } public void setFileSyncFlag(boolean value) { this.channel.setFileSyncFlag(value); } public boolean isFileSyncFlag() { return this.channel.isFileSyncFlag(); } public Date getCreateTime() { return this.channel.getCreateTime(); } public String getLastUpdateBy() { return this.channel.getLastUpdateBy(); } public Date getLastUpdateTime() { return this.channel.getLastUpdateTime(); } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((getNodeId() == null) ? 0 : getNodeId().hashCode()); result = prime * result + ((getChannelId() == null) ? 0 : getChannelId().hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; NodeChannel other = (NodeChannel) obj; if (getNodeId() == null) { if (other.getNodeId() != null) { return false; } } else if (!getNodeId().equals(other.getNodeId())) { return false; } if (getChannelId() == null) { if (other.getChannelId() != null) { return false; } } else if (!getChannelId().equals(other.getChannelId())) { return false; } return true; } @Override public String toString() { return getNodeId() + " : " + getChannelId(); } }