Arreglo conflicto

This commit is contained in:
Brayan Osmar Pereyra Suxo
2014-01-07 15:10:29 -04:00
5 changed files with 367 additions and 46 deletions

View File

@@ -124,6 +124,7 @@ Feature: Getting started with Behat tests
And the type is "object"
And that "tri_param" is set to "PRIVATE"
And store "tri_uid" in session array
And store "tri_uid" in session array as variable "trigger1"
Scenario: re-post a new trigger, to get an error
Given that I have a valid access_token
@@ -141,7 +142,7 @@ Feature: Getting started with Behat tests
Then the response status code should be 400
And the content type is "application/json"
And the type is "object"
#message: "Bad Request: There is a triggers with the same name in this process"
#message: "Bad Request: There is a previously created trigger with the same name in this process"
Scenario: modify a Trigger
Given that I have a valid access_token
@@ -161,6 +162,35 @@ Feature: Getting started with Behat tests
And the content type is "application/json"
And the type is "object"
And that "tri_title" is set to "Trigger #1-modified"
And that "tri_description" is set to "Trigger #1 - -modified"
And that "tri_type" is set to "script"
And that "tri_webbot" is set to "print 'hello modified world!!'; "
And that "tri_param" is set to "private"
Scenario: get a previously created trigger
Given that I have a valid access_token
And that I want to get a resource with the key "tri_uid" stored in session array
And I request "project/14414793652a5d718b65590036026581/trigger"
Then the response status code should be 200
And the content type is "application/json"
And that "tri_title" is set to "Trigger #1-modified"
And that "tri_description" is set to "Trigger #1 - -modified"
And that "tri_type" is set to "script"
And that "tri_webbot" is set to "print 'hello modified world!!'; "
And that "tri_param" is set to "private"
Scenario: get a previously created trigger using alternative variable
Given that I have a valid access_token
And that I want to get a resource with the key "trigger1" stored in session array
And I request "project/14414793652a5d718b65590036026581/trigger"
Then the response status code should be 200
And the content type is "application/json"
And that "tri_title" is set to "Trigger #1-modified"
And that "tri_description" is set to "Trigger #1 - -modified"
And that "tri_type" is set to "script"
And that "tri_webbot" is set to "print 'hello modified world!!'; "
And that "tri_param" is set to "private"
Scenario: delete a previously created trigger
Given that I have a valid access_token

View File

@@ -1,23 +1,176 @@
@ProcessMakerMichelangelo @RestAPI
Feature: Dynaforms Resources
Feature: DynaForms Resources
#GET /api/1.0/{workspace}/project/{prj_uid}/dynaforms
# Get a List DynaForms of a Project
Scenario: Get a List DynaForms of a Project
Given that I have a valid access_token
And I request "project/14414793652a5d718b65590036026581/dynaforms"
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
Background:
Given that I have a valid access_token
#POST /api/1.0/{workspace}/project/{prj_uid}/dynaform
# Create a new DynaForm for a Project
# Creation normal of a DynaForm
Scenario: Create "My DynaForm1" for a Project (Creation normal of a DynaForm)
Given that I have a valid access_token
And POST this data:
"""
{
"dyn_title": "My DynaForm1",
"dyn_description": "My DynaForm1 DESCRIPTION",
"dyn_type": "xmlform"
}
"""
And I request "project/14414793652a5d718b65590036026581/dynaform"
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 "dyn_uid" in session array as variable "dynaForm1"
Scenario: Get a List of dynaforms of a project
Given this scenario is not implemented yet
Scenario: Get a single dynaform of a project
Given this scenario is not implemented yet
Scenario: Create a new dynaform for a project
Given this scenario is not implemented yet
Scenario: Create a copy of a dynaform and import it to another project
Given this scenario is not implemented yet
Scenario: Update a dynaform of a project
Given this scenario is not implemented yet
#POST /api/1.0/{workspace}/project/{prj_uid}/dynaform
# Create a new DynaForm for a Project
# Copy/Import a DynaForm
Scenario: Create "DynaForm Demo" for a Project (Copy/Import a DynaForm)
Given that I have a valid access_token
And POST this data:
"""
{
"dyn_title": "DynaForm Demo",
"dyn_description": "Description",
"dyn_type": "xmlform",
"copy_import":
{
"prj_uid": "48207364252cc27894ca354020290166",
"dyn_uid": "68268455252cc27cb463d76013645722"
}
}
"""
And I request "project/14414793652a5d718b65590036026581/dynaform"
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 "dyn_uid" in session array as variable "dynaForm2"
#POST /api/1.0/{workspace}/project/{prj_uid}/dynaform
# Create a new DynaForm for a Project
# Creation of a DynaForm based in a PMTable
Scenario: Create "My DynaForm3" for a Project (Creation of a DynaForm based in a PMTable)
Given that I have a valid access_token
And POST this data:
"""
{
"dyn_title": "My DynaForm3",
"dyn_description": "My DynaForm3 DESCRIPTION",
"dyn_type": "xmlform",
"pmtable":
{
"tab_uid": "65193158852cc1a93a5a535084878044",
"fields": [
{
"fld_name": "DYN_UID",
"pro_variable": "@#APPLICATION"
}
]
}
}
"""
And I request "project/14414793652a5d718b65590036026581/dynaform"
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 "dyn_uid" in session array as variable "dynaForm3"
#PUT /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}
# Update a DynaForm for a Project
Scenario: Update a DynaForm for a Project
Given that I have a valid access_token
And PUT this data:
"""
{
"dyn_title": "My DynaForm1 Modified",
"dyn_description": "My DynaForm1 DESCRIPTION Modified",
"dyn_type": "xmlform"
}
"""
And that I want to update a resource with the key "dynaForm1" stored in session array
And I request "project/14414793652a5d718b65590036026581/dynaform"
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 "dyn_title" is set to "My DynaForm1 Modified"
#GET /api/1.0/{workspace}/project/{prj_uid}/dynaforms
# Get a List DynaForms of a Project
Scenario: Get a List DynaForms of a Project
Given that I have a valid access_token
And I request "project/14414793652a5d718b65590036026581/dynaforms"
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 "dyn_title" property in row 0 equals "DynaForm Demo"
And the "dyn_description" property in row 0 equals "Description"
And the "dyn_type" property in row 0 equals "xmlform"
#GET /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}
# Get a single DynaForm of a Project
Scenario: Get a single DynaForm of a Project
Given that I have a valid access_token
And that I want to get a resource with the key "dynaForm3" stored in session array
And I request "project/14414793652a5d718b65590036026581/dynaform"
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 "dyn_title" is set to "My DynaForm3"
And that "dyn_description" is set to "My DynaForm3 DESCRIPTION"
And that "dyn_type" is set to "xmlform"
#DELETE /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}
# Delete a DynaForm of a Project
Scenario: Delete a previously created DynaForms
Given that I have a valid access_token
And that I want to delete a resource with the key "dynaForm1" stored in session array
And I request "project/14414793652a5d718b65590036026581/dynaform"
And the content type is "application/json"
Then the response status code should be 200
And the response charset is "UTF-8"
#DELETE /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}
# Delete a DynaForm of a Project
Scenario: Delete a previously created DynaForms
Given that I have a valid access_token
And that I want to delete a resource with the key "dynaForm2" stored in session array
And I request "project/14414793652a5d718b65590036026581/dynaform"
And the content type is "application/json"
Then the response status code should be 200
And the response charset is "UTF-8"
#DELETE /api/1.0/{workspace}/project/{prj_uid}/dynaform/{dyn_uid}
# Delete a DynaForm of a Project
Scenario: Delete a previously created DynaForms
Given that I have a valid access_token
And that I want to delete a resource with the key "dynaForm3" stored in session array
And I request "project/14414793652a5d718b65590036026581/dynaform"
And the content type is "application/json"
Then the response status code should be 200
And the response charset is "UTF-8"
#GET /api/1.0/{workspace}/project/{prj_uid}/dynaforms
# Get a List DynaForms of a Project
Scenario: Get a List DynaForms of a Project
Given that I have a valid access_token
And I request "project/14414793652a5d718b65590036026581/dynaforms"
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
Scenario: Delete a dynaform of a project
Given this scenario is not implemented yet

View File

@@ -1075,4 +1075,6 @@ class RestContext extends BehatContext
{
throw new PendingException();
}
}

View File

@@ -186,7 +186,7 @@ class ProcessSupervisor
}
/**
* Return output documents of a project
* Return dynaform supervisor
* @param string $sProcessUID
*
* @return array
@@ -228,15 +228,63 @@ class ProcessSupervisor
'step_position' => $aRow['STEP_POSITION'],
'title' => $aRow['DYN_TITLE']);
$oDataset->next();
}
return $aResp;
}
return $aResp;
} catch (Exception $e) {
throw $e;
}
}
/**
* Return output documents of a project
* Return available dynaform supervisor
* @param string $sProcessUID
*
* @return array
*
* @access public
*/
public function getAvailableDynaformSupervisors($sProcessUID = '')
{
try {
$oCriteria = $this->getDynaformSupervisor($sProcessUID);
$aUIDS = array();
foreach ($oCriteria as $oCriteria => $value) {
$aUIDS[] = $value["step_uid_obj"];
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn(\DynaformPeer::DYN_UID);
$oCriteria->addSelectColumn(\DynaformPeer::PRO_UID);
$oCriteria->addAsColumn('DYN_TITLE', 'C.CON_VALUE');
$oCriteria->addAlias('C', 'CONTENT');
$aConditions = array();
$aConditions[] = array(\DynaformPeer::DYN_UID, 'C.CON_ID');
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'DYN_TITLE' . $sDelimiter);
$aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
$oCriteria->add(\DynaformPeer::PRO_UID, $sProcessUID);
$oCriteria->add(\DynaformPeer::DYN_TYPE, 'xmlform');
$oCriteria->add(\DynaformPeer::DYN_UID, $aUIDS, \Criteria::NOT_IN);
$oDataset = \StepSupervisorPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$oDataset = \StepSupervisorPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aResp[] = array('pro_uid' => $aRow['PRO_UID'],
'dyn_uid' => $aRow['DYN_UID'],
'title' => $aRow['DYN_TITLE']);
$oDataset->next();
}
return $aResp;
} catch (Exception $e) {
throw $e;
}
}
/**
* Return input documents supervisor
* @param string $sProcessUID
*
* @return array
@@ -285,6 +333,54 @@ class ProcessSupervisor
}
}
/**
* Return available inputdocuments supervisor
* @param string $sProcessUID
*
* @return array
*
* @access public
*/
public function getAvailableInputDocumentSupervisor($sProcessUID = '')
{
try {
$oCriteria = $this->getInputDocumentSupervisor($sProcessUID);
$aUIDS = array();
foreach ($oCriteria as $oCriteria => $value) {
$aUIDS[] = $value["step_uid_obj"];
}
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn(\InputDocumentPeer::INP_DOC_UID);
$oCriteria->addSelectColumn(\InputDocumentPeer::PRO_UID);
$oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE');
$oCriteria->addAlias('C', 'CONTENT');
$aConditions = array();
$aConditions[] = array(\InputDocumentPeer::INP_DOC_UID, 'C.CON_ID');
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'INP_DOC_TITLE' . $sDelimiter);
$aConditions[] = array('C.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
$oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN);
$oCriteria->add(\InputDocumentPeer::PRO_UID, $sProcessUID);
$oCriteria->add(\InputDocumentPeer::INP_DOC_UID, $aUIDS, \Criteria::NOT_IN);
$oDataset = \StepSupervisorPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$oDataset = \StepSupervisorPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aResp[] = array('pro_uid' => $aRow['PRO_UID'],
'inp_doc_uid' => $aRow['INP_DOC_UID'],
'title' => $aRow['INP_DOC_TITLE']);
$oDataset->next();
}
return $aResp;
} catch (Exception $e) {
throw $e;
}
}
/**
* Remove a supervisor of an activity
*

View File

@@ -33,28 +33,6 @@ class ProcessSupervisors extends Api
return $response;
}
/**
* @param string $prjUid {@min 32} {@max 32}
* @param string $filter
* @param int $start
* @param int $limit
*
* @url GET /:prjUid/available-supervisors
*/
public function doGetAvailableSupervisors($prjUid, $filter = '', $start = null, $limit = null)
{
try {
$supervisor = new \BusinessModel\ProcessSupervisor();
$arrayData = $supervisor->getAvailableSupervisors($prjUid, $filter, $start, $limit);
//Response
$response = $arrayData;
} catch (\Exception $e) {
//response
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @param string $prjUid {@min 32} {@max 32}
*
@@ -93,6 +71,68 @@ class ProcessSupervisors extends Api
return $response;
}
/**
* @param string $prjUid {@min 32} {@max 32}
* @param string $filter
* @param int $start
* @param int $limit
*
* @url GET /:prjUid/available-supervisors
*/
public function doGetAvailableSupervisors($prjUid, $filter = '', $start = null, $limit = null)
{
try {
$supervisor = new \BusinessModel\ProcessSupervisor();
$arrayData = $supervisor->getAvailableSupervisors($prjUid, $filter, $start, $limit);
//Response
$response = $arrayData;
} catch (\Exception $e) {
//response
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @param string $prjUid {@min 32} {@max 32}
*
* @url GET /:prjUid/available-dynaform-supervisor
*/
public function doGetAvailableDynaformSupervisor($prjUid)
{
try {
$supervisor = new \BusinessModel\ProcessSupervisor();
$arrayData = $supervisor->getAvailableDynaformSupervisors($prjUid);
//Response
$response = $arrayData;
} catch (\Exception $e) {
//response
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @param string $prjUid {@min 32} {@max 32}
*
* @url GET /:prjUid/available-inputdocument-supervisor
*/
public function doGetAvailableInputDocumentSupervisor($prjUid)
{
try {
$supervisor = new \BusinessModel\ProcessSupervisor();
$arrayData = $supervisor->getAvailableInputDocumentSupervisor($prjUid);
//Response
$response = $arrayData;
} catch (\Exception $e) {
//response
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @url DELETE /:prjUid/supervisor/:supUid
*