1 //
2 //Copyright (c) 2003, Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
3 //All rights reserved.
4 //
5 //Redistribution and use in source and binary forms, with or without modification,
6 //are permitted provided that the following conditions are met:
7 //
8 //* Redistributions of source code must retain the above copyright notice,
9 //this list of conditions and the following disclaimer.
10 //* Redistributions in binary form must reproduce the above copyright notice,
11 //this list of conditions and the following disclaimer in the documentation
12 //and/or other materials provided with the distribution.
13 //* Neither the name of the Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
14 //nor the names of its contributors may be used to endorse or promote products
15 //derived from this software without specific prior written permission.
16 //
17 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 //AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 //IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21 //INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 //BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23 //OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 //WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 //ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 //POSSIBILITY OF SUCH DAMAGE.
27 //
28
29 package org.objectledge.cache;
30
31 import org.objectledge.database.persistence.InputRecord;
32 import org.objectledge.database.persistence.OutputRecord;
33 import org.objectledge.database.persistence.PersistenceException;
34 import org.objectledge.database.persistence.Persistent;
35
36 /**
37 * @author <a href="mailto:rafal@caltha.pl">Pawel Potempski</a>
38 * @version $Id: TestValue.java,v 1.3 2006/02/08 18:26:00 zwierzem Exp $
39 */
40 public class TestValue implements Persistent
41 {
42 private static String table = "test_value";
43
44 private static String[] keyColumns = new String[] { "test_value_id" };
45
46 private boolean saved = false;
47
48 private String name;
49
50 private int quantity;
51
52 public TestValue()
53 {
54 // default constructor
55 }
56
57 public TestValue(String name, int quantity)
58 {
59 this.name = name;
60 this.quantity = quantity;
61 }
62
63 public String getTable()
64 {
65 return table;
66 }
67
68 public String[] getKeyColumns()
69 {
70 return keyColumns;
71 }
72
73 public void setSaved(long id)
74 {
75 saved = true;
76 }
77
78 public boolean getSaved()
79 {
80 return saved;
81 }
82
83 public void getData(OutputRecord out) throws PersistenceException
84 {
85 out.setString("name", name);
86 out.setInteger("quantity", quantity);
87 }
88
89 public void setData(InputRecord in) throws PersistenceException
90 {
91 name = in.getString("name");
92 quantity = in.getInteger("quantity");
93 }
94
95 public String getName()
96 {
97 return name;
98 }
99
100 public int getQuantity()
101 {
102 return quantity;
103 }
104
105 public void setName(String name)
106 {
107 this.name = name;
108 }
109
110 public void setQuantity(int quantity)
111 {
112 this.quantity = quantity;
113 }
114
115 }