ProcessMaker-MA "Input Documents Resources (validations)"
- Se han corregido validaciones con el campo "inp_doc_title" en POST y PUT - Se a restablecido los behat basicos en un nuevo archivo llamado "basic_sequence.feature" (Input Documents Resources) - Se a renombrado el archivo "case_tracket.feature" por "basic_sequence.feature" (Case Tracker)
This commit is contained in:
@@ -0,0 +1,134 @@
|
|||||||
|
@ProcessMakerMichelangelo @RestAPI
|
||||||
|
Feature: Input Documents Resources
|
||||||
|
Background:
|
||||||
|
Given that I have a valid access_token
|
||||||
|
|
||||||
|
#GET /api/1.0/{workspace}/project/{prj_uid}/input-documents
|
||||||
|
# Get a List Input Documents of a Project
|
||||||
|
Scenario: Get a List Input Documents of a Project
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-documents"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "array"
|
||||||
|
And the json data is an empty array
|
||||||
|
|
||||||
|
#POST /api/1.0/{workspace}/project/{prj_uid}/input-document
|
||||||
|
# Create a new Input Document for a Project
|
||||||
|
Scenario: Create "My InputDocument1" for a Project
|
||||||
|
And POST this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"inp_doc_title": "My InputDocument1",
|
||||||
|
"inp_doc_description": "My InputDocument1 DESCRIPTION",
|
||||||
|
"inp_doc_form_needed": "VIRTUAL",
|
||||||
|
"inp_doc_original": "ORIGINAL",
|
||||||
|
"inp_doc_published": "PRIVATE",
|
||||||
|
"inp_doc_versioning": 1,
|
||||||
|
"inp_doc_destination_path": "",
|
||||||
|
"inp_doc_tags": "INPUT"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-document"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 201
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
And store "inp_doc_uid" in session array as variable "inp_doc_uid1"
|
||||||
|
|
||||||
|
#POST /api/1.0/{workspace}/project/{prj_uid}/input-document
|
||||||
|
# Create a new Input Document for a Project
|
||||||
|
Scenario: Create "My InputDocument2" for a Project
|
||||||
|
And POST this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"inp_doc_title": "My InputDocument2",
|
||||||
|
"inp_doc_description": "My InputDocument2 DESCRIPTION",
|
||||||
|
"inp_doc_form_needed": "VIRTUAL",
|
||||||
|
"inp_doc_original": "ORIGINAL",
|
||||||
|
"inp_doc_published": "PRIVATE",
|
||||||
|
"inp_doc_versioning": 1,
|
||||||
|
"inp_doc_destination_path": "",
|
||||||
|
"inp_doc_tags": "INPUT"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-document"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 201
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
And store "inp_doc_uid" in session array as variable "inp_doc_uid2"
|
||||||
|
|
||||||
|
#PUT /api/1.0/{workspace}/project/{prj_uid}/input-document/{inp_doc_uid}
|
||||||
|
# Update an Input Document for a Project
|
||||||
|
Scenario: Update an Input Document for a Project
|
||||||
|
And PUT this data:
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"inp_doc_title": "My InputDocument1 Modified",
|
||||||
|
"inp_doc_description": "My InputDocument1 DESCRIPTION Modified",
|
||||||
|
"inp_doc_form_needed": "VIRTUAL",
|
||||||
|
"inp_doc_original": "ORIGINAL",
|
||||||
|
"inp_doc_published": "PRIVATE"
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
And that I want to update a resource with the key "inp_doc_uid1" stored in session array
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-document"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
|
||||||
|
#GET /api/1.0/{workspace}/project/{prj_uid}/input-documents
|
||||||
|
# Get a List Input Documents of a Project
|
||||||
|
Scenario: Get a List Input Documents of a Project
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-documents"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "array"
|
||||||
|
And the "inp_doc_title" property in row 0 equals "My InputDocument1 Modified"
|
||||||
|
And the "inp_doc_description" property in row 0 equals "My InputDocument1 DESCRIPTION Modified"
|
||||||
|
|
||||||
|
#GET /api/1.0/{workspace}/project/{prj_uid}/input-document/{inp_doc_uid}
|
||||||
|
# Get a single Input Document of a Project
|
||||||
|
Scenario: Get a single Input Document of a Project
|
||||||
|
And that I want to get a resource with the key "inp_doc_uid1" stored in session array
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-document"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
And that "inp_doc_title" is set to "My InputDocument1 Modified"
|
||||||
|
And that "inp_doc_description" is set to "My InputDocument1 DESCRIPTION Modified"
|
||||||
|
|
||||||
|
#DELETE /api/1.0/{workspace}/project/{prj_uid}/input-document/{inp_doc_uid}
|
||||||
|
# Delete an Input Document of a Project
|
||||||
|
Scenario: Delete a previously created Input Document
|
||||||
|
And that I want to delete a resource with the key "inp_doc_uid1" stored in session array
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-document"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
|
||||||
|
#DELETE /api/1.0/{workspace}/project/{prj_uid}/input-document/{inp_doc_uid}
|
||||||
|
# Delete an Input Document of a Project
|
||||||
|
Scenario: Delete a previously created Input Document
|
||||||
|
And that I want to delete a resource with the key "inp_doc_uid2" stored in session array
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-document"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "object"
|
||||||
|
|
||||||
|
#GET /api/1.0/{workspace}/project/{prj_uid}/input-documents
|
||||||
|
# Get a List Input Documents of a Project
|
||||||
|
Scenario: Get a List Input Documents of a Project
|
||||||
|
And I request "project/14414793652a5d718b65590036026581/input-documents"
|
||||||
|
And the content type is "application/json"
|
||||||
|
Then the response status code should be 200
|
||||||
|
And the response charset is "UTF-8"
|
||||||
|
And the type is "array"
|
||||||
|
And the json data is an empty array
|
||||||
|
|
||||||
@@ -3,34 +3,6 @@ namespace BusinessModel;
|
|||||||
|
|
||||||
class InputDocument
|
class InputDocument
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Get data of unique ids of an InputDocument (Unique id of Process)
|
|
||||||
*
|
|
||||||
* @param string $inputDocumentUid Unique id of InputDocument
|
|
||||||
*
|
|
||||||
* return array
|
|
||||||
*/
|
|
||||||
public function getDataUids($inputDocumentUid)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$criteria = new \Criteria("workflow");
|
|
||||||
|
|
||||||
$criteria->addSelectColumn(\InputDocumentPeer::PRO_UID);
|
|
||||||
$criteria->add(\InputDocumentPeer::INP_DOC_UID, $inputDocumentUid, \Criteria::EQUAL);
|
|
||||||
|
|
||||||
$rsCriteria = \InputDocumentPeer::doSelectRS($criteria);
|
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
if ($rsCriteria->next()) {
|
|
||||||
return $rsCriteria->getRow();
|
|
||||||
} else {
|
|
||||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($inputDocumentUid, "INPUT_DOCUMENT"), "The UID \"{0}\" doesn't exist in table {1}")));
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verify if the title exists in the InputDocuments of Process
|
* Verify if the title exists in the InputDocuments of Process
|
||||||
*
|
*
|
||||||
@@ -78,30 +50,6 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get data from a request data
|
|
||||||
*
|
|
||||||
* @param object $requestData Request data
|
|
||||||
*
|
|
||||||
* return array Return an array with data of request data
|
|
||||||
*/
|
|
||||||
public function getArrayDataFromRequestData($requestData)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$arrayData = array();
|
|
||||||
|
|
||||||
$requestData = (array)($requestData);
|
|
||||||
|
|
||||||
foreach ($requestData as $key => $value) {
|
|
||||||
$arrayData[$key] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $arrayData;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create InputDocument for a Process
|
* Create InputDocument for a Process
|
||||||
*
|
*
|
||||||
@@ -124,20 +72,43 @@ class InputDocument
|
|||||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
|
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isset($arrayData["INP_DOC_TITLE"])) {
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array("INP_DOC_TITLE"), "The \"{0}\" attribute is not defined")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($arrayData["INP_DOC_TITLE"]) && trim($arrayData["INP_DOC_TITLE"]) == "") {
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array("INP_DOC_TITLE"), "The \"{0}\" attribute is empty")));
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($arrayData["INP_DOC_TITLE"]) && $this->titleExists($processUid, $arrayData["INP_DOC_TITLE"])) {
|
if (isset($arrayData["INP_DOC_TITLE"]) && $this->titleExists($processUid, $arrayData["INP_DOC_TITLE"])) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_INPUT_NOT_SAVE")));
|
throw (new \Exception(\G::LoadTranslation("ID_INPUT_NOT_SAVE")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Flags
|
||||||
|
$flagDataDestinationPath = (isset($arrayData["INP_DOC_DESTINATION_PATH"]))? 1 : 0;
|
||||||
|
$flagDataTags = (isset($arrayData["INP_DOC_TAGS"]))? 1 : 0;
|
||||||
|
|
||||||
//Create
|
//Create
|
||||||
$inputdoc = new \InputDocument();
|
$inputDocument = new \InputDocument();
|
||||||
|
|
||||||
$arrayData["PRO_UID"] = $processUid;
|
$arrayData["PRO_UID"] = $processUid;
|
||||||
|
|
||||||
$inputDocumentUid = $inputdoc->create($arrayData);
|
$arrayData["INP_DOC_DESTINATION_PATH"] = ($flagDataDestinationPath == 1)? $arrayData["INP_DOC_DESTINATION_PATH"] : "";
|
||||||
|
$arrayData["INP_DOC_TAGS"] = ($flagDataTags == 1)? $arrayData["INP_DOC_TAGS"] : "";
|
||||||
|
|
||||||
|
$inputDocumentUid = $inputDocument->create($arrayData);
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
unset($arrayData["PRO_UID"]);
|
unset($arrayData["PRO_UID"]);
|
||||||
|
|
||||||
|
if ($flagDataDestinationPath == 0) {
|
||||||
|
unset($arrayData["INP_DOC_DESTINATION_PATH"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($flagDataTags == 0) {
|
||||||
|
unset($arrayData["INP_DOC_TAGS"]);
|
||||||
|
}
|
||||||
|
|
||||||
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||||
|
|
||||||
unset($arrayData["inp_doc_uid"]);
|
unset($arrayData["inp_doc_uid"]);
|
||||||
@@ -161,19 +132,22 @@ class InputDocument
|
|||||||
try {
|
try {
|
||||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||||
|
|
||||||
//Verify data
|
$inputDocument = new \InputDocument();
|
||||||
$inputdoc = new \InputDocument();
|
|
||||||
|
|
||||||
if (!$inputdoc->InputExists($inputDocumentUid)) {
|
$arrayInputDocumentData = $inputDocument->load($inputDocumentUid);
|
||||||
|
|
||||||
|
//Uids
|
||||||
|
$processUid = $arrayInputDocumentData["PRO_UID"];
|
||||||
|
|
||||||
|
//Verify data
|
||||||
|
if (!$inputDocument->InputExists($inputDocumentUid)) {
|
||||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($inputDocumentUid, "INPUT_DOCUMENT"), "The UID \"{0}\" doesn't exist in table {1}")));
|
throw (new \Exception(str_replace(array("{0}", "{1}"), array($inputDocumentUid, "INPUT_DOCUMENT"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Uids
|
if (isset($arrayData["INP_DOC_TITLE"]) && trim($arrayData["INP_DOC_TITLE"]) == "") {
|
||||||
$arrayDataUid = $this->getDataUids($inputDocumentUid);
|
throw (new \Exception(str_replace(array("{0}"), array("INP_DOC_TITLE"), "The \"{0}\" attribute is empty")));
|
||||||
|
}
|
||||||
|
|
||||||
$processUid = $arrayDataUid["PRO_UID"];
|
|
||||||
|
|
||||||
//Verify data
|
|
||||||
if (isset($arrayData["INP_DOC_TITLE"]) && $this->titleExists($processUid, $arrayData["INP_DOC_TITLE"], $inputDocumentUid)) {
|
if (isset($arrayData["INP_DOC_TITLE"]) && $this->titleExists($processUid, $arrayData["INP_DOC_TITLE"], $inputDocumentUid)) {
|
||||||
throw (new \Exception(\G::LoadTranslation("ID_INPUT_NOT_SAVE")));
|
throw (new \Exception(\G::LoadTranslation("ID_INPUT_NOT_SAVE")));
|
||||||
}
|
}
|
||||||
@@ -181,7 +155,7 @@ class InputDocument
|
|||||||
//Update
|
//Update
|
||||||
$arrayData["INP_DOC_UID"] = $inputDocumentUid;
|
$arrayData["INP_DOC_UID"] = $inputDocumentUid;
|
||||||
|
|
||||||
$result = $inputdoc->update($arrayData);
|
$result = $inputDocument->update($arrayData);
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
unset($arrayData["INP_DOC_UID"]);
|
unset($arrayData["INP_DOC_UID"]);
|
||||||
@@ -203,9 +177,9 @@ class InputDocument
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data
|
//Verify data
|
||||||
$inputdoc = new \InputDocument();
|
$inputDocument = new \InputDocument();
|
||||||
|
|
||||||
if (!$inputdoc->InputExists($inputDocumentUid)) {
|
if (!$inputDocument->InputExists($inputDocumentUid)) {
|
||||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($inputDocumentUid, "INPUT_DOCUMENT"), "The UID \"{0}\" doesn't exist in table {1}")));
|
throw (new \Exception(str_replace(array("{0}", "{1}"), array($inputDocumentUid, "INPUT_DOCUMENT"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,9 +200,9 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
//InputDocument
|
//InputDocument
|
||||||
$inputdoc = new \InputDocument();
|
$inputDocument = new \InputDocument();
|
||||||
|
|
||||||
$result = $inputdoc->remove($inputDocumentUid);
|
$result = $inputDocument->remove($inputDocumentUid);
|
||||||
|
|
||||||
//Step
|
//Step
|
||||||
$step = new \Step();
|
$step = new \Step();
|
||||||
@@ -297,11 +271,11 @@ class InputDocument
|
|||||||
public function getInputDocumentDataFromRecord($record)
|
public function getInputDocumentDataFromRecord($record)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$inputdoc = new \InputDocument();
|
|
||||||
|
|
||||||
if ($record["INP_DOC_TITLE"] . "" == "") {
|
if ($record["INP_DOC_TITLE"] . "" == "") {
|
||||||
|
$inputDocument = new \InputDocument();
|
||||||
|
|
||||||
//There is no transaltion for this Document name, try to get/regenerate the label
|
//There is no transaltion for this Document name, try to get/regenerate the label
|
||||||
$arrayInputdocData = $inputdoc->load($record["INP_DOC_UID"]);
|
$arrayInputdocData = $inputDocument->load($record["INP_DOC_UID"]);
|
||||||
|
|
||||||
$record["INP_DOC_TITLE"] = $arrayInputdocData["INP_DOC_TITLE"];
|
$record["INP_DOC_TITLE"] = $arrayInputdocData["INP_DOC_TITLE"];
|
||||||
$record["INP_DOC_DESCRIPTION"] = $arrayInputdocData["INP_DOC_DESCRIPTION"];
|
$record["INP_DOC_DESCRIPTION"] = $arrayInputdocData["INP_DOC_DESCRIPTION"];
|
||||||
@@ -334,9 +308,9 @@ class InputDocument
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data
|
//Verify data
|
||||||
$inputdoc = new \InputDocument();
|
$inputDocument = new \InputDocument();
|
||||||
|
|
||||||
if (!$inputdoc->InputExists($inputDocumentUid)) {
|
if (!$inputDocument->InputExists($inputDocumentUid)) {
|
||||||
throw (new \Exception(str_replace(array("{0}", "{1}"), array($inputDocumentUid, "INPUT_DOCUMENT"), "The UID \"{0}\" doesn't exist in table {1}")));
|
throw (new \Exception(str_replace(array("{0}", "{1}"), array($inputDocumentUid, "INPUT_DOCUMENT"), "The UID \"{0}\" doesn't exist in table {1}")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,6 +167,8 @@ class Project extends Api
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @url GET /:projectUid/input-documents
|
* @url GET /:projectUid/input-documents
|
||||||
|
*
|
||||||
|
* @param string $projectUid {@min 32}{@max 32}
|
||||||
*/
|
*/
|
||||||
public function doGetInputDocuments($projectUid)
|
public function doGetInputDocuments($projectUid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ class InputDocument extends Api
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @url GET /:projectUid/input-document/:inputDocumentUid
|
* @url GET /:projectUid/input-document/:inputDocumentUid
|
||||||
|
*
|
||||||
|
* @param string $inputDocumentUid {@min 32}{@max 32}
|
||||||
|
* @param string $projectUid {@min 32}{@max 32}
|
||||||
*/
|
*/
|
||||||
public function doGetInputDocument($inputDocumentUid, $projectUid)
|
public function doGetInputDocument($inputDocumentUid, $projectUid)
|
||||||
{
|
{
|
||||||
@@ -30,19 +33,35 @@ class InputDocument extends Api
|
|||||||
/**
|
/**
|
||||||
* @url POST /:projectUid/input-document
|
* @url POST /:projectUid/input-document
|
||||||
*
|
*
|
||||||
* @param string $projectUid
|
* @param string $projectUid {@min 32}{@max 32}
|
||||||
* @param InputDocumentPostStructure $request_data
|
* @param array $request_data
|
||||||
|
* @param string $inp_doc_title {@from body}
|
||||||
|
* @param string $inp_doc_description {@from body}
|
||||||
|
* @param string $inp_doc_form_needed {@from body}{@choice VIRTUAL,REAL,VREAL}
|
||||||
|
* @param string $inp_doc_original {@from body}{@choice ORIGINAL,COPY}
|
||||||
|
* @param string $inp_doc_published {@from body}{@choice PRIVATE}
|
||||||
|
* @param int $inp_doc_versioning {@from body}{@choice 0,1}
|
||||||
|
* @param string $inp_doc_destination_path {@from body}
|
||||||
|
* @param string $inp_doc_tags {@from body}
|
||||||
*
|
*
|
||||||
* @status 201
|
* @status 201
|
||||||
*/
|
*/
|
||||||
public function doPostInputDocument($projectUid, InputDocumentPostStructure $request_data = null)
|
public function doPostInputDocument(
|
||||||
{
|
$projectUid,
|
||||||
|
$request_data,
|
||||||
|
$inp_doc_title = "",
|
||||||
|
$inp_doc_description = "",
|
||||||
|
$inp_doc_form_needed = "VIRTUAL",
|
||||||
|
$inp_doc_original = "ORIGINAL",
|
||||||
|
$inp_doc_published = "PRIVATE",
|
||||||
|
$inp_doc_versioning = 0,
|
||||||
|
$inp_doc_destination_path = "",
|
||||||
|
$inp_doc_tags = ""
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
$inputdoc = new \BusinessModel\InputDocument();
|
$inputdoc = new \BusinessModel\InputDocument();
|
||||||
|
|
||||||
$arrayData = $inputdoc->getArrayDataFromRequestData($request_data);
|
$arrayData = $inputdoc->create($projectUid, $request_data);
|
||||||
|
|
||||||
$arrayData = $inputdoc->create($projectUid, $arrayData);
|
|
||||||
|
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
|
|
||||||
@@ -55,18 +74,35 @@ class InputDocument extends Api
|
|||||||
/**
|
/**
|
||||||
* @url PUT /:projectUid/input-document/:inputDocumentUid
|
* @url PUT /:projectUid/input-document/:inputDocumentUid
|
||||||
*
|
*
|
||||||
* @param string $inputDocumentUid
|
* @param string $inputDocumentUid {@min 32}{@max 32}
|
||||||
* @param string $projectUid
|
* @param string $projectUid {@min 32}{@max 32}
|
||||||
* @param InputDocumentPutStructure $request_data
|
* @param array $request_data
|
||||||
|
* @param string $inp_doc_title {@from body}
|
||||||
|
* @param string $inp_doc_description {@from body}
|
||||||
|
* @param string $inp_doc_form_needed {@from body}{@choice VIRTUAL,REAL,VREAL}
|
||||||
|
* @param string $inp_doc_original {@from body}{@choice ORIGINAL,COPY}
|
||||||
|
* @param string $inp_doc_published {@from body}{@choice PRIVATE}
|
||||||
|
* @param int $inp_doc_versioning {@from body}{@choice 0,1}
|
||||||
|
* @param string $inp_doc_destination_path {@from body}
|
||||||
|
* @param string $inp_doc_tags {@from body}
|
||||||
*/
|
*/
|
||||||
public function doPutInputDocument($inputDocumentUid, $projectUid, InputDocumentPutStructure $request_data = null)
|
public function doPutInputDocument(
|
||||||
{
|
$inputDocumentUid,
|
||||||
|
$projectUid,
|
||||||
|
$request_data,
|
||||||
|
$inp_doc_title = "",
|
||||||
|
$inp_doc_description = "",
|
||||||
|
$inp_doc_form_needed = "VIRTUAL",
|
||||||
|
$inp_doc_original = "ORIGINAL",
|
||||||
|
$inp_doc_published = "PRIVATE",
|
||||||
|
$inp_doc_versioning = 0,
|
||||||
|
$inp_doc_destination_path = "",
|
||||||
|
$inp_doc_tags = ""
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
$inputdoc = new \BusinessModel\InputDocument();
|
$inputdoc = new \BusinessModel\InputDocument();
|
||||||
|
|
||||||
$arrayData = $inputdoc->getArrayDataFromRequestData($request_data);
|
$arrayData = $inputdoc->update($inputDocumentUid, $request_data);
|
||||||
|
|
||||||
$arrayData = $inputdoc->update($inputDocumentUid, $arrayData);
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
}
|
}
|
||||||
@@ -74,6 +110,9 @@ class InputDocument extends Api
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @url DELETE /:projectUid/input-document/:inputDocumentUid
|
* @url DELETE /:projectUid/input-document/:inputDocumentUid
|
||||||
|
*
|
||||||
|
* @param string $inputDocumentUid {@min 32}{@max 32}
|
||||||
|
* @param string $projectUid {@min 32}{@max 32}
|
||||||
*/
|
*/
|
||||||
public function doDeleteInputDocument($inputDocumentUid, $projectUid)
|
public function doDeleteInputDocument($inputDocumentUid, $projectUid)
|
||||||
{
|
{
|
||||||
@@ -87,89 +126,3 @@ class InputDocument extends Api
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class InputDocumentPostStructure
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var string {@from body}{@required true}
|
|
||||||
*/
|
|
||||||
public $inp_doc_title;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}
|
|
||||||
*/
|
|
||||||
public $inp_doc_description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}{@choice VIRTUAL,REAL,VREAL}
|
|
||||||
*/
|
|
||||||
public $inp_doc_form_needed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}{@choice ORIGINAL,COPY}
|
|
||||||
*/
|
|
||||||
public $inp_doc_original;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}{@choice PRIVATE}
|
|
||||||
*/
|
|
||||||
public $inp_doc_published;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int {@from body}{@choice 0,1}
|
|
||||||
*/
|
|
||||||
public $inp_doc_versioning;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}
|
|
||||||
*/
|
|
||||||
public $inp_doc_destination_path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}
|
|
||||||
*/
|
|
||||||
public $inp_doc_tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
class InputDocumentPutStructure
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @var string {@from body}
|
|
||||||
*/
|
|
||||||
public $inp_doc_title;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}
|
|
||||||
*/
|
|
||||||
public $inp_doc_description;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}{@choice VIRTUAL,REAL,VREAL}
|
|
||||||
*/
|
|
||||||
public $inp_doc_form_needed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}{@choice ORIGINAL,COPY}
|
|
||||||
*/
|
|
||||||
public $inp_doc_original;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}{@choice PRIVATE}
|
|
||||||
*/
|
|
||||||
public $inp_doc_published;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int {@from body}{@choice 0,1}
|
|
||||||
*/
|
|
||||||
public $inp_doc_versioning;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}
|
|
||||||
*/
|
|
||||||
public $inp_doc_destination_path;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string {@from body}
|
|
||||||
*/
|
|
||||||
public $inp_doc_tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user