void removeEdgeRole ( EdgeRole er , boolean preserveData ) { if ( er . getVertexLabel ( ) != this ) { throw new IllegalStateException ( "Trying to remove a EdgeRole from a non owner VertexLabel" ) ; } Collection < VertexLabel > ers ; switch ( er . getDirection ( ) ) { // we don't support both case BOTH : throw new IllegalStateException ( "BOTH is not a supported direction" ) ; case IN : ers = er . getEdgeLabel ( ) . getInVertexLabels ( ) ; break ; case OUT : ers = er . getEdgeLabel ( ) . getOutVertexLabels ( ) ; break ; default : throw new IllegalStateException ( "Unknown direction!" ) ; } if ( ! ers . contains ( this ) ) { throw new IllegalStateException ( "Trying to remove a EdgeRole from a non owner VertexLabel" ) ; } // the edge had only this vertex on that direction, remove the edge if ( ers . size ( ) == 1 ) { er . getEdgeLabel ( ) . remove ( preserveData ) ; } else { getSchema ( ) . getTopology ( ) . lock ( ) ; switch ( er . getDirection ( ) ) { // we don't support both case BOTH : throw new IllegalStateException ( "BOTH is not a supported direction" ) ; case IN : uncommittedRemovedInEdgeLabels . put ( er . getEdgeLabel ( ) . getFullName ( ) , EdgeRemoveType . ROLE ) ; er . getEdgeLabel ( ) . removeInVertexLabel ( this , preserveData ) ; break ; case OUT : uncommittedRemovedOutEdgeLabels . put ( er . getEdgeLabel ( ) . getFullName ( ) , EdgeRemoveType . ROLE ) ; er . getEdgeLabel ( ) . removeOutVertexLabel ( this , preserveData ) ; break ; } this . getSchema ( ) . getTopology ( ) . fire ( er , "" , TopologyChangeAction . DELETE ) ; } }
remove a given edge role