|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @category Brownie/BpmOnline |
|
4
|
|
|
* @author Brownie <[email protected]> |
|
5
|
|
|
* @license https://opensource.org/licenses/MIT |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace Brownie\BpmOnline\DataService; |
|
9
|
|
|
|
|
10
|
|
|
use Brownie\BpmOnline\Exception\ValidateException; |
|
11
|
|
|
use Brownie\Util\StorageArray; |
|
12
|
|
|
|
|
13
|
|
|
/** |
|
14
|
|
|
* Common class for contract query. |
|
15
|
|
|
* |
|
16
|
|
|
* @method string getRootSchemaName() Sets the name of the root object schema. |
|
17
|
|
|
* @method Contract setRootSchemaName($rootSchemaName) Returns the name of the root object schema. |
|
18
|
|
|
* @method int getOperationType() Returns the type of operation with a record. |
|
19
|
|
|
* @method Contract setOperationType($operationType) Sets the type of operation with the entry. |
|
20
|
|
|
* @method string getContractType() Returns the type of the contract. |
|
21
|
|
|
* @method Contract setContractType($contractType) Sets the contract type. |
|
22
|
|
|
*/ |
|
23
|
|
|
class Contract extends StorageArray |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* Type of operation with record SELECT for sampling data. |
|
27
|
|
|
*/ |
|
28
|
|
|
const SELECT = 0; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Type of operation with record INSERT to insert data. |
|
32
|
|
|
*/ |
|
33
|
|
|
const INSERT = 1; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Type of operation with record UPDATE to update the data. |
|
37
|
|
|
*/ |
|
38
|
|
|
const UPDATE = 2; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Type of operation with record DELETE to delete data. |
|
42
|
|
|
*/ |
|
43
|
|
|
const DELETE = 3; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* Type of operation with record BATCH for group queries. |
|
47
|
|
|
*/ |
|
48
|
|
|
const BATCH = 4; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* The endpoint for the SELECT operation. |
|
52
|
|
|
*/ |
|
53
|
|
|
const SELECT_QUERY = 'SelectQuery'; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* The endpoint for the INSERT operation. |
|
57
|
|
|
*/ |
|
58
|
|
|
const INSERT_QUERY = 'InsertQuery'; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* The endpoint for the UPDATE operation. |
|
62
|
|
|
*/ |
|
63
|
|
|
const UPDATE_QUERY = 'UpdateQuery'; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* The endpoint for the DELETE operation. |
|
67
|
|
|
*/ |
|
68
|
|
|
const DELETE_QUERY = 'DeleteQuery'; |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* The endpoint for the BATCH operation. |
|
72
|
|
|
*/ |
|
73
|
|
|
const BATCH_QUERY = 'BatchQuery'; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* List of supported fields. |
|
77
|
|
|
* |
|
78
|
|
|
* @var array |
|
79
|
|
|
*/ |
|
80
|
|
|
protected $fields = [ |
|
81
|
|
|
/** |
|
82
|
|
|
* The name of the root schema object. |
|
83
|
|
|
*/ |
|
84
|
|
|
'rootSchemaName' => '', |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Record operation type. |
|
88
|
|
|
*/ |
|
89
|
|
|
'operationType' => null, |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Determination of the contract to fulfill the request in the API. |
|
93
|
|
|
*/ |
|
94
|
|
|
'contractType' => null, |
|
95
|
|
|
]; |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* Validates contract data, throws an exception in case of an error. |
|
99
|
|
|
* |
|
100
|
|
|
* @throws ValidateException |
|
101
|
|
|
*/ |
|
102
|
1 |
|
public function validate() |
|
103
|
|
|
{ |
|
104
|
1 |
|
throw new ValidateException('Invalid contract arguments.'); |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
|
|
/** |
|
108
|
|
|
* Returns the response of the performance contract. |
|
109
|
|
|
* |
|
110
|
|
|
* @param string $rawResponse Raw response. |
|
111
|
|
|
* |
|
112
|
|
|
* @return Response |
|
113
|
|
|
* |
|
114
|
|
|
* @throws ValidateException |
|
115
|
|
|
*/ |
|
116
|
1 |
|
public function getResponse(/** @scrutinizer ignore-unused */ $rawResponse) |
|
117
|
|
|
{ |
|
118
|
1 |
|
throw new ValidateException('Invalid response arguments.'); |
|
119
|
|
|
} |
|
120
|
|
|
} |
|
121
|
|
|
|