public TaxonomyTerm createTaxonomyTerm ( final String taxonomy , final String name , final String slug , final String description ) throws SQLException { Term term = createTerm ( name , slug ) ; Connection conn = null ; PreparedStatement stmt = null ; ResultSet rs = null ; Timer . Context ctx = metrics . createTaxonomyTermTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( insertTaxonomyTermSQL , Statement . RETURN_GENERATED_KEYS ) ; stmt . setLong ( 1 , term . id ) ; stmt . setString ( 2 , taxonomy ) ; stmt . setString ( 3 , Strings . nullToEmpty ( description ) ) ; stmt . executeUpdate ( ) ; rs = stmt . getGeneratedKeys ( ) ; if ( rs . next ( ) ) { return new TaxonomyTerm ( rs . getLong ( 1 ) , taxonomy , term , description ) ; } else { throw new SQLException ( "Problem creating taxonomy term (no generated id)" ) ; } } finally { ctx . stop ( ) ; closeQuietly ( conn , stmt , rs ) ; } }
Creates a taxonomy term .