01: /*
02: * TriggerDefinition.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.db;
13:
14: import java.sql.SQLException;
15: import workbench.util.SqlUtil;
16:
17: /**
18: *
19: * @author support@sql-workbench.net
20: */
21: public class TriggerDefinition implements DbObject {
22: private String schema;
23: private String catalog;
24: private String triggerName;
25:
26: public TriggerDefinition(String cat, String schem, String name) {
27: schema = schem;
28: catalog = cat;
29: triggerName = name;
30: }
31:
32: public CharSequence getSource(WbConnection con) throws SQLException {
33: if (con == null)
34: return null;
35: return con.getMetadata().getTriggerSource(catalog, schema,
36: triggerName);
37: }
38:
39: public String getSchema() {
40: return schema;
41: }
42:
43: public String getCatalog() {
44: return catalog;
45: }
46:
47: public String getObjectName(WbConnection conn) {
48: return conn.getMetadata().quoteObjectname(this .triggerName);
49: }
50:
51: public String getObjectExpression(WbConnection conn) {
52: return SqlUtil.buildExpression(conn, catalog, schema,
53: triggerName);
54: }
55:
56: public String getObjectName() {
57: return triggerName;
58: }
59:
60: public String getObjectType() {
61: return "TRIGGER";
62: }
63:
64: public String toString() {
65: return triggerName;
66: }
67:
68: }
|