The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Elive::Entity::Report - Elluminate Report entity instance class

DESCRIPTION

This is the entity class for server side reports. These are visible on the Elluminate server under the 'Reports' tab.

Please note that the list method (listReports command) does not return the body of the report. The report object needs to be refetched via the retrieve method.

For example, the following code snippet exports all reports for a site:

    my $reports = Elive::Entity::Report->list;
    my @report_ids = map {$_->reportId} @$reports;

    foreach my $report_id (@report_ids) {

        #
        # listed objects don't have the report body, refetch them.
        #

        my $rpt = Elive::Entity::Report->retrieve( $report_id );

        my $name = $rpt->name;
        $name =~ s/[^\w]//g; # sanitise
        my $export_file = "/tmp/report_${reportId}_${name}.xml";

        open (my $dump_fh, '>', $export_file)
            or die "unable to open $export_file: $!";
        print $dump_fh $rpt->xml;
        close ($dump_fh);

    }

METHODS

list

    my $all_reports = Elive::Entity::Report->list();

List reports.

Note: This command does not return the body of the report (xml property).

retrieve

    my $report = Elive::Entity::Report->retrieve( $report_id );
    my $report_xml = $report->xml;

Retrieves a report, including the body of the report (xml property).

insert

The insert method is not available for reports.

update

The update method is not available for reports.

delete

    my $report = Elive::Entity::Report->retrieve( $report_id );
    $report->delete if $report;

Deletes a report.