Skip to content
Snippets Groups Projects
Verified Commit 659c0f16 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

REVERT changes in Job.java

parent 221ef924
Branches
Tags
1 merge request!70Refactory the entity id
Pipeline #27780 failed
/*
* ** header v3.0
* 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
*
* 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/>.
*
* ** end header
*/
package org.caosdb.server.jobs;
public abstract class EntityFlagJob extends EntityJob {
protected String value = null;
public void setValue(final String value) {
this.value = value;
}
@Override
protected void run() {
if (this.value == null) {
this.value = this.getClass().getAnnotation(JobAnnotation.class).defaultValue();
}
job(this.value);
}
protected abstract void job(final String value);
}
......@@ -467,21 +467,19 @@ public abstract class Job {
// general rules, role rules, data type rules
jobs.addAll(loadStandardJobs(entity, transaction));
// TODO move to job
// load flag jobs
if (!entity.getFlags().isEmpty()) {
for (final String key : entity.getFlags().keySet()) {
final Job j = getJob(key, JobFailureSeverity.ERROR, entity, transaction);
if (j != null) {
if (j instanceof EntityFlagJob) {
((EntityFlagJob) j).setValue(entity.getFlag(key));
if (j instanceof FlagJob) {
((FlagJob) j).setValue(entity.getFlag(key));
}
jobs.add(j);
}
}
}
// TODO move to job
// load parent flag jobs
if (entity.hasParents()) {
for (final EntityInterface p : entity.getParents()) {
......@@ -489,8 +487,8 @@ public abstract class Job {
for (final String key : p.getFlags().keySet()) {
final Job j = getJob(key, JobFailureSeverity.ERROR, entity, transaction);
if (j != null) {
if (j instanceof EntityFlagJob) {
((EntityFlagJob) j).setValue(p.getFlag(key));
if (j instanceof FlagJob) {
((FlagJob) j).setValue(p.getFlag(key));
}
jobs.add(j);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment