summaryrefslogtreecommitdiffstats
path: root/extensions/Push/lib/LogEntry.pm
blob: 848df04806c725a24196ef3806b05f893ab2b921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

package Bugzilla::Extension::Push::LogEntry;

use strict;
use warnings;

use base 'Bugzilla::Object';

use constant AUDIT_CREATES => 0;
use constant AUDIT_UPDATES => 0;
use constant AUDIT_REMOVES => 0;
use constant USE_MEMCACHED => 0;

use Bugzilla;
use Bugzilla::Error;
use Bugzilla::Extension::Push::Constants;

#
# initialisation
#

use constant DB_TABLE => 'push_log';
use constant DB_COLUMNS => qw(
    id
    message_id
    change_set
    routing_key
    connector
    push_ts
    processed_ts
    result
    data
);
use constant VALIDATORS => {
    data => \&_check_data,
};
use constant NAME_FIELD => '';
use constant LIST_ORDER => 'processed_ts DESC';

#
# accessors
#

sub message_id   { return $_[0]->{'message_id'};   }
sub change_set   { return $_[0]->{'change_set'};   }
sub routing_key  { return $_[0]->{'routing_key'};  }
sub connector    { return $_[0]->{'connector'};    }
sub push_ts      { return $_[0]->{'push_ts'};      }
sub processed_ts { return $_[0]->{'processed_ts'}; }
sub result       { return $_[0]->{'result'};       }
sub data         { return $_[0]->{'data'};         }

sub result_string { return push_result_to_string($_[0]->result) }

#
# validators
#

sub _check_data {
    my ($invocant, $value) = @_;
    return $value eq '' ? undef : $value;
}

1;