Skip to content
Snippets Groups Projects
Commit 6752497d authored by Daniel Hornung's avatar Daniel Hornung
Browse files

DOC: Comments, small style changes.

parent 44eb1748
No related branches found
No related tags found
2 merge requests!21Release v0.4.0,!18fix importance bug
#
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Copyright (C) 2021 Timm Fitsche <t.fitschen@indiscale.com>
# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
#
......
......@@ -169,11 +169,12 @@ public abstract class Job {
* <p>If the targetParent is not in the set of parents of the child, this method iterates through
* the direct parents of the child.
*
* <p>If the both entities are part of this transaction, they are resolved within this
* transaction. Otherwise they are fetched from the database backend or the whole evaluation takes
* place in the backend (if both have persistent ids and are not part of this transaction).
* <p>If both entities are part of this transaction, they are resolved within this transaction.
* Otherwise they are fetched from the database backend or the whole evaluation takes place in the
* backend (if both have persistent ids and are not part of this transaction).
*
* <p>Also, if both entities have the same id or name, the return value is true.
* <p>If both entities have the same id or name, the return value is true without any further
* checks.
*
* @param child the child entity
* @param targetParent the parent entity
......@@ -551,8 +552,8 @@ public abstract class Job {
}
/**
* Resolve an entity (which might only be specified by it's name or id) to it's full
* representation (with properties, parents and all).
* Resolve an entity (which might only be specified by it's name or id) to its full representation
* (with properties, parents and all).
*
* @param entity the entity to be resolved.
* @return the resolved entity.
......
/*
* This file is a part of the CaosDB Project.
*
* Copyright (C) 2021 IndiScale GmbH <info@indiscale.com>
* Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.caosdb.server.jobs;
import java.io.BufferedReader;
......@@ -26,11 +46,11 @@ import org.caosdb.server.utils.ConfigurationException;
* <p>A job rule contains of a quintuple (domain, entity, transaction type, job name, job failure
* severity).
*
* <p>The domain and the entities define for which entities the job (of the given name) should be
* loaded. The transaction type (e.g. Insert, Update, Delete) defines the transaction where this
* rule applies. The job failure severity sets the related property of a job.
* <p>The domain and entity define for which entities the job (of the given name) should be loaded.
* The transaction type (e.g. Insert, Update, Delete) defines the transaction where this rule
* applies. The job failure severity sets the related property of a job.
*
* <p>The configuration is being read from a config file {@link
* <p>The configuration is being read by default from a config file {@link
* ServerProperties#KEY_JOB_RULES_CONFIG}
*
* <p>This class works as a singleton, most of the time. It is possible to instanciate it otherwise,
......@@ -117,19 +137,19 @@ public class JobConfig {
private void addRule(final Map<String, List<Object[]>> result, final String[] row) {
if (row.length != 5) {
throw new ConfigurationException(
"Could not parse the job rules. Lines of four comma-separated values expected");
"Could not parse the job rules. Lines of five comma-separated values expected");
}
try {
final Integer domain = Integer.parseInt(row[0]);
final Integer entity = Integer.parseInt(row[1]);
final String transaction = row[2];
final String job = row[3];
final JobFailureSeverity severiy = JobFailureSeverity.valueOf(row[4]);
final JobFailureSeverity severity = JobFailureSeverity.valueOf(row[4]);
final String key = getKey(domain, entity, transaction);
if (!result.containsKey(key)) {
result.put(key, new ArrayList<>());
}
result.get(key).add(new Object[] {job, severiy});
result.get(key).add(new Object[] {job, severity});
} catch (final Exception e) {
throw new ConfigurationException("Could not parse the job rules.", e);
......@@ -137,14 +157,14 @@ public class JobConfig {
}
/**
* Factory method for the instanciation and configuration of a job for a specific entity.
* Factory method for the instanciation and configuration of jobs for a specific entity.
*
* @param domain the domain of the rule
* @param entity the entity of the rule (this might be a particular datatype or a role, like
* "RecordType")
* @param target the entity for which the job will run.
* @param transaction the transaction for which the job will run.
* @return A fresh job instance
* @return Fresh job instances, one for each matching job rule.
*/
public List<Job> getConfiguredJobs(
final Integer domain,
......
......@@ -75,7 +75,9 @@ public class CheckParOblPropPresent extends EntityJob {
}
/**
* Check if all obligatory properties of the given parent are present. Add a warning,
* Check if all obligatory properties of the given parent are present.
*
* <p>Add an error or warning if not.
*
* @param parent
* @throws Message
......@@ -128,6 +130,7 @@ public class CheckParOblPropPresent extends EntityJob {
}
}
/** Look at the entity's importance flag first, at the container's flag second. */
private void handleImportanceFlags() {
final String globalFlag =
getTransaction().getContainer().getFlags().get(OBL_IMPORTANCE_FLAG_KEY);
......
......@@ -4,6 +4,8 @@
*
* Copyright (C) 2018 Research Group Biomedical Physics,
* Max-Planck-Institute for Dynamics and Self-Organization Göttingen
* Copyright (C) 2021 Indiscale GmbH <info@indiscale.com>
* Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment