Browse Source

generated code; begin domain and records

develop
Robin Thoni 8 years ago
parent
commit
bb8d45a6dd

+ 9
- 6
app/Http/Business/DnsDomainsBusiness.php View File

@@ -17,15 +17,18 @@ class DnsDomainsBusiness extends LuBusiness {
17 17
         if (is_null($domain->getName()) || !is_string($domain->getName())) {
18 18
             self::badInput("Name must be an string");
19 19
         }
20
+        if (strtoupper($domain->getType()) != "MASTER" && strtoupper($domain->getType()) != "SLAVE") {
21
+            self::badInput("Type must be SLAVE or MASTER");
22
+        }
23
+        $domain->setType(strtoupper($domain->getType()));
24
+        $domain->setLastCheck(null);
25
+        $domain->setNotifiedSerial(null);
26
+        $domain->setAccount(null);
20 27
     }
21 28
 
22 29
     public static function add(DnsDomainsDbo $domain)
23 30
     {
24
-        return 0;
25
-    }
26
-
27
-    public static function edit(DnsDomainsDbo $domain)
28
-    {
29
-        return 0;
31
+        self::checkDomain($domain);
32
+        return DnsDomainsDataAccess::addId($domain);
30 33
     }
31 34
 }

+ 46
- 0
app/Http/Business/DnsRecordsBusiness.php View File

@@ -2,13 +2,59 @@
2 2
 
3 3
 namespace App\Http\Business;
4 4
 
5
+use Carbon\Carbon;
5 6
 use Luticate\Utils\LuBusiness;
6 7
 use App\Http\DataAccess\DnsRecordsDataAccess;
7 8
 use App\Http\DBO\DnsRecordsDbo;
8 9
 
9 10
 class DnsRecordsBusiness extends LuBusiness {
11
+
12
+    const RECORD_TYPES = array("A", "AAAA", "CNAME", "HINFO", "MX", "NAPTR", "NS", "PTR",
13
+        "SOA", "SPF", "SRV", "SSHFP", "TXT", "RP");
14
+
10 15
     protected static function getDataAccess()
11 16
     {
12 17
         return new DnsRecordsDataAccess();
13 18
     }
19
+
20
+    public static function checkRecord(DnsRecordsDbo $record)
21
+    {
22
+        DnsDomainsBusiness::getById($record->getDomainId());
23
+        if (is_null($record->getName()) || !is_string($record->getName())) {
24
+            self::badInput("Name must be an string");
25
+        }
26
+        if (is_null($record->getContent()) || !is_string($record->getContent())) {
27
+            self::badInput("Content must be an string");
28
+        }
29
+        if (!in_array($record->getType(), self::RECORD_TYPES)) {
30
+            self::badInput("Type be must be one of " . join(",", self::RECORD_TYPES));
31
+        }
32
+        if (!is_bool($record->getDisabled())) {
33
+            self::badInput("Disabled must be a boolean");
34
+        }
35
+        if (!is_bool($record->getAuth())) {
36
+            self::badInput("Auth must be a boolean");
37
+        }
38
+        if (!is_null($record->getOrdername()) && !is_string($record->getOrdername())) {
39
+            self::badInput("Ordername must be an string or null");
40
+        }
41
+        if (!is_int($record->getPrio())) {
42
+            self::badInput("Prio must be an int");
43
+        }
44
+        if (!is_int($record->getTtl())) {
45
+            self::badInput("Ttl must be a int");
46
+        }
47
+        $record->setChangeDate(Carbon::now()->timestamp);
48
+    }
49
+
50
+    public static function getAll($domain_id, $page = 0, $perPage = PHP_INT_MAX, $query = "")
51
+    {
52
+        return DnsRecordsDataAccess::getAll($domain_id, $query, $page, $perPage);
53
+    }
54
+
55
+    public static function add(DnsRecordsDbo $record)
56
+    {
57
+        self::checkRecord($record);
58
+        return DnsRecordsDataAccess::addId($record);
59
+    }
14 60
 }

+ 10
- 6
app/Http/Controller/DnsDomainsController.php View File

@@ -25,19 +25,23 @@ class DnsDomainsController extends LuController {
25 25
         return DnsDomainsBusiness::getAll($page, $perPage, $query);
26 26
     }
27 27
 
28
+    /**
29
+     * Add a new DNS domain
30
+     * @param DnsDomainsDbo $domain The new domain
31
+     * @return int
32
+     */
28 33
     public function add(DnsDomainsDbo $domain)
29 34
     {
30 35
         return DnsDomainsBusiness::add($domain);
31 36
     }
32 37
 
38
+    /**
39
+     * Delete a DNS domain
40
+     * @param LuIntDbo $domain_id The domain id
41
+     * @return bool
42
+     */
33 43
     public function del(LuIntDbo $domain_id)
34 44
     {
35 45
         return DnsDomainsBusiness::deleteById($domain_id->getInt());
36 46
     }
37
-
38
-    public function edit(LuIntDbo $domain_id, DnsDomainsDbo $domain)
39
-    {
40
-        $domain->setId($domain_id->getInt());
41
-        return DnsDomainsBusiness::edit($domain);
42
-    }
43 47
 }

+ 34
- 0
app/Http/Controller/DnsRecordsController.php View File

@@ -2,6 +2,7 @@
2 2
 
3 3
 namespace App\Http\Controller;
4 4
 
5
+use Luticate\Utils\Dbo\LuIntDbo;
5 6
 use Luticate\Utils\LuController;
6 7
 use App\Http\Business\DnsRecordsBusiness;
7 8
 use App\Http\DBO\DnsRecordsDbo;
@@ -11,4 +12,37 @@ class DnsRecordsController extends LuController {
11 12
     {
12 13
         return new DnsRecordsBusiness();
13 14
     }
15
+
16
+    /**
17
+     * Get all dns domain records
18
+     * @param LuIntDbo $domain_id The domain id
19
+     * @param int $page The page number, 0 based
20
+     * @param int $perPage Items per page
21
+     * @param string $query The filter query
22
+     * @return \App\Http\DBO\DnsDomainsDbo[]
23
+     */
24
+    public function getAll(LuIntDbo $domain_id, $page = 0, $perPage = 20000000, $query = "")
25
+    {
26
+        return DnsRecordsBusiness::getAll($domain_id->getInt(), $page, $perPage, $query);
27
+    }
28
+
29
+    /**
30
+     * Add a new DNS domain record
31
+     * @param DnsRecordsDbo $record The new domain record
32
+     * @return int
33
+     */
34
+    public function add(DnsRecordsDbo $record)
35
+    {
36
+        return DnsRecordsBusiness::add($record);
37
+    }
38
+
39
+    /**
40
+     * Delete a DNS domain record
41
+     * @param LuIntDbo $domain_id The domain record id
42
+     * @return bool
43
+     */
44
+    public function del(LuIntDbo $domain_id)
45
+    {
46
+        return DnsRecordsBusiness::deleteById($domain_id->getInt());
47
+    }
14 48
 }

+ 11
- 0
app/Http/DataAccess/DnsDomainsDataAccess.php View File

@@ -2,6 +2,7 @@
2 2
 
3 3
 namespace App\Http\DataAccess;
4 4
 
5
+use App\Http\DataAccess\SP\SpGetDomains;
5 6
 use Luticate\Utils\LuDataAccess;
6 7
 use App\Http\DataAccess\Models\DnsDomains;
7 8
 use App\Http\DBO\DnsDomainsDbo;
@@ -11,4 +12,14 @@ class DnsDomainsDataAccess extends LuDataAccess {
11 12
     {
12 13
         return new DnsDomains();
13 14
     }
15
+
16
+    protected static function getOrderBy()
17
+    {
18
+        return array(array("name", "ASC"));
19
+    }
20
+
21
+    public static function getAll($page = 0, $perPage = PHP_INT_MAX, $query = "")
22
+    {
23
+        return SpGetDomains::getMultipleJson($query, $page, $perPage);
24
+    }
14 25
 }

+ 11
- 1
app/Http/DataAccess/DnsRecordsDataAccess.php View File

@@ -2,13 +2,23 @@
2 2
 
3 3
 namespace App\Http\DataAccess;
4 4
 
5
+use App\Http\DataAccess\SP\SpGetDomainRecords;
5 6
 use Luticate\Utils\LuDataAccess;
6 7
 use App\Http\DataAccess\Models\DnsRecords;
7
-use App\Http\DBO\DnsRecordsDbo;
8 8
 
9 9
 class DnsRecordsDataAccess extends LuDataAccess {
10 10
     protected static function getModel()
11 11
     {
12 12
         return new DnsRecords();
13 13
     }
14
+
15
+    protected static function getOrderBy()
16
+    {
17
+        return array(array("name", "ASC"));
18
+    }
19
+
20
+    public static function getAll($domain_id, $page = 0, $perPage = PHP_INT_MAX, $query = "")
21
+    {
22
+        return SpGetDomainRecords::getMultipleJson($domain_id, $query, $page, $perPage);
23
+    }
14 24
 }

+ 103
- 0
app/Http/DataAccess/SP/SpGetDomainRecords.php View File

@@ -0,0 +1,103 @@
1
+<?php
2
+
3
+/**
4
+ * AUTO GENERATED BY LUTICATE GENERATOR
5
+ * ANY CHANGES WILL BE OVERWRITTEN
6
+ */
7
+
8
+namespace App\Http\DataAccess\SP;
9
+
10
+use Luticate\Utils\LuSpDbo;
11
+use Luticate\Utils\LuMultipleDbo;
12
+use Luticate\Utils\LuStringUtils;
13
+use Illuminate\Support\Facades\DB;
14
+
15
+class SpGetDomainRecords extends LuSpDbo {
16
+
17
+    /**
18
+    * @param $dam
19
+    * @return \App\Http\DataAccess\SP\SpGetDomainRecords|null
20
+    */
21
+    protected static function damToDbo($dam)
22
+    {
23
+        if (is_null($dam))
24
+            return null;
25
+        $dbo = new SpGetDomainRecords();
26
+
27
+        $dbo->setRecords(LuStringUtils::convertJsonString($dam->records));
28
+
29
+        return $dbo;
30
+    }
31
+
32
+
33
+    /**
34
+    * @param $domain_id integer
35
+    * @param $query string
36
+    * @return \App\Http\DataAccess\SP\SpGetDomainRecords[];
37
+    */
38
+    public static function execute($domain_id, $query)
39
+    {
40
+        $values = DB::select('SELECT to_json(data.records) AS records FROM sp_get_domain_records(:domain_id, :query) data', array(":domain_id" => $domain_id, ":query" => $query));
41
+        $dboValues = array();
42
+        foreach ($values as $value)
43
+            $dboValues[] = self::damToDbo($value);
44
+        return $dboValues;
45
+    }
46
+
47
+    /**
48
+    * @param $domain_id integer
49
+    * @param $query string
50
+    * @param $page int The page number, 0 based
51
+    * @param $perPage int The number of items per page
52
+    * @return \Luticate\Utils\LuMultipleDbo;
53
+    */
54
+    public static function getMultipleJson($domain_id, $query, $page, $perPage)
55
+    {
56
+        $values = DB::select('SELECT (SELECT count(*) FROM sp_get_domain_records(:domain_id, :query)) as count, (SELECT json_agg(q) FROM (SELECT * FROM sp_get_domain_records(:domain_id, :query) OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
57
+            array(":domain_id" => $domain_id, ":query" => $query, ":page" => $page, ":perPage" => $perPage));
58
+        $value = $values[0];
59
+        if (is_null($value->data))
60
+        {
61
+            $value->data = '[]';
62
+        }
63
+        $data = LuStringUtils::convertJsonString($value->data);
64
+        return new LuMultipleDbo($value->count, $data);
65
+    }
66
+
67
+    public function jsonSerialize()
68
+    {
69
+        return array(
70
+            "Records" => $this->_records
71
+        );
72
+    }
73
+
74
+    public static function jsonDeserialize($json)
75
+    {
76
+        $dbo = new SpGetDomainRecords();
77
+        if (isset($json["Records"])) {
78
+            $dbo->setRecords($json["Records"]);
79
+        }
80
+        return $dbo;
81
+    }
82
+
83
+    public static function generateSample()
84
+    {
85
+        $dbo = new SpGetDomainRecords();
86
+        $dbo->setRecords("sample string");
87
+        return $dbo;
88
+    }
89
+
90
+
91
+    /**
92
+    * @var USER-DEFINED
93
+    */
94
+    protected $_records;
95
+    public function getRecords()
96
+    {
97
+        return $this->_records;
98
+    }
99
+    public function setRecords($value)
100
+    {
101
+        $this->_records = $value;
102
+    }
103
+}

+ 101
- 0
app/Http/DataAccess/SP/SpGetDomains.php View File

@@ -0,0 +1,101 @@
1
+<?php
2
+
3
+/**
4
+ * AUTO GENERATED BY LUTICATE GENERATOR
5
+ * ANY CHANGES WILL BE OVERWRITTEN
6
+ */
7
+
8
+namespace App\Http\DataAccess\SP;
9
+
10
+use Luticate\Utils\LuSpDbo;
11
+use Luticate\Utils\LuMultipleDbo;
12
+use Luticate\Utils\LuStringUtils;
13
+use Illuminate\Support\Facades\DB;
14
+
15
+class SpGetDomains extends LuSpDbo {
16
+
17
+    /**
18
+    * @param $dam
19
+    * @return \App\Http\DataAccess\SP\SpGetDomains|null
20
+    */
21
+    protected static function damToDbo($dam)
22
+    {
23
+        if (is_null($dam))
24
+            return null;
25
+        $dbo = new SpGetDomains();
26
+
27
+        $dbo->setDomains(LuStringUtils::convertJsonString($dam->domains));
28
+
29
+        return $dbo;
30
+    }
31
+
32
+
33
+    /**
34
+    * @param $query string
35
+    * @return \App\Http\DataAccess\SP\SpGetDomains[];
36
+    */
37
+    public static function execute($query)
38
+    {
39
+        $values = DB::select('SELECT to_json(data.domains) AS domains FROM sp_get_domains(:query) data', array(":query" => $query));
40
+        $dboValues = array();
41
+        foreach ($values as $value)
42
+            $dboValues[] = self::damToDbo($value);
43
+        return $dboValues;
44
+    }
45
+
46
+    /**
47
+    * @param $query string
48
+    * @param $page int The page number, 0 based
49
+    * @param $perPage int The number of items per page
50
+    * @return \Luticate\Utils\LuMultipleDbo;
51
+    */
52
+    public static function getMultipleJson($query, $page, $perPage)
53
+    {
54
+        $values = DB::select('SELECT (SELECT count(*) FROM sp_get_domains(:query)) as count, (SELECT json_agg(q) FROM (SELECT * FROM sp_get_domains(:query) OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
55
+            array(":query" => $query, ":page" => $page, ":perPage" => $perPage));
56
+        $value = $values[0];
57
+        if (is_null($value->data))
58
+        {
59
+            $value->data = '[]';
60
+        }
61
+        $data = LuStringUtils::convertJsonString($value->data);
62
+        return new LuMultipleDbo($value->count, $data);
63
+    }
64
+
65
+    public function jsonSerialize()
66
+    {
67
+        return array(
68
+            "Domains" => $this->_domains
69
+        );
70
+    }
71
+
72
+    public static function jsonDeserialize($json)
73
+    {
74
+        $dbo = new SpGetDomains();
75
+        if (isset($json["Domains"])) {
76
+            $dbo->setDomains($json["Domains"]);
77
+        }
78
+        return $dbo;
79
+    }
80
+
81
+    public static function generateSample()
82
+    {
83
+        $dbo = new SpGetDomains();
84
+        $dbo->setDomains("sample string");
85
+        return $dbo;
86
+    }
87
+
88
+
89
+    /**
90
+    * @var USER-DEFINED
91
+    */
92
+    protected $_domains;
93
+    public function getDomains()
94
+    {
95
+        return $this->_domains;
96
+    }
97
+    public function setDomains($value)
98
+    {
99
+        $this->_domains = $value;
100
+    }
101
+}

+ 81
- 0
app/Http/DataAccess/SP/SpSearch.php View File

@@ -0,0 +1,81 @@
1
+<?php
2
+
3
+/**
4
+ * AUTO GENERATED BY LUTICATE GENERATOR
5
+ * ANY CHANGES WILL BE OVERWRITTEN
6
+ */
7
+
8
+namespace App\Http\DataAccess\SP;
9
+
10
+use Luticate\Utils\LuSpDbo;
11
+use Luticate\Utils\LuMultipleDbo;
12
+use Luticate\Utils\LuStringUtils;
13
+use Illuminate\Support\Facades\DB;
14
+
15
+class SpSearch extends LuSpDbo {
16
+
17
+    /**
18
+    * @param $dam
19
+    * @return \App\Http\DataAccess\SP\SpSearch|null
20
+    */
21
+    protected static function damToDbo($dam)
22
+    {
23
+        if (is_null($dam))
24
+            return null;
25
+        $dbo = new SpSearch();
26
+
27
+        $dbo->setRes(LuStringUtils::convertJsonString($dam->_res));
28
+
29
+        return $dbo;
30
+    }
31
+
32
+
33
+    /**
34
+    * @param $_text string
35
+    * @param $_query string
36
+    * @return \App\Http\DataAccess\SP\SpSearch;
37
+    */
38
+    public static function execute($_text, $_query)
39
+    {
40
+        $values = DB::select('SELECT to_json(data._res) AS _res FROM sp_search(:_text, :_query) data', array(":_text" => $_text, ":_query" => $_query));
41
+        return self::damToDbo($values[0]);
42
+    }
43
+
44
+
45
+    public function jsonSerialize()
46
+    {
47
+        return array(
48
+            "Res" => $this->_Res
49
+        );
50
+    }
51
+
52
+    public static function jsonDeserialize($json)
53
+    {
54
+        $dbo = new SpSearch();
55
+        if (isset($json["Res"])) {
56
+            $dbo->setRes($json["Res"]);
57
+        }
58
+        return $dbo;
59
+    }
60
+
61
+    public static function generateSample()
62
+    {
63
+        $dbo = new SpSearch();
64
+        $dbo->setRes(true);
65
+        return $dbo;
66
+    }
67
+
68
+
69
+    /**
70
+    * @var boolean
71
+    */
72
+    protected $_Res;
73
+    public function getRes()
74
+    {
75
+        return $this->_Res;
76
+    }
77
+    public function setRes($value)
78
+    {
79
+        $this->_Res = $value;
80
+    }
81
+}

+ 82
- 0
app/Http/DataAccess/SP/Unaccent.php View File

@@ -0,0 +1,82 @@
1
+<?php
2
+
3
+/**
4
+ * AUTO GENERATED BY LUTICATE GENERATOR
5
+ * ANY CHANGES WILL BE OVERWRITTEN
6
+ */
7
+
8
+namespace App\Http\DataAccess\SP;
9
+
10
+use Luticate\Utils\LuSpDbo;
11
+use Luticate\Utils\LuMultipleDbo;
12
+use Luticate\Utils\LuStringUtils;
13
+use Illuminate\Support\Facades\DB;
14
+
15
+class Unaccent extends LuSpDbo {
16
+
17
+    /**
18
+    * @param $dam
19
+    * @return \App\Http\DataAccess\SP\Unaccent|null
20
+    */
21
+    protected static function damToDbo($dam)
22
+    {
23
+        if (is_null($dam))
24
+            return null;
25
+        $dbo = new Unaccent();
26
+
27
+        $dbo->setUnaccent(LuStringUtils::convertJsonString($dam->unaccent));
28
+
29
+        return $dbo;
30
+    }
31
+
32
+
33
+    /**
34
+    * @param $ regdictionary
35
+    * @param $ text
36
+    * @param $ text
37
+    * @return \App\Http\DataAccess\SP\Unaccent;
38
+    */
39
+    public static function execute($, $, $)
40
+    {
41
+        $values = DB::select('SELECT to_json(data.unaccent) AS unaccent FROM unaccent(:, :, :) data', array(":" => $, ":" => $, ":" => $));
42
+        return self::damToDbo($values[0]);
43
+    }
44
+
45
+
46
+    public function jsonSerialize()
47
+    {
48
+        return array(
49
+            "Unaccent" => $this->_unaccent
50
+        );
51
+    }
52
+
53
+    public static function jsonDeserialize($json)
54
+    {
55
+        $dbo = new Unaccent();
56
+        if (isset($json["Unaccent"])) {
57
+            $dbo->setUnaccent($json["Unaccent"]);
58
+        }
59
+        return $dbo;
60
+    }
61
+
62
+    public static function generateSample()
63
+    {
64
+        $dbo = new Unaccent();
65
+        $dbo->setUnaccent("sample string");
66
+        return $dbo;
67
+    }
68
+
69
+
70
+    /**
71
+    * @var text
72
+    */
73
+    protected $_unaccent;
74
+    public function getUnaccent()
75
+    {
76
+        return $this->_unaccent;
77
+    }
78
+    public function setUnaccent($value)
79
+    {
80
+        $this->_unaccent = $value;
81
+    }
82
+}

+ 80
- 0
app/Http/DataAccess/SP/UnaccentInit.php View File

@@ -0,0 +1,80 @@
1
+<?php
2
+
3
+/**
4
+ * AUTO GENERATED BY LUTICATE GENERATOR
5
+ * ANY CHANGES WILL BE OVERWRITTEN
6
+ */
7
+
8
+namespace App\Http\DataAccess\SP;
9
+
10
+use Luticate\Utils\LuSpDbo;
11
+use Luticate\Utils\LuMultipleDbo;
12
+use Luticate\Utils\LuStringUtils;
13
+use Illuminate\Support\Facades\DB;
14
+
15
+class UnaccentInit extends LuSpDbo {
16
+
17
+    /**
18
+    * @param $dam
19
+    * @return \App\Http\DataAccess\SP\UnaccentInit|null
20
+    */
21
+    protected static function damToDbo($dam)
22
+    {
23
+        if (is_null($dam))
24
+            return null;
25
+        $dbo = new UnaccentInit();
26
+
27
+        $dbo->setUnaccentInit(LuStringUtils::convertJsonString($dam->unaccent_init));
28
+
29
+        return $dbo;
30
+    }
31
+
32
+
33
+    /**
34
+    * @param $ internal
35
+    * @return \App\Http\DataAccess\SP\UnaccentInit;
36
+    */
37
+    public static function execute($)
38
+    {
39
+        $values = DB::select('SELECT to_json(data.unaccent_init) AS unaccent_init FROM unaccent_init(:) data', array(":" => $));
40
+        return self::damToDbo($values[0]);
41
+    }
42
+
43
+
44
+    public function jsonSerialize()
45
+    {
46
+        return array(
47
+            "UnaccentInit" => $this->_unaccentInit
48
+        );
49
+    }
50
+
51
+    public static function jsonDeserialize($json)
52
+    {
53
+        $dbo = new UnaccentInit();
54
+        if (isset($json["UnaccentInit"])) {
55
+            $dbo->setUnaccentInit($json["UnaccentInit"]);
56
+        }
57
+        return $dbo;
58
+    }
59
+
60
+    public static function generateSample()
61
+    {
62
+        $dbo = new UnaccentInit();
63
+        $dbo->setUnaccentInit("sample string");
64
+        return $dbo;
65
+    }
66
+
67
+
68
+    /**
69
+    * @var internal
70
+    */
71
+    protected $_unaccentInit;
72
+    public function getUnaccentInit()
73
+    {
74
+        return $this->_unaccentInit;
75
+    }
76
+    public function setUnaccentInit($value)
77
+    {
78
+        $this->_unaccentInit = $value;
79
+    }
80
+}

+ 83
- 0
app/Http/DataAccess/SP/UnaccentLexize.php View File

@@ -0,0 +1,83 @@
1
+<?php
2
+
3
+/**
4
+ * AUTO GENERATED BY LUTICATE GENERATOR
5
+ * ANY CHANGES WILL BE OVERWRITTEN
6
+ */
7
+
8
+namespace App\Http\DataAccess\SP;
9
+
10
+use Luticate\Utils\LuSpDbo;
11
+use Luticate\Utils\LuMultipleDbo;
12
+use Luticate\Utils\LuStringUtils;
13
+use Illuminate\Support\Facades\DB;
14
+
15
+class UnaccentLexize extends LuSpDbo {
16
+
17
+    /**
18
+    * @param $dam
19
+    * @return \App\Http\DataAccess\SP\UnaccentLexize|null
20
+    */
21
+    protected static function damToDbo($dam)
22
+    {
23
+        if (is_null($dam))
24
+            return null;
25
+        $dbo = new UnaccentLexize();
26
+
27
+        $dbo->setUnaccentLexize(LuStringUtils::convertJsonString($dam->unaccent_lexize));
28
+
29
+        return $dbo;
30
+    }
31
+
32
+
33
+    /**
34
+    * @param $ internal
35
+    * @param $ internal
36
+    * @param $ internal
37
+    * @param $ internal
38
+    * @return \App\Http\DataAccess\SP\UnaccentLexize;
39
+    */
40
+    public static function execute($, $, $, $)
41
+    {
42
+        $values = DB::select('SELECT to_json(data.unaccent_lexize) AS unaccent_lexize FROM unaccent_lexize(:, :, :, :) data', array(":" => $, ":" => $, ":" => $, ":" => $));
43
+        return self::damToDbo($values[0]);
44
+    }
45
+
46
+
47
+    public function jsonSerialize()
48
+    {
49
+        return array(
50
+            "UnaccentLexize" => $this->_unaccentLexize
51
+        );
52
+    }
53
+
54
+    public static function jsonDeserialize($json)
55
+    {
56
+        $dbo = new UnaccentLexize();
57
+        if (isset($json["UnaccentLexize"])) {
58
+            $dbo->setUnaccentLexize($json["UnaccentLexize"]);
59
+        }
60
+        return $dbo;
61
+    }
62
+
63
+    public static function generateSample()
64
+    {
65
+        $dbo = new UnaccentLexize();
66
+        $dbo->setUnaccentLexize("sample string");
67
+        return $dbo;
68
+    }
69
+
70
+
71
+    /**
72
+    * @var internal
73
+    */
74
+    protected $_unaccentLexize;
75
+    public function getUnaccentLexize()
76
+    {
77
+        return $this->_unaccentLexize;
78
+    }
79
+    public function setUnaccentLexize($value)
80
+    {
81
+        $this->_unaccentLexize = $value;
82
+    }
83
+}

+ 4
- 0
app/Http/DataAccess/SP/src/sp_get_domain_records.sql View File

@@ -0,0 +1,4 @@
1
+
2
+        SELECT r FROM dns_records r
3
+        WHERE sp_search(r.name, query)
4
+        ORDER BY r.name

+ 4
- 0
app/Http/DataAccess/SP/src/sp_get_domains.sql View File

@@ -0,0 +1,4 @@
1
+
2
+        SELECT d FROM dns_domains d
3
+        WHERE sp_search(d.name, query)
4
+        ORDER BY d.name

+ 2
- 0
app/Http/DataAccess/SP/src/sp_search.sql View File

@@ -0,0 +1,2 @@
1
+
2
+	SELECT unaccent(_text) ILIKE '%' || unaccent(_query) || '%'

+ 1
- 0
app/Http/DataAccess/SP/src/unaccent.sql View File

@@ -0,0 +1 @@
1
+unaccent_dict

+ 1
- 0
app/Http/DataAccess/SP/src/unaccent_init.sql View File

@@ -0,0 +1 @@
1
+unaccent_init

+ 1
- 0
app/Http/DataAccess/SP/src/unaccent_lexize.sql View File

@@ -0,0 +1 @@
1
+unaccent_lexize

+ 5
- 1
app/Http/routes.php View File

@@ -8,6 +8,7 @@ $route = LuRoute::getInstance();
8 8
 
9 9
 $int = LuRoute::REG_UINT;
10 10
 $domain_id = "{domain_id:$int}";
11
+$record_id = "{record_id:$int}";
11 12
 
12 13
 LuticateBusiness::setupAuth();
13 14
 LuticateBusiness::setupRoutes();
@@ -16,4 +17,7 @@ LuDocBusiness::setupRoutes("/lunet");
16 17
 $route->get("/dns", "DnsDomains", "getAll");
17 18
 $route->post("/dns/add", "DnsDomains", "add");
18 19
 $route->post("/dns/$domain_id/del", "DnsDomains", "del");
19
-$route->post("/dns/$domain_id/edit", "DnsDomains", "edit");
20
+
21
+$route->get("/dns/$domain_id/records", "DnsRecords", "getAll");
22
+$route->post("/dns/$domain_id/records/add", "DnsRecords", "add");
23
+$route->post("/dns/$domain_id/records/$record_id/del", "DnsRecords", "del");

Loading…
Cancel
Save