📄 rundataformbean.java
字号:
/* @LICENSE_COPYRIGHT@ */
package net.sf.irunninglog.servlet.formbean;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.GregorianCalendar;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionMapping;
import net.sf.irunninglog.canonical.CanonicalUtilities;
import net.sf.irunninglog.canonical.HasGeneratedId;
import net.sf.irunninglog.canonical.ReferenceData;
import net.sf.irunninglog.canonical.RunData;
import net.sf.irunninglog.canonical.Shoe;
import net.sf.irunninglog.service.IQueryService;
import net.sf.irunninglog.service.ServiceException;
import net.sf.irunninglog.servlet.UserContainer;
import net.sf.irunninglog.util.ConstantValues;
import net.sf.irunninglog.util.Conversions;
import net.sf.irunninglog.util.DTO;
import net.sf.irunninglog.util.FatalRuntimeException;
import net.sf.irunninglog.util.Utilities;
/**
* Form bean representation of the <em>Run Data</em> business object. Used to
* provide an implementation of the <em>Run Data</em> object within the
* application's view tier.
*
* @author <a href="mailto:allan_e_lewis@yahoo.com">Allan Lewis</a>
* @version $Revision: 1.1.1.1 $ $Date: 2005/06/23 01:49:01 $
* @since iRunningLog 1.0
*/
public final class RunDataFormBean extends HasGeneratedIdFormBean {
/** <code>Log</code> instance for this class. */
private static final Log LOG = LogFactory.getLog(RunDataFormBean.class);
/** Valid values for the <em>units</em> field. */
private static final List VALID_UNITS_VALUES;
/** The bean's <em>date</em> field. */
private String mDate;
/** The bean's <em>distance</em> field. */
private String mDistance;
/** The bean's <em>units</em> field. */
private String mUnits;
/** The bean's <em>time</em> field. */
private String mTime;
/** The bean's <em>pace</em> field. */
private String mPace;
/** The bean's <em>route</em> field. */
private String mRoute;
/** The bean's <em>run type</em> field. */
private String mRunType;
/** The bean's <em>shoes</em> field. */
private String mShoes;
/** The bean's <em>comments</em> field. */
private String mComments;
/** Set of valid values for the <em>route</em> field. */
private Collection validRouteValues;
/** Set of valid values for the <em>run type</em> field. */
private Collection validRunTypeValues;
/** Set of valid values for the <em>shoes</em> field. */
private Collection validShoeValues;
static {
VALID_UNITS_VALUES =
CanonicalUtilities.getValidValues(RunData.CANONICAL_ID,
RunData.FIELD_UNITS);
}
/**
* Get the value of the bean's <em>date</em> field.
*
* @return The current value of the <em>date</em> field
*/
public String getDate() {
return mDate;
}
/**
* Set the value of the bean's <em>date</em> field.
*
* @param value The value to be set onto the <em>date</em> field
*/
public void setDate(String value) {
mDate = value;
}
/**
* Get the value of the bean's <em>distance</em> field.
*
* @return The current value of the <em>distance</em> field
*/
public String getDistance() {
return mDistance;
}
/**
* Set the value of the bean's <em>distance</em> field.
*
* @param value The value to be set onto the <em>distance</em> field
*/
public void setDistance(String value) {
mDistance = value;
}
/**
* Get the value of the bean's <em>untis</em> field.
*
* @return The current value of the <em>units</em> field
*/
public String getUnits() {
return mUnits;
}
/**
* Set the value of the bean's <em>units</em> field.
*
* @param value The value to be set onto the <em>units</em> field
*/
public void setUnits(String value) {
mUnits = value;
}
/**
* Get the list of valid values for the <code>units</code> field. This
* will return a list of strings comprising the set of valid values. Note:
* the list will NOT contain a blank/null value. It is up to the view
* to determine whether or not a blank value should be present.
*
* @return A list of <code>String</code> representing the allowed values
* for the <em>units</em> field
*/
public List getValidUnitsValues() {
return VALID_UNITS_VALUES;
}
/**
* Get the (abbreviated) value of the form bean's <em>units</em>
* field. This will return the appropriate abbreviation for either miles
* or kilometers based on the actual value of the <em>units</em> field.
*
* @return The abbreviated value, or an empty string if the <em>units</em>
* value is empty or null
*/
public String getShortUnits() {
String units = (getUnits() == null) ? ConstantValues.STRING_BLANK
: getUnits();
if (units.equals(ConstantValues.STRING_KILOMETERS)) {
return ConstantValues.STRING_KILOMETERS_SHORT;
} else if (units.equals(ConstantValues.STRING_MILES)) {
return ConstantValues.STRING_MILES_SHORT;
} else {
return null;
}
}
/**
* Get the value of the bean's <em>time</em> field.
*
* @return The current value of the <em>time</em> field
*/
public String getTime() {
return mTime;
}
/**
* Set the value of the bean's <em>time</em> field.
*
* @param value The value to be set onto the <em>time</em> field
*/
public void setTime(String value) {
mTime = value;
}
/**
* Get the value of the bean's <em>pace</em> field.
*
* @return The current value of the <em>pace</em> field
*/
public String getPace() {
return mPace;
}
/**
* Set the value of the bean's <em>pace</em> field.
*
* @param value The value to be set onto the <em>pace</em> field
*/
public void setPace(String value) {
mPace = value;
}
/**
* Get the value of the bean's <em>route</em> field.
*
* @return The current value of the <em>route</em> field
*/
public String getRoute() {
return mRoute;
}
/**
* Set the value of the bean's <em>route</em> field.
*
* @param value The value to be set onto the <em>route</em> field
*/
public void setRoute(String value) {
mRoute = value;
}
/**
* Returns a collection of <code>DropDownOptionFormBean</code>s representing
* the valid drop-down options for the <em>route</em> field.
*
* @return A (non-null) collection of <code>DropDownOptionFormBean</code>s
*/
public Collection getValidRouteValues() {
return (validRouteValues == null) ? Collections.EMPTY_LIST
: Collections.unmodifiableCollection(validRouteValues);
}
/**
* Get the value of the bean's <em>run type</em> field.
*
* @return The current value of the <em>run type</em> field
*/
public String getRunType() {
return mRunType;
}
/**
* Set the value of the bean's <em>run type</em> field.
*
* @param value The value to be set onto the <em>run type</em> field
*/
public void setRunType(String value) {
mRunType = value;
}
/**
* Returns a collection of <code>DropDownOptionFormBean</code>s representing
* the valid drop-down options for the <em>run type</em> field.
*
* @return A (non-null) collection of <code>DropDownOptionFormBean</code>s
*/
public Collection getValidRunTypeValues() {
return (validRunTypeValues == null) ? Collections.EMPTY_LIST
: Collections.unmodifiableCollection(validRunTypeValues);
}
/**
* Get the value of the bean's <em>shoes</em> field.
*
* @return The current value of the <em>shoes</em> field
*/
public String getShoes() {
return mShoes;
}
/**
* Set the value of the bean's <em>shoes</em> field.
*
* @param value The value to be set onto the <em>shoes</em> field
*/
public void setShoes(String value) {
mShoes = value;
}
/**
* Returns a collection of <code>DropDownOptionFormBean</code>s representing
* the valid drop-down options for the <em>shoes</em> field.
*
* @return A (non-null) collection of <code>DropDownOptionFormBean</code>s
*/
public Collection getValidShoeValues() {
return (validShoeValues == null) ? Collections.EMPTY_LIST
: Collections.unmodifiableCollection(validShoeValues);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -