01: /*
02: * SalomeTMF is a Test Management Framework
03: * Copyright (C) 2005 France Telecom R&D
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2 of the License, or (at your option) any later version.
09: *
10: * This library 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 GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *
19: * @author Marche Mikael
20: *
21: * Contact: mikael.marche@rd.francetelecom.com
22: */
23:
24: package org.objectweb.salome_tmf.data;
25:
26: import java.io.Serializable;
27:
28: abstract public class SimpleData implements Serializable {
29:
30: protected String name;
31: protected String description = "";
32: protected int idBdd = -1;
33:
34: SimpleData(String name, String description) {
35: this .name = name;
36: this .description = description;
37: idBdd = -1;
38: }
39:
40: /*
41: * Set id of this data in BDD
42: */
43: protected void setIdBdd(int id) {
44: idBdd = id;
45: }
46:
47: /*
48: * Get id of this data in BDD
49: */
50: public int getIdBdd() {
51: return idBdd;
52: }
53:
54: /*
55: * Return true if the data is in base
56: */
57: public boolean isInBase() {
58: return idBdd != -1;
59: }
60:
61: /*
62: * Return the name of the data
63: */
64: public String getNameFromModel() {
65: return name;
66: }
67:
68: /*
69: * Return the name of the data
70: */
71:
72: public String getDescriptionFromModel() {
73: return description;
74: }
75:
76: abstract public void updateInDBAndModel(String name,
77: String description) throws Exception;
78:
79: public void updateDescriptionInModel(String description) {
80: this .description = description;
81: }
82:
83: protected void setNameInModel(String name) {
84: this .name = name;
85: }
86:
87: public String toString() {
88: return name;
89: }
90:
91: public abstract boolean existeInBase() throws Exception;
92:
93: public abstract void clearCache();
94: }
|