Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,20 @@ public ResultSet query(final String query, ContextConfiguration configuration, f
return query(query, null, (Map) null);
}

// TODO: This command method can only handle queries, a command method needs to be provided in mongoDBWrapper
@Override
public ResultSet command(final String query, ContextConfiguration configuration, final Map<String, Object> parameters) {
return null;
try {
return mongoDBWrapper.query(query);
} catch (final Exception e) {
LogManager.instance().log(this, Level.SEVERE, "Error on initializing Mongo query engine", e);
throw new CommandParsingException("Error on initializing Mongo query engine", e);
}
Comment on lines +77 to +82
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The body of this method is identical to the query(String, ContextConfiguration, Map<String, Object>) method. To avoid code duplication and improve maintainability, you can delegate this call directly to the query method.

    return query(query, configuration, parameters);

}

// TODO: This command method can only handle queries, a command method needs to be provided in mongoDBWrapper
@Override
public ResultSet command(final String query, ContextConfiguration configuration, final Object... parameters) {
return null;
return query(query, null, (Map) null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and to avoid duplicating logic, it's better to delegate to the query method that has the same signature (query(..., Object...)). This makes the code more maintainable as any future changes to the query method will be automatically reflected here.

    return query(query, configuration, parameters);

}
}
Loading