-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from danrot/versioning
Use VersionHandler and adapt tests
- Loading branch information
Showing
6 changed files
with
179 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
namespace Jackalope\Transport\DoctrineDBAL; | ||
|
||
use Jackalope\Version\GenericVersioningInterface; | ||
use Jackalope\Version\VersionHandler; | ||
use PHPCR\LoginException; | ||
use PHPCR\NodeType\NodeDefinitionInterface; | ||
use PHPCR\NodeType\NodeTypeExistsException; | ||
|
@@ -24,6 +26,7 @@ | |
use PHPCR\Query\InvalidQueryException; | ||
use PHPCR\NodeType\ConstraintViolationException; | ||
|
||
use PHPCR\UnsupportedRepositoryOperationException; | ||
use PHPCR\Util\QOM\Sql2ToQomQueryConverter; | ||
use PHPCR\Util\ValueConverter; | ||
use PHPCR\Util\UUIDHelper; | ||
|
@@ -52,6 +55,7 @@ | |
use Jackalope\FactoryInterface; | ||
use Jackalope\NotImplementedException; | ||
use Jackalope\NodeType\NodeProcessor; | ||
use PHPCR\Version\VersionException; | ||
|
||
/** | ||
* Class to handle the communication between Jackalope and RDBMS via Doctrine DBAL. | ||
|
@@ -62,7 +66,7 @@ | |
* @author Benjamin Eberlei <[email protected]> | ||
* @author Lukas Kahwe Smith <[email protected]> | ||
*/ | ||
class Client extends BaseTransport implements QueryTransport, WritingInterface, WorkspaceManagementInterface, NodeTypeManagementInterface, TransactionInterface | ||
class Client extends BaseTransport implements QueryTransport, WritingInterface, WorkspaceManagementInterface, NodeTypeManagementInterface, TransactionInterface, GenericVersioningInterface | ||
{ | ||
/** | ||
* SQlite can only handle a maximum of 999 parameters inside an IN statement | ||
|
@@ -177,6 +181,11 @@ class Client extends BaseTransport implements QueryTransport, WritingInterface, | |
*/ | ||
private $nodeProcessor; | ||
|
||
/** | ||
* @var VersionHandler | ||
*/ | ||
private $versionHandler; | ||
|
||
/** | ||
* @param FactoryInterface $factory | ||
* @param Connection $conn | ||
|
@@ -1902,7 +1911,8 @@ private function getNodeProcessor() | |
$this->nodeProcessor = new NodeProcessor( | ||
$this->credentials->getUserID(), | ||
$this->getNamespacesObject(), | ||
$this->getAutoLastModified() | ||
$this->getAutoLastModified(), | ||
$this->versionHandler | ||
); | ||
|
||
return $this->nodeProcessor; | ||
|
@@ -2539,8 +2549,12 @@ public function rollbackSave() | |
public function updateProperties(Node $node) | ||
{ | ||
$this->assertLoggedIn(); | ||
// we can ignore the operations returned, there will be no additions because of property updates | ||
$this->getNodeProcessor()->process($node); | ||
|
||
$additionalAddOperations = $this->getNodeProcessor()->process($node); | ||
|
||
if (!empty($additionalAddOperations)) { | ||
$this->storeNodes($additionalAddOperations); | ||
} | ||
|
||
$this->syncNode($node->getIdentifier(), $node->getPath(), $node->getPrimaryNodeType(), false, $node->getProperties()); | ||
|
||
|
@@ -2568,4 +2582,49 @@ private function initConnection() | |
|
||
$this->connectionInitialized = true; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function checkinItem($path) | ||
{ | ||
return $this->versionHandler->checkinItem($path); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function checkoutItem($path) | ||
{ | ||
return $this->versionHandler->checkoutItem($path); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function restoreItem($removeExisting, $versionPath, $path) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function removeVersion($versionPath, $versionName) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
/** | ||
* Sets the generic version handler delivered by jackalope | ||
* @param VersionHandler $versionHandler | ||
*/ | ||
public function setVersionHandler(VersionHandler $versionHandler) | ||
{ | ||
if ($this->versionHandler) { | ||
throw new \InvalidArgumentException('Version handler is already set'); | ||
} | ||
|
||
$this->versionHandler = $versionHandler; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<sv:node jcr="http://www.jcp.org/jcr/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:rep="internal" sv:name="jcr:system"> | ||
<sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
<sv:value>nt:unstructured</sv:value> | ||
</sv:property> | ||
<sv:node sv:name="jcr:versionStorage"> | ||
<sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
<sv:value>nt:unstructured</sv:value> | ||
</sv:property> | ||
</sv:node> | ||
</sv:node> |