Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
70b9a8f3
Commit
70b9a8f3
authored
Jul 18, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gidstorage get attachment method added
parent
0d42a75e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
src/jio.storage/gidstorage.js
src/jio.storage/gidstorage.js
+50
-0
No files found.
src/jio.storage/gidstorage.js
View file @
70b9a8f3
...
...
@@ -420,6 +420,56 @@
});
};
/**
* Gets an attachment from a document thank to its gid, a sub allDocs and a
* complex query.
*
* @method getAttachment
* @param {Command} command The JIO command
*/
that
.
getAttachment
=
function
(
command
)
{
setTimeout
(
function
()
{
var
gid_object
,
complex_query
,
doc
=
command
.
cloneDoc
();
gid_object
=
gidParse
(
doc
.
_id
,
priv
.
constraints
);
if
(
gid_object
===
undefined
)
{
return
that
.
error
({
"
status
"
:
400
,
"
statusText
"
:
"
Bad Request
"
,
"
error
"
:
"
bad_request
"
,
"
message
"
:
"
Cannot get attachment
"
,
"
reason
"
:
"
metadata should respect constraints
"
});
}
complex_query
=
gidToComplexQuery
(
gid_object
);
that
.
addJob
(
'
allDocs
'
,
priv
.
sub_storage
,
{},
{
"
query
"
:
complex_query
,
"
wildcard_character
"
:
null
},
function
(
response
)
{
if
(
response
.
total_rows
===
0
)
{
return
that
.
error
({
"
status
"
:
404
,
"
statusText
"
:
"
Not Found
"
,
"
error
"
:
"
not_found
"
,
"
message
"
:
"
Cannot get attachment
"
,
"
reason
"
:
"
Document already exist
"
});
}
gid_object
=
doc
.
_id
;
doc
.
_id
=
response
.
rows
[
0
].
id
;
that
.
addJob
(
'
getAttachment
'
,
priv
.
sub_storage
,
doc
,
{
},
function
(
response
)
{
that
.
success
(
response
);
},
function
(
err
)
{
err
.
message
=
"
Cannot put attachment
"
;
that
.
error
(
err
);
});
},
function
(
err
)
{
err
.
message
=
"
Cannot put attachment
"
;
that
.
error
(
err
);
});
});
};
/**
* Remove a document thank to its gid, sub allDocs and a complex query.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment