Subversion Repositories DevTools

Rev

Rev 7201 | Rev 7333 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7201 Rev 7253
Line 1095... Line 1095...
1095
    }
1095
    }
1096
    
1096
    
1097
    /**
1097
    /**
1098
     * Add entry to the Build_Instance table
1098
     * Add entry to the Build_Instance table
1099
     * Returns the build instance number. This will be used to cross reference unit tests results
1099
     * Returns the build instance number. This will be used to cross reference unit tests results
-
 
1100
     * @param rtagId
-
 
1101
     * @param pvId
-
 
1102
     * @param BuildReason
-
 
1103
     * @param buildRef 
1100
     * 
1104
     * 
1101
     * @throws throws SQLException, Exception 
1105
     * @throws throws SQLException, Exception 
1102
     * 
1106
     * 
1103
     */
1107
     */
1104
    public int createBuildInstance(int rtagId, int pvId, BuildReason reason) throws SQLException, Exception
1108
    public int createBuildInstance(int rtagId, int pvId, BuildReason reason, String buildRef) throws SQLException, Exception
1105
    {
1109
    {
1106
        int buildId = 0;
1110
        int buildId = 0;
1107
        
1111
        
1108
        mLogger.debug("createBuildInstance {}:{}", rtagId, pvId);
1112
        mLogger.debug("createBuildInstance {}:{}", rtagId, pvId);
1109
        if ( mUseDatabase )
1113
        if ( mUseDatabase )
1110
        {
1114
        {
1111
            try
1115
            try
1112
            {
1116
            {
1113
                connect();
1117
                connect();
1114
                CallableStatement stmt = mConnection.prepareCall("begin ? := PK_RMAPI.new_build_instance(?,?,?); end;");
1118
                CallableStatement stmt = mConnection.prepareCall("begin ? := PK_RMAPI.new_build_instance(?,?,?,?); end;");
1115
                stmt.registerOutParameter( 1, Types.INTEGER);
1119
                stmt.registerOutParameter( 1, Types.INTEGER);
1116
                stmt.setLong( 2,rtagId );
1120
                stmt.setLong( 2,rtagId );
1117
                stmt.setLong( 3,pvId );
1121
                stmt.setLong( 3,pvId );
1118
                stmt.setString( 4,reason.toString() );
1122
                stmt.setString( 4,reason.toString() );
-
 
1123
                stmt.setString( 5,buildRef);
1119
                stmt.executeUpdate();
1124
                stmt.executeUpdate();
1120
                buildId = stmt.getInt( 1 );
1125
                buildId = stmt.getInt( 1 );
1121
                
1126
                
1122
                mLogger.warn("createBuildInstance: Build Instance ID: {}", buildId);
1127
                mLogger.warn("createBuildInstance: Build Instance ID: {}", buildId);
1123
 
1128
 
Line 1192... Line 1197...
1192
        }
1197
        }
1193
        return rv;
1198
        return rv;
1194
    }
1199
    }
1195
    
1200
    
1196
    /**
1201
    /**
-
 
1202
     * Remove the BuildRef once the build log has been deleted
-
 
1203
     * 
-
 
1204
     * @param rtagId       - Release Id
-
 
1205
     * @param buildRef     - Build Ref
-
 
1206
     * 
-
 
1207
     * Returns the internal error code. <0 == error
-
 
1208
     * 
-
 
1209
     * Handles exceptions locally as its called in a context with little handling 
-
 
1210
     * 
-
 
1211
     */
-
 
1212
    public int removeBuildRef(int rtagId, String buildRef)
-
 
1213
    {
-
 
1214
        int rv = 0;
-
 
1215
        
-
 
1216
        mLogger.debug("removeBuildRef {}:{}", rtagId, buildRef);
-
 
1217
        if ( mUseDatabase )
-
 
1218
        {
-
 
1219
            try
-
 
1220
            {
-
 
1221
                connect();
-
 
1222
    
-
 
1223
                String sql = "begin ? := PK_RMAPI.update_build_ref(?,?); end;";
-
 
1224
                
-
 
1225
                CallableStatement stmt = mConnection.prepareCall(sql);
-
 
1226
                stmt.registerOutParameter( 1, Types.INTEGER);
-
 
1227
                stmt.setLong( 2,rtagId );
-
 
1228
                stmt.setString( 3,buildRef );
-
 
1229
                stmt.executeUpdate();
-
 
1230
                rv = stmt.getInt( 1 );
-
 
1231
                
-
 
1232
                mLogger.warn("removeBuildRef: Result: {}", rv);
-
 
1233
    
-
 
1234
                stmt.close();
-
 
1235
                commit();
-
 
1236
            }
-
 
1237
            catch ( SQLException e )
-
 
1238
            {
-
 
1239
                mLogger.error("{} sql exception:{}", "removeBuildRef", e.getMessage());
-
 
1240
                
-
 
1241
            } catch (Exception e) {
-
 
1242
                mLogger.error("{} excpetion:{}", "removeBuildRef", e);
-
 
1243
            }
-
 
1244
            finally
-
 
1245
            {
-
 
1246
                // this block is executed regardless of what happens in the try block
-
 
1247
                //      even if an exception is thrown
-
 
1248
                //      ensure disconnect
-
 
1249
                disconnect();
-
 
1250
            }
-
 
1251
        }
-
 
1252
        return rv;
-
 
1253
    }
-
 
1254
 
-
 
1255
    /**
1197
     * Insert Test Results into Release Manager
1256
     * Insert Test Results into Release Manager
1198
     * Manage connection and disconnection
1257
     * Manage connection and disconnection
1199
     * 
1258
     * 
1200
     * @param buildId
1259
     * @param buildId
1201
     * @param btr
1260
     * @param btr