Node siteNode = SiteUtil.getSiteStructure(this.manager, getSourceDocument())
.getRepositoryNode();
nodes.add(siteNode);
Clipboard clipboard = new ClipboardHelper().getClipboard(getContext());
DocumentIdentityMap map = getDocumentIdentityMap();
Publication pub = getSourceDocument().getPublication();
String area = getSourceDocument().getArea();
Document clippedDocument = clipboard.getDocument(map);
Document targetDocument = getTargetDocument();
String clippedName = clippedDocument.getName();
String clippedId = clippedDocument.getId();
String clippedBase = clippedId.substring(0, clippedId.length() - clippedName.length());
String targetBase = getSourceDocument().getId() + "/";
DocumentSet subsite = SiteUtil.getSubSite(this.manager, clippedDocument);
Document[] subsiteDocs = subsite.getDocuments();
for (int i = 0; i < subsiteDocs.length; i++) {
if (clipboard.getMethod() == Clipboard.METHOD_CUT) {
nodes.addAll(Arrays.asList(subsiteDocs[i].getRepositoryNodes()));
}
String id = subsiteDocs[i].getId().substring(clippedBase.length());
Document targetSubsiteDoc = map.get(pub, area, targetBase + id, subsiteDocs[i].getLanguage());
nodes.addAll(Arrays.asList(targetSubsiteDoc.getRepositoryNodes()));
}
} catch (Exception e) {
throw new UsecaseException(e);