Package org.c3s.rpgplayer.db.beans

Examples of org.c3s.rpgplayer.db.beans.DBFilesBean


    if (files != null) {
      result = new ArrayList<DBFilesBean>();
      for(String key: files.keySet()) {
        long file_id = Long.valueOf(key);
        Map<String, Object> info = (Map<String, Object>)files.get(key);
        DBFilesBean bean = DbAccess.filesAccess.getFileByGameIdAndFileId(game_id, file_id);
        bean.setState((String) info.get("state"));
        bean.setLinkType((String) info.get("type"));
        if (update && bean.getGameFileId() != null && ("insert".equals(bean.getState()) || "none".equals(bean.getState()))) {
          DbAccess.gameFilesAccess.updateByPrimaryKey(mapper.map(bean, DBGameFilesBean.class), bean.getGameFileId());
        } else if (update && bean.getGameFileId() != null && "delete".equals(bean.getState())) {
          DbAccess.gameFilesAccess.deleteByPrimaryKey(bean.getGameFileId());
        } else if (update && bean.getGameFileId() == null && "insert".equals(bean.getState())) {
          DBGameFilesBean newBean = new DBGameFilesBean().
              setFileId(file_id).setGameId(game_id).setLinkType(bean.getLinkType()).setIsActive(1);
          DbAccess.gameFilesAccess.insert(newBean);
        }
       
        if (!update || !"delete".equals(bean.getState())) {
          result.add(bean);
        }
      }
    }
    return result;
View Full Code Here


        FileUtils.copyFile(file.getUploadedFile(), newFile);
       
        /**
         * save to base
         */
        DBFilesBean dbfile = new DBFilesBean();
        dbfile.setIsTemporary(1);
        dbfile.setPath(path + newName);
        dbfile.setTemporaryName(newName);
        dbfile.setName(filename);
        dbfile.setSize(file.getFileSize());
        dbfile.setMimeType(file.getRealContentType());
        dbfile.setAddtitional(gson.toJson(additional));
       
        DbAccess.filesAccess.insert(dbfile);
        //
        result.put("fileinfo", dbfile);
       
View Full Code Here

TOP

Related Classes of org.c3s.rpgplayer.db.beans.DBFilesBean

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.