Пример #1
0
 @Override
 public void grantGroupOwner(String granter, String uid, String groupId) throws ZeusException {
   GroupDescriptor gd = getGroupDescriptor(groupId);
   if (gd != null) {
     updateGroup(granter, gd, uid, gd.getParent());
   }
 }
Пример #2
0
 @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);
 }
Пример #3
0
 @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);
 }
Пример #4
0
 @Override
 public void updateGroup(String user, GroupDescriptor group) throws ZeusException {
   GroupPersistence old =
       (GroupPersistence)
           getHibernateTemplate().get(GroupPersistence.class, Integer.valueOf(group.getId()));
   updateGroup(
       user, group, old.getOwner(), old.getParent() == null ? null : old.getParent().toString());
 }
Пример #5
0
 @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();
 }
Пример #6
0
  @Override
  public GroupDescriptor createGroup(
      String user, String groupName, String parentGroup, boolean isDirectory) throws ZeusException {
    if (parentGroup == null) {
      throw new ZeusException("parent group may not be null");
    }
    GroupDescriptor group = new GroupDescriptor();
    group.setOwner(user);
    group.setName(groupName);
    group.setParent(parentGroup);
    group.setDirectory(isDirectory);

    GroupValidate.valide(group);

    GroupPersistence persist = PersistenceAndBeanConvert.convert(group);
    persist.setGmtCreate(new Date());
    persist.setGmtModified(new Date());

    getHibernateTemplate().save(persist);
    return PersistenceAndBeanConvert.convert(persist);
  }
Пример #7
0
  public void updateGroup(String user, GroupDescriptor group, String owner, String parent)
      throws ZeusException {

    GroupPersistence old =
        (GroupPersistence)
            getHibernateTemplate().get(GroupPersistence.class, Integer.valueOf(group.getId()));

    GroupPersistence persist = PersistenceAndBeanConvert.convert(group);

    persist.setOwner(owner);
    if (parent != null) {
      persist.setParent(Integer.valueOf(parent));
    }

    // 以下属性不允许修改,强制采用老的数据
    persist.setDirectory(old.getDirectory());
    persist.setGmtCreate(old.getGmtCreate());
    persist.setGmtModified(new Date());

    getHibernateTemplate().update(persist);
  }