org.cyrusbuilt.guncabinet.dao.events.TableUpdateFinishedEventArgs.java Source code

Java tutorial

Introduction

Here is the source code for org.cyrusbuilt.guncabinet.dao.events.TableUpdateFinishedEventArgs.java

Source

/**
 * TableUpdateFinishedEventArgs.java
 * 
 * Copyright (c) 2013 CyrusBuilt
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
package org.cyrusbuilt.guncabinet.dao.events;

import org.cyrusbuilt.guncabinet.dao.Tables;
import org.joda.time.DateTime;
import org.joda.time.Period;

/**
 *  Table update finished event arguments class.
 * @author cyrusbuilt
 */
public class TableUpdateFinishedEventArgs extends EventArgs {
    private Tables _table = Tables.None;
    private Integer _recordId = 0;
    private Period _elapsed = Period.ZERO;

    /**
     * Initializes a new instance of the {@link org.cyrusbuilt.guncabinet.dao.events.TableUpdateFinishedEventArgs}
     * class with the start time, the table that was updated, and the ID of the
     * record that was the subject of the update.
     * @param start The time the table update started.
     * @param table The table that was updated.
     * @param recordId The ID of the record that was inserted, updated, or deleted.
     */
    public TableUpdateFinishedEventArgs(DateTime start, Tables table, Integer recordId) {
        super();
        this._elapsed = new Period(start, DateTime.now());
        this._table = table;
        this._recordId = recordId;
    }

    /**
     * Gets the amount of time it took for the table update to complete.
     * @return The elapsed time.
     */
    public Period elapsed() {
        return this._elapsed;
    }

    /**
     * Gets the table that was updated.
     * @return The table that was updated.
     */
    public Tables affectedTable() {
        return this._table;
    }

    /**
     * Gets the ID of the record that was affected.
     * @return The ID of the record that was inserted, updated, or deleted.
     */
    public Integer recordId() {
        return this._recordId;
    }
}