IDatabaseObject.java

biz/hammurapi/sql/IDatabaseObject.java

Violations

Inspector Message Severity Location
Java Inspector 048 Copyrights information should be present in each file. 1
Java Inspector 089 Parameter processor documentation is too short. It is only 1 words. Should be at least 3 words. 2 47:9
Java Inspector 089 Parameter processor documentation is too short. It is only 1 words. Should be at least 3 words. 2 56:9
Java Inspector 089 Undocumented method 2 58:9
Java Inspector 089 Parameter holder is not documented 2 65:9
Java Inspector 089 Undocumented method 2 67:9
Java Inspector 089 Method is not properly documented 2 85:9
Java Inspector 089 Parameter source is not documented 2 107:9
Java Inspector 089 Undocumented method 2 109:9
Java Inspector 089 Undocumented method 2 111:9
Java Inspector 089 Undocumented method 2 113:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 47:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 56:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 58:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 65:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 67:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 75:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 80:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 85:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 91:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 98:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 107:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 109:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 111:9
Java Inspector 047 No need to provide (public, abstract, ) modifiers for interface methods 3 113:9

Source code

1/*
2 * hgcommons 9
3 * Hammurapi Group Common Library
4 * Copyright (C) 2003 Hammurapi Group
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * URL: http://www.hammurapi.biz/hammurapi-biz/ef/xmenu/hammurapi-group/products/products/hgcommons/index.html
21 * e-Mail: support@hammurapi.biz
22 */
23package biz.hammurapi.sql;
24
25import java.sql.SQLException;
26import java.util.Properties;
27
28import org.w3c.dom.Element;
29
30import biz.hammurapi.config.ConfigurationException;
31
32/**
33 * Interface of DatabaseObject. This interface is used for creating dynamic proxies backed
34 * up with database obects.
35 * @author Pavel Vlasov
36 * @revision $Revision$
37 */
38public interface IDatabaseObject {
39
40 /**
41 * Updates row in a table by primary key
42 * @param processor SQLProcessor
43 * @param tableName Target table
44 * @return Number of updates
45 * @throws SQLException
46 */
47 public abstract int update(SQLProcessor processor, String tableName) throws SQLException;
48
49 /**
50 * Deletes row in a table by primary key.
51 * @param processor SQLProcessor
52 * @param tableName Target table
53 * @return Number of updates
54 * @throws SQLException
55 */
56 public abstract int delete(SQLProcessor processor, String tableName) throws SQLException;
57
58 public abstract int insert(SQLProcessor processor, String tableName) throws SQLException;
59
60 /**
61 * Loads columns from XML element
62 * @param holder
63 * @throws ConfigurationException If loading fails
64 */
65 public abstract void fromDom(Element holder) throws ConfigurationException;
66
67 public abstract void fromDom(Element holder, Properties nameMap) throws ConfigurationException;
68
69 /**
70 * Serializes to DOM.
71 * @param holder Holder element
72 * @param nameMap Name map
73 * @param originals Output original values if any.
74 */
75 public abstract void toDom(Element holder, Properties nameMap, boolean originals);
76
77 /**
78 * Sets current values as original values in primary key columns.
79 */
80 public abstract void setOriginal();
81
82 /**
83 * @return true if object was modified since last database operation.
84 */
85 public abstract boolean isModified();
86
87 /**
88 * isDeleted flag is cleared when primary key columns are modified
89 * @return true if delete() method was executed.
90 */
91 public abstract boolean isDeleted();
92
93 /**
94 * Sets all columns to default values and clears
95 * modified and deleted flags.
96 *
97 */
98 public abstract void clear();
99
100 /**
101 * Copies values from source object to this object.
102 * Modified flag is set for non-primary key columns and
103 * cleared for primary key columns. It allows to insert
104 * copies with new autogenerated primary keys.
105 * @param source
106 */
107 public abstract void copy(DatabaseObject source);
108
109 public abstract void setColumnAttribute(String columnName, Object key, Object value);
110
111 public abstract Object getColumnAttribute(String columnName, Object key);
112
113 public abstract Object removeColumnAttribute(String columnName, Object key);
114
115}