1 package org.hibernate.sql; 3 4 import java.util.Iterator ; 5 import java.util.Map ; 6 7 14 public class HSQLCaseFragment extends CaseFragment { 15 16 public String toFragmentString() { 17 StringBuffer buf = new StringBuffer ( cases.size() * 15 + 10 ); 18 StringBuffer buf2 = new StringBuffer ( cases.size() ); 19 20 Iterator iter = cases.entrySet().iterator(); 21 while ( iter.hasNext() ) { 22 Map.Entry me = (Map.Entry ) iter.next(); 23 buf.append(" casewhen(") 24 .append( me.getKey() ) 25 .append(" is not null") 26 .append(", ") 27 .append( me.getValue() ) 28 .append(", "); 29 buf2.append(")"); 30 } 31 32 buf.append("-1"); buf.append( buf2.toString() ); 34 if ( returnColumnName!=null ) { 35 buf.append(" as ") 36 .append(returnColumnName); 37 } 38 return buf.toString(); 39 } 40 } 41 42 | Popular Tags |