Skip to content

Commit 15176b8

Browse files
committed
Comments
1 parent 22f1d16 commit 15176b8

File tree

1 file changed

+120
-1
lines changed

1 file changed

+120
-1
lines changed

src/org/labkey/remoteapi/query/SaveRowsCommand.java

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,49 +69,94 @@ public SaveRowsCommand(Command... commands)
6969
addCommands(commands);
7070
}
7171

72+
/**
73+
* Returns the extra context map containing additional parameters for the save operation.
74+
* This context can be used to pass additional information to the server during the save process.
75+
* @return Map containing extra context parameters, or null if no extra context is set
76+
*/
7277
public Map<String, Object> getExtraContext()
7378
{
7479
return _extraContext;
7580
}
7681

82+
/**
83+
* Sets additional context parameters for the save operation.
84+
* @param extraContext Map containing extra parameters to be passed to the server
85+
* @return This SaveRowsCommand instance for method chaining
86+
*/
7787
public SaveRowsCommand setExtraContext(Map<String, Object> extraContext)
7888
{
7989
_extraContext = extraContext;
8090
return this;
8191
}
8292

93+
/**
94+
* Adds one or more Command objects to the set of commands to be executed by this SaveRowsCommand.
95+
* @param commands The commands to add to this SaveRowsCommand.
96+
* @return This SaveRowsCommand instance for method chaining
97+
*/
8398
public SaveRowsCommand addCommands(Command... commands)
8499
{
85100
for (Command command : commands)
86101
{
87102
if (command != null)
88103
_commands.add(command);
89104
}
90-
91105
return this;
92106
}
93107

108+
/**
109+
* Returns the list of Command objects representing the batch operations to be executed.
110+
* Each Command in the list represents a single insert, update, or delete operation.
111+
* @return List of Command objects to be executed
112+
*/
94113
public List<Command> getCommands()
95114
{
96115
return _commands;
97116
}
98117

118+
/**
119+
* Checks if the operations should be executed in a transaction.
120+
* When true, all operations will be executed atomically - either all succeed or all fail.
121+
* @return Boolean indicating if operations should be transacted, or null for default behavior
122+
*/
99123
public Boolean isTransacted()
100124
{
101125
return _transacted;
102126
}
103127

128+
/**
129+
* Sets whether the operations should be executed in a transaction.
130+
* @param transacted When true, all operations will be executed atomically.
131+
* When false, operations may partially succeed.
132+
* When null, uses server default behavior.
133+
* @return This SaveRowsCommand instance for method chaining
134+
*/
104135
public SaveRowsCommand setTransacted(Boolean transacted)
105136
{
106137
_transacted = transacted;
107138
return this;
108139
}
109140

141+
/**
142+
* Checks if this is a validation-only operation.
143+
* When true, the server will validate the operations without making any actual changes.
144+
* @return Boolean When true, validates operations without making changes.
145+
* When false, executes operations normally.
146+
* When null, uses server default behavior.
147+
*/
110148
public Boolean isValidateOnly()
111149
{
112150
return _validateOnly;
113151
}
114152

