Search in sources :

Example 11 with DefaultDatabaseObjectSerializer

use of com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer in project serverless by bluenimble.

the class GetOne2One method main.

public static void main(String[] args) throws DatabaseException {
    Database db = new DatabaseServer().get();
    DatabaseObject driver = db.get("Drivers", "5aa425145e67264b7858685a");
    DatabaseObject car = (DatabaseObject) driver.get("car");
    System.out.println(car.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
Also used : DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject)

Example 12 with DefaultDatabaseObjectSerializer

use of com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer in project serverless by bluenimble.

the class GetWithId method main.

public static void main(String[] args) throws DatabaseException {
    Database db = new DatabaseServer().get();
    DatabaseObject dbo = db.get("WithIds", 100);
    System.out.println("Object Id: " + dbo.getId());
    System.out.println(dbo.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
Also used : DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject)

Example 13 with DefaultDatabaseObjectSerializer

use of com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer in project serverless by bluenimble.

the class UpdateOne2One method main.

public static void main(String[] args) throws DatabaseException {
    Database db = new DatabaseServer().get();
    DatabaseObject employee = db.get("Employees", "5aa4192e5e6726413c7db45a");
    employee.set("address", "Never Found");
    DatabaseObject city = (DatabaseObject) employee.get("city");
    city.set("name", "Eldorado");
    employee.save();
    System.out.println(employee.toString());
    System.out.println();
    System.out.println("+===============================================================================+");
    System.out.println();
    System.out.println(employee.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
Also used : DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject)

Example 14 with DefaultDatabaseObjectSerializer

use of com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer in project serverless by bluenimble.

the class Load method main.

public static void main(String[] args) throws Exception {
    Database db = new DatabaseServer().get();
    DatabaseObject spa = db.create("SpaStreams");
    spa.load(Json.load(new File("tests/data-1.json")));
    spa.save();
    System.out.println(spa.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
Also used : DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject) File(java.io.File)

Example 15 with DefaultDatabaseObjectSerializer

use of com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer in project serverless by bluenimble.

the class UpdateOne2One method main.

public static void main(String[] args) throws DatabaseException {
    Database db = new DatabaseServer().get();
    DatabaseObject driver = db.get("Drivers", "722388b0-9a9a-459e-a583-d802653a60b0");
    driver.set("address", "Never Found");
    DatabaseObject car = (DatabaseObject) driver.get("car");
    car.set("model", "AlphaRomeo");
    driver.save();
    System.out.println();
    System.out.println("+===============================================================================+");
    System.out.println();
    System.out.println(driver.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
Also used : DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject)

Aggregations

Database (com.bluenimble.platform.db.Database)20 DatabaseObject (com.bluenimble.platform.db.DatabaseObject)20 DefaultDatabaseObjectSerializer (com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer)20 JsonObject (com.bluenimble.platform.json.JsonObject)11 JsonQuery (com.bluenimble.platform.db.query.impls.JsonQuery)10 ApiAccessDeniedException (com.bluenimble.platform.api.ApiAccessDeniedException)1 ApiServiceExecutionException (com.bluenimble.platform.api.ApiServiceExecutionException)1 ApiSpace (com.bluenimble.platform.api.ApiSpace)1 JsonApiOutput (com.bluenimble.platform.api.impls.JsonApiOutput)1 DatabaseException (com.bluenimble.platform.db.DatabaseException)1 JsonArray (com.bluenimble.platform.json.JsonArray)1 File (java.io.File)1