Author: dgeraskov
Date: 2012-02-03 09:14:24 -0500 (Fri, 03 Feb 2012)
New Revision: 38411
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
Log:
https://issues.jboss.org/browse/JBIDE-10148
Validate QeryExporter before launching
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2012-02-03
12:03:20 UTC (rev 38410)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java 2012-02-03
14:14:24 UTC (rev 38411)
@@ -27,6 +27,8 @@
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@@ -542,6 +544,16 @@
if(StringHelper.isEmpty(attributes.getOutputPath())) {
abort(HibernateConsoleMessages.CodeGenerationLaunchDelegate_output_has_to_be_specified_in
+ configuration.getName(), null,
ICodeGenerationLaunchConstants.ERR_OUTPUT_PATH_NOTFOUND);
}
+
+ List<ExporterFactory> exporterFactories = attributes.getExporterFactories();
+ for (Iterator<ExporterFactory> iter = exporterFactories.iterator();
iter.hasNext();) {
+ ExporterFactory exFactory = iter.next();
+ if (exFactory.isEnabled(configuration) &&
exFactory.getExporterDefinitionId().equals("org.hibernate.tools.query")) {
//$NON-NLS-1$
+ if (!exFactory.getProperties().containsKey("query_string")){ //$NON-NLS-1$
+ abort("Query property should be explicitly set for Query Exporter", null,
ICodeGenerationLaunchConstants.ERR_OUTPUT_PATH_NOTFOUND); //$NON-NLS-1$
+ }
+ }
+ }
return super.preLaunchCheck( configuration, mode, monitor );
}