graphdb/src/main/java/com/orientechnologies/orient/graph/sql/OCommandExecutorSQLDeleteVertex.java
public Object execute(final Map<Object, Object> iArgs) {
    if (rid == null && query == null)
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");

    if (!returning.equalsIgnoreCase("COUNT"))
      allDeletedRecords = new ArrayList<ORecord>();

    txAlreadyBegun = getDatabase().getTransaction().isActive();

    if (rid != null) {
      // REMOVE PUNCTUAL RID
      OGraphCommandExecutorSQLFactory.runInConfiguredTxMode(new OGraphCommandExecutorSQLFactory.GraphCallBack<Object>() {
        @Override
        public Object call(OrientBaseGraph graph) {
          final OrientVertex v = graph.getVertex(rid);
          if (v != null) {
            v.remove();
            removed = 1;
          }
          return null;
        }
      });

      // CLOSE PENDING TX
      end();

    } else if (query != null) {
      // TARGET IS A CLASS + OPTIONAL CONDITION
      OGraphCommandExecutorSQLFactory.runInConfiguredTxMode(new OGraphCommandExecutorSQLFactory.GraphCallBack<OrientGraph>() {

        @Override
        public OrientGraph call(final OrientBaseGraph iGraph) {
          // TARGET IS A CLASS + OPTIONAL CONDITION
          currentGraph.set(iGraph);
          query.setContext(getContext());
          query.execute(iArgs);
          return null;
        }

      });

    } else
      throw new OCommandExecutionException("Invalid target");

    if (returning.equalsIgnoreCase("COUNT"))
      // RETURNS ONLY THE COUNT
      return removed;
    else
      // RETURNS ALL THE DELETED RECORDS
      return allDeletedRecords;
  }
public Object execute(final Map<Object, Object> iArgs) {
    if (rid == null && query == null)
      throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet");

    if (!returning.equalsIgnoreCase("COUNT"))
      allDeletedRecords = new ArrayList<ORecord>();

    txAlreadyBegun = getDatabase().getTransaction().isActive();

    if (rid != null) {
      // REMOVE PUNCTUAL RID
      OGraphCommandExecutorSQLFactory.runInConfiguredTxMode(new OGraphCommandExecutorSQLFactory.GraphCallBack<Object>() {
        @Override
        public Object call(OrientBaseGraph graph) {
          final OrientVertex v = graph.getVertex(rid);
          if (v != null) {
            v.remove();
            removed = 1;
          }
          return null;
        }
      });

      // CLOSE PENDING TX
      end();

    } else if (query != null) {
      // TARGET IS A CLASS + OPTIONAL CONDITION
      OGraphCommandExecutorSQLFactory.runInConfiguredTxMode(new OGraphCommandExecutorSQLFactory.GraphCallBack<OrientGraph>() {

        @Override
        public OrientGraph call(final OrientBaseGraph iGraph) {
          // TARGET IS A CLASS + OPTIONAL CONDITION
          currentGraph.set(iGraph);
          query.setContext(getContext());
          query.execute(iArgs);
          return null;
        }

      });

    } else
      throw new OCommandExecutionException("Invalid target");

    if (returning.equalsIgnoreCase("COUNT"))
      // RETURNS ONLY THE COUNT
      return removed;
    else
      // RETURNS ALL THE DELETED RECORDS
      return allDeletedRecords;
  }
public Object execute ( final Map < Object , Object > iArgs ) { if ( rid == null && query == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; if ( ! returning . equalsIgnoreCase ( "COUNT" ) ) allDeletedRecords = new ArrayList < ORecord > ( ) ; txAlreadyBegun = getDatabase ( ) . getTransaction ( ) . isActive ( ) ; if ( rid != null ) { // REMOVE PUNCTUAL RID
 OGraphCommandExecutorSQLFactory . runInConfiguredTxMode ( new OGraphCommandExecutorSQLFactory . GraphCallBack < Object > ( ) { @ Override public Object call ( OrientBaseGraph graph ) { final OrientVertex v = graph . getVertex ( rid ) ; if ( v != null ) { v . remove ( ) ; removed = 1 ; } return null ; } } ) ; // CLOSE PENDING TX
 end ( ) ; } else if ( query != null ) { // TARGET IS A CLASS + OPTIONAL CONDITION
 OGraphCommandExecutorSQLFactory . runInConfiguredTxMode ( new OGraphCommandExecutorSQLFactory . GraphCallBack < OrientGraph > ( ) { @ Override public OrientGraph call ( final OrientBaseGraph iGraph ) { // TARGET IS A CLASS + OPTIONAL CONDITION
 currentGraph . set ( iGraph ) ; query . setContext ( getContext ( ) ) ; query . execute ( iArgs ) ; return null ; } } ) ; } else throw new OCommandExecutionException ( "Invalid target" ) ; if ( returning . equalsIgnoreCase ( "COUNT" ) ) // RETURNS ONLY THE COUNT
 return removed ; else // RETURNS ALL THE DELETED RECORDS
 return allDeletedRecords ; }
Execute the command and return the ODocument object created.
Execute the command and return the ODocument object created .