Search in sources :

Example 16 with DefaultDatabaseObjectSerializer

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

the class FindOne method main.

public static void main(String[] args) throws DatabaseException {
    Database db = new DatabaseServer().get();
    DatabaseObject city = db.findOne("Cities", new JsonQuery(new JsonObject()));
    System.out.println(city.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
}
Also used : JsonQuery(com.bluenimble.platform.db.query.impls.JsonQuery) DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject) JsonObject(com.bluenimble.platform.json.JsonObject)

Example 17 with DefaultDatabaseObjectSerializer

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

the class Get method main.

public static void main(String[] args) throws DatabaseException {
    Database db = new DatabaseServer().get();
    DatabaseObject employee = db.get("Employees", "3e6b5afe-166d-46cd-b6a9-66ec0bb581d4");
    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 18 with DefaultDatabaseObjectSerializer

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

the class FindAllWithCount method main.

public static void main(String[] args) throws Exception {
    String query = "{ count: 1 }";
    Database db = new DatabaseServer().get();
    List<DatabaseObject> employees = db.find("Employees", new JsonQuery(new JsonObject(query)), null);
    for (DatabaseObject employee : employees) {
        System.out.println(employee.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
    }
}
Also used : JsonQuery(com.bluenimble.platform.db.query.impls.JsonQuery) DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject) JsonObject(com.bluenimble.platform.json.JsonObject)

Example 19 with DefaultDatabaseObjectSerializer

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

the class FindAllWithSelect method main.

public static void main(String[] args) throws Exception {
    String query = "{ select: [name], orderBy: { name: asc } }";
    Database db = new DatabaseServer().get();
    List<DatabaseObject> employees = db.find("Employees", new JsonQuery(new JsonObject(query)), null);
    for (DatabaseObject employee : employees) {
        System.out.println(employee.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
    }
}
Also used : JsonQuery(com.bluenimble.platform.db.query.impls.JsonQuery) DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject) JsonObject(com.bluenimble.platform.json.JsonObject)

Example 20 with DefaultDatabaseObjectSerializer

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

the class FindAllWithSort method main.

public static void main(String[] args) throws Exception {
    String query = "{ orderBy: { name: asc } }";
    Database db = new DatabaseServer().get();
    List<DatabaseObject> employees = db.find("Employees", new JsonQuery(new JsonObject(query)), null);
    for (DatabaseObject employee : employees) {
        System.out.println(employee.toJson(new DefaultDatabaseObjectSerializer(2, 2)));
    }
}
Also used : JsonQuery(com.bluenimble.platform.db.query.impls.JsonQuery) DefaultDatabaseObjectSerializer(com.bluenimble.platform.db.impls.DefaultDatabaseObjectSerializer) Database(com.bluenimble.platform.db.Database) DatabaseObject(com.bluenimble.platform.db.DatabaseObject) JsonObject(com.bluenimble.platform.json.JsonObject)

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