public void save() throws RegistryException{
EntityManager em = null;
try {
em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
AdvancedInputDataHandling dataHandling;
if (dataHandlingId != 0) {
dataHandling = em.find(AdvancedInputDataHandling.class, dataHandlingId);
dataHandling.setDataHandlingId(dataHandlingId);
} else {
dataHandling = new AdvancedInputDataHandling();
}
Experiment experiment = em.find(Experiment.class, experimentResource.getExpID());
if (taskDetailResource != null) {
TaskDetail taskDetail = em.find(TaskDetail.class, taskDetailResource.getTaskId());
dataHandling.setTaskId(taskDetailResource.getTaskId());
dataHandling.setTask(taskDetail);
}
dataHandling.setExpId(experimentResource.getExpID());
dataHandling.setExperiment(experiment);
dataHandling.setWorkingDir(workingDir);
dataHandling.setParentWorkingDir(workingDirParent);
dataHandling.setStageInputsToWorkingDir(stageInputFiles);
dataHandling.setCleanAfterJob(cleanAfterJob);
em.persist(dataHandling);
dataHandlingId = dataHandling.getDataHandlingId();
em.getTransaction().commit();
em.close();
}catch (Exception e){
logger.error(e.getMessage(), e);
throw new RegistryException(e);