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.config.Config;
008    import railo.runtime.dump.DumpData;
009    import railo.runtime.dump.DumpProperties;
010    import railo.runtime.engine.ThreadLocalPageContext;
011    import railo.runtime.err.ErrorPage;
012    import railo.runtime.exp.CatchBlock;
013    import railo.runtime.exp.IPageException;
014    import railo.runtime.exp.PageException;
015    import railo.runtime.exp.PageExceptionBox;
016    import railo.runtime.orm.ORMException;
017    import railo.runtime.type.Struct;
018    
019    public class HibernateRuntimeException extends HibernateException  implements IPageException,PageExceptionBox  {
020    private PageException pe;
021    
022            
023            /**
024             * constructor of the class
025             * @param pe page exception to hold
026             */
027            public HibernateRuntimeException(PageException pe) {
028                    super(pe.getMessage());
029                    this.pe=pe;
030            }
031            
032            /**
033             * standart excption constructor
034             * @param message message of the exception
035             */
036            public HibernateRuntimeException(HibernateORMEngine engine,String message) {
037                    super(message);
038                    this.pe=new railo.runtime.orm.hibernate.HibernateException(engine,message);
039            }
040            
041            /**
042             * standart excption constructor
043             * @param message message of the exception
044             * @param detail detailed information to the exception
045             */
046            public HibernateRuntimeException(String message,String detail) {
047                    super(message);
048                    this.pe=new ORMException(message,detail);
049            }
050    
051            @Override
052            public String getDetail() {
053                    return pe.getDetail();
054            }
055            
056            @Override
057            public String getErrorCode() {
058                    return pe.getErrorCode();
059            }
060            
061            @Override
062            public String getExtendedInfo() {
063                    return pe.getExtendedInfo();
064            }
065            
066            @Override
067            public Struct getCatchBlock(PageContext pc) {
068                    return getCatchBlock(pc.getConfig());
069            }
070            
071            public Struct getCatchBlock() {
072                    // TLPC
073                    return pe.getCatchBlock(ThreadLocalPageContext.getConfig());
074            }
075            
076    
077            public CatchBlock getCatchBlock(Config config) {
078                    return pe.getCatchBlock(config);
079            }
080            
081            @Override
082            public Struct getErrorBlock(PageContext pc,ErrorPage ep) {
083                    return pe.getErrorBlock(pc,ep);
084            }
085            @Override
086            public void addContext(PageSource template, int line, int column,StackTraceElement ste) {
087                    pe.addContext(template,line,column,ste);
088            }
089            
090            @Override
091            public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) {
092                    return pe.toDumpData(pageContext, maxlevel,dp);
093            }
094    
095            @Override
096            public PageException getPageException() {
097                    return pe;
098            }
099    
100            @Override
101            public void setDetail(String detail) {
102                             pe.setDetail(detail);
103            }
104    
105            @Override
106            public void setErrorCode(String errorCode) {
107                             pe.setErrorCode(errorCode);            
108            }
109    
110            @Override
111            public void setExtendedInfo(String extendedInfo) {
112                             pe.setExtendedInfo(extendedInfo);              
113            }
114            
115            @Override
116            public boolean typeEqual(String type) {
117                    return  pe.typeEqual(type);
118            }
119            
120            @Override
121            public String getTypeAsString() {
122                    return pe.getTypeAsString();
123            }
124    
125            @Override
126            public String getCustomTypeAsString() {
127                    return pe.getCustomTypeAsString();
128            }
129    
130        @Override
131        public int getTracePointer() {
132            return pe.getTracePointer();
133        }
134    
135        @Override
136        public void setTracePointer(int tracePointer) {
137            pe.setTracePointer(tracePointer);
138        }
139    
140        @Override
141        public Struct getAdditional() {
142            return pe.getAddional();
143        }
144        public Struct getAddional() {
145            return pe.getAddional();
146        }
147    
148        public String getStackTraceAsString() {
149            return pe.getStackTraceAsString();
150        }
151    }