@Test public void testSave(){ Job job = new Job(); job.setAppId(1L); job.setClazz("me.hao0.antares.client.job.HelloJob"); job.setCron("0/30 * * * * ?"); job.setStatus(JobStatus.ENABLE.value()); job.setType(JobType.DEFAULT.value()); assertTrue(jobManager.save(job)); }
public Boolean save(Job job){ boolean isCreate = job.getId() == null; boolean success = jobDao.save(job); if (success){ if (isCreate){ if(jobDao.bindApp(job.getAppId(), job.getId())){ success = jobDao.indexJobClass(job.getAppId(), job.getId(), job.getClazz()); } else { success = false; } if (!success){ delete(job.getId()); } } } return success; }
JobManager { public Boolean save(Job job){ boolean isCreate = job.getId() == null; boolean success = jobDao.save(job); if (success){ if (isCreate){ if(jobDao.bindApp(job.getAppId(), job.getId())){ success = jobDao.indexJobClass(job.getAppId(), job.getId(), job.getClazz()); } else { success = false; } if (!success){ delete(job.getId()); } } } return success; } }
JobManager { public Boolean save(Job job){ boolean isCreate = job.getId() == null; boolean success = jobDao.save(job); if (success){ if (isCreate){ if(jobDao.bindApp(job.getAppId(), job.getId())){ success = jobDao.indexJobClass(job.getAppId(), job.getId(), job.getClazz()); } else { success = false; } if (!success){ delete(job.getId()); } } } return success; }  }
JobManager { public Boolean save(Job job){ boolean isCreate = job.getId() == null; boolean success = jobDao.save(job); if (success){ if (isCreate){ if(jobDao.bindApp(job.getAppId(), job.getId())){ success = jobDao.indexJobClass(job.getAppId(), job.getId(), job.getClazz()); } else { success = false; } if (!success){ delete(job.getId()); } } } return success; }  Boolean save(Job job); Boolean delete(Long jobId); }
JobManager { public Boolean save(Job job){ boolean isCreate = job.getId() == null; boolean success = jobDao.save(job); if (success){ if (isCreate){ if(jobDao.bindApp(job.getAppId(), job.getId())){ success = jobDao.indexJobClass(job.getAppId(), job.getId(), job.getClazz()); } else { success = false; } if (!success){ delete(job.getId()); } } } return success; }  Boolean save(Job job); Boolean delete(Long jobId);  }