case CLUSTER:
return entity;
case FEED:
Feed feed = (Feed) entity.copy();
Cluster feedCluster = FeedHelper.getCluster(feed, clusterName);
Iterator<Cluster> itr = feed.getClusters().getClusters().iterator();
while (itr.hasNext()) {
Cluster cluster = itr.next();
//In addition to retaining the required clster, retain the sources clusters if this is the target
// cluster
//1. Retain cluster if cluster n
if (!(cluster.getName().equals(clusterName)
|| (feedCluster.getType() == ClusterType.TARGET
&& cluster.getType() == ClusterType.SOURCE))) {
itr.remove();
}
}
return (T) feed;
case PROCESS:
Process process = (Process) entity.copy();
Iterator<org.apache.falcon.entity.v0.process.Cluster> procItr =
process.getClusters().getClusters().iterator();
while (procItr.hasNext()) {
org.apache.falcon.entity.v0.process.Cluster cluster = procItr.next();
if (!cluster.getName().equals(clusterName)) {
procItr.remove();
}
}
return (T) process;
default: