@Override protected void perfromSingleAction(AjaxRequestTarget target, ODocument object) { object.delete(); }
@Override public OVertexDocument delete() { deleteLinks(this); super.delete(); return this; }
@Override public OVertex delete() { deleteLinks(this); element.delete(); return this; }
public OEdgeDocument delete() { OEdgeDelegate.deleteLinks(this); super.delete(); return this; }
public OEdge delete() { deleteLinks(this); if (element != null) { element.delete(); } return this; }
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { super.onClick(targetOptional); rowModel.getObject().delete(); DataTable<?, ?> table = findParent(DataTable.class); if(table!=null && targetOptional.isPresent()) targetOptional.get().add(table); }
@Override public void remove() { graph.autoStartTransaction(); getRecord().delete(); }
public synchronized void dropFunction(OFunction function) { reloadIfNeeded(ODatabaseRecordThreadLocal.instance().get()); String name = function.getName(); ODocument doc = function.getDocument(); doc.delete(); functions.remove(name.toUpperCase(Locale.ENGLISH)); }
public synchronized void dropFunction(String iName) { reloadIfNeeded(ODatabaseRecordThreadLocal.instance().get()); OFunction function = getFunction(iName); ODocument doc = function.getDocument(); doc.delete(); functions.remove(iName.toUpperCase(Locale.ENGLISH)); }
/** * (Internal only) */ protected static void deleteEdgeIfAny(final OIdentifiable iRecord, boolean forceReload) { if (iRecord != null) { final ODocument doc = getDocument(iRecord, forceReload); if (doc != null) { final OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(doc); if (clazz != null && clazz.isEdgeType()) // DELETE THE EDGE RECORD TOO doc.delete(); } } }
@Override public void deleteByRelationType(IRelationType relationType) { // delete source reference pointing to relation type OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<>("select * from Relation where relationType = " + relationType.getId()); List<ODocument> result = db.command(query).execute(); // remove relation and link for (ODocument document : result) { ODocument relationLink = getRelationLink(document, true); if (relationLink != null && db.load(relationLink.getIdentity()) != null) relationLink.delete(); document.delete(); } }
@Override public void deleteByRelation(INode node) { // delete source reference pointing to relation node OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<>("select * from Relation where relationLink.in = " + node.getId() + " OR relationLink.out = " + node.getId()); List<ODocument> result = db.command(query).execute(); // remove relation and link for (ODocument document : result) { ODocument relationLink = getRelationLink(document, true); if (relationLink != null && db.load(relationLink.getIdentity()) != null) relationLink.delete(); document.delete(); } }
private static void deleteEdgeIfAny(final OIdentifiable iRecord) { if (iRecord != null) { final ODocument doc = iRecord.getRecord(); if (doc != null && doc.getSchemaClass() != null && doc.getSchemaClass().isSubClassOf(OrientEdge.CLASS_NAME)) // DELETE THE EDGE RECORD TOO doc.delete(); } }
@Override public Object call(Integer iArgument) { OLogManager.instance().debug(this, "Deleting scheduled event '%s' rid=%s...", event, event.getDocument().getIdentity()); event.getDocument().delete(); return null; } }, 10, 0, new ORecord[] { event.getDocument() });
/** * Removes any {@link BrowseNode}s associated with the given component id. */ public void deleteComponentNode(final ODatabaseDocumentTx db, final EntityId componentId) { // some formats have the same component appearing on different branches of the tree Iterable<ODocument> documents = db.command(new OCommandSQL(FIND_BY_COMPONENT)).execute( ImmutableMap.of(P_COMPONENT_ID, recordIdentity(componentId))); documents.forEach(document -> { if (document.containsField(P_ASSET_ID)) { // asset still exists, just remove component details document.removeField(P_COMPONENT_ID); document.save(); } else { document.delete(); } }); }
/** * delete record from database * @param entity to be deleted * @return true if deletion succeeded */ public boolean delete(@Nullable T entity) { if (entity == null) return true; try { initDb(); if (logger.isInfoEnabled()) logger.info("Deleting entity : " + entity.toString()); // delete connected edges, if there are any OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<>("select from E where in = " + entity.getId() + " OR out = " + entity.getId()); for (ODocument edge : (List<ODocument>) db.command(query).execute()) edge.delete(); // The following code renders an NPE //repositoryFactory.getDb().command(new OCommandSQL("delete edge where in = " + entity.getId() + " OR out = " + entity.getId())).execute(); return db.delete(new ORecordId(entity.getId())) != null; } catch (Exception e) { logger.warn("Could not delete entry (search engine entry deleted if applicable): " + entity.getId()); } return false; }
/** * Removes the {@link BrowseNode} associated with the given asset id. */ public void deleteAssetNode(final ODatabaseDocumentTx db, final EntityId assetId) { // a given asset will only appear once in the tree ODocument document = getFirst( db.command(new OCommandSQL(FIND_BY_ASSET)).execute( ImmutableMap.of(P_ASSET_ID, recordIdentity(assetId))), null); if (document != null) { if (document.containsField(P_COMPONENT_ID)) { // component still exists, just remove asset details document.removeField(P_ASSET_ID); document.removeField(P_ASSET_NAME_LOWERCASE); document.save(); } else { document.delete(); } } }
for(ODocument w : list){ System.out.println("Deleting: " + w); w.delete();
/** * Removes the Element from the Graph. In case the element is a Vertex, all the incoming and outgoing edges are automatically * removed too. */ void removeRecord() { checkIfAttached(); final OrientBaseGraph graph = getGraph(); graph.setCurrentGraphInThreadLocal(); graph.autoStartTransaction(); if (checkDeletedInTx()) graph.throwRecordNotFoundException(getIdentity(), "The graph element with id " + getIdentity() + " not found"); try { getRecord().load(); } catch (ORecordNotFoundException e) { graph.throwRecordNotFoundException(getIdentity(), e.getMessage()); } getRecord().delete(); }
@Test public void testODocumentLinksDataProvider() { ODocument doc1 = new ODocument("ClassA"); doc1.field("name", "doc1Ext"); doc1.save(); ODocument doc2 = new ODocument("ClassA"); doc2.field("name", "doc2Ext"); doc2.field("other", Arrays.asList(doc1)); try { ODocumentModel documentModel = new ODocumentModel(doc2); OPropertyModel propertyModel = new OPropertyModel("ClassA", "other"); ODocumentLinksDataProvider provider = new ODocumentLinksDataProvider(documentModel, propertyModel); assertEquals(1, provider.size()); assertEquals(doc1, provider.iterator(0, 1).next()); doc2.save(); provider.detach(); assertEquals(1, provider.size()); assertEquals(doc1, provider.iterator(0, 1).next()); } finally { doc1.delete(); doc2.delete(); } }