153+
/**
154+
* Sets whether this should be a validation-only operation.
155+
* @param validateOnly When true, validates operations without making changes.
156+
* When false, executes operations normally.
157+
* When null, uses server default behavior.
158+
* @return This SaveRowsCommand instance for method chaining
159+
*/
115160
public SaveRowsCommand setValidateOnly(Boolean validateOnly)
116161
{
117162
_validateOnly = validateOnly;
@@ -156,6 +201,10 @@ public enum CommandType
156201
// N.B. You may be inclined to have this share implementation with BaseRowsCommand; however, I would caution
157202
// against doing so. This class does not represent a command like a PostCommand or a GetCommand but rather
158203
// aligns with the "commands" made on a request to the save rows endpoint.
204+
/**
205+
* Represents a single command operation of a specified type
206+
* (e.g., insert, update, delete) to be executed within a {@link SaveRowsCommand}.
207+
*/
159208
public static class Command
160209
{
161210
BaseRowsCommand.AuditBehavior _auditBehavior;
@@ -204,81 +253,151 @@ public JSONObject getJsonObject()
204253
return json;
205254
}
206255

256+
/**
257+
* Gets the audit behavior setting for this command.
258+
* Determines the level of detail in the audit log for this operation.
259+
* @return The current audit behavior setting, or null if using default behavior
260+
*/
207261
public BaseRowsCommand.AuditBehavior getAuditBehavior()
208262
{
209263
return _auditBehavior;
210264
}
211265

266+
/**
267+
* Sets the audit behavior for this command.
268+
* @param auditBehavior The desired audit behavior
269+
* @return This Command instance for method chaining
270+
*/
212271
public Command setAuditBehavior(BaseRowsCommand.AuditBehavior auditBehavior)
213272
{
214273
_auditBehavior = auditBehavior;
215274
return this;
216275
}
217276

277+
/**
278+
* Gets the user-provided comment that will be included in the audit log.
279+
* @return The audit comment, or null if none was set
280+
*/
218281
public String getAuditUserComment()
219282
{
220283
return _auditUserComment;
221284
}
222285

286+
/**
287+
* Sets a user comment to be included in the audit log for this command.
288+
* @param auditUserComment The comment to include in the audit log
289+
* @return This Command instance for method chaining
290+
*/
223291
public Command setAuditUserComment(String auditUserComment)
224292
{
225293
_auditUserComment = auditUserComment;
226294
return this;
227295
}
228296

297+
/**
298+
* Gets the type of operation this command represents.
299+
* @return The CommandType for this command
300+
*/
229301
public CommandType getCommandType()
230302
{
231303
return _commandType;
232304
}
233305

306+
/**
307+
* Gets the container path where this command should be executed.
308+
* @return The container path, or null if using the default container
309+
*/
234310
public String getContainerPath()
235311
{
236312
return _containerPath;
237313
}
238314

315+
/**
316+
* Sets the container path where this command should be executed.
317+
* @param containerPath The target container path
318+
* @return This Command instance for method chaining
319+
*/
239320
public Command setContainerPath(String containerPath)
240321
{
241322
_containerPath = containerPath;
242323
return this;
243324
}
244325

326+
/**
327+
* Gets additional context parameters specific to this command.
328+
* @return Map of extra context parameters, or null if none are set
329+
*/
245330
public Map<String, Object> getExtraContext()
246331
{
247332
return _extraContext;
248333
}
249334

335+
/**
336+
* Sets additional context parameters for this specific command.
337+
* @param extraContext Map of extra parameters to be passed with this command
338+
* @return This Command instance for method chaining
339+
*/
250340
public Command setExtraContext(Map<String, Object> extraContext)
251341
{
252342
_extraContext = extraContext;
253343
return this;
254344
}
255345

346+
/**
347+
* Gets the name of the query this command operates on.
348+
* @return The query name
349+
*/
256350
public String getQueryName()
257351
{
258352
return _queryName;
259353
}
260354

355+
/**
356+
* Gets the name of the schema containing the query.
357+
* @return The schema name
358+
*/
261359
public String getSchemaName()
262360
{
263361
return _schemaName;
264362
}
265363

364+
/**
365+
* Gets the list of rows to be processed by this command.
366+
* Each row is represented as a Map of column names to values.
367+
* @return List of rows to be processed
368+
*/
266369
public List<Map<String, Object>> getRows()
267370
{
268371
return _rows;
269372
}
270373

374+
/**
375+
* Sets the list of rows to be processed by this command.
376+
* @param rows List of maps where each map represents a row with column names as keys
377+
* @return This Command instance for method chaining
378+
*/
271379
public Command setRows(List<Map<String, Object>> rows)
272380
{
273381
_rows = rows;
274382
return this;
275383
}
276384

385+
/**
386+
* Checks if the command should skip re-selecting rows after the operation.
387+
* @return Boolean indicating whether to skip row re-selection or null for default behavior
388+
*/
277389
public Boolean isSkipReselectRows()
278390
{
279391
return _skipReselectRows;
280392
}
281393

394+
/**
395+
* Sets whether to skip re-selecting rows after the operation completes.
396+
* @param skipReselectRows When true, skips row reselection after the operation
397+
* When false, performs row reselection
398+
* When null, uses server default behavior
399+
* @return This Command instance for method chaining
400+
*/
282401
public Command setSkipReselectRows(Boolean skipReselectRows)
283402
{
284403
_skipReselectRows = skipReselectRows;

0 commit comments

Comments
 (0)