Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for log templates #202

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Support for log templates #202

wants to merge 7 commits into from

Conversation

georgweiss
Copy link
Member

See also #201

@@ -185,7 +241,7 @@ void elasticIndexValidation(ElasticsearchClient client) {
// Olog Logbook Index
try (InputStream is = ElasticConfig.class.getResourceAsStream("/logbook_mapping.json")) {
BooleanResponse exits = client.indices().exists(ExistsRequest.of(e -> e.index(ES_LOGBOOK_INDEX)));
if(!exits.value()) {
if (!exits.value()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this variable be called exists? Same question for several instances below.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's local scope so I do not think it matters that much.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought for increased readability.


@Override
public long count() {
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be the constant 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unused override, so it does not matter that much in my opinion. If we need to expose the count in the REST API or internally, we can implement the actual count.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it's unused, should the function count() be removed from the interface?

Copy link
Member Author

Choose a reason for hiding this comment

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

Third party interface, mandates implementation


@Override
public void deleteAll(Iterable<? extends LogTemplate> entities) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, TextUtil.LOG_TEMPLATE_DELETE_ALL_NOT_SUPPORTED);
Copy link
Collaborator

@abrahamwolk abrahamwolk Nov 14, 2024

Choose a reason for hiding this comment

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

Why is this not impemented when delete(LogTemplate logTemplate) and deleteById() are implemented? Same question for deleteAll() and deleteAllById(Iterable ids) below.

Copy link
Member Author

Choose a reason for hiding this comment

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

Since there is currently no use case for that in clients.

Copy link
Collaborator

Choose a reason for hiding this comment

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

As above, should the functions then be removed from the interface if they are unused?

Copy link
Member Author

Choose a reason for hiding this comment

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

Third party interface, mandates implementation

d.index(ElasticConfig.ES_LOG_TEMPLATE_INDEX).id(id).refresh(Refresh.True));
DeleteResponse deleteResponse = client.delete(deleteRequest);
if (deleteResponse.result().equals(Result.Deleted)) {
logger.log(Level.WARNING, MessageFormat.format(TextUtil.LOG_TEMPLATE_DELETED, id));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is a warning logged when the template is deleted (which is the purpose of calling the function)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, will change to INFO

* @return The updated {@link LogTemplate} record, or HTTP status 404 if the log template does not exist. If the path
* variable does not match the id in the log record, HTTP status 400 (bad request) is returned.
*/
/*
Copy link
Collaborator

Choose a reason for hiding this comment

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

Commented-out code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will remove.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, commented out for the time being, once client UI is in place (and authorization) this will be uncommented.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants