database.getMetadata().getSchema().save();
}
private void populateDatabase() {
ODocument car = new ODocument(database, CAR);
car.field("plate", "JINF223S");
ODocument johnDoe = new ODocument(database, WORKER);
johnDoe.field("name", "John");
johnDoe.field("surname", "Doe");
johnDoe.field("car", car);
johnDoe.save();
johnDoeID = johnDoe.getIdentity().copy();
ODocument janeDoe = new ODocument(database, WORKER);
janeDoe.field("name", "Jane");
janeDoe.field("surname", "Doe");
janeDoe.save();
janeDoeID = janeDoe.getIdentity().copy();
ODocument chuckNorris = new ODocument(database, WORKER);
chuckNorris.field("name", "Chuck");
chuckNorris.field("surname", "Norris");
chuckNorris.save();
chuckNorrisID = chuckNorris.getIdentity().copy();
ODocument jackBauer = new ODocument(database, WORKER);
jackBauer.field("name", "Jack");
jackBauer.field("surname", "Bauer");
jackBauer.save();
jackBauerID = jackBauer.getIdentity().copy();
ODocument ctu = new ODocument(database, WORKPLACE);
ctu.field("name", "CTU");
ctu.field("boss", jackBauer);
List<ODocument> workplace1Workers = new ArrayList<ODocument>();
workplace1Workers.add(chuckNorris);
workplace1Workers.add(janeDoe);
ctu.field("workers", workplace1Workers);
ctu.save();
ctuID = ctu.getIdentity().copy();
ODocument fbi = new ODocument(database, WORKPLACE);
fbi.field("name", "FBI");
fbi.field("boss", chuckNorris);
List<ODocument> workplace2Workers = new ArrayList<ODocument>();
workplace2Workers.add(chuckNorris);
workplace2Workers.add(jackBauer);
fbi.field("workers", workplace2Workers);
fbi.save();
fbiID = fbi.getIdentity().copy();
car.field("owner", jackBauer);
car.save();
carID = car.getIdentity().copy();
}