2013년 8월 11일 일요일

[Struts, Struts2, Struts Spring, StrutsFramework, Struts MVC, Struts게시판, 스프럿츠게시판, Struts Action, Struts DAO, struts교육, struts강좌, struts2교육, struts2강좌]스트럿츠 멀티 게시판4. 관리자( 2 ) 모델 패키지 관련 파일입니다.

The is_reply to set.
        */
        public void setIs_reply(String is_reply) {
                this.is_reply = is_reply;
        }
        /**
        * @return Returns the board_code.
        */
        public String getBoard_code() {
                return board_code;
        }
        /**
        * @param board_code The board_code to set.
        */
        public void setBoard_code(String board_code) {
                this.board_code = board_code;
        }
        /**
        * @return Returns the board_name.
        */
        public String getBoard_name() {
                return board_name;
        }
        /**
        * @param board_name The board_name to set.
        */
        public void setBoard_name(String board_name) {
                this.board_name = board_name;
        }
        /**
        * @return Returns the bottom_html.
        */
        public String getBottom_html() {
                return bottom_html;
        }
        /**
        * @param bottom_html The bottom_html to set.
        */
        public void setBottom_html(String bottom_html) {
                this.bottom_html = bottom_html;
        }
        /**
        * @return Returns the is_file.
        */
        public String getIs_file() {
                return is_file;
        }
        /**
        * @param is_file The is_file to set.
        */
        public void setIs_file(String is_file) {
                this.is_file = is_file;
        }
        /**
        * @return Returns the is_memo.
        */
        public String getIs_memo() {
                return is_memo;
        }
        /**
        * @param is_memo The is_memo to set.
        */
        public void setIs_memo(String is_memo) {
                this.is_memo = is_memo;
        }
        /**
        * @return Returns the is_page_count.
        */
        public String getIs_page_count() {
                return is_page_count;
        }
        /**
        * @param is_page_count The is_page_count to set.
        */
        public void setIs_page_count(String is_page_count) {
                this.is_page_count = is_page_count;
        }
        /**
        * @return Returns the is_search.
        */
        public String getIs_search() {
                return is_search;
        }
        /**
        * @param is_search The is_search to set.
        */
        public void setIs_search(String is_search) {
                this.is_search = is_search;
        }
        /**
        * @return Returns the left_html.
        */
        public String getLeft_html() {
                return left_html;
        }
        /**
        * @param left_html The left_html to set.
        */
        public void setLeft_html(String left_html) {
                this.left_html = left_html;
        }
        /**
        * @return Returns the list_per_page.
        */
        public String getList_per_page() {
                return list_per_page;
        }
        /**
        * @param list_per_page The list_per_page to set.
        */
        public void setList_per_page(String list_per_page) {
                this.list_per_page = list_per_page;
        }
        /**
        * @return Returns the member_level.
        */
        public String getMember_level() {
                return member_level;
        }
        /**
        * @param member_level The member_level to set.
        */
        public void setMember_level(String member_level) {
                this.member_level = member_level;
        }
        /**
        * @return Returns the page_count.
        */
        public String getPage_count() {
                return page_count;
        }
        /**
        * @param page_count The page_count to set.
        */
        public void setPage_count(String page_count) {
                this.page_count = page_count;
        }
        /**
        * @return Returns the right_html.
        */
        public String getRight_html() {
                return right_html;
        }
        /**
        * @param right_html The right_html to set.
        */
        public void setRight_html(String right_html) {
                this.right_html = right_html;
        }
        /**
        * @return Returns the table_color1.
        */
        public String getTable_color1() {
                return table_color1;
        }
        /**
        * @param table_color1 The table_color1 to set.
        */
        public void setTable_color1(String table_color1) {
                this.table_color1 = table_color1;
        }
        /**
        * @return Returns the table_color2.
        */
        public String getTable_color2() {
                return table_color2;
        }
        /**
        * @param table_color2 The table_color2 to set.
        */
        public void setTable_color2(String table_color2) {
                this.table_color2 = table_color2;
        }
        /**
        * @return Returns the top_html.
        */
        public String getTop_html() {
                return top_html;
        }
        /**
        * @param top_html The top_html to set.
        */
        public void setTop_html(String top_html) {
                this.top_html = top_html;
        }
}

/////////////// ManagerBoardForm.java ///////////////////////////
package manager.model;

import org.apache.struts.action.ActionForm;

public class ManagerBoardForm extends ActionForm
{
        private String action = null;
        private String board_code = null;
        private String board_name = null;
        private String top_html = null;
        private String left_html = null;
        private String right_html = null;
        private String bottom_html = null;
        private String is_page_count = null;
        private String is_search = null;
    private String is_file = null;
    private String is_memo = null;
    private String is_reply = null;
        private String member_level = null;
        private String list_per_page = null;
        private String page_count = null;
        private String table_color1 = null;
        private String table_color2 = null;
       
       
       
        /**
        * @return Returns the is_reply.
        */
        public String getIs_reply() {
                return is_reply;
        }
        /**
        * @param is_reply The is_reply to set.
        */
        public void setIs_reply(String is_reply) {
                this.is_reply = is_reply;
        }
        /**
        * @return Returns the board_name.
        */
        public String getBoard_name() {
                return board_name;
        }
        /**
        * @param board_name The board_name to set.
        */
        public void setBoard_name(String board_name) {
                this.board_name = board_name;
        }
        /**
        * @return Returns the is_memo.
        */
        public String getIs_memo() {
                return is_memo;
        }
        /**
        * @param is_memo The is_memo to set.
        */
        public void setIs_memo(String is_memo) {
                this.is_memo = is_memo;
        }
        /**
        * @return Returns the action.
        */
        public String getAction() {
                return action;
        }
        /**
        * @param action The action to set.
        */
        public void setAction(String action) {
                this.action = action;
        }
        /**
        * @return Returns the bottom_html.
        */
        public String getBottom_html() {
                return bottom_html;
        }
        /**
        * @param bottom_html The bottom_html to set.
        */
        public void setBottom_html(String bottom_html) {
                this.bottom_html = bottom_html;
        }
        /**
        * @return Returns the is_file.
        */
        public String getIs_file() {
                return is_file;
        }
        /**
        * @param is_file The is_file to set.
        */
        public void setIs_file(String is_file) {
                this.is_file = is_file;
        }
        /**
        * @return Returns the is_page_count.
        */
        public String getIs_page_count() {
                return is_page_count;
        }
        /**
        * @param is_page_count The is_page_count to set.
        */
        public void setIs_page_count(String is_page_count) {
                this.is_page_count = is_page_count;
        }
        /**
        * @return Returns the is_search.
        */
        public String getIs_search() {
                return is_search;
        }
        /**
        * @param is_search The is_search to set.
        */
        public void setIs_search(String is_search) {
                this.is_search = is_search;
        }
       
        /**
        * @return Returns the left_html.
        */
        public String getLeft_html() {
                return left_html;
        }
        /**
        * @param left_html The left_html to set.
        */
        public void setLeft_html(String left_html) {
                this.left_html = left_html;
        }
        /**
        * @return Returns the list_per_page.
        */
        public String getList_per_page() {
                return list_per_page;
        }
        /**
        * @param list_per_page The list_per_page to set.
        */
        public void setList_per_page(String list_per_page) {
                this.list_per_page = list_per_page;
        }
       
        /**
        * @return Returns the board_code.
        */
        public String getBoard_code() {
                return board_code;
        }
        /**
        * @param board_code The board_code to set.
        */
        public void setBoard_code(String board_code) {
                this.board_code = board_code;
        }
        /**
        * @return Returns the page_count.
        */
        public String getPage_count() {
                return page_count;
        }
        /**
        * @param page_count The page_count to set.
        */
        public void setPage_count(String page_count) {
                this.page_count = page_count;
        }
        /**
        * @return Returns the right_html.
        */
        public String getRight_html() {
                return right_html;
        }
        /**
        * @param right_html The right_html to set.
        */
        public void setRight_html(String right_html) {
                this.right_html = right_html;
        }
        /**
        * @return Returns the table_color1.
        */
        public String getTable_color1() {
                return table_color1;
        }
        /**
        * @param table_color1 The table_color1 to set.
        */
        public void setTable_color1(String table_color1) {
                this.table_color1 = table_color1;
        }
        /**
        * @return Returns the table_color2.
        */
        public String getTable_color2() {
                return table_color2;
        }
        /**
        * @param table_color2 The table_color2 to set.
        */
        public void setTable_color2(String table_color2) {
                this.table_color2 = table_color2;
        }
        /**
        * @return Returns the top_html.
        */
        public String getTop_html() {
                return top_html;
        }
        /**
        * @param top_html The top_html to set.
        */
        public void setTop_html(String top_html) {
                this.top_html = top_html;
        }
        /**
        * @return Returns the user_level.
        */
        public String getMember_level() {
                return member_level;
        }
        /**
        * @param user_level The user_level to set.
        */
        public void setMember_level(String member_level) {
                this.member_level = member_level;
        }
}

/////////////// ManagerDAO.java ///////////////////////////
package manager.model;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import oracle.jdbc.driver.OracleResultSet;
import oracle.sql.CLOB;
import java.io.CharArrayReader;
import java.io.Reader;
import java.io.Writer;
import java.util.List;
import java.util.ArrayList;

