public void drop() { activateOnCurrentThread(); db.drop(); }
public long getDocumentCount(String docType) { activateOnCurrentThread(); return db.countClass(docType); }
public void close() { if (db != null) { activateOnCurrentThread(); db.close(); } DBUtil.closeDataStore(); }
private DocumentList query(String sql) { activateOnCurrentThread(); List<ODocument> results = db.query(new OSQLSynchQuery<ODocument>(sql)); return DocumentList.wrap(results.iterator()); }
private DocumentList query(String sql, Object... args) { activateOnCurrentThread(); List<ODocument> results = db.command(new OSQLSynchQuery<ODocument>(sql)).execute(args); return DocumentList.wrap(results.iterator()); }
private void executeCommand(String query, Object... args) { activateOnCurrentThread(); db.command(new OCommandSQL(query)).execute(args); }
/** * Get a document by sourceUri and update it from the given map. * @param incomingDocMap The document's db columns. * @return The saved document. * @throws IllegalArgumentException if sourceUri or docType are null, or if the document doesn't exist. */ public ODocument mergeDocument(Map<String, ? extends Object> incomingDocMap) { String sourceUri = (String) incomingDocMap.get(DocumentAttributes.SOURCE_URI.toString()); if (null == sourceUri) throw new IllegalArgumentException("Document sourceUri is null."); String docType = (String) incomingDocMap.get(Crawler.Attributes.TYPE); if (null == docType) throw new IllegalArgumentException("Document docType is null."); // Get a document by sourceUri String sql = "SELECT * FROM " + docType + " WHERE sourceuri=?"; activateOnCurrentThread(); List<ODocument> results = db.command(new OSQLSynchQuery<ODocument>(sql)).execute(sourceUri); if (results.size() == 0) throw new JBakeException("No document with sourceUri '"+sourceUri+"'."); // Update it from the given map. ODocument incomingDoc = new ODocument(docType); incomingDoc.fromMap(incomingDocMap); ODocument merged = results.get(0).merge(incomingDoc, true, false); return merged; }
public void drop() { activateOnCurrentThread(); db.drop(); }
public long getDocumentCount(String docType) { activateOnCurrentThread(); return db.countClass(docType); }
public void close() { if (db != null) { activateOnCurrentThread(); db.close(); } DBUtil.closeDataStore(); }
private DocumentList query(String sql) { activateOnCurrentThread(); List<ODocument> results = db.query(new OSQLSynchQuery<ODocument>(sql)); return DocumentList.wrap(results.iterator()); }
private DocumentList query(String sql, Object... args) { activateOnCurrentThread(); List<ODocument> results = db.command(new OSQLSynchQuery<ODocument>(sql)).execute(args); return DocumentList.wrap(results.iterator()); }
private void executeCommand(String query, Object... args) { activateOnCurrentThread(); db.command(new OCommandSQL(query)).execute(args); }
/** * Get a document by sourceUri and update it from the given map. * @param incomingDocMap The document's db columns. * @return The saved document. * @throws IllegalArgumentException if sourceUri or docType are null, or if the document doesn't exist. */ public ODocument mergeDocument(Map<String, ? extends Object> incomingDocMap) { String sourceUri = (String) incomingDocMap.get(DocumentAttributes.SOURCE_URI.toString()); if (null == sourceUri) throw new IllegalArgumentException("Document sourceUri is null."); String docType = (String) incomingDocMap.get(Crawler.Attributes.TYPE); if (null == docType) throw new IllegalArgumentException("Document docType is null."); // Get a document by sourceUri String sql = "SELECT * FROM " + docType + " WHERE sourceuri=?"; activateOnCurrentThread(); List<ODocument> results = db.command(new OSQLSynchQuery<ODocument>(sql)).execute(sourceUri); if (results.size() == 0) throw new JBakeException("No document with sourceUri '"+sourceUri+"'."); // Update it from the given map. ODocument incomingDoc = new ODocument(docType); incomingDoc.fromMap(incomingDocMap); ODocument merged = results.get(0).merge(incomingDoc, true, false); return merged; }