Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F996113
resource-representation.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
resource-representation.js
View Options
/**
* Represents a particular resource in database. Constructed by database entry.
* @class
* @param {object} database_entry
*/
function
ResourceRepresentation
(
database_entry
)
{
this
.
database_entry
=
database_entry
;
}
ResourceRepresentation
.
prototype
=
new
function
(){
/**
* Returns an object representing the resource, ready to be output for the public, e.g. as JSON
* @alias Resource#getData
* @return {object}
*/
this
.
getData
=
function
(){
var
data
=
this
.
database_entry
.
body
||
{};
data
.
owner_id
=
this
.
database_entry
.
owner
;
data
.
id
=
this
.
database_entry
.
sealious_id
;
data
.
access_mode
=
this
.
database_entry
.
access_mode
;
data
.
type
=
this
.
database_entry
.
type
;
return
data
;
}
/**
* Encodes Resource's data into JSON
* @alias Resource#toString
* @return {string} contains the json-encoded data
*/
this
.
toString
=
function
(){
return
JSON
.
stringify
(
this
.
getData
());
}
/**
access_mode are not used in current version of Sealious, this code should be removed
*/
this
.
get_access_mode
=
function
(){
return
this
.
database_entry
.
access_mode
;
}
}
module
.
exports
=
ResourceRepresentation
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 10:45 (1 d, 3 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
556419
Default Alt Text
resource-representation.js (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment