copy(sourceRoot,targetParent,targetName);
}
protected void copy(Feed source,Feed parent,String name)
{
XMLRepresentationParser parser = new XMLRepresentationParser();
try {
// get the feed document without the entries
Document feedDoc = parser.load(app.getStorage().getFeedHead(source.getPath(), source.getUUID()));
// Create the feed. The ID will be changed since the feed exits
Feed newFeed = app.createFeed(parent.getPath()+name, feedDoc);
// copy the entries
Iterator<Entry> entries = source.getEntries();
while (entries.hasNext()) {
Entry entry = entries.next();
Document entryDoc = parser.load(app.getEntryRepresentation("", entry));
Iterator<EntryMedia> mediaResources = entry.getResources();
if (mediaResources.hasNext()) {
// we have a media entry and so copy the media
EntryMedia media = mediaResources.next();
Representation mediaRep = app.getStorage().getMedia(source.getPath(), source.getUUID(), media.getName());