@Override public void moveJob(String uid, String jobId, String groupId) throws ZeusException { JobDescriptor jd = getJobDescriptor(jobId).getX(); GroupDescriptor gd = getGroupDescriptor(groupId); if (gd.isDirectory()) { throw new ZeusException("非法操作"); } updateJob(uid, jd, jd.getOwner(), groupId); }
@Override public void moveGroup(String uid, String groupId, String newParentGroupId) throws ZeusException { GroupDescriptor gd = getGroupDescriptor(groupId); GroupDescriptor parent = getGroupDescriptor(newParentGroupId); if (!parent.isDirectory()) { throw new ZeusException("非法操作"); } updateGroup(uid, gd, gd.getOwner(), newParentGroupId); }
@Override public JobDescriptor createJob( String user, String jobName, String parentGroup, JobRunType jobType) throws ZeusException { GroupDescriptor parent = getGroupDescriptor(parentGroup); if (parent.isDirectory()) { throw new ZeusException("目录组下不得创建Job"); } JobDescriptor job = new JobDescriptor(); job.setOwner(user); job.setName(jobName); job.setGroupId(parentGroup); job.setJobType(jobType); job.setPreProcessers(Arrays.asList((Processer) new DownloadProcesser())); JobPersistence persist = PersistenceAndBeanConvert.convert(job); persist.setGmtCreate(new Date()); persist.setGmtModified(new Date()); getHibernateTemplate().save(persist); return PersistenceAndBeanConvert.convert(persist).getX(); }