public Date [ ] removeDatastream ( String id , Date start , Date end ) throws ServerException { assertNotInvalidated ( ) ; assertNotPendingRemoval ( ) ; ArrayList < Datastream > removeList = new ArrayList < Datastream > ( ) ; for ( Datastream ds : m_obj . datastreams ( id ) ) { boolean doRemove = false ; if ( start != null ) { if ( end != null ) { if ( ds . DSCreateDT . compareTo ( start ) >= 0 && ds . DSCreateDT . compareTo ( end ) <= 0 ) { doRemove = true ; } } else { if ( ds . DSCreateDT . compareTo ( start ) >= 0 ) { doRemove = true ; } } } else { if ( end != null ) { if ( ds . DSCreateDT . compareTo ( end ) <= 0 ) { doRemove = true ; } } else { doRemove = true ; } } if ( doRemove ) { // Note: We don't remove old audit records by design. // add this datastream to the datastream to-be-removed list. removeList . add ( ds ) ; } } /* Now that we've identified all ds versions to remove, remove 'em */ for ( Datastream toRemove : removeList ) { m_obj . removeDatastreamVersion ( toRemove ) ; } // finally, return the dates of each deleted item Date [ ] deletedDates = new Date [ removeList . size ( ) ] ; for ( int i = 0 ; i < removeList . size ( ) ; i ++ ) { deletedDates [ i ] = ( removeList . get ( i ) ) . DSCreateDT ; } return deletedDates ; }
Removes a datastream from the object .