gt:         List<EnvironmentModifierData> envModifiers = getEnvModifiers();
context: package org.ow2.proactive.scheduler.core.db;
  
  import java.io.Serializable;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  
  import javax.persistence.CollectionTable;
  import javax.persistence.Column;
  import javax.persistence.ElementCollection;
  import javax.persistence.Embeddable;
  import javax.persistence.EmbeddedId;
  import javax.persistence.Entity;
  import javax.persistence.FetchType;
  import javax.persistence.JoinColumn;
  import javax.persistence.Lob;
  import javax.persistence.ManyToOne;
  import javax.persistence.OneToMany;
  import javax.persistence.OneToOne;
  import javax.persistence.Table;
  import javax.persistence.Transient;
  
  import org.ow2.proactive.scheduler.common.task.ForkEnvironment;
  import org.ow2.proactive.scheduler.common.task.ParallelEnvironment;
  import org.ow2.proactive.scheduler.common.task.PropertyModifier;
  import org.ow2.proactive.scheduler.common.task.RestartMode;
  import org.ow2.proactive.scheduler.common.task.TaskId;
  import org.ow2.proactive.scheduler.common.task.TaskStatus;
  import org.ow2.proactive.scheduler.common.task.dataspaces.InputSelector;
  import org.ow2.proactive.scheduler.common.task.dataspaces.OutputSelector;
  import org.ow2.proactive.scheduler.common.task.flow.FlowBlock;
  import org.ow2.proactive.scheduler.common.usage.TaskUsage;
  import org.ow2.proactive.scheduler.core.properties.PASchedulerProperties;
  import org.ow2.proactive.scheduler.job.InternalJob;
  import org.ow2.proactive.scheduler.job.JobIdImpl;
  import org.ow2.proactive.scheduler.task.TaskIdImpl;
  import org.ow2.proactive.scheduler.task.containers.ExecutableContainer;
  import org.ow2.proactive.scheduler.task.containers.ScriptExecutableContainer;
  import org.ow2.proactive.scheduler.task.internal.InternalForkedScriptTask;
  import org.ow2.proactive.scheduler.task.internal.InternalScriptTask;
  import org.ow2.proactive.scheduler.task.internal.InternalTask;
  import org.ow2.proactive.scripting.InvalidScriptException;
  import org.ow2.proactive.scripting.SelectionScript;
  import org.ow2.proactive.scripting.TaskScript;
  import org.ow2.proactive.topology.descriptor.ArbitraryTopologyDescriptor;
  import org.ow2.proactive.topology.descriptor.BestProximityDescriptor;
  import org.ow2.proactive.topology.descriptor.DifferentHostsExclusiveDescriptor;
  import org.ow2.proactive.topology.descriptor.MultipleHostsExclusiveDescriptor;
  import org.ow2.proactive.topology.descriptor.SingleHostDescriptor;
  import org.ow2.proactive.topology.descriptor.SingleHostExclusiveDescriptor;
  import org.ow2.proactive.topology.descriptor.ThresholdProximityDescriptor;
  import org.ow2.proactive.topology.descriptor.TopologyDescriptor;
  import org.hibernate.annotations.BatchSize;
  import org.hibernate.annotations.Cascade;
  import org.hibernate.annotations.CascadeType;
  import org.hibernate.annotations.ForeignKey;
  import org.hibernate.annotations.Index;
  import org.hibernate.annotations.OnDelete;
  import org.hibernate.annotations.OnDeleteAction;
  import org.hibernate.annotations.Parameter;
  import org.hibernate.annotations.Type;
  import org.hibernate.type.SerializableToBlobType;
  
  
  @Entity
  @Table(name = "TASK_DATA"/*, uniqueConstraints = { @UniqueConstraint(columnNames = {
  		"TASK_ID_JOB", "TASK_NAME" }) }*/)
  public class TaskData {
  
      private static final String SCRIPT_TASK = "SCRIPT_TASK";
  
      private static final String FORKED_SCRIPT_TASK = "FORKED_SCRIPT_TASK";
  
      private DBTaskId id;
  
      private JobData jobData;
  
      private List<DBTaskId> dependentTasks;
  
      private List<DBTaskId> joinedBranches;
  
      private TaskData ifBranch;
  
      private Map<String, String> genericInformation;
  
      private List<SelectionScriptData> selectionScripts;
  
      private List<SelectorData> dataspaceSelectors;
  
      private ScriptData preScript;
  
      private ScriptData postScript;
  
      private ScriptData cleanScript;
  
      private ScriptData flowScript;
  
      private ScriptData script;
  
      private String taskName;
  
      private String description;
  
      private long startTime;
  
      private long finishedTime;
  
      private long executionDuration;
  
      private TaskStatus taskStatus;
  
      private String executionHostName;
  
      private int maxNumberOfExecution;
  
      private boolean cancelJobOnError;
  
      private int numberOfExecutionLeft;
  
      private int numberOfExecutionOnFailureLeft;
  
      private String resultPreview;
  
      private boolean preciousResult;
  
      private boolean preciousLogs;
  
      private boolean runAsMe;
  
      private long wallTime;
  
      private int iteration;
  
      private int replication;
  
      private String matchingBlock;
  
      private String taskType;
  
      private int restartModeId;
  
      private FlowBlock flowBlock;
  
      private int parallelEnvNodesNumber;
  
      private String topologyDescriptor;
  
      private long topologyDescriptorThreshold;
  
      /* Fork environment parameters */
  
      private String javaHome;
      private List<String> jvmArguments;
      private List<String> additionalClasspath;
      private ScriptData envScript;
      private List<EnvironmentModifierData> envModifiers;
      private String workingDir;
  
      @Column(name = "JAVA_HOME", length = Integer.MAX_VALUE)
      @Lob
      public String getJavaHome() {
          return javaHome;
      }
  
      public void setJavaHome(String javaHome) {
          this.javaHome = javaHome;
      }
  
      @Column(name = "JVM_ARGUMENTS")
      @Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @org.hibernate.annotations.Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
      public List<String> getJvmArguments() {
          return jvmArguments;
      }
  
      public void setJvmArguments(List<String> jvmArguments) {
          this.jvmArguments = jvmArguments;
      }
  
      @Column(name = "CLASSPATH")
      @Type(type = "org.hibernate.type.SerializableToBlobType", parameters = @org.hibernate.annotations.Parameter(name = SerializableToBlobType.CLASS_NAME, value = "java.lang.Object"))
      public List<String> getAdditionalClasspath() {
          return additionalClasspath;
      }
  
      public void setAdditionalClasspath(List<String> additionalClasspath) {
          this.additionalClasspath = additionalClasspath;
      }
  
      @Cascade(org.hibernate.annotations.CascadeType.ALL)
      @OneToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "ENV_SCRIPT_ID")
      @ForeignKey(name = "none") // disable foreign key, to be able to remove runtime data
      @Index(name = "TASK_ENV_SCRIPT")
      public ScriptData getEnvScript() {
          return envScript;
      }
  
      public void setEnvScript(ScriptData envScript) {
          this.envScript = envScript;
      }
  
      @Cascade(org.hibernate.annotations.CascadeType.ALL)
      @OneToOne(fetch = FetchType.LAZY)
      @JoinColumn(name = "SCRIPT_ID")
      @ForeignKey(name = "none") // disable foreign key, to be able to remove runtime data
      @Index(name = "TASK_SCRIPT")
      public ScriptData getScript() {
          return script;
      }
  
      public void setScript(ScriptData script) {
          this.script = script;
      }
  
      @Cascade(org.hibernate.annotations.CascadeType.ALL)
      @OneToMany(mappedBy = "taskData")
      @OnDelete(action = OnDeleteAction.CASCADE)
      public List<EnvironmentModifierData> getEnvModifiers() {
          return envModifiers;
      }
  
      public void setEnvModifiers(List<EnvironmentModifierData> envModifiers) {
          this.envModifiers = envModifiers;
      }
  
      @Column(name = "WORKING_DIR")
      public String getWorkingDir() {
          return workingDir;
      }
  
      public void setWorkingDir(String workingDir) {
          this.workingDir = workingDir;
      }
  
      public ForkEnvironment createForkEnvironment() throws InvalidScriptException {
          ForkEnvironment forkEnv = new ForkEnvironment();
          forkEnv.setJavaHome(javaHome);
          forkEnv.setWorkingDir(workingDir);
  
          List<String> additionalClasspath = getAdditionalClasspath();
          if (additionalClasspath != null) {
              for (String classpath : additionalClasspath) {
                  forkEnv.addAdditionalClasspath(classpath);
              }
          }
  
          List<String> jvmArguments = getJvmArguments();
          if (jvmArguments != null) {
              for (String jvmArg : jvmArguments) {
                  forkEnv.addJVMArgument(jvmArg);
              }
          }
  
  