-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address https://github.com/Islandora-CLAW/CLAW/issues/302 ; Query Par… #51
Merged
Merged
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
de1c49c
Address https://github.com/Islandora-CLAW/CLAW/issues/302 ; Query Par…
ruebot 2e8b0f7
Code review
ruebot 54318bc
Please review. Hopefully this is not a hot mess!!!
ruebot ec7b848
Code review
ruebot 9171593
Code review
ruebot 3c46ffc
coding standards
ruebot 6fe77e5
Merge branch 'master' of github.com:Islandora-CLAW/chullo into issue-302
ruebot e672893
code review
ruebot 7ab6b4a
code review
ruebot 88f8c08
More code review from @diegopino and @whikloj
ruebot 15107b9
s/resource/transaction/
ruebot e9a47c7
stop overthinking tests
ruebot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,11 +153,12 @@ public function getGraph( | |
/** | ||
* Creates a new resource in Fedora. | ||
* | ||
* @param string $uri Resource URI | ||
* @param string $content String or binary content | ||
* @param array $headers HTTP Headers | ||
* @param string $transaction Transaction id | ||
* @param string $checksum SHA-1 checksum | ||
* @param string $uri Resource URI | ||
* @param string $content String or binary content | ||
* @param array $headers HTTP Headers | ||
* @param string $transaction Transaction id | ||
* @param string $checksum_algorithm Checksum algorithm | ||
* @param string $checksum_value Checksum value | ||
* | ||
* @return string Uri of newly created resource or null if failed | ||
*/ | ||
|
@@ -166,14 +167,16 @@ public function createResource( | |
$content = null, | ||
$headers = [], | ||
$transaction = "", | ||
$checksum = "" | ||
$checksum_value = "", | ||
$checksum_algorithm = "sha1" | ||
) { | ||
$response = $this->api->createResource( | ||
$uri, | ||
$content, | ||
$headers, | ||
$transaction, | ||
$checksum | ||
$checksum_value, | ||
$checksum_algorithm | ||
); | ||
|
||
if ($response->getStatusCode() != 201) { | ||
|
@@ -188,11 +191,12 @@ public function createResource( | |
/** | ||
* Saves a resource in Fedora. | ||
* | ||
* @param string $uri Resource URI | ||
* @param string $content String or binary content | ||
* @param array $headers HTTP Headers | ||
* @param string $transaction Transaction id | ||
* @param string $checksum SHA-1 checksum | ||
* @param string $uri Resource URI | ||
* @param string $content String or binary content | ||
* @param array $headers HTTP Headers | ||
* @param string $transaction Transaction id | ||
* @param string $checksum_algorithm Checksum algorithm | ||
* @param string $checksum_value Checksum value | ||
* | ||
* @return boolean True if successful | ||
*/ | ||
|
@@ -201,14 +205,16 @@ public function saveResource( | |
$content = null, | ||
$headers = [], | ||
$transaction = "", | ||
$checksum = "" | ||
$checksum_value = "", | ||
$checksum_algorithm = "sha1" | ||
) { | ||
$response = $this->api->saveResource( | ||
$uri, | ||
$content, | ||
$headers, | ||
$transaction, | ||
$checksum | ||
$checksum_value, | ||
$checksum_algorithm | ||
); | ||
|
||
return $response->getStatusCode() == 204; | ||
|
@@ -226,21 +232,23 @@ public function saveResource( | |
public function saveGraph( | ||
$uri, | ||
\EasyRdf_Graph $graph, | ||
$checksum_algorithm = "", | ||
$transaction = "" | ||
) { | ||
// Serialze the rdf. | ||
$turtle = $graph->serialise('turtle'); | ||
|
||
// Checksum it. | ||
$checksum = sha1($turtle); | ||
$checksum_value = sha1($turtle); | ||
|
||
// Save it. | ||
return $this->saveResource( | ||
$uri, | ||
$turtle, | ||
['Content-Type' => 'text/turtle'], | ||
$transaction, | ||
$checksum | ||
$checksum_value, | ||
$checksum_algorithm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You also don't need this line, it will default to "sha1" which is what you are using. |
||
); | ||
} | ||
|
||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need this line.