Package com.sogou.qadev.service.cynthia.bean

Examples of com.sogou.qadev.service.cynthia.bean.Attachment


   * @return
   */
  public static boolean abscut(String fileId, int x, int y,int width, int height) {
    DataAccessSession das = DataAccessFactory.getInstance().getSysDas();
   
    Attachment attachment = das.queryAttachment(DataAccessFactory.getInstance().createUUID(fileId), true);
     
    if (attachment == null)
      return false;
   
        try {
            //读取源图像
            BufferedImage bi = ImageIO.read(new ByteArrayInputStream(attachment.getData()));
            byte[] outByte = abscut(bi, x, y, width, height);
            //更新文件data
            attachment.setData(outByte);
            return das.updateAttachment(attachment);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }finally{
View Full Code Here


        {
          System.err.print("java decode file name exception");
        }

       
        Attachment attachment = das.createAttachment(realFileName, item.get());
       
        FileBean fBean = new FileBean();
        fBean.setId(attachment.getId().getValue());
        fBean.setFilename(attachment.getName());
        fBean.setFileId(attachment.getFileId());
        allFileBean.add(fBean);
       
      }
    }
    if(isError)
View Full Code Here

      tempFile.delete();
     
      //图片上传到分布式文件系统
      //fileId = FileUpDownLoadHandler.postFile("cynthia"+showName+System.currentTimeMillis(), data);
      //图片上传到数据库,针对开源
      Attachment attachment = DataAccessFactory.getInstance().getSysDas().createAttachment(showName, data);
      fileId = ConfigUtil.getCynthiaWebRoot() + "attachment/download.jsp?method=download&id=" + attachment.getId().getValue();
     
    } catch (IOException e) {
      e.printStackTrace();
    }finally{
      StreamCloserManager.closeInputStream(fin);
View Full Code Here

      pstm.setTimestamp(5, createTime);
      pstm.setString(6, fileId==null?"":fileId);
      pstm.setBytes(7, data);
      pstm.execute();

      Attachment attachment = new AttachmentImpl(id);
      attachment.setName(name);
      attachment.setCreateUser(username);
      attachment.setCreateTime(createTime);
      attachment.setData(data);
      attachment.setSize(data.length);
      attachment.setFileId(fileId);

      return attachment;
    }
    catch(Exception e){
      e.printStackTrace();
View Full Code Here

        statement.setLong(i + 1, Long.parseLong(ids[i].getValue()));
      }

      rs = statement.executeQuery();
      while (rs.next()){
        Attachment attachment = new AttachmentImpl(DataAccessFactory.getInstance().createUUID(Long.toString(rs.getLong(1))));
        attachment.setSize(rs.getLong(2));
        attachment.setName(rs.getString(3));
        attachment.setCreateUser(rs.getString(4));
        attachment.setCreateTime(rs.getTimestamp(5));
        if (needData){
          //分布式文件系统
//          byte[] data = FileUpDownLoadHandler.downloadData(rs.getString("file_id"));
         
          byte[] data = rs.getBytes("data");
          attachment.setData(data);
        }
        attachmentList.add(attachment);
      }
    }
    catch (Exception e){
View Full Code Here

TOP

Related Classes of com.sogou.qadev.service.cynthia.bean.Attachment

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.