| @@ 43-115 (lines=73) @@ | ||
| 40 | * |
|
| 41 | * @package OCA\Circles\Db |
|
| 42 | */ |
|
| 43 | class GSEventsRequestBuilder extends CoreRequestBuilder { |
|
| 44 | ||
| 45 | ||
| 46 | /** |
|
| 47 | * Base of the Sql Insert request for Shares |
|
| 48 | * |
|
| 49 | * @return IQueryBuilder |
|
| 50 | */ |
|
| 51 | protected function getGSEventsInsertSql() { |
|
| 52 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 53 | $qb->insert(self::TABLE_GSEVENTS); |
|
| 54 | ||
| 55 | return $qb; |
|
| 56 | } |
|
| 57 | ||
| 58 | ||
| 59 | /** |
|
| 60 | * Base of the Sql Update request for Groups |
|
| 61 | * |
|
| 62 | * @return IQueryBuilder |
|
| 63 | */ |
|
| 64 | protected function getGSEventsUpdateSql() { |
|
| 65 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 66 | $qb->update(self::TABLE_GSEVENTS); |
|
| 67 | ||
| 68 | return $qb; |
|
| 69 | } |
|
| 70 | ||
| 71 | ||
| 72 | /** |
|
| 73 | * @return IQueryBuilder |
|
| 74 | */ |
|
| 75 | protected function getGSEventsSelectSql() { |
|
| 76 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 77 | ||
| 78 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
|
| 79 | $qb->select('gse.token', 'gse.event', 'gse.instance', 'gse.severity', 'gse.status', 'gse.creation') |
|
| 80 | ->from(self::TABLE_GSEVENTS, 'gse'); |
|
| 81 | ||
| 82 | $this->default_select_alias = 'gse'; |
|
| 83 | ||
| 84 | return $qb; |
|
| 85 | } |
|
| 86 | ||
| 87 | ||
| 88 | /** |
|
| 89 | * Base of the Sql Delete request |
|
| 90 | * |
|
| 91 | * @return IQueryBuilder |
|
| 92 | */ |
|
| 93 | protected function getGSEventsDeleteSql() { |
|
| 94 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 95 | $qb->delete(self::TABLE_GSEVENTS); |
|
| 96 | ||
| 97 | return $qb; |
|
| 98 | } |
|
| 99 | ||
| 100 | ||
| 101 | /** |
|
| 102 | * @param array $data |
|
| 103 | * |
|
| 104 | * @return GSWrapper |
|
| 105 | * @throws JsonException |
|
| 106 | * @throws ModelException |
|
| 107 | */ |
|
| 108 | protected function parseGSEventsSelectSql($data): GSWrapper { |
|
| 109 | $wrapper = new GSWrapper(); |
|
| 110 | $wrapper->import($data); |
|
| 111 | ||
| 112 | return $wrapper; |
|
| 113 | } |
|
| 114 | ||
| 115 | } |
|
| 116 | ||
| @@ 41-114 (lines=74) @@ | ||
| 38 | * |
|
| 39 | * @package OCA\Circles\Db |
|
| 40 | */ |
|
| 41 | class GSSharesRequestBuilder extends CoreRequestBuilder { |
|
| 42 | ||
| 43 | ||
| 44 | /** |
|
| 45 | * Base of the Sql Insert request for Shares |
|
| 46 | * |
|
| 47 | * @return IQueryBuilder |
|
| 48 | */ |
|
| 49 | protected function getGSSharesInsertSql() { |
|
| 50 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 51 | $qb->insert(self::TABLE_GSSHARES); |
|
| 52 | ||
| 53 | return $qb; |
|
| 54 | } |
|
| 55 | ||
| 56 | ||
| 57 | /** |
|
| 58 | * Base of the Sql Update request for Groups |
|
| 59 | * |
|
| 60 | * @return IQueryBuilder |
|
| 61 | */ |
|
| 62 | protected function getGSSharesUpdateSql() { |
|
| 63 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 64 | $qb->update(self::TABLE_GSSHARES); |
|
| 65 | ||
| 66 | return $qb; |
|
| 67 | } |
|
| 68 | ||
| 69 | ||
| 70 | /** |
|
| 71 | * @return IQueryBuilder |
|
| 72 | */ |
|
| 73 | protected function getGSSharesSelectSql() { |
|
| 74 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 75 | ||
| 76 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
|
| 77 | $qb->select( |
|
| 78 | 'gsh.id', 'gsh.circle_unique_id', 'gsh.owner', 'gsh.instance', 'gsh.token', 'gsh.parent', |
|
| 79 | 'gsh.mountpoint', 'gsh.mountpoint_hash' |
|
| 80 | ) |
|
| 81 | ->from(self::TABLE_GSSHARES, 'gsh'); |
|
| 82 | ||
| 83 | $this->default_select_alias = 'gsh'; |
|
| 84 | ||
| 85 | return $qb; |
|
| 86 | } |
|
| 87 | ||
| 88 | ||
| 89 | /** |
|
| 90 | * Base of the Sql Delete request |
|
| 91 | * |
|
| 92 | * @return IQueryBuilder |
|
| 93 | */ |
|
| 94 | protected function getGSSharesDeleteSql() { |
|
| 95 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 96 | $qb->delete(self::TABLE_GSSHARES); |
|
| 97 | ||
| 98 | return $qb; |
|
| 99 | } |
|
| 100 | ||
| 101 | ||
| 102 | /** |
|
| 103 | * @param array $data |
|
| 104 | * |
|
| 105 | * @return GSShare |
|
| 106 | */ |
|
| 107 | protected function parseGSSharesSelectSql($data): GSShare { |
|
| 108 | $share = new GSShare(); |
|
| 109 | $share->importFromDatabase($data); |
|
| 110 | ||
| 111 | return $share; |
|
| 112 | } |
|
| 113 | ||
| 114 | } |
|
| 115 | ||
| @@ 42-118 (lines=77) @@ | ||
| 39 | * |
|
| 40 | * @package OCA\Circles\Db |
|
| 41 | */ |
|
| 42 | class TokensRequestBuilder extends CoreRequestBuilder { |
|
| 43 | ||
| 44 | ||
| 45 | use TArrayTools; |
|
| 46 | ||
| 47 | ||
| 48 | /** |
|
| 49 | * Base of the Sql Insert request for Shares |
|
| 50 | * |
|
| 51 | * @return IQueryBuilder |
|
| 52 | */ |
|
| 53 | protected function getTokensInsertSql() { |
|
| 54 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 55 | $qb->insert(self::TABLE_TOKENS); |
|
| 56 | ||
| 57 | return $qb; |
|
| 58 | } |
|
| 59 | ||
| 60 | ||
| 61 | /** |
|
| 62 | * Base of the Sql Update request for Groups |
|
| 63 | * |
|
| 64 | * @param int $circleId |
|
| 65 | * @param string $groupId |
|
| 66 | * |
|
| 67 | * @return IQueryBuilder |
|
| 68 | */ |
|
| 69 | protected function getTokensUpdateSql($circleId, $groupId) { |
|
| 70 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 71 | $qb->update(self::TABLE_TOKENS); |
|
| 72 | ||
| 73 | return $qb; |
|
| 74 | } |
|
| 75 | ||
| 76 | ||
| 77 | /** |
|
| 78 | * @return IQueryBuilder |
|
| 79 | */ |
|
| 80 | protected function getTokensSelectSql() { |
|
| 81 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 82 | ||
| 83 | /** @noinspection PhpMethodParametersCountMismatchInspection */ |
|
| 84 | $qb->select('t.user_id', 't.circle_id', 't.member_id', 't.share_id', 't.token', 't.accepted') |
|
| 85 | ->from(self::TABLE_TOKENS, 't'); |
|
| 86 | ||
| 87 | $this->default_select_alias = 't'; |
|
| 88 | ||
| 89 | return $qb; |
|
| 90 | } |
|
| 91 | ||
| 92 | ||
| 93 | /** |
|
| 94 | * Base of the Sql Delete request |
|
| 95 | * |
|
| 96 | * @return IQueryBuilder |
|
| 97 | */ |
|
| 98 | protected function getTokensDeleteSql() { |
|
| 99 | $qb = $this->dbConnection->getQueryBuilder(); |
|
| 100 | $qb->delete(self::TABLE_TOKENS); |
|
| 101 | ||
| 102 | return $qb; |
|
| 103 | } |
|
| 104 | ||
| 105 | ||
| 106 | /** |
|
| 107 | * @param array $data |
|
| 108 | * |
|
| 109 | * @return SharesToken |
|
| 110 | */ |
|
| 111 | protected function parseTokensSelectSql($data) { |
|
| 112 | $sharesToken = new SharesToken(); |
|
| 113 | $sharesToken->import($data); |
|
| 114 | ||
| 115 | return $sharesToken; |
|
| 116 | } |
|
| 117 | ||
| 118 | } |
|
| 119 | ||