@@ -37,15 +37,6 @@ private String createQueryLineOpLimitsGroups(String id, String tableName) {
3737 return "select * from " + tableName + " where branch_id = '" + id + "'" ;
3838 }
3939
40- private String getLimitsGroupId (JdbcConnection connection , String uuid ) throws DatabaseException , SQLException {
41- String query = "select id from operational_limits_group where uuid = '" + uuid + "'" ;
42- ResultSet resultSetOp = connection .createStatement ().executeQuery (query );
43- if (resultSetOp .next ()) {
44- return resultSetOp .getString (ID_COL );
45- }
46- return "" ;
47- }
48-
4940 private String createQueryLineOpLimitsGroupsWithPos (String tableName , String id , String pos ) {
5041 return "select * from " + tableName + " where branch_id = '" + id + "' and pos_operational_limits_groups = " + pos ;
5142 }
@@ -139,8 +130,8 @@ public SqlStatement[] generateStatements(Database database) throws CustomChangeE
139130 final String branchCreationOpLimitsGroupsTable = i == 0 ? "line_creation_operational_limits_groups"
140131 : "two_windings_transformer_creation_operational_limits_groups" ;
141132
142- String branchesToProcess = "Select id, selected_operational_limits_group_id1, selected_operational_limits_group_id2 from " + branchCreationTable ;
143- try (ResultSet branches = connection .createStatement ().executeQuery (branchesToProcess )) {
133+ String branchesToProcess = "Select id, selected_operational_limits_group_id1, selected_operational_limits_group_id2 from <Table>" ;
134+ try (ResultSet branches = connection .createStatement ().executeQuery (branchesToProcess . replace ( "<Table>" , branchCreationTable ) )) {
144135 while (branches .next ()) {
145136 int position = 0 ;
146137 //get operational limits groups1
@@ -159,10 +150,12 @@ public SqlStatement[] generateStatements(Database database) throws CustomChangeE
159150 String branchCreationOpLimitsGroup2Id = branchCreationOpLimitsGroups2 .getString (OPERATIONAL_LG_ID_COL );
160151
161152 // Compare Both limitsGroups 1 and 2 limits
162- ResultSet operationalLimitsGroups1 = connection .createStatement ().executeQuery ("select * from operational_limits_group where " + UUID_COL + " = '" + branchCreationOpLimitsGroup1Id + "'" );
153+ String query = "select * from operational_limits_group where uuid = '<id>'" ;
154+ ResultSet operationalLimitsGroups1 = connection .createStatement ().executeQuery (query .replace ("<id>" , branchCreationOpLimitsGroup1Id ));
163155
164156 if (compareOperationalLimitsInfos (connection , branchCreationOpLimitsGroup1Id , branchCreationOpLimitsGroup2Id )) {
165- ResultSet operationalLimitsGroups2 = connection .createStatement ().executeQuery ("select current_limits_id from operational_limits_group where " + UUID_COL + " = '" + branchCreationOpLimitsGroup2Id + "'" );
157+ String query2 = "select current_limits_id from operational_limits_group where uuid = '<id>'" ;
158+ ResultSet operationalLimitsGroups2 = connection .createStatement ().executeQuery (query2 .replace ("<id>" , branchCreationOpLimitsGroup2Id ));
166159
167160 // - remove line from operational_limits_group
168161 // - remove related permanent limit from current_limits
@@ -195,7 +188,8 @@ public SqlStatement[] generateStatements(Database database) throws CustomChangeE
195188 .addColumnValue (POS_OP_LG_COL , position ++));
196189
197190 // Change Applicability side 2
198- ResultSet operationalLimitsGroups2 = connection .createStatement ().executeQuery ("select * from operational_limits_group where " + UUID_COL + " = '" + branchCreationOpLimitsGroup2Id + "'" );
191+ String query3 = "select * from operational_limits_group where uuid = '<id>'" ;
192+ ResultSet operationalLimitsGroups2 = connection .createStatement ().executeQuery (query3 .replace ("<id>" , branchCreationOpLimitsGroup2Id ));
199193 addOperationalLimitsGroupApplicability (database , operationalLimitsGroups2 , statements , "SIDE2" );
200194
201195 // Add to merged table
0 commit comments