private static View copyChildView( GroupByView groupView, String[] propertyNames, Object groupByValues, AgentInstanceViewFactoryChainContext agentInstanceContext, View originalChildView) { if (originalChildView instanceof MergeView) { String message = "Unexpected merge view as child of group-by view"; log.fatal(".copySubViews " + message); throw new EPException(message); } if (!(originalChildView instanceof CloneableView)) { throw new EPException( "Unexpected error copying subview " + originalChildView.getClass().getName()); } CloneableView cloneableView = (CloneableView) originalChildView; // Copy child node View copyChildView = cloneableView.cloneView(); copyChildView.setParent(groupView); // Make the sub views for child copying from the original to the child copySubViews( groupView.getCriteriaExpressions(), propertyNames, groupByValues, originalChildView, copyChildView, agentInstanceContext); return copyChildView; }