⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 routebo.java

📁 A Java web application, based on Struts and Hibernate, that serves as an online running log. Users m
💻 JAVA
字号:
/* @LICENSE_COPYRIGHT@ */package net.sf.irunninglog.businessobject;import java.util.List;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import net.sf.irunninglog.canonical.Route;import net.sf.irunninglog.util.ConversionException;import net.sf.irunninglog.util.DTO;import net.sf.irunninglog.validation.ValidationUtilities;/** * Business object representing a <em>Route</em>.  This is a POJO business * object (BO) implementation that is used to represent <em>Route</em>s * entities within the application's business layer. * * @author <a href="mailto:allan_e_lewis@yahoo.com">Allan Lewis</a> * @version $Revision: 1.2 $ $Date: 2005/06/25 15:18:19 $ * @since iRunningLog 1.0 */public class RouteBO extends ReferenceDataBO {    /** <code>Log</code> instance for this class. */    private static final Log LOG = LogFactory.getLog(RouteBO.class);    /** The route's <em>comments</em> field. */    private String mComments;    /**     * Create a new business object instance.     *     * @deprecated Use the <code>BusinessObjectFactory</code> to obtain new     *             instances     * @see BusinessObjectFactory#newInstance(String)     */    public RouteBO() {        super();    }    /**     * Get the value of the BO's <em>comments</em> field.     *     * @return The current value of the <em>comments</em> field     */    public String getComments() {        return mComments;    }    /**     * Set the value of the BO's <em>comments</em> field.     *     * @param value The value to be set onto the <em>comments</em> field     */    public void setComments(String value) {        mComments = value;    }    /**     * Get a data transfer objects containing values that represent the current     * state of this BO.  This is a template method that is called from the     * final method <code>getValues</code> in <code>BaseBO</code>.     *     * @return The data transfer object, populated with the appropriate values     * @see BaseBO#getValues()     */    protected DTO getValuesInternal() {        DTO valueObject = super.getValuesInternal();        String value = null;        if (LOG.isDebugEnabled()) {            LOG.debug("getValuesInternal: Contents of the value object "                      + " (before) " + valueObject);        }        valueObject.setCanonicalId(Route.CANONICAL_ID);        value = getComments();        valueObject.setValue(Route.FIELD_COMMENTS, value);        if (LOG.isDebugEnabled()) {            LOG.debug("getValuesInternal: Contents of the value object (after) "                      + valueObject);        }        return valueObject;    }    /**     * Update the BO's fields with the values provided in a data transfer     * object.  This is a template method that is called from the final     * <code>setValue</code> method in <code>BaseBO</code>.     *     * @param valueObject The data transfer object containing values to be     *                    used in updating this BO     * @throws ConversionException If a conversion error occurrs while setting     *                             the fields     * @see BaseBO#setValues(DTO)     */    protected void setValuesInternal(DTO valueObject)                                                   throws ConversionException {        if (LOG.isDebugEnabled()) {            LOG.debug("setValuesInternal: Contents of the value object "                      + valueObject);        }        super.setValuesInternal(valueObject);        String value = null;        value = valueObject.getValue(Route.FIELD_COMMENTS);        setComments(value);    }    /**     * Validate the values contained in a data transfer object.  This method     * is reponsible for perofrming all validations on the transfer object, and     * should be called before updating the BO's fields to avoid     * bad data and/or errors.     *     * @param valueObject The data transfer object whose fields are to be     *                    validated     * @return A list consisting of any errors found while validating the     *         transfer object     */    protected List validateValues(DTO valueObject) {        List errors = super.validateValues(valueObject);        if (LOG.isDebugEnabled()) {            LOG.debug("validateValues: Before validations, error list contains"                      + errors.size() + " error(s)");        }        validateCommentsValue(valueObject, errors);        if (LOG.isDebugEnabled()) {            LOG.debug("validateValues: After validations, error list contains"                      + errors.size() + " error(s)");        }        return errors;    }    /**     * Validate the <code>comments</code> field value on a data transfer     * object.     *     * @param valueObject The data transfer object containing the value(s) to     *                    be validated     * @param errors An error list, which this method may add to if there are     *               any validation errors     */    private void validateCommentsValue(DTO valueObject, List errors) {        ValidationUtilities.executeMaxLengthValidation(valueObject,                                                       Route.FIELD_COMMENTS,                                                       errors);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -