if (resource.isMultiInstance()) {
AbstractMultiInstanceResource multiResource = (AbstractMultiInstanceResource) resource;
Map<String, ResourceInstance> instancesMap = multiResource.getInstances();
Iterator<ResourceInstance> iter = instancesMap.values().iterator();
while (iter.hasNext()) {
ResourceInstance resourceInstance = iter.next();
String path = folder + resourceInstance.getFileName();
//System.out.println("source " + path);
InputStream is = this.getStorageManager().getStream(path, true);
if (is != null) {
String pathDest = folderDest + resourceInstance.getFileName();
//System.out.println("destination " + pathDest);
this.getStorageManager().saveFile(pathDest, isProtected, is);
}
}
} else {
AbstractMonoInstanceResource monoResource = (AbstractMonoInstanceResource) resource;
ResourceInstance resourceInstance = monoResource.getInstance();
String path = folder + resourceInstance.getFileName();
//System.out.println("source " + path);
InputStream is = this.getStorageManager().getStream(path, true);
if (null != is) {
String pathDest = folderDest + resourceInstance.getFileName();
//System.out.println("destination " + pathDest);
this.getStorageManager().saveFile(pathDest, isProtected, is);
}
}
this.getResourceDAO().addResource(resource);