Пример #1
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());
 }
Пример #2
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);
  }
Пример #3
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);
  }