Examples of FileBean


Examples of org.cipres.treebase.web.model.FileBean

  public List<FileBean> getFiles(HttpServletRequest request) throws Exception {
    if (request instanceof MultipartHttpServletRequest) {

      MultipartHttpServletRequest multiReq = (MultipartHttpServletRequest) request;
      MultipartFile file = null;
      FileBean fileBean = null;
      List<FileBean> files = new ArrayList<FileBean>();
      for (Object o : multiReq.getFileMap().values()) {
        if (o != null) {
          file = (MultipartFile) o;
          if (!file.isEmpty()) {
            fileBean = new FileBean();
            fileBean.setName(file.getOriginalFilename());
            fileBean.setData(file.getBytes());
            files.add(fileBean);
          }
        }
      }
      return files;
View Full Code Here

Examples of org.cipres.treebase.web.model.FileBean

  public List<FileBean> getFiles(HttpServletRequest request) throws Exception {
    if (request instanceof MultipartHttpServletRequest) {

      MultipartHttpServletRequest multiReq = (MultipartHttpServletRequest) request;
      MultipartFile file = null;
      FileBean bean = null;
      List<FileBean> files = new ArrayList<FileBean>();
      for (Object o : multiReq.getFileMap().values()) {
        if (o != null) {
          file = (MultipartFile) o;
          if (!file.isEmpty()) {
            bean = new FileBean();
            bean.setName(file.getOriginalFilename());
            bean.setData(file.getBytes());
            files.add(bean);
          }
        }
      }
      return files;
View Full Code Here

Examples of org.cipres.treebase.web.model.FileBean

   */
  public List<FileBean> getFiles(HttpServletRequest request) throws Exception {

    MultipartHttpServletRequest multiReq = (MultipartHttpServletRequest) request;
    MultipartFile file = null;
    FileBean bean = null;
    List<FileBean> files = new ArrayList<FileBean>();

    for (Object o : multiReq.getFileMap().values()) {
      if (o != null) {
        file = (MultipartFile) o;
        if (!file.isEmpty()) {
          bean = new FileBean();
          bean.setName(file.getOriginalFilename());
          bean.setData(file.getBytes());
          files.add(bean);
        }
      }
    }
    return files;
View Full Code Here

Examples of org.cipres.treebase.web.model.FileBean

   */
  public List<FileBean> getFiles(HttpServletRequest request) throws Exception {

    MultipartHttpServletRequest multiReq = (MultipartHttpServletRequest) request;
    MultipartFile file = null;
    FileBean bean = null;
    List<FileBean> files = new ArrayList<FileBean>();

    for (Object o : multiReq.getFileMap().values()) {
      if (o != null) {
        file = (MultipartFile) o;
        if (!file.isEmpty()) {
          bean = new FileBean();
          bean.setName(file.getOriginalFilename());
          bean.setData(file.getBytes());
          files.add(bean);
        }
      }
    }
    return files;
View Full Code Here

Examples of org.openqreg.bean.FileBean

      fsa.setStatus(AjaxWidgetAnswer.STATUS_NOSERVICE);
      return fsa;
    }
    User user = Dispatcher.getInstance().getUser(userId);
    // we have access carry on...
    FileBean fileBean = fsr.getFile();
    Collection<String> fileShareUsers = fsr.getFileShareUsers();
    fsa.setFile(fileBean);
    Connection con = null;
    try {
      try {
        // add default answer text, listboxtexts, guisettings,
        // containers
        addDefaultAnswer(user, fsr, fsa);

        con = DbHandler.getConnection();
        con.setAutoCommit(false);
        fileBean.setUpdatedby(userId);
        fileBean.setTsupdated(new Timestamp(System.currentTimeMillis()));
        fileBean.store(con);

        // service groups
        Collection<FileshareuserBean> col = FileshareuserFinder
            .findByFileid(con, fileBean.getId());
        // loop exsisting FileshareuserBean update or remove based on
        // status
        for (FileshareuserBean fsuBean : col) {
          if (!fileShareUsers.contains(fsuBean.getUserid())) {
            fsuBean.remove(con);
          }
          fileShareUsers.remove(fsuBean.getUserid());
        }
        User fileUser;
        // loop remaining services and create them
        for (String uId : fileShareUsers) {
          FileshareuserBean fsuBean = new FileshareuserBean();
          fsuBean.setFileid(fileBean.getId());
          fsuBean.setUserid(uId);
          fileUser = (User) UserFinderBase
              .findByPrimaryKey(new UserKey(uId));
          if (null != fileUser) {
            //set correct label ending up on switch
            fsuBean.setUserdescription(fileUser.getFirstname()
                + " " + fileUser.getLastname());
          }
          fsuBean.create(con);
        }
        con.commit();
        // sa.setStatus(AjaxWidgetAnswer.STATUS_UPDATED);
        // Dispatcher.getInstance().populateAccessTable();
        // Collection<FileBean> col =
        // FileFinder.findByOwner(user.getId());
        fileBean.setFileShareUserCol(FileshareuserFinder
            .findByFileid(fileBean.getId()));
        // fsa.setServiceGroups(ServicegroupFinder.findByServiceid(fsr
        // .getServiceId()));
        // fsa.setUserGroups(UsergroupFinderBase.findAll());
      } finally {
        if (null != con) {
View Full Code Here

Examples of org.openqreg.bean.FileBean

      User user, LoginAnswer loginAnswer, FetchData fetch, String langId)
      throws ServletException, IOException {

    Long fileId = fetch.getValueAsLong("fileId");

    FileBean fileToGet = null;
    try {
      fileToGet = (FileBean) FileFinder.findByPrimaryKey(new FileKey(
          fileId));
    } catch (SQLException e) {
      log.log(Level.ERROR, "giveService() error finding file:", e);

    }

    // if(disp.checkAccess(loginAnswer.getUserId(),"START_PAGE")){
    try {
      if (null != fileToGet
          && null != fileToGet.getService()
          && Dispatcher.getInstance().checkAccess(
              loginAnswer.getUserId(), fileToGet.getService())) {

        // idea, get picture info from db including needed service to
        // see
        // picture, if user has service serv picture, else dont...

        String fileName = fileToGet.getPath() + fileToGet.getName();
        File checkFile = new File(fileName);
        if (checkFile.exists()) {
          File file = new File(fileName);

          // res.setContentType("image/JPEG");
          res.setContentType("application/download");
          res.setHeader("Content-Disposition",
              "attachment; filename=\"" + fileToGet.getName()
                  + "\"");

          // res.setContentType(fileToGet.getContenttype());
          // res.setHeader(arg0, arg1)
          ServletOutputStream servletoutputstream = res
View Full Code Here

Examples of org.openqreg.bean.FileBean

              + " <br/>");

        } else {

          // write metadata to db
          FileBean file = new FileBean();
          file.setName(fh.getFileName());
          file.setSize(Integer.valueOf(fh.getFileSize()));
          // file.setContenttype(?);
          file.setPath(fileSharePath);
          file.setOwner(user.getId());
          file.setCreatedby(user.getId());
          file.setService("FILESHARE_DOWNLOAD");
          file.create();

          // fileSharePath from context.xml
          fh.setPath(fileSharePath);
          fh.writeFileToDisk();
          // String answer = XMLImporter.importFile(fh);
View Full Code Here

Examples of org.openqreg.bean.FileBean

* @return A populated FileBean
*
* @throws SQLException
*/
protected static FileBean populate(ResultSet rs) throws SQLException {
FileBean valueObject = new FileBean();
valueObject.setId((Long)rs.getObject(1));
valueObject.setName((String)rs.getObject(2));
valueObject.setPath((String)rs.getObject(3));
valueObject.setSize((Integer)rs.getObject(4));
valueObject.setContenttype((String)rs.getObject(5));
valueObject.setDescription((String)rs.getObject(6));
valueObject.setService((String)rs.getObject(7));
valueObject.setOwner((String)rs.getObject(8));
valueObject.setCreatedby((String)rs.getObject(9));
valueObject.setUpdatedby((String)rs.getObject(10));
valueObject.setTscreated((java.sql.Timestamp)rs.getObject(11));
valueObject.setTsupdated((java.sql.Timestamp)rs.getObject(12));
return valueObject;
}
View Full Code Here

Examples of org.openqreg.bean.FileBean

* @throws SQLException
*/
public static Collection<FileBean> findAll(Connection con) throws SQLException {
PreparedStatement pStmt = null;
ResultSet rs = null;
FileBean valueObject = null;
Collection<FileBean> col = Collections.synchronizedList(new ArrayList<FileBean>());
try{
pStmt = con.prepareStatement(FIND_ALL_STATEMENT);
rs = pStmt.executeQuery();
while (rs.next()){
valueObject = populate(rs);
valueObject.afterPopulate(con);
col.add(valueObject);
}
return col;
}finally{
if(null!=rs){
View Full Code Here

Examples of org.openqreg.bean.FileBean

* @throws SQLException
*/
public static Object findByPrimaryKey(Connection con, PrimaryKey key) throws SQLException {
PreparedStatement pStmt = null;
ResultSet rs = null;
FileBean valueObject = null;
FileKey primaryKey = (FileKey) key;
try{
pStmt = con.prepareStatement(FileBeanBase.SELECT_STATEMENT);
pStmt.setObject(1, primaryKey.getId());
rs = pStmt.executeQuery();
while (rs.next()){
valueObject = populate(rs);
valueObject.afterPopulate(con);
}
return valueObject;
}finally{
if(null!=rs){
rs.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.