private OrientGraphFactory factory;
public void initialize() {
factory = new OrientGraphFactory(builder.toString(), USERNAME, PASSWORD);
ODatabaseRecordThreadLocal.INSTANCE.set(factory.getDatabase());
}
private Vertex getClientVertex(OrientGraph graph, String guid) {
}
public void writeDocument(String filename, Date dateCreated, String category, String guid, byte[] contents, int pageCount, String description, String code, String fiscalYear, boolean
taxAdministratorsCopy, boolean clientsCopy, boolean archivesCopy, boolean processed) {
OrientGraph graph = factory.getTx();try {Vertex clientVertex = getClientVertex(graph, guid);OrientVertex documentVertex = graph.addVertex("class:Document");documentVertex.setProperty(FILENAME_PARAMETER, filename);documentVertex.setProperty(GUID_PARAMETER, guid);documentVertex.setProperty(CREATION_DATE_PARAMETER, dateCreated);if(description != null) {documentVertex.setProperty(DESCRIPTION_PARAMETER, description);}documentVertex.setProperty(NUM_PAGES_PARAMETER, pageCount);documentVertex.setProperty(FISCAL_YEAR_PARAMETER, fiscalYear);if(category != null) {documentVertex.setProperty(CATEGORY_PARAMETER, category);}if(code != null) {documentVertex.setProperty(CODE_PARAMETER, code);}documentVertex.setProperty(TAX_ADMINISTRATOR_COPY_PARAMETER, taxAdministratorsCopy);documentVertex.setProperty(CLIENT_COPY_PARAMETER, clientsCopy);documentVertex.setProperty(ARCHIVE_COPY_PARAMETER, archivesCopy);documentVertex.setProperty(PROCESSED_PARAMETER, processed);ORecordBytes record = new ORecordBytes(contents);record.save();documentVertex.setProperty(CONTENT_PARAMETER, record.getIdentity());Object id = documentVertex.getId();documentVertex = graph.getVertex(id);graph.addEdge("class:E", clientVertex, documentVertex, OWNS_EDGE);
// Thumbnail generation code...
OrientVertex thumbnailVertex = graph.addVertex("class:Thumbnail");ORecordBytes thumbnailRecord = new ORecordBytes(thumbnail);thumbnailRecord.save();thumbnailVertex.setProperty(CONTENT_PARAMETER, thumbnailRecord.getIdentity());Object thumbnailId = thumbnailVertex.getId();thumbnailVertex = graph.getVertex(thumbnailId);graph.addEdge("class:E", documentVertex, thumbnailVertex, RENDITION_EDGE);}catch(Exception e) {e.printStackTrace();}graph.shutdown();}
--
---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Orient Technologies
The Company behind OrientDB
StringBuilder builder = new StringBuilder();
builder.append("SELECT COUNT(*) FROM ");
builder.append(DOCUMENT_CLASS);
builder.append(" WHERE guid='");
builder.append(guid);
builder.append("' AND fiscalyear='");
builder.append(taxYear);
builder.append("'");
List<ODocument> resultList = factory.getDatabase().command(new OCommandSQL(builder.toString())).execute();
StringBuilder builder = new StringBuilder();
builder.append("SELECT COUNT(*) FROM ");
builder.append(DOCUMENT_CLASS);
builder.append(" WHERE guid='");
builder.append(guid);
builder.append("' AND fiscalyear='");
builder.append(taxYear);
builder.append("' AND category LIKE '%");
builder.append(categories[i]);
builder.append("%'");
List<ODocument> resultList = factory.getDatabase().command(new OCommandSQL(builder.toString())).execute();
Orient Technologies
The Company behind OrientDB
Orient Technologies
The Company behind OrientDB
Orient Technologies
The Company behind OrientDB
...
Orient Technologies
The Company behind OrientDB