01: /*
02: * Copyright (C) 2003 Joseph Mocker
03: * mock-sf@misfit.dhs.org
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * as published by the Free Software Foundation; either version 2
08: * of the License, or any later version.
09: *
10: * This program is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13: * GNU General Public License for more details.
14: *
15: * You should have received a copy of the GNU General Public License
16: * along with this program; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18: */
19:
20: package net.sourceforge.squirrel_sql.plugins.sqlbookmark;
21:
22: import java.io.Serializable;
23:
24: /**
25: * A class encapsulating an SQL Bookmark.
26: *
27: * @author Joseph Mocker
28: */
29: public class Bookmark {
30:
31: /**
32: * The name of the bookmark
33: */
34: protected String _name;
35:
36: private String _description;
37: /**
38: * The SQL for the bookmark
39: */
40: protected String _sql;
41: private String _toString;
42:
43: public Bookmark() {
44: this (null, null, null);
45: }
46:
47: public Bookmark(String name, String description, String sql) {
48: _name = name;
49: _description = description;
50: setSql(sql);
51: initToString();
52: }
53:
54: private void initToString() {
55: String name = null == _name ? "(missing name)" : _name;
56: String description = null == _description ? "(missing description)"
57: : _description;
58: _toString = "(" + name + ") " + description;
59: }
60:
61: public String getName() {
62: return _name;
63: }
64:
65: public String getDescription() {
66: return _description;
67: }
68:
69: public String getSql() {
70: return _sql;
71: }
72:
73: public void setName(String name) {
74: this ._name = name;
75: initToString();
76: }
77:
78: public void setDescription(String description) {
79: this ._description = description;
80: initToString();
81: }
82:
83: public void setSql(String sql) {
84: _sql = sql;
85: // if(null == sql )
86: // {
87: // _sql = null;
88: // }
89: // else
90: // {
91: // _sql = "\n" + sql.trim();
92: // }
93: }
94:
95: public String toString() {
96: return _toString;
97: }
98: }
|