public class FlatsyFlatFileDatabase extends Object implements FlatsyDatabase
| Constructor and Description |
|---|
FlatsyFlatFileDatabase(Path root) |
| Modifier and Type | Method and Description |
|---|---|
List<FlatsyObject> |
children(FlatsyObject object)
Gets a list of objects that belong to a specified parent node
In filesystem terms the folder contents
|
void |
create(FlatsyObject object,
InputStream content) |
void |
create(FlatsyObject object,
String content) |
void |
delete(FlatsyObject object)
Delete an object from the system
|
FlatsyObject |
get(String uri) |
void |
move(FlatsyObject object,
String newUri)
Update an object uri and all child objects
|
Map<String,String> |
moveMap(FlatsyObject object,
String newUri)
Get the mapping that would move an object and all subfiles to a new uri
|
FlatsyObject |
parent(FlatsyObject object)
Gets the parent node of the object
Note that the parent of root is null
|
String |
retrieve(FlatsyObject object)
Retrieves the string contents for the FlatsyObject database object
Suitable for deserialising objects from JSON
|
<T> Object |
retrieveAs(FlatsyObject object,
Class<T> tClass)
Deserialise the object as a specific class
|
InputStream |
retrieveStream(FlatsyObject object)
Writes the content of the object to an OutputStream.
|
FlatsyObject |
root() |
String |
toString() |
FlatsyObjectType |
type(String uri)
The FlatsyObjectType of an object
|
void |
update(FlatsyObject object,
FlatsyOperator update)
Update the object using a FlatsyOperator
|
public FlatsyFlatFileDatabase(Path root)
public FlatsyObject root()
root in interface FlatsyDatabasepublic FlatsyObject get(String uri)
get in interface FlatsyDatabasepublic void create(FlatsyObject object, String content)
create in interface FlatsyDatabasepublic void create(FlatsyObject object, InputStream content) throws IOException
create in interface FlatsyDatabaseIOExceptionpublic String retrieve(FlatsyObject object)
FlatsyDatabaseretrieve in interface FlatsyDatabaseobject - a FlatsyObject with valid URIpublic InputStream retrieveStream(FlatsyObject object) throws IOException
FlatsyDatabaseretrieveStream in interface FlatsyDatabaseobject - a FlatsyObject with valid URIIOException - if the object cannot be openedpublic <T> Object retrieveAs(FlatsyObject object, Class<T> tClass)
FlatsyDatabaseretrieveAs in interface FlatsyDatabaseT - genericobject - a Flatsy ObjecttClass - the class to deserialise the object aspublic void update(FlatsyObject object, FlatsyOperator update)
FlatsyDatabaseupdate in interface FlatsyDatabaseobject - a FlatsyObject to updateupdate - the Operator to applypublic void delete(FlatsyObject object)
FlatsyDatabasedelete in interface FlatsyDatabaseobject - the objectpublic List<FlatsyObject> children(FlatsyObject object)
FlatsyDatabasechildren in interface FlatsyDatabaseobject - giving the base uripublic FlatsyObject parent(FlatsyObject object)
FlatsyDatabaseparent in interface FlatsyDatabaseobject - an objectpublic void move(FlatsyObject object, String newUri)
move in interface FlatsyDatabaseobject - an object to movenewUri - a new uri to move it topublic Map<String,String> moveMap(FlatsyObject object, String newUri)
moveMap in interface FlatsyDatabaseobject - an object that is going to be movednewUri - the uri it will be moved topublic FlatsyObjectType type(String uri)
FlatsyDatabasetype in interface FlatsyDatabaseuri - the id of the objectCopyright © 2015. All rights reserved.