Package org.mapache.business

Examples of org.mapache.business.MapacheException


    public void saveCategory(Category _category) throws MapacheException{
        categoryDataAccess.saveCategory(_category);
    }
    public void deleteCategory(Category category) throws MapacheException {
        if(category.getTopicCount()>0){
            throw new MapacheException("Category was found in at least one topic, can not delete category",null);
        }
        else{
            categoryDataAccess.deleteCategory(category);           
        }
    }
View Full Code Here


        topicDataAccess.saveTopic(_topic);
    }
   
    public void deleteTopic(Topic topic) throws MapacheException {
        if(topic.getReplyCount()>0){
            throw new MapacheException("Topic contains replies, can't delete blog",null);
        }
        else{
            topicDataAccess.deleteTopic(topic);
        }
    }
View Full Code Here

            loadResultInList(blogs,resultSet);
            _loadAllBlogsStmt.close();
        }
        catch(SQLException e){
            blogs=null;
            throw new MapacheException("Error occurred when loading blogs from database!",e);
        }
        catch (DAOException e) {
            blogs=null;
            throw new MapacheException("Error occurred when loading blogs from database!",e);
        }
        finally{
            MySQLDAOFactory.freeConnection(_oConn);
        }
        return blogs;
View Full Code Here

            _saveBlogStmt.setString(2, blog.getDescription());
            _saveBlogStmt.setInt(3, blog.getBlogID());
            _saveBlogStmt.execute();
            _saveBlogStmt.close();
        } catch (SQLException e) {
            throw new MapacheException("Error occurred when saving blog ", e);
        } catch (DAOException e) {
             throw new MapacheException("Error occurred when saving blog ", e);
        } finally {
            MySQLDAOFactory.freeConnection(_oConn);
        }
    }
View Full Code Here

                    _oConn.prepareStatement("DELETE FROM Blog WHERE BlogID = ?");
            _deleteBlogStmt.setInt(1, blog.getBlogID());
            _deleteBlogStmt.execute();
            _deleteBlogStmt.close();
        } catch (SQLException e) {
            throw new MapacheException("An error occurred when deleting the blog",e);
        } catch (DAOException e) {
            throw new MapacheException("An error occurred when deleting the blog",e);
        } finally {
            MySQLDAOFactory.freeConnection(_oConn);
        }
    }
View Full Code Here

    public Collection<User> getUsers() throws MapacheException {
        Collection<User> users = null;
        try {
            users = userDataAccess.searchUsers();
        } catch (DAOException e) {
            throw new MapacheException("Unable to find users", e);
        }
        return users;
    }
View Full Code Here

            _createBlogStmt.setString(1, newBlog.getTitle());
            _createBlogStmt.setString(2, newBlog.getDescription());
            _createBlogStmt.execute();
            _createBlogStmt.close();
        } catch (SQLException e) {
            throw new MapacheException("An error occurred when creating a new blog", e);
        } catch (DAOException e) {
             throw new MapacheException("An error occurred when creating a new blog", e);
        } finally {
            MySQLDAOFactory.freeConnection(_oConn);
        }
    }
View Full Code Here

            if (!result.next())
                b = null;
            b = fetchRecordInBlogObject(result);
            _loadBlogByBlogIDStmt.close();
        } catch (SQLException e) {
            throw new MapacheException("An error occurred when loading blog",e);
        } catch (DAOException e) {
             throw new MapacheException("An error occurred when loading blog",e);
        } finally {
            MySQLDAOFactory.freeConnection(_oConn);
        }
        return b;
    }
View Full Code Here

            loadResultInList(blogs,resultSet);
            _loadAllBlogsStmt.close();
        }
        catch(SQLException e){
            blogs=null;
            throw new MapacheException("Error occurred when loading blogs from database!",e);
        }
        catch (DAOException e) {
            blogs=null;
            throw new MapacheException("Error occurred when loading blogs from database!",e);
        }
        finally{
            MySQLDAOFactory.freeConnection(_oConn);
        }
        return blogs;
View Full Code Here

            if (!result.next())
                b = null;
            b = fetchRecordInBlogObject(result);
            _loadBlogByBlogIDStmt.close();
        } catch (SQLException e) {
            throw new MapacheException("An error occurred when loading blog",e);
        } catch (DAOException e) {
             throw new MapacheException("An error occurred when loading blog",e);
        } finally {
            MySQLDAOFactory.freeConnection(_oConn);
        }
        return b;
    }
View Full Code Here

TOP

Related Classes of org.mapache.business.MapacheException

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.