<commit_before>package li.strolch.migrations;

import static li.strolch.migrations.Migration.BAG_PARAMETERS;
import static li.strolch.migrations.Migration.MIGRATIONS_ID;
import static li.strolch.migrations.Migration.MIGRATIONS_TYPE;
import static li.strolch.migrations.Migration.PARAM_CURRENT_VERSION;

import java.util.HashMap;
import java.util.Map;

import li.strolch.agent.api.ComponentContainer;
import li.strolch.agent.api.StrolchRealm;
import li.strolch.model.Resource;
import li.strolch.model.parameter.StringParameter;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.runtime.configuration.StrolchConfigurationException;
import ch.eitchnet.privilege.model.Certificate;
import ch.eitchnet.utils.Version;

public class CurrentMigrationVersionQuery {

	private ComponentContainer container;
	private Map<String, Version> currentVersions;

	/**
	 * @param container
	 */
	public CurrentMigrationVersionQuery(ComponentContainer container) {
		this.container = container;
	}

	public void doQuery(Certificate cert) {

		this.currentVersions = new HashMap<>();

		for (String realmName : this.container.getRealmNames()) {
			StrolchRealm realm = this.container.getRealm(realmName);
			try (StrolchTransaction tx = realm.openTx(cert, getClass())) {

				Resource migrationsRes = tx.getResourceBy(MIGRATIONS_TYPE, MIGRATIONS_ID);
				if (migrationsRes == null) {
					this.currentVersions.put(realmName, Version.emptyVersion);
					continue;
				}
<commit_msg>[Minor] don't log CurrentMigrationVersionQuery queries<commit_after>package li.strolch.migrations;

import static li.strolch.migrations.Migration.BAG_PARAMETERS;
import static li.strolch.migrations.Migration.MIGRATIONS_ID;
import static li.strolch.migrations.Migration.MIGRATIONS_TYPE;
import static li.strolch.migrations.Migration.PARAM_CURRENT_VERSION;

import java.util.HashMap;
import java.util.Map;

import li.strolch.agent.api.ComponentContainer;
import li.strolch.agent.api.StrolchRealm;
import li.strolch.model.Resource;
import li.strolch.model.parameter.StringParameter;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.runtime.configuration.StrolchConfigurationException;
import ch.eitchnet.privilege.model.Certificate;
import ch.eitchnet.utils.Version;

public class CurrentMigrationVersionQuery {

	private ComponentContainer container;
	private Map<String, Version> currentVersions;

	/**
	 * @param container
	 */
	public CurrentMigrationVersionQuery(ComponentContainer container) {
		this.container = container;
	}

	public void doQuery(Certificate cert) {

		this.currentVersions = new HashMap<>();

		for (String realmName : this.container.getRealmNames()) {
			StrolchRealm realm = this.container.getRealm(realmName);
			try (StrolchTransaction tx = realm.openTx(cert, getClass())) {
				tx.setSuppressDoNothingLogging(true);

				Resource migrationsRes = tx.getResourceBy(MIGRATIONS_TYPE, MIGRATIONS_ID);
				if (migrationsRes == null) {
					this.currentVersions.put(realmName, Version.emptyVersion);
					continue;
				}

{'fraction_non_alphanumeric': 0.09681654085986216, 'fraction_numerical': 0.0, 'mean_word_length': 5.849438202247191, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '987249', 'n_tokens_mistral': 1003, 'n_tokens_neox': 963, 'n_words': 165}