From 659c0f169c45182e31f5fc805dac8f1c1e73c90d Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Thu, 1 Sep 2022 17:39:38 +0200
Subject: [PATCH] REVERT changes in Job.java

---
 .../org/caosdb/server/jobs/EntityFlagJob.java | 42 -------------------
 src/main/java/org/caosdb/server/jobs/Job.java | 10 ++---
 2 files changed, 4 insertions(+), 48 deletions(-)
 delete mode 100644 src/main/java/org/caosdb/server/jobs/EntityFlagJob.java

diff --git a/src/main/java/org/caosdb/server/jobs/EntityFlagJob.java b/src/main/java/org/caosdb/server/jobs/EntityFlagJob.java
deleted file mode 100644
index e00b7aee..00000000
--- a/src/main/java/org/caosdb/server/jobs/EntityFlagJob.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * ** 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);
-}
diff --git a/src/main/java/org/caosdb/server/jobs/Job.java b/src/main/java/org/caosdb/server/jobs/Job.java
index e709d074..0e9d7ef7 100644
--- a/src/main/java/org/caosdb/server/jobs/Job.java
+++ b/src/main/java/org/caosdb/server/jobs/Job.java
@@ -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);
             }
-- 
GitLab