@Override protected void _save() { final ODocument edge = getDocument(); final List<Property> propertyList = GraphDBPropertyUtils.listProperties(this.getClass()); GraphDB.serializeFiledsOfPojoToGraphDocument(propertyList, this, edge); if (outVertex != null) outVertex.save(); if (inVertex != null) inVertex.save(); edge.save(); GraphDB.serializeFiledsOfGraphDocumentToPojo(propertyList, edge, this); }
@SuppressWarnings("unchecked") public <T extends OUT> T getOutVertex() { if (outVertex != null) return (T) outVertex; final ODocument outDoc = getDocument().field(OGraphDatabase.EDGE_FIELD_OUT); if (outDoc == null) return null; outVertex = (T) GraphDB.documentToModel(outDoc); return (T) outVertex; }
@SuppressWarnings("unchecked") public <T extends IN> T getInVertex() { if (inVertex != null) return (T) inVertex; final ODocument inDoc = getDocument().field(OGraphDatabase.EDGE_FIELD_IN); if (inDoc == null) return null; inVertex = GraphDB.documentToModel(inDoc); return (T) inVertex; }
protected static OGraphDatabase db() { return GraphDB.open(); }