[jboss-cvs] jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console ...

Max Rydahl Andersen mandersen at jboss.com
Fri Jul 21 08:42:04 EDT 2006


  User: mandersen
  Date: 06/07/21 08:42:04

  Modified:    hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console    
                        HQLQueryPage.java ImageConstants.java ImageMap.java
                        ConsoleQueryParameter.java
  Log:
  HBX-638 support null in query parameters view
  
  Revision  Changes    Path
  1.8       +6 -2      jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HQLQueryPage.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/HQLQueryPage.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- HQLQueryPage.java	7 Jul 2006 13:50:57 -0000	1.7
  +++ HQLQueryPage.java	21 Jul 2006 12:42:04 -0000	1.8
  @@ -68,13 +68,17 @@
   			ConsoleQueryParameter parameter = queryParameters2[i];
   			try {
   				int pos = Integer.parseInt(parameter.getName());
  -				query2.setParameter(pos, parameter.getValue(), parameter.getType());
  +				query2.setParameter(pos, calcValue( parameter ), parameter.getType());
   			} catch(NumberFormatException nfe) {
  -				query2.setParameter(parameter.getName(), parameter.getValue(), parameter.getType());	
  +				query2.setParameter(parameter.getName(), calcValue( parameter ), parameter.getType());	
   			}			
   		}		
   	}
   
  +	private Object calcValue(ConsoleQueryParameter parameter) {
  +		return parameter.getValueForQuery();				
  +	}
  +
   	/**
   	 * @param session
   	 * @param string
  
  
  
  1.9       +3 -0      jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ImageConstants.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageConstants.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- ImageConstants.java	7 Jul 2006 13:50:57 -0000	1.8
  +++ ImageConstants.java	21 Jul 2006 12:42:04 -0000	1.9
  @@ -112,4 +112,7 @@
   	public static final String CRITERIA_EDITOR = "images/criteria_editor.gif";
   	public static final String FUNCTION = "FUNCTION";
       
  +	public static final String CHECKBOX_FULL = "images/xpl/complete_tsk.gif";
  +	public static final String CHECKBOX_EMPTY = "images/xpl/incomplete_tsk.gif";
  +    
   }
  \ No newline at end of file
  
  
  
  1.9       +2 -0      jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ImageMap.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ImageMap.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- ImageMap.java	7 Jul 2006 13:50:57 -0000	1.8
  +++ ImageMap.java	21 Jul 2006 12:42:04 -0000	1.9
  @@ -69,6 +69,8 @@
           declareRegistryImage(HIBERNATE_LOGO, "images/hibernate.gif");
           declareRegistryImage(JBOSS_LOGO, "images/jboss.gif");
           declareRegistryImage(FUNCTION, "images/function.gif");
  +        declareRegistryImage(CHECKBOX_EMPTY, "images/xpl/incomplete_tsk.gif");
  +        declareRegistryImage(CHECKBOX_FULL, "images/xpl/complete_tsk.gif");
   		
   	}
   
  
  
  
  1.7       +20 -4     jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConsoleQueryParameter.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConsoleQueryParameter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -b -r1.6 -r1.7
  --- ConsoleQueryParameter.java	7 Jul 2006 13:50:57 -0000	1.6
  +++ ConsoleQueryParameter.java	21 Jul 2006 12:42:04 -0000	1.7
  @@ -39,7 +39,7 @@
   
   public class ConsoleQueryParameter {
   
  -	static public final Object NULL_MARKER = new Object() { public String toString() { return "[null]"; } };
  +	static private final Object NULL_MARKER = null; //new Object() { public String toString() { return "[null]"; } };
   	
   	static final Map typeFormats = new HashMap();
   	static {
  @@ -114,12 +114,12 @@
   	}
   	
   	public void setValue(Object value) {
  -		if(value == null) { throw new IllegalArgumentException("Value must not be set to null"); }
  +		//if(value == null) { throw new IllegalArgumentException("Value must not be set to null"); }
   		this.value = value;
   	}
   	
   	public String getValueAsString() {
  -		if(getValue()==NULL_MARKER) return "";
  +		if(isNull()) return "";
   		return type.toString(getValue());
   	}
   	
  @@ -128,7 +128,7 @@
   			Object object = type.fromStringValue(value);
   			setValue(object);
   		} catch(Exception he) {
  -			setValue(NULL_MARKER);
  +			setNull();
   		}
   	}
   
  @@ -146,4 +146,20 @@
   	public static Set getPossibleTypes() {
   		return typeFormats.keySet();
   	}
  +
  +	public void setNull() {
  +		setValue( NULL_MARKER );
  +	}
  +	
  +	public boolean isNull() {
  +		return getValue()==NULL_MARKER;
  +	}
  +
  +	public Object getValueForQuery() {
  +		if(isNull()) {
  +			return null;
  +		} else {
  +			return getValue();
  +		}	
  +	}
   }
  
  
  



More information about the jboss-cvs-commits mailing list