Package com.taobao.zeus.store.mysql.persistence

Examples of com.taobao.zeus.store.mysql.persistence.FilePersistence


  }
  public static FilePersistence convert(FileDescriptor file){
    if(file==null){
      return null;
    }
    FilePersistence persistence=new FilePersistence();
    persistence.setContent(file.getContent());
    persistence.setId(file.getId()==null?null:Long.valueOf(file.getId()));
    persistence.setName(file.getName());
    persistence.setOwner(file.getOwner());
    persistence.setParent(file.getParent()==null?null:Long.valueOf(file.getParent()));
    persistence.setType(file.isFolder()?FilePersistence.FOLDER:FilePersistence.FILE);
    persistence.setGmtCreate(file.getGmtCreate());
    persistence.setGmtModified(file.getGmtModified());
    return persistence;
  }
View Full Code Here


    FileManager {

  @Override
  public FileDescriptor addFile(String uid, String parentId, String name,
      boolean folder) {
    FilePersistence fp = new FilePersistence();
    fp.setName(name);
    fp.setOwner(uid);
    fp.setParent(Long.valueOf(parentId));
    fp.setType(folder ? FilePersistence.FOLDER : FilePersistence.FILE);
    getHibernateTemplate().save(fp);
    return PersistenceAndBeanConvert.convert(fp);
  }
View Full Code Here

    return PersistenceAndBeanConvert.convert(fp);
  }

  @Override
  public void deleteFile(String fileId) {
    FilePersistence fp = (FilePersistence) getHibernateTemplate().get(
        FilePersistence.class, Long.valueOf(fileId));
    getHibernateTemplate().delete(fp);
  }
View Full Code Here

    getHibernateTemplate().delete(fp);
  }

  @Override
  public FileDescriptor getFile(String id) {
    FilePersistence fp = (FilePersistence) getHibernateTemplate().get(
        FilePersistence.class, Long.valueOf(id));
    if (fp != null) {
      return PersistenceAndBeanConvert.convert(fp);
    }
    return null;
View Full Code Here

            List<FilePersistence> list = query.list();
            if (list == null || list.isEmpty()) {
              if (list == null) {
                list = new ArrayList<FilePersistence>();
              }
              FilePersistence personal = new FilePersistence();
              personal.setName(PERSONAL);
              personal.setOwner(uid);
              personal.setType(FilePersistence.FOLDER);
              session.save(personal);
              FilePersistence common = new FilePersistence();
              common.setName(SHARE);
              common.setOwner(uid);
              common.setType(FilePersistence.FOLDER);
              session.save(common);

              list.add(personal);
              list.add(common);
            }
View Full Code Here

TOP

Related Classes of com.taobao.zeus.store.mysql.persistence.FilePersistence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.