public void save() throws RegistryException{
EntityManager em = null;
try {
em = ResourceUtils.getEntityManager();
em.getTransaction().begin();
Computational_Resource_Scheduling scheduling;
if (schedulingId != 0) {
scheduling = em.find(Computational_Resource_Scheduling.class, schedulingId);
scheduling.setSchedulingId(schedulingId);
} else {
scheduling = new Computational_Resource_Scheduling();
}
Experiment experiment = em.find(Experiment.class, experimentResource.getExpID());
if (taskDetailResource != null) {
TaskDetail taskDetail = em.find(TaskDetail.class, taskDetailResource.getTaskId());
scheduling.setTask(taskDetail);
scheduling.setTaskId(taskDetailResource.getTaskId());
}
scheduling.setExpId(experimentResource.getExpID());
scheduling.setExperiment(experiment);
scheduling.setResourceHostId(resourceHostId);
scheduling.setCpuCount(cpuCount);
scheduling.setNodeCount(nodeCount);
scheduling.setNumberOfThreads(numberOfThreads);
scheduling.setQueueName(queueName);
scheduling.setWallTimeLimit(walltimeLimit);
scheduling.setJobStartTime(jobStartTime);
scheduling.setTotalPhysicalmemory(physicalMemory);
scheduling.setProjectName(projectName);
em.persist(scheduling);
schedulingId = scheduling.getSchedulingId();
em.getTransaction().commit();
em.close();
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RegistryException(e);