1package Netdot::Model::DeviceModule;
2
3use base 'Netdot::Model';
4use warnings;
5use strict;
6use Data::Dumper;
7
8my $logger = Netdot->log->get_logger('Netdot::Model::Device');
9
10=head1 NAME
11
12Netdot::Model::DeviceModule - Device Module Class
13
14=head1 CLASS METHODS
15=cut
16
17################################################################
18
19=head2 insert - Insert DeviceModule object
20
21    We override the insert method for extra functionality
22      - Automatically assign timestamps
23
24  Arguments:
25    Hash ref with field/value pairs
26  Returns:
27    New DeviceModule object
28  Examples:
29    DeviceModule->insert({number=>1, name=>"blah"});
30=cut
31
32sub insert {
33    my ($class, $argv) = @_;
34    $argv->{date_installed} = $class->timestamp();
35    $argv->{last_updated}   = $class->timestamp();
36    return $class->SUPER::insert( $argv );
37}
38
39=head1 OBJECT METHODS
40=cut
41
42################################################################
43
44=head2 update - Update DeviceModule object
45
46    We override the update method for extra functionality
47      - Automatically assign timestamps
48
49  Arguments:
50    Hash ref with field/value pairs
51  Returns:
52    See Class::DBI::update()
53  Examples:
54    $module->update({number=>1, name=>"blah"});
55=cut
56
57sub update {
58    my ($self, $argv) = @_;
59    $argv->{last_updated} = $self->timestamp();
60    return $self->SUPER::update( $argv );
61}
62
63=head1 AUTHOR
64
65Carlos Vicente, C<< <cvicente at ns.uoregon.edu> >>
66
67=head1 COPYRIGHT & LICENSE
68
69Copyright 2012 University of Oregon, all rights reserved.
70
71This program is free software; you can redistribute it and/or modify
72it under the terms of the GNU General Public License as published by
73the Free Software Foundation; either version 2 of the License, or
74(at your option) any later version.
75
76This program is distributed in the hope that it will be useful, but
77WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
78or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
79License for more details.
80
81You should have received a copy of the GNU General Public License
82along with this program; if not, write to the Free Software Foundation,
83Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
84
85=cut
86
87#Be sure to return 1
881;
89
90