src/Jaspersoft/Service/RepositoryService.php
public function copyResource($resourceUri, $destinationFolderUri, $createFolders = true, $overwrite = false)
    {
        $url = self::makeUrl(null, $destinationFolderUri);

        $url .= '?' . Util::query_suffix(array("createFolders" => $createFolders, "overwrite" => $overwrite));
        $response = $this->service->makeRequest($url, array(200), 'POST', null, true, 'application/json', 'application/json', array("Content-Location: " . $resourceUri));

        $data = $response['body'];
        $headers = $response['headers'];
        $content_type = array_values(preg_grep("#repository\.(.*)\+#", $headers));
        preg_match("#repository\.(.*)\+#", $content_type[0], $resource_type);

        $class = RESOURCE_NAMESPACE . '\\' . ucfirst($resource_type[1]);
        if (class_exists($class) && is_subclass_of($class, RESOURCE_NAMESPACE . '\\Resource')) {
            return $class::createFromJSON(json_decode($data, true), $class);
        } else {
            return Resource::createFromJSON(json_decode($data, true));
        }

    }
public function copyResource($resourceUri, $destinationFolderUri, $createFolders = true, $overwrite = false)
    {
        $url = self::makeUrl(null, $destinationFolderUri);

        $url .= '?' . Util::query_suffix(array("createFolders" => $createFolders, "overwrite" => $overwrite));
        $response = $this->service->makeRequest($url, array(200), 'POST', null, true, 'application/json', 'application/json', array("Content-Location: " . $resourceUri));

        $data = $response['body'];
        $headers = $response['headers'];
        $content_type = array_values(preg_grep("#repository\.(.*)\+#", $headers));
        preg_match("#repository\.(.*)\+#", $content_type[0], $resource_type);

        $class = RESOURCE_NAMESPACE . '\\' . ucfirst($resource_type[1]);
        if (class_exists($class) && is_subclass_of($class, RESOURCE_NAMESPACE . '\\Resource')) {
            return $class::createFromJSON(json_decode($data, true), $class);
        } else {
            return Resource::createFromJSON(json_decode($data, true));
        }

    }
public function copyResource ( $ resourceUri , $ destinationFolderUri , $ createFolders = true , $ overwrite = false ) { $ url = self :: makeUrl ( null , $ destinationFolderUri ) ; $ url .= '?' . Util :: query_suffix ( array ( "createFolders" => $ createFolders , "overwrite" => $ overwrite ) ) ; $ response = $ this -> service -> makeRequest ( $ url , array ( 200 ) , 'POST' , null , true , 'application/json' , 'application/json' , array ( "Content-Location: " . $ resourceUri ) ) ; $ data = $ response [ 'body' ] ; $ headers = $ response [ 'headers' ] ; $ content_type = array_values ( preg_grep ( "#repository\.(.*)\+#" , $ headers ) ) ; preg_match ( "#repository\.(.*)\+#" , $ content_type [ 0 ] , $ resource_type ) ; $ class = RESOURCE_NAMESPACE . '\\' . ucfirst ( $ resource_type [ 1 ] ) ; if ( class_exists ( $ class ) && is_subclass_of ( $ class , RESOURCE_NAMESPACE . '\\Resource' ) ) { return $ class :: createFromJSON ( json_decode ( $ data , true ) , $ class ) ; } else { return Resource :: createFromJSON ( json_decode ( $ data , true ) ) ; } }
Copy a resource from one location to another

@param string $resourceUri URI of resource to be copied
@param string $destinationFolderUri URI of folder the resource is to be copied to
@param boolean $createFolders Should folders be created if they do not already exist?
@param boolean $overwrite Should files be overwritten while performing this operation?
@return \Jaspersoft\Dto\Resource\Resource
Copy a resource from one location to another