1 | |
package org.apache.torque.mojo; |
2 | |
|
3 | |
import java.io.IOException; |
4 | |
import java.util.Properties; |
5 | |
|
6 | |
import org.apache.maven.plugin.MojoExecutionException; |
7 | |
import org.kuali.db.DatabaseCommand; |
8 | |
import org.kuali.db.SQLGenerator; |
9 | |
import org.kuali.db.Transaction; |
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | 0 | public abstract class SingleDBACommandMojo extends AbstractDBACommandMojo { |
15 | |
|
16 | |
public abstract String getCommand(); |
17 | |
|
18 | |
@Override |
19 | |
protected void configureTransactions() throws MojoExecutionException { |
20 | 0 | Properties properties = getContextProperties(); |
21 | 0 | SQLGenerator generator = new SQLGenerator(properties, url, DatabaseCommand.valueOf(getCommand().toUpperCase())); |
22 | |
try { |
23 | 0 | generator.setEncoding(getEncoding()); |
24 | 0 | String sql = generator.getSQL(); |
25 | 0 | Transaction t = new Transaction(); |
26 | 0 | t.addText(sql); |
27 | 0 | t.setDescription(getTransactionDescription(DatabaseCommand.valueOf(getCommand().toUpperCase()))); |
28 | 0 | transactions.add(t); |
29 | 0 | } catch (IOException e) { |
30 | 0 | throw new MojoExecutionException("Error configuring transactions", e); |
31 | 0 | } |
32 | 0 | } |
33 | |
} |