Skip to content

Commit 41cf45d

Browse files
authored
Merge pull request #165 from CourseOrchestra/dependabot/maven/celesta.version-7.4.8
Bump celesta.version from 7.3.48 to 7.4.8
2 parents b732485 + a9f7e61 commit 41cf45d

File tree

5 files changed

+41
-30
lines changed

5 files changed

+41
-30
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<properties>
5151
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5252
<!--dependency versions -->
53-
<celesta.version>7.3.48</celesta.version>
53+
<celesta.version>7.4.8</celesta.version>
5454
<checkstyle.version>9.0.1</checkstyle.version>
5555
<junit.version>5.7.2</junit.version>
5656
<junit.platform.version>1.5.2</junit.platform.version>

src/main/java/ru/curs/bass/Bass.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ void setupDBConnection() {
6262
final OutputStream os;
6363
if (properties.getFilePath() != null) {
6464
File f = new File(properties.getFilePath());
65-
if (!f.getParentFile().exists())
65+
if (!f.getParentFile().exists()) {
6666
f.mkdirs();
67+
}
6768
os = new FileOutputStream(f);
6869
this.ddlConsumer = new OutputStreamDdlConsumer(os);
6970
} else {
@@ -78,8 +79,9 @@ void setupDBConnection() {
7879

7980
this.dbAdaptor = daf.createDbAdaptor();
8081
try (Connection conn = connectionPool.get()) {
81-
if (!dbAdaptor.isValidConnection(conn, 10))
82+
if (!dbAdaptor.isValidConnection(conn, 10)) {
8283
throw new CelestaException("Cannot connect to database.");
84+
}
8385
} catch (SQLException e) {
8486
throw new BassException(e);
8587
}
@@ -138,8 +140,9 @@ void outputDdlScript() {
138140

139141
@Override
140142
public void close() {
141-
if (connectionPool != null)
143+
if (connectionPool != null) {
142144
connectionPool.close();
145+
}
143146
}
144147

145148
DBAdaptor getDbAdaptor() {

src/main/java/ru/curs/bass/ConsoleHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public final void error(String message) {
2828
errMessage(message);
2929
}
3030

31-
protected void errMessage(String message){
31+
protected void errMessage(String message) {
3232
out.println(ansi().fgBrightRed().a(" ERROR: ").a(message).reset());
3333
}
3434

src/main/java/ru/curs/bass/SchemaDataAccessor.java

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@
88
import ru.curs.celesta.dbutils.stmt.PreparedStmtHolder;
99
import ru.curs.celesta.dbutils.term.AlwaysTrue;
1010
import ru.curs.celesta.dbutils.term.FromTerm;
11-
import ru.curs.celesta.score.*;
11+
import ru.curs.celesta.score.DataGrainElement;
12+
import ru.curs.celesta.score.ParseException;
13+
import ru.curs.celesta.score.Table;
1214
import ru.curs.celesta.syscursors.ISchemaCursor;
1315

1416
import java.sql.PreparedStatement;
1517
import java.sql.ResultSet;
1618
import java.sql.SQLException;
17-
import java.util.Arrays;
1819
import java.util.Collections;
1920
import java.util.Date;
20-
import java.util.Objects;
21-
import java.util.stream.Collectors;
2221

2322
public class SchemaDataAccessor extends CsqlBasicDataAccessor<CallContext> implements ISchemaCursor {
2423

@@ -103,8 +102,9 @@ public String getId() {
103102
}
104103

105104
@Override
106-
public void setId(String id) {
105+
public SchemaDataAccessor setId(String id) {
107106
this.id = id;
107+
return this;
108108
}
109109

110110
@Override
@@ -113,8 +113,9 @@ public String getVersion() {
113113
}
114114

115115
@Override
116-
public void setVersion(String version) {
116+
public SchemaDataAccessor setVersion(String version) {
117117
this.version = version;
118+
return this;
118119
}
119120

120121
@Override
@@ -123,8 +124,9 @@ public Integer getLength() {
123124
}
124125

125126
@Override
126-
public void setLength(Integer length) {
127+
public SchemaDataAccessor setLength(Integer length) {
127128
this.length = length;
129+
return this;
128130
}
129131

130132
@Override
@@ -133,8 +135,9 @@ public String getChecksum() {
133135
}
134136

135137
@Override
136-
public void setChecksum(String checksum) {
138+
public SchemaDataAccessor setChecksum(String checksum) {
137139
this.checksum = checksum;
140+
return this;
138141
}
139142

140143
@Override
@@ -143,8 +146,9 @@ public Integer getState() {
143146
}
144147

145148
@Override
146-
public void setState(Integer state) {
149+
public SchemaDataAccessor setState(Integer state) {
147150
this.state = state;
151+
return this;
148152
}
149153

150154
@Override
@@ -153,24 +157,27 @@ public Date getLastmodified() {
153157
}
154158

155159
@Override
156-
public void setLastmodified(Date lastmodified) {
160+
public SchemaDataAccessor setLastmodified(Date lastmodified) {
157161
this.lastmodified = lastmodified;
162+
return this;
158163
}
159164

160165
public String getMessage() {
161166
return message;
162167
}
163168

164169
@Override
165-
public void setMessage(String message) {
170+
public SchemaDataAccessor setMessage(String message) {
166171
this.message = message;
172+
return this;
167173
}
168174

169175

170176
@Override
171177
public void update() throws CelestaException {
172-
if (updatingIsDisabled)
178+
if (updatingIsDisabled) {
173179
return;
180+
}
174181
try (PreparedStatement stmt = update.getStatement(currentValues(), 0)) {
175182
stmt.execute();
176183
} catch (SQLException e) {
@@ -179,15 +186,15 @@ public void update() throws CelestaException {
179186
}
180187

181188
@Override
182-
public void get(Object... values) throws CelestaException {
183-
try (PreparedStatement stmt = get.getStatement(values, 0);
189+
public void get(String id) throws CelestaException {
190+
try (PreparedStatement stmt = get.getStatement(new String[]{id}, 0);
184191
ResultSet rs = stmt.executeQuery()) {
185192
if (rs.next()) {
186193
parseResult(rs);
187194
} else {
188-
String sb = Arrays.stream(values).map(Objects::toString).collect(Collectors.joining(", "));
189-
if (!updatingIsDisabled)
190-
throw new CelestaException("There is no %s (%s).", meta().getName(), sb);
195+
if (!updatingIsDisabled) {
196+
throw new CelestaException("There is no %s (%s).", meta().getName(), id);
197+
}
191198
}
192199
} catch (SQLException e) {
193200
throw new CelestaException(e);
@@ -205,9 +212,9 @@ public boolean nextInSet() throws CelestaException {
205212

206213
boolean result;
207214
try {
208-
if (cursor == null)
215+
if (cursor == null) {
209216
result = findSet();
210-
else {
217+
} else {
211218
result = cursor.next();
212219
}
213220
if (result) {
@@ -226,8 +233,9 @@ private boolean findSet() throws CelestaException {
226233
PreparedStatement ps = findSet.getStatement(currentValues(), 0);
227234
boolean result;
228235
try {
229-
if (cursor != null)
236+
if (cursor != null) {
230237
cursor.close();
238+
}
231239
cursor = ps.executeQuery();
232240
result = cursor.next();
233241
if (result) {
@@ -251,8 +259,9 @@ private void parseResult(ResultSet rs) throws SQLException {
251259

252260
@Override
253261
public void insert() throws CelestaException {
254-
if (updatingIsDisabled)
262+
if (updatingIsDisabled) {
255263
return;
264+
}
256265
try (PreparedStatement stmt = insert.getStatement(currentValues(), 0)) {
257266
stmt.execute();
258267
} catch (SQLException e) {
@@ -266,9 +275,8 @@ public final Table meta() throws CelestaException {
266275
}
267276

268277
private Object[] currentValues() {
269-
Object[] result = {id != null ? id.replace("\"", "") : null, version, length, checksum, state, lastmodified,
270-
message};
271-
return result;
278+
return new Object[]{id != null ? id.replace("\"", "") : null,
279+
version, length, checksum, state, lastmodified, message};
272280
}
273281

274282
}

src/main/java/ru/curs/bass/SyntaxHighlighter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,4 @@ void colorize(Ansi output, String group) {
158158
String getPattern() {
159159
return "'[^']*'('([^'])*')*";
160160
}
161-
}
161+
}

0 commit comments

Comments
 (0)