Skip to content
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 #12

Merged
merged 1 commit into from
Jul 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/ResourceService/Controller/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,19 @@ public function get(Application $app, Request $request, $id, $child)

/**
* Resource POST route controller. takes $id (valid UUID or empty) for the parent resource as first value to match
* takes 'rx' and/or 'checksum' as optional query arguments
* takes 'rx' as an optional query arguments
*
* @see https://wiki.duraspace.org/display/FEDORA4x/RESTful+HTTP+API (Create new resources within a LDP container)
*/
public function post(Application $app, Request $request, $id)
{
$tx = $request->query->get('tx', "");
$checksum = $request->query->get('checksum', "");
try {
$response = $app['api']->createResource(
$app->escape($id),
$request->getContent(),
$request->headers->all(),
$tx,
$checksum
$tx
);
} catch (\Exception $e) {
$app->abort(
Expand All @@ -69,21 +67,19 @@ public function post(Application $app, Request $request, $id)
/**
* Resource PUT route. takes $id (valid UUID or empty) for the resource to be update/created
* as first value to match, optional a Child resource relative path
* takes 'rx' and/or 'checksum' as optional query arguments
* takes 'rx' as an optional query arguments
*
* @see https://wiki.duraspace.org/display/FEDORA4x/RESTful+HTTP+API (Create a resource with a specified path...)
*/
public function put(Application $app, Request $request, $id, $child)
{
$tx = $request->query->get('tx', "");
$checksum = $request->query->get('checksum', "");
try {
$response = $app['api']->saveResource(
$app->escape($id) . '/' . $child,
$request->getContent(),
$request->headers->all(),
$tx,
$checksum
$tx
);
} catch (\Exception $e) {
$app->abort(503, '"Chullo says Fedora4 Repository is Not available"');
Expand Down Expand Up @@ -117,7 +113,7 @@ public function patch(Application $app, Request $request, $id, $child)

/**
* Resource DELETE route controller. takes $id (valid UUID) for the parent resource as first value to match
* takes 'rx' and/or 'checksum' as optional query arguments
* takes 'rx' as an optional query arguments
* @see https://wiki.duraspace.org/display/FEDORA40/RESTful+HTTP+API#RESTfulHTTPAPI-RedDELETEDeletearesource
* @todo check for transaction and create one if empty.
* @todo test with the force.
Expand Down