public void save() throws RegistryException {
EntityManager em = null;
try {
em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
AdvancedOutputDataHandling dataHandling;
if (outputDataHandlingId != 0 ){
dataHandling = em.find(AdvancedOutputDataHandling.class, outputDataHandlingId);
dataHandling.setOutputDataHandlingId(outputDataHandlingId);
}else {
dataHandling = new AdvancedOutputDataHandling();
}
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.setDataRegUrl(dataRegUrl);
dataHandling.setOutputDataDir(outputDataDir);
dataHandling.setPersistOutputData(persistOutputData);
em.persist(dataHandling);
outputDataHandlingId = dataHandling.getOutputDataHandlingId();
em.getTransaction().commit();
em.close();
}catch (Exception e){
logger.error(e.getMessage(), e);
throw new RegistryException(e);