001    package railo.runtime.orm.hibernate;
002    
003    import org.hibernate.HibernateException;
004    
005    import railo.runtime.PageContext;
006    import railo.runtime.PageSource;
007    import railo.runtime.dump.DumpData;
008    import railo.runtime.dump.DumpProperties;
009    import railo.runtime.engine.ThreadLocalPageContext;
010    import railo.runtime.err.ErrorPage;
011    import railo.runtime.exp.IPageException;
012    import railo.runtime.exp.PageException;
013    import railo.runtime.exp.PageExceptionBox;
014    import railo.runtime.orm.ORMException;
015    import railo.runtime.type.Struct;
016    
017    public class HibernateRuntimeException extends HibernateException  implements IPageException,PageExceptionBox  {
018    private PageException pe;
019    
020            
021            /**
022             * constructor of the class
023             * @param pe page exception to hold
024             */
025            public HibernateRuntimeException(PageException pe) {
026                    super(pe.getMessage());
027                    this.pe=pe;
028            }
029            
030            /**
031             * standart excption constructor
032             * @param message message of the exception
033             */
034            public HibernateRuntimeException(HibernateORMEngine engine,String message) {
035                    super(message);
036                    this.pe=new railo.runtime.orm.hibernate.HibernateException(engine,message);
037            }
038            
039            /**
040             * standart excption constructor
041             * @param message message of the exception
042             * @param detail detailed information to the exception
043             */
044            public HibernateRuntimeException(String message,String detail) {
045                    super(message);
046                    this.pe=new ORMException(message,detail);
047            }
048    
049            /**
050             * @see railo.runtime.exp.IPageException#getDetail()
051             */
052            public String getDetail() {
053                    return pe.getDetail();
054            }
055            
056            /**
057             * @see railo.runtime.exp.IPageException#getErrorCode()
058             */
059            public String getErrorCode() {
060                    return pe.getErrorCode();
061            }
062            
063            /**
064             * @see railo.runtime.exp.IPageException#getExtendedInfo()
065             */
066            public String getExtendedInfo() {
067                    return pe.getExtendedInfo();
068            }
069            
070            /**
071             *
072             * @see railo.runtime.exp.IPageException#getCatchBlock(railo.runtime.PageContext)
073             */
074            public Struct getCatchBlock(PageContext pc) {
075                    return pe.getCatchBlock(pc);
076            }
077            
078            /**
079             * @see railo.runtime.exp.IPageException#getCatchBlock()
080             */
081            public Struct getCatchBlock() {
082                    // TLPC
083                    return pe.getCatchBlock(ThreadLocalPageContext.get());
084            }
085            
086            /**
087             * @see railo.runtime.exp.IPageException#getErrorBlock(PageContext pc,ErrorPage ep)
088             */
089            public Struct getErrorBlock(PageContext pc,ErrorPage ep) {
090                    return pe.getErrorBlock(pc,ep);
091            }
092            /**
093             * @see railo.runtime.exp.IPageException#addContext(PageSource, int, int)
094             */
095            public void addContext(PageSource template, int line, int column,StackTraceElement ste) {
096                    pe.addContext(template,line,column,ste);
097            }
098            
099            /**
100             * @see railo.runtime.dump.Dumpable#toDumpData(railo.runtime.PageContext, int)
101             */
102            public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
103                    return pe.toDumpData(pageContext, maxlevel,dp);
104            }
105    
106            /**
107             * @see railo.runtime.exp.PageExceptionBox#getPageException()
108             */
109            public PageException getPageException() {
110                    return pe;
111            }
112    
113            /**
114             * @see railo.runtime.exp.IPageException#setDetail(java.lang.String)
115             */
116            public void setDetail(String detail) {
117                             pe.setDetail(detail);
118            }
119    
120            /**
121             * @see railo.runtime.exp.IPageException#setErrorCode(java.lang.String)
122             */
123            public void setErrorCode(String errorCode) {
124                             pe.setErrorCode(errorCode);            
125            }
126    
127            /**
128             * @see railo.runtime.exp.IPageException#setExtendedInfo(java.lang.String)
129             */
130            public void setExtendedInfo(String extendedInfo) {
131                             pe.setExtendedInfo(extendedInfo);              
132            }
133            
134            /**
135             * @see railo.runtime.exp.IPageException#typeEqual(java.lang.String)
136             */
137            public boolean typeEqual(String type) {
138                    return  pe.typeEqual(type);
139            }
140            
141            /**
142             * @see railo.runtime.exp.IPageException#getTypeAsString()
143             */
144            public String getTypeAsString() {
145                    return pe.getTypeAsString();
146            }
147    
148            /**
149             * @see railo.runtime.exp.IPageException#getCustomTypeAsString()
150             */
151            public String getCustomTypeAsString() {
152                    return pe.getCustomTypeAsString();
153            }
154    
155        /* *
156         * @see railo.runtime.exp.IPageException#getLine()
157         * /
158        public String getLine() {
159            return pe.getLine();
160        }*/
161    
162        /**
163         * @see railo.runtime.exp.IPageException#getTracePointer()
164         */
165        public int getTracePointer() {
166            return pe.getTracePointer();
167        }
168    
169        /**
170         * @see railo.runtime.exp.IPageException#setTracePointer(int)
171         */
172        public void setTracePointer(int tracePointer) {
173            pe.setTracePointer(tracePointer);
174        }
175    
176        /**
177         * @see railo.runtime.exp.IPageException#getAdditional()
178         */
179        public Struct getAdditional() {
180            return pe.getAddional();
181        }
182        public Struct getAddional() {
183            return pe.getAddional();
184        }
185    
186        public String getStackTraceAsString() {
187            return pe.getStackTraceAsString();
188        }
189    }