import com.bitmechanic.sql.ConnectionPoolManager;
import multiboard.KKJLog;


public class ManagerDAO
{
        Connection con=null;
    PreparedStatement pstmt=null;
    ResultSet rs = null;
    String sql = "";
       
    /*
    *                개요                :  게시판 마스터 리스트
    *                작성일            :        2005-08-10       
    *                작성자        :        김길재
    *                수정자        :
    */
    public List list()
    {
            List BoardMasterList = new ArrayList();
       
        try
                {
                con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
         
               
            String sql = "SELECT * FROM BOARD_MST ORDER BY BOARD_CODE DESC";
             
            pstmt = con.prepareStatement(sql);
           
            rs = pstmt.executeQuery();

            while(rs.next())
            { 

                    BoardMasterVO BoardMaster = new BoardMasterVO();
                   
                    BoardMaster.setBoard_code( rs.getString( "BOARD_CODE" ) );
                    BoardMaster.setBoard_name( rs.getString( "BOARD_NAME" ) );
                    BoardMaster.setTable_color1( rs.getString( "TABLE_COLOR1" ) );
                    BoardMaster.setTable_color2( rs.getString( "TABLE_COLOR2" ) );
                    BoardMaster.setIs_page_count( rs.getString( "IS_PAGE_COUNT" ) );
                    BoardMaster.setIs_search( rs.getString( "IS_SEARCH" ) );
                    BoardMaster.setIs_file( rs.getString( "IS_FILE" ) );
                    BoardMaster.setIs_memo( rs.getString( "IS_MEMO" ) );
                    BoardMaster.setIs_reply( rs.getString( "IS_Reply" ) );
                    BoardMaster.setMember_level( Integer.toString( rs.getInt( "MEMBER_LEVEL" ) ) );
                    BoardMaster.setList_per_page( Integer.toString( rs.getInt( "LIST_PER_PAGE" ) ) );
                    BoardMaster.setPage_count( Integer.toString( rs.getInt( "PAGE_COUNT" ) ) );

                BoardMasterList.add( BoardMaster );
            }
            con.commit();
        }
        catch (Exception e)
                {
                try
                        {
                        con.rollback();
                        }
                catch( Exception e1 )
                        {}
                KKJLog.info( "//////////////////////////////////////////////" );
                KKJLog.info( "list Error : " + e.toString() );
                KKJLog.info( "//////////////////////////////////////////////" );
                return null;
        }
        finally
        {
                try
                {

                        if ( rs != null )
                                rs.close();
                        if ( pstmt != null )
                                pstmt.close();
                        if ( con != null )
                                con.close();
                }
                catch ( Exception ignore )
                {
                }
        }

        return BoardMasterList;
   
        }   
   
    /*
    *                개요                :  메인 화면용 게시판 마스터 리스트
    *                작성일            :        2005-08-10       
    *                작성자        :        김길재
    *                수정자        :
    */
    public List list_index()
    {
            List BoardMasterList = new ArrayList();
       
        try
                {
                con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
         
               
            String sql = "SELECT * FROM BOARD_MST ORDER BY BOARD_CODE";
             
            pstmt = con.prepareStatement(sql);
           
            rs = pstmt.executeQuery();

            while(rs.next())
            { 

                    BoardMasterVO BoardMaster = new BoardMasterVO();
                   
                    BoardMaster.setBoard_code( rs.getString( "BOARD_CODE" ) );
                    BoardMaster.setBoard_name( rs.getString( "BOARD_NAME" ) );
                    //BoardMaster.setTable_color1( rs.getString( "TABLE_COLOR1" ) );
                    //BoardMaster.setTable_color2( rs.getString( "TABLE_COLOR2" ) );
                    //BoardMaster.setIs_page_count( rs.getString( "IS_PAGE_COUNT" ) );
                    //BoardMaster.setIs_search( rs.getString( "IS_SEARCH" ) );
                    //BoardMaster.setIs_file( rs.getString( "IS_FILE" ) );
                    //BoardMaster.setIs_memo( rs.getString( "IS_MEMO" ) );
                    //BoardMaster.setIs_reply( rs.getString( "IS_Reply" ) );
                    //BoardMaster.setMember_level( Integer.toString( rs.getInt( "MEMBER_LEVEL" ) ) );
                    //BoardMaster.setList_per_page( Integer.toString( rs.getInt( "LIST_PER_PAGE" ) ) );
                    //BoardMaster.setPage_count( Integer.toString( rs.getInt( "PAGE_COUNT" ) ) );

                BoardMasterList.add( BoardMaster );
            }
            con.commit();
        }
        catch (Exception e)
                {
                try
                        {
                        con.rollback();
                        }
                catch( Exception e1 )
                        {}
                KKJLog.info( "//////////////////////////////////////////////" );
                KKJLog.info( "list_index Error : " + e.toString() );
                KKJLog.info( "//////////////////////////////////////////////" );
                return null;
        }
        finally
        {
                try
                {

                        if ( rs != null )
                                rs.close();
                        if ( pstmt != null )
                                pstmt.close();
                        if ( con != null )
                                con.close();
                }
                catch ( Exception ignore )
                {
                }
        }

        return BoardMasterList;
   
        }   
   
    /*
    *                개요                :  게시판 객체 리턴
    *                작성일            :        2005-08-10       
    *                작성자        :        김길재
    *                수정자        :
    */
    public BoardMasterVO view( String board_code )
    {
            BoardMasterVO BoardMaster = new BoardMasterVO();
       
        try
                {
                con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
         
               
            String sql = "SELECT * FROM BOARD_MST WHERE BOARD_CODE = ?";
             
            pstmt = con.prepareStatement(sql);
           
            pstmt.setString( 1 , board_code );
           
            rs = pstmt.executeQuery();

            while(rs.next())
            { 
                    BoardMaster.setBoard_code( rs.getString( "BOARD_CODE" ) );
                    BoardMaster.setBoard_name( rs.getString( "BOARD_NAME" ) );
                    BoardMaster.setTable_color1( rs.getString( "TABLE_COLOR1" ) );
                    BoardMaster.setTable_color2( rs.getString( "TABLE_COLOR2" ) );
                    BoardMaster.setIs_page_count( rs.getString( "IS_PAGE_COUNT" ) );
                    BoardMaster.setIs_search( rs.getString( "IS_SEARCH" ) );
                    BoardMaster.setIs_file( rs.getString( "IS_FILE" ) );
                    BoardMaster.setIs_memo( rs.getString( "IS_MEMO" ) );
                    BoardMaster.setIs_reply( rs.getString( "IS_REPLY" ) );
                    BoardMaster.setMember_level( Integer.toString( rs.getInt( "MEMBER_LEVEL" ) ) );
                    BoardMaster.setList_per_page( Integer.toString( rs.getInt( "LIST_PER_PAGE" ) ) );
                    BoardMaster.setPage_count( Integer.toString( rs.getInt( "PAGE_COUNT" ) ) );
                   
                    //TOP_HTML 읽어오기
                StringBuffer sbuf = new StringBuffer();
                Reader reader = rs.getCharacterStream( "TOP_HTML" );
                char[] buffer = new char[ 1024 ];
                int read;
                while( ( read = reader.read( buffer , 0 , 1024 ) ) != -1 )
                {
                        sbuf.append( buffer, 0 , read );
                }
                reader.close();
               
                BoardMaster.setTop_html( sbuf.toString() );
               
                //LEFT_HTML 읽어오기
                sbuf = new StringBuffer();
                reader = rs.getCharacterStream( "LEFT_HTML" );
                buffer = new char[ 1024 ];
                while( ( read = reader.read( buffer , 0 , 1024 ) ) != -1 )
                {
                        sbuf.append( buffer, 0 , read );
                }
                reader.close();
               
                BoardMaster.setLeft_html( sbuf.toString() );
               
                //RIGHT_HTML 읽어오기
                sbuf = new StringBuffer();
                reader = rs.getCharacterStream( "RIGHT_HTML" );
                buffer = new char[ 1024 ];
                while( ( read = reader.read( buffer , 0 , 1024 ) ) != -1 )
                {
                        sbuf.append( buffer, 0 , read );
                }
                reader.close();
               
                BoardMaster.setRight_html( sbuf.toString() );
               
                //BOTTOM_HTML 읽어오기
                sbuf = new StringBuffer();
                reader = rs.getCharacterStream( "BOTTOM_HTML" );
                buffer = new char[ 1024 ];
                while( ( read = reader.read( buffer , 0 , 1024 ) ) != -1 )
                {
                        sbuf.append( buffer, 0 , read );
                }
                reader.close();
               
                BoardMaster.setBottom_html( sbuf.toString() );
            }
            con.commit();
        }
        catch (Exception e)
                {
                try
                        {
                        con.rollback();
                        }
                catch( Exception e1 )
                        {}
                KKJLog.info( "//////////////////////////////////////////////" );
                KKJLog.info( "view Error : " + e.toString() );
                KKJLog.info( "//////////////////////////////////////////////" );
                return null;
        }
        finally
        {
              &n 

댓글 없음:

댓글 쓰기