SQL Plugin copied from Quantum plugin and refactored for PHPEclipse
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.sql / src / net / sourceforge / phpdt / sql / bookmarks / Bookmark.java
1 package net.sourceforge.phpdt.sql.bookmarks;
2
3 /**
4  * @author root
5  *
6  * To change this generated comment edit the template variable "typecomment":
7  * Window>Preferences>Java>Templates.
8  * To enable and disable the creation of type comments go to
9  * Window>Preferences>Java>Code Generation.
10  */
11 public class Bookmark {
12         String name = "";
13         String username = "";
14         String password = "";
15         String connect = "";
16         String driver = "";
17         String type = "";
18         String driverFile = "";
19         String schema = "";
20         
21         public Bookmark() {
22         }
23
24         public Bookmark(Bookmark data) {
25                 setName(data.getName());
26                 setUsername(data.getUsername());
27                 setPassword(data.getPassword());
28                 setConnect(data.getConnect());
29                 setDriver(data.getDriver());
30                 setType(data.getType());
31                 setDriverFile(data.getDriverFile());
32         }
33
34         public Bookmark(
35                 String name,
36                 String username,
37                 String password,
38                 String connect,
39                 String driver,
40                 String type,
41                 String driverFile) {
42                 this.name = username;
43                 this.username = username;
44                 this.password = password;
45                 this.connect = connect;
46                 this.driver = driver;
47                 this.type = type;
48                 this.driverFile = driverFile;
49         }
50
51         /**
52          * Returns the connect.
53          * @return String
54          */
55         public String getConnect() {
56                 return connect;
57         }
58
59         /**
60          * Returns the driver.
61          * @return String
62          */
63         public String getDriver() {
64                 return driver;
65         }
66
67         /**
68          * Returns the driverFile.
69          * @return String
70          */
71         public String getDriverFile() {
72                 return driverFile;
73         }
74
75         /**
76          * Returns the password.
77          * @return String
78          */
79         public String getPassword() {
80                 return password;
81         }
82
83         /**
84          * Returns the username.
85          * @return String
86          */
87         public String getUsername() {
88                 return username;
89         }
90
91         /**
92          * Sets the connect.
93          * @param connect The connect to set
94          */
95         public void setConnect(String connect) {
96                 if (connect == null) {
97                         connect = "";
98                 }
99                 this.connect = connect;
100         }
101
102         /**
103          * Sets the driver.
104          * @param driver The driver to set
105          */
106         public void setDriver(String driver) {
107                 if (driver == null) {
108                         driver = "";
109                 }
110                 this.driver = driver;
111         }
112
113         /**
114          * Sets the driverFile.
115          * @param driverFile The driverFile to set
116          */
117         public void setDriverFile(String driverFile) {
118                 if (driverFile == null) {
119                         driverFile = "";
120                 }
121                 this.driverFile = driverFile;
122         }
123
124         /**
125          * Sets the password.
126          * @param password The password to set
127          */
128         public void setPassword(String password) {
129                 if (password == null) {
130                         password = "";
131                 }
132                 this.password = password;
133         }
134
135         /**
136          * Sets the username.
137          * @param username The username to set
138          */
139         public void setUsername(String username) {
140                 if (username == null) {
141                         username = "";
142                 }
143                 this.username = username;
144         }
145
146         /**
147          * Returns the name.
148          * @return String
149          */
150         public String getName() {
151                 return name;
152         }
153
154         /**
155          * Sets the name.
156          * @param name The name to set
157          */
158         public void setName(String name) {
159                 if (name == null) {
160                         name = "";
161                 }
162                 this.name = name;
163         }
164
165         public boolean isEmpty() {
166                 if (name.equals("") &&
167                 username.equals("") &&
168                 password.equals("") &&
169                 connect.equals("") &&
170                 driver.equals("") &&
171                 type.equals("") &&
172                 driverFile.equals("")) {
173                         return true;
174                 }
175                 return false;
176         }
177         public String toString() {
178                 StringBuffer buffer = new StringBuffer();
179                 buffer.append("[");
180                 buffer.append("name=");
181                 buffer.append(name);
182                 buffer.append(", ");
183                 buffer.append("username=");
184                 buffer.append(username);
185                 buffer.append(", ");
186                 buffer.append("password=****");
187                 buffer.append(", ");
188                 buffer.append("connect=");
189                 buffer.append(connect);
190                 buffer.append(", ");
191                 buffer.append("driver=");
192                 buffer.append(driver);
193                 buffer.append(", ");
194                 buffer.append("type=");
195                 buffer.append(type);
196                 buffer.append(", ");
197                 buffer.append("driverFile=");
198                 buffer.append(driverFile);
199                 buffer.append("]");
200                 return buffer.toString();
201         }
202         
203         public String getType() {
204                 return type;
205         }
206
207         public void setType(String type) {
208                 this.type = type;
209         }
210
211         public String getSchema() {
212                 return schema;
213         }
214
215         public void setSchema(String schema) {
216                 this.schema = schema;
217         }
218
219 }