| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| PoemContext |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * $Source: /usr/cvsroot/melati/melati/src/main/java/org/melati/PoemContext.java,v $ | |
| 3 | * $Revision: 1.8 $ | |
| 4 | * | |
| 5 | * Copyright (C) 2005 Tim Pizey | |
| 6 | * | |
| 7 | * Part of Melati (http://melati.org), a framework for the rapid | |
| 8 | * development of clean, maintainable web applications. | |
| 9 | * | |
| 10 | * Melati is free software; Permission is granted to copy, distribute | |
| 11 | * and/or modify this software under the terms either: | |
| 12 | * | |
| 13 | * a) the GNU General Public License as published by the Free Software | |
| 14 | * Foundation; either version 2 of the License, or (at your option) | |
| 15 | * any later version, | |
| 16 | * | |
| 17 | * or | |
| 18 | * | |
| 19 | * b) any version of the Melati Software License, as published | |
| 20 | * at http://melati.org | |
| 21 | * | |
| 22 | * You should have received a copy of the GNU General Public License and | |
| 23 | * the Melati Software License along with this program; | |
| 24 | * if not, write to the Free Software Foundation, Inc., | |
| 25 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA to obtain the | |
| 26 | * GNU General Public License and visit http://melati.org to obtain the | |
| 27 | * Melati Software License. | |
| 28 | * | |
| 29 | * Feel free to contact the Developers of Melati (http://melati.org), | |
| 30 | * if you would like to work out a different arrangement than the options | |
| 31 | * outlined here. It is our intention to allow Melati to be used by as | |
| 32 | * wide an audience as possible. | |
| 33 | * | |
| 34 | * This program is distributed in the hope that it will be useful, | |
| 35 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 36 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 37 | * GNU General Public License for more details. | |
| 38 | * | |
| 39 | * Contact details for copyright holder: | |
| 40 | * | |
| 41 | * Tim Pizey <timp At paneris.org> | |
| 42 | * http://paneris.org/~timp | |
| 43 | */ | |
| 44 | ||
| 45 | package org.melati; | |
| 46 | ||
| 47 | import org.melati.util.StringUtils; | |
| 48 | ||
| 49 | ||
| 50 | /** | |
| 51 | * Holds the names of the database, table and method and the value of the | |
| 52 | * TROID for a POEM session. | |
| 53 | * A PoemContext can specify an individual database record, a table or the | |
| 54 | * whole database. | |
| 55 | */ | |
| 56 | ||
| 57 | public class PoemContext implements Cloneable { | |
| 58 | ||
| 59 | /** The database in use */ | |
| 60 | String logicalDatabase; | |
| 61 | /** The table in use */ | |
| 62 | String table; | |
| 63 | /** The troid in use */ | |
| 64 | Integer troid; | |
| 65 | /** The method in use */ | |
| 66 | String method; | |
| 67 | ||
| 68 | /** | |
| 69 | * Empty constructor. | |
| 70 | * If you use this then you have to populate the object by hand. | |
| 71 | */ | |
| 72 | 250 | public PoemContext() { } |
| 73 | ||
| 74 | /** | |
| 75 | * Constructor. | |
| 76 | * @param logicalDatabase the name of a logical database | |
| 77 | * @param table the name of the table we are dealing with table | |
| 78 | * @param troid the Table Row Object ID we are dealing with | |
| 79 | * @param method what we are doing to this object | |
| 80 | */ | |
| 81 | public PoemContext(String logicalDatabase, String table, Integer troid, | |
| 82 | 1 | String method) { |
| 83 | 1 | this.logicalDatabase = logicalDatabase; |
| 84 | 1 | this.table = table; |
| 85 | 1 | this.troid = troid; |
| 86 | 1 | this.method = method; |
| 87 | 1 | } |
| 88 | ||
| 89 | ||
| 90 | /** | |
| 91 | * @return a string representation of the state of this class | |
| 92 | */ | |
| 93 | public String toString() { | |
| 94 | 9 | return "logicalDatabase = " + logicalDatabase + ", " + |
| 95 | "table = " + table + ", " + | |
| 96 | "troid = " + troid + ", " + | |
| 97 | "method = " + method; | |
| 98 | } | |
| 99 | ||
| 100 | /** | |
| 101 | * Clone me. | |
| 102 | * @return a duplicate of this | |
| 103 | * @throws CloneNotSupportedException cannot be thrown | |
| 104 | */ | |
| 105 | public Object clone() throws CloneNotSupportedException { | |
| 106 | 1 | return super.clone(); |
| 107 | } | |
| 108 | ||
| 109 | ||
| 110 | /** | |
| 111 | * @return the logical database name. | |
| 112 | */ | |
| 113 | public String getLogicalDatabase() { | |
| 114 | 387 | return logicalDatabase; |
| 115 | } | |
| 116 | ||
| 117 | /** | |
| 118 | * @return the table name. | |
| 119 | */ | |
| 120 | public String getTable() { | |
| 121 | 65 | return table; |
| 122 | } | |
| 123 | ||
| 124 | /** | |
| 125 | * @return the TROID. | |
| 126 | */ | |
| 127 | public Integer getTroid() { | |
| 128 | 59 | return troid; |
| 129 | } | |
| 130 | ||
| 131 | /** | |
| 132 | * @return the method. | |
| 133 | */ | |
| 134 | public String getMethod() { | |
| 135 | 48 | return method; |
| 136 | } | |
| 137 | /** | |
| 138 | * @param logicalDatabase The logicalDatabase to set. | |
| 139 | */ | |
| 140 | public void setLogicalDatabase(String logicalDatabase) { | |
| 141 | 72 | this.logicalDatabase = logicalDatabase; |
| 142 | 72 | } |
| 143 | /** | |
| 144 | * @param method The method to set. | |
| 145 | */ | |
| 146 | public void setMethod(String method) { | |
| 147 | 43 | this.method = StringUtils.nulled(method); |
| 148 | 43 | } |
| 149 | /** | |
| 150 | * @param table The table to set. | |
| 151 | */ | |
| 152 | public void setTable(String table) { | |
| 153 | 33 | this.table = table; |
| 154 | 33 | } |
| 155 | /** | |
| 156 | * @param troid The troid to set. | |
| 157 | */ | |
| 158 | public void setTroid(Integer troid) { | |
| 159 | 26 | this.troid = troid; |
| 160 | 26 | } |
| 161 | } |