001/** 002 * 003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved. 004 * 005 * This library is free software; you can redistribute it and/or 006 * modify it under the terms of the GNU Lesser General Public 007 * License as published by the Free Software Foundation; either 008 * version 2.1 of the License, or (at your option) any later version. 009 * 010 * This library is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 013 * Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public 016 * License along with this library. If not, see <http://www.gnu.org/licenses/>. 017 * 018 **/ 019package lucee.runtime.orm.hibernate; 020 021 022import lucee.runtime.PageContext; 023import lucee.runtime.PageSource; 024import lucee.runtime.config.Config; 025import lucee.runtime.dump.DumpData; 026import lucee.runtime.dump.DumpProperties; 027import lucee.runtime.err.ErrorPage; 028import lucee.runtime.exp.CatchBlock; 029import lucee.runtime.exp.IPageException; 030import lucee.runtime.exp.PageException; 031import lucee.runtime.exp.PageExceptionBox; 032import lucee.runtime.type.Struct; 033 034import org.hibernate.HibernateException; 035 036public class HibernatePageException extends HibernateException implements IPageException,PageExceptionBox { 037 038 private static final long serialVersionUID = -7745292875775743390L; 039 040 private PageException pe; 041 042 043 /** 044 * constructor of the class 045 * @param pe page exception to hold 046 */ 047 public HibernatePageException(PageException pe) { 048 super(pe.getMessage()); 049 this.pe=pe; 050 } 051 052 053 @Override 054 public String getDetail() { 055 return pe.getDetail(); 056 } 057 058 @Override 059 public String getErrorCode() { 060 return pe.getErrorCode(); 061 } 062 063 @Override 064 public String getExtendedInfo() { 065 return pe.getExtendedInfo(); 066 } 067 068 @Override 069 public Struct getCatchBlock(PageContext pc) { 070 return getCatchBlock(pc.getConfig()); 071 } 072 073 public Struct getCatchBlock() { 074 // TLPC 075 return pe.getCatchBlock(CommonUtil.config()); 076 } 077 078 079 public CatchBlock getCatchBlock(Config config) { 080 return pe.getCatchBlock(config); 081 } 082 083 @Override 084 public Struct getErrorBlock(PageContext pc,ErrorPage ep) { 085 return pe.getErrorBlock(pc,ep); 086 } 087 @Override 088 public void addContext(PageSource template, int line, int column,StackTraceElement ste) { 089 pe.addContext(template,line,column,ste); 090 } 091 092 @Override 093 public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) { 094 return pe.toDumpData(pageContext, maxlevel,dp); 095 } 096 097 @Override 098 public PageException getPageException() { 099 return pe; 100 } 101 102 @Override 103 public void setDetail(String detail) { 104 pe.setDetail(detail); 105 } 106 107 @Override 108 public void setErrorCode(String errorCode) { 109 pe.setErrorCode(errorCode); 110 } 111 112 @Override 113 public void setExtendedInfo(String extendedInfo) { 114 pe.setExtendedInfo(extendedInfo); 115 } 116 117 @Override 118 public boolean typeEqual(String type) { 119 return pe.typeEqual(type); 120 } 121 122 @Override 123 public String getTypeAsString() { 124 return pe.getTypeAsString(); 125 } 126 127 @Override 128 public String getCustomTypeAsString() { 129 return pe.getCustomTypeAsString(); 130 } 131 132 @Override 133 public int getTracePointer() { 134 return pe.getTracePointer(); 135 } 136 137 @Override 138 public void setTracePointer(int tracePointer) { 139 pe.setTracePointer(tracePointer); 140 } 141 142 @Override 143 public Struct getAdditional() { 144 return pe.getAddional(); 145 } 146 public Struct getAddional() { 147 return pe.getAddional(); 148 } 149 150 public String getStackTraceAsString() { 151 return pe.getStackTraceAsString(); 152 } 153}