-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFactory.php
More file actions
executable file
·98 lines (85 loc) · 2.45 KB
/
Factory.php
File metadata and controls
executable file
·98 lines (85 loc) · 2.45 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
namespace Hboie\JasperReportBundle;
use Jaspersoft\Client\Client;
use Hboie\JasperReportBundle\ReportService;
use Hboie\JasperReportBundle\ImportExportService;
use Hboie\JasperReportBundle\RepositoryService;
class Factory
{
/**
* @var Client $reportClient
*/
private $reportClient;
/**
* @var ReportService $reportService
*/
private $reportService;
/**
* @var ImportExportService $importExportService
*/
private $importExportService;
/**
* @var RepositoryService $repositoryService
*/
private $repositoryService;
public function createClient($config)
{
$server_url = $config['host'];
$username = $config['username'];
$password = $config['password'];
$org_id = $config['org_id'];
$this->reportClient = new Client($server_url, $username, $password, $org_id);
if ( isset($config['timeout']) ) {
$timeout = intval($config['timeout']);
if ( is_numeric($config['timeout']) && $timeout > 0 ) {
$this->reportClient->setRequestTimeout( $timeout );
}
}
}
/**
* @return Client
*/
public function getClient()
{
return $this->reportClient;
}
/**
* get report-service
*
* @return \Hboie\JasperReportBundle\ReportService
*/
public function getReportService()
{
if ( ! isset( $this->reportService ) )
{
$this->reportService = new ReportService( $this->reportClient->reportService() );
}
return $this->reportService;
}
/**
* get export-/import-service
*
* @return \Hboie\JasperReportBundle\ImportExportService
*/
public function getImportExportService()
{
if ( ! isset( $this->importExportService ) )
{
$this->importExportService = new ImportExportService( $this->reportClient->importExportService() );
}
return $this->importExportService;
}
/**
* get repository service
*
* @return \Hboie\JasperReportBundle\RepositoryService
*/
public function getRepositoryService()
{
if ( ! isset( $this->repositoryService ) )
{
$this->repositoryService = new RepositoryService( $this->reportClient->repositoryService() );
}
return $this->repositoryService;
}
}