def copy(source_repository_name, target_repository_name, query = {})
target_properties = properties(target_repository_name)
query[:fields] ||= properties(source_repository_name).select do |property|
target_properties.include?(property)
end
repository(target_repository_name) do |repository|
resources = []
all(query.merge(:repository => source_repository_name)).each do |resource|
new_resource = new
query[:fields].each { |property| new_resource.__send__("#{property.name}=", property.get(resource)) }
resources << new_resource if new_resource.save
end
all(Query.target_query(repository, self, resources))
end
end