From ce969c714dd2f6b755ad925feaa75d8d8a7e8a0c Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Thu, 9 Jan 2014 09:14:47 -0400 Subject: [PATCH 01/12] Se modifican url de los end points, se adiciona get por busqueda especifica y filtro en caso de usuarios y grupos disponibles --- .../src/BusinessModel/ProcessSupervisor.php | 484 +++++++++++------- .../Project/ProcessSupervisors.php | 317 +++++++----- 2 files changed, 488 insertions(+), 313 deletions(-) diff --git a/workflow/engine/src/BusinessModel/ProcessSupervisor.php b/workflow/engine/src/BusinessModel/ProcessSupervisor.php index 14b47a4a2..4cf848d8e 100644 --- a/workflow/engine/src/BusinessModel/ProcessSupervisor.php +++ b/workflow/engine/src/BusinessModel/ProcessSupervisor.php @@ -8,19 +8,17 @@ class ProcessSupervisor /** * Return supervisors * @param string $sProcessUID - * @param string $filter - * @param int $start - * @param int $limit * * @return array * * @access public */ - public function getSupervisors($sProcessUID = '', $filter, $start, $limit) + public function getProcessSupervisors($sProcessUID = '') { try { // Groups $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID); $oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID); $oCriteria->addAsColumn('GRP_TITLE', \ContentPeer::CON_VALUE); $aConditions [] = array(\ProcessUserPeer::USR_UID, \ContentPeer::CON_ID); @@ -33,53 +31,103 @@ class ProcessSupervisor $oDataset = \ProcessUserPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); - $oCriteria = new \Criteria('workflow'); - $oCriteria->addSelectColumn('COUNT(*) AS MEMBERS_NUMBER'); - $oCriteria->add(\GroupUserPeer::GRP_UID, $results['GRP_UID']); - $oDataset2 = \GroupUserPeer::doSelectRS($oCriteria); - $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - $oDataset2->next(); - $aRow2 = $oDataset2->getRow(); while ($aRow = $oDataset->getRow()) { - $aResp[] = array('sup_uid' => $aRow['USR_UID'], - 'sup_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] . - ' (' . $aRow2['MEMBERS_NUMBER'] . ' ' . - ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')). - ')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']), - 'sup_lastname' => "", - 'sup_username' => "", - 'sup_type' => "group" ); + $aResp[] = array('pu_uid' => $aRow['PU_UID'], + 'pu_type' => "GROUP_SUPERVISOR", + 'grp_uid' => $aRow['USR_UID'], + 'grp_name' => $aRow['GRP_TITLE']); $oDataset->next(); } // Users $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID); + $oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID); $oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME); $oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME); $oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME); $oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL); - if ($filter) { - $oCriteria->add( $oCriteria->getNewCriterion( \UsersPeer::USR_USERNAME, "%$filter%", \Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( \UsersPeer::USR_FIRSTNAME, "%$filter%", \Criteria::LIKE ) )->addOr( $oCriteria->getNewCriterion( \UsersPeer::USR_LASTNAME, "%$filter%", \Criteria::LIKE ) ) ); - } $oCriteria->addJoin(\ProcessUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN); $oCriteria->add(\ProcessUserPeer::PU_TYPE, 'SUPERVISOR'); $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID); - if ($start) { - $oCriteria->setOffset( $start ); - } - if ($limit) { - $oCriteria->setLimit( $limit ); - } $oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME); $oDataset = \ProcessUserPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aResp[] = array('sup_uid' => $aRow['USR_UID'], - 'sup_name' => $aRow['USR_FIRSTNAME'], - 'sup_lastname' => $aRow['USR_LASTNAME'], - 'sup_username' => $aRow['USR_USERNAME'], - 'sup_type' => "user" ); + $aResp[] = array('pu_uid' => $aRow['PU_UID'], + 'pu_type' => "SUPERVISOR", + 'usr_uid' => $aRow['USR_UID'], + 'usr_firstname' => $aRow['USR_FIRSTNAME'], + 'usr_lastname' => $aRow['USR_LASTNAME'], + 'usr_username' => $aRow['USR_USERNAME'], + 'usr_email' => $aRow['USR_EMAIL'] ); + $oDataset->next(); + } + return $aResp; + } catch (Exception $e) { + throw $e; + } + } + + /** + * Return a spefic supervisor + * @param string $sProcessUID + * @param string $sPuUID + * + * @return object + * + * @access public + */ + public function getProcessSupervisor($sProcessUID = '', $sPuUID = '') + { + try { + // Groups + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID); + $oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID); + $oCriteria->addAsColumn('GRP_TITLE', \ContentPeer::CON_VALUE); + $aConditions [] = array(\ProcessUserPeer::USR_UID, \ContentPeer::CON_ID); + $aConditions [] = array(\ContentPeer::CON_CATEGORY, \DBAdapter::getStringDelimiter().'GRP_TITLE'.\DBAdapter::getStringDelimiter()); + $aConditions [] = array(\ContentPeer::CON_LANG, \DBAdapter::getStringDelimiter().SYS_LANG.\DBAdapter::getStringDelimiter()); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $oCriteria->add(\ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR'); + $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\ProcessUserPeer::PU_UID, $sPuUID); + $oCriteria->addAscendingOrderByColumn(\ContentPeer::CON_VALUE); + $oDataset = \ProcessUserPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aResp = array('pu_uid' => $aRow['PU_UID'], + 'pu_type' => "GROUP_SUPERVISOR", + 'grp_uid' => $aRow['USR_UID'], + 'grp_name' => $aRow['GRP_TITLE']); + $oDataset->next(); + } + // Users + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\ProcessUserPeer::USR_UID); + $oCriteria->addSelectColumn(\ProcessUserPeer::PU_UID); + $oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME); + $oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME); + $oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME); + $oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL); + $oCriteria->addJoin(\ProcessUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN); + $oCriteria->add(\ProcessUserPeer::PU_TYPE, 'SUPERVISOR'); + $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\ProcessUserPeer::PU_UID, $sPuUID); + $oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME); + $oDataset = \ProcessUserPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aResp = array('pu_uid' => $aRow['PU_UID'], + 'pu_type' => "SUPERVISOR", + 'usr_uid' => $aRow['USR_UID'], + 'usr_firstname' => $aRow['USR_FIRSTNAME'], + 'usr_lastname' => $aRow['USR_LASTNAME'], + 'usr_username' => $aRow['USR_USERNAME'], + 'usr_email' => $aRow['USR_EMAIL'] ); $oDataset->next(); } return $aResp; @@ -91,15 +139,13 @@ class ProcessSupervisor /** * Return available supervisors * @param string $sProcessUID - * @param string $filter - * @param int $start - * @param int $limit + * @param string $obj_type * * @return array * * @access public */ - public function getAvailableSupervisors($sProcessUID = '', $filter, $start, $limit) + public function getAvailableProcessSupervisors($sProcessUID = '', $obj_type) { try { // Groups @@ -140,15 +186,15 @@ class ProcessSupervisor $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); $aRow2 = $oDataset2->getRow(); - while ($aRow = $oDataset->getRow()) { - $aRespLi[] = array('sup_uid' => $aRow['GRP_UID'], - 'sup_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] . - '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']), - 'sup_lastname' => "", - 'sup_username' => "", - 'sup_type' => "group" ); - $oDataset->next(); + if ($obj_type == 'group' || $obj_type == '') { + while ($aRow = $oDataset->getRow()) { + $aRespLi[] = array('grp_uid' => $aRow['GRP_UID'], + 'grp_name' => $aRow['GRP_TITLE'], + 'obj_type' => "group"); + $oDataset->next(); + } } + $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn(\UsersPeer::USR_UID); @@ -166,18 +212,22 @@ class ProcessSupervisor $oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME); $oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME); $oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME); + $oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL); $oCriteria->add(\UsersPeer::USR_UID, $aUIDS, \Criteria::IN); $oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME); $oDataset = \UsersPeer::doSelectRS($oCriteria); $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - $aRespLi[] = array('sup_uid' => $aRow['USR_UID'], - 'sup_name' => $aRow['USR_FIRSTNAME'], - 'sup_lastname' => $aRow['USR_LASTNAME'], - 'sup_username' => $aRow['USR_USERNAME'], - 'sup_type' => "user" ); - $oDataset->next(); + if ($obj_type == 'user' || $obj_type == '') { + while ($aRow = $oDataset->getRow()) { + $aRespLi[] = array('usr_uid' => $aRow['USR_UID'], + 'usr_firstname' => $aRow['USR_FIRSTNAME'], + 'usr_lastname' => $aRow['USR_LASTNAME'], + 'usr_username' => $aRow['USR_USERNAME'], + 'usr_email' => $aRow['USR_EMAIL'], + "obj_type" => "user" ); + $oDataset->next(); + } } return $aRespLi; } catch (Exception $e) { @@ -186,14 +236,14 @@ class ProcessSupervisor } /** - * Return dynaform supervisor + * Return dynaforms supervisor * @param string $sProcessUID * * @return array * * @access public */ - public function getDynaformSupervisor($sProcessUID = '') + public function getProcessSupervisorDynaforms($sProcessUID = '') { try { $sDelimiter = \DBAdapter::getStringDelimiter(); @@ -221,12 +271,60 @@ class ProcessSupervisor $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aResp[] = array('step_uid' => $aRow['STEP_UID'], - 'pro_uid' => $aRow['PRO_UID'], - 'step_type_obj' => $aRow['STEP_TYPE_OBJ'], - 'step_uid_obj' => $aRow['STEP_UID_OBJ'], - 'step_position' => $aRow['STEP_POSITION'], - 'title' => $aRow['DYN_TITLE']); + $aResp[] = array('pud_uid' => $aRow['STEP_UID'], + 'pud_position' => $aRow['STEP_POSITION'], + 'dyn_uid' => $aRow['STEP_UID_OBJ'], + 'dyn_title' => $aRow['DYN_TITLE']); + $oDataset->next(); + } + return $aResp; + } catch (Exception $e) { + throw $e; + } + } + + /** + * Return a specific dynaform supervisor + * @param string $sProcessUID + * @param string $sPudUID + * + * @return array + * + * @access public + */ + public function getProcessSupervisorDynaform($sProcessUID = '', $sPudUID = '') + { + try { + $sDelimiter = \DBAdapter::getStringDelimiter(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); + $oCriteria->addAsColumn('DYN_TITLE', 'C.CON_VALUE'); + $oCriteria->addAlias('C', 'CONTENT'); + $aConditions = array(); + $aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \DynaformPeer::DYN_UID ); + $aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'DYNAFORM' . $sDelimiter ); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $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(\StepSupervisorPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\StepSupervisorPeer::STEP_UID, $sPudUID); + $oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'DYNAFORM'); + $oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION); + $oDataset = \StepSupervisorPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aResp = array('pud_uid' => $aRow['STEP_UID'], + 'pud_position' => $aRow['STEP_POSITION'], + 'dyn_uid' => $aRow['STEP_UID_OBJ'], + 'dyn_title' => $aRow['DYN_TITLE']); $oDataset->next(); } return $aResp; @@ -243,13 +341,13 @@ class ProcessSupervisor * * @access public */ - public function getAvailableDynaformSupervisors($sProcessUID = '') + public function getAvailableProcessSupervisorDynaform($sProcessUID = '') { try { - $oCriteria = $this->getDynaformSupervisor($sProcessUID); + $oCriteria = $this->getProcessSupervisorDynaforms($sProcessUID); $aUIDS = array(); foreach ($oCriteria as $oCriteria => $value) { - $aUIDS[] = $value["step_uid_obj"]; + $aUIDS[] = $value["dyn_uid"]; } $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); @@ -272,9 +370,8 @@ class ProcessSupervisor $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']); + $aResp[] = array('dyn_uid' => $aRow['DYN_UID'], + 'dyn_title' => $aRow['DYN_TITLE']); $oDataset->next(); } return $aResp; @@ -291,7 +388,7 @@ class ProcessSupervisor * * @access public */ - public function getInputDocumentSupervisor($sProcessUID = '') + public function getProcessSupervisorInputDocuments($sProcessUID = '') { try { $sDelimiter = \DBAdapter::getStringDelimiter(); @@ -319,12 +416,60 @@ class ProcessSupervisor $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aResp[] = array('step_uid' => $aRow['STEP_UID'], - 'pro_uid' => $aRow['PRO_UID'], - 'step_type_obj' => $aRow['STEP_TYPE_OBJ'], - 'step_uid_obj' => $aRow['STEP_UID_OBJ'], - 'step_position' => $aRow['STEP_POSITION'], - 'title' => $aRow['INP_DOC_TITLE']); + $aResp[] = array('pui_uid' => $aRow['STEP_UID'], + 'pui_position' => $aRow['STEP_POSITION'], + 'input_doc_uid' => $aRow['STEP_UID_OBJ'], + 'input_doc_title' => $aRow['INP_DOC_TITLE']); + $oDataset->next(); + } + return $aResp; + } catch (Exception $e) { + throw $e; + } + } + + /** + * Return a specific input document supervisor + * @param string $sProcessUID + * @param string $sPuiUID + * + * @return array + * + * @access public + */ + public function getProcessSupervisorInputDocument($sProcessUID = '', $sPuiUID = '') + { + try { + $sDelimiter = \DBAdapter::getStringDelimiter(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); + $oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE'); + $oCriteria->addAlias('C', 'CONTENT'); + $aConditions = array(); + $aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \InputDocumentPeer::INP_DOC_UID); + $aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'INPUT_DOCUMENT' . $sDelimiter); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $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(\StepSupervisorPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\StepSupervisorPeer::STEP_UID, $sPuiUID); + $oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT'); + $oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION); + $oDataset = \StepSupervisorPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aResp[] = array('pui_uid' => $aRow['STEP_UID'], + 'pui_position' => $aRow['STEP_POSITION'], + 'input_doc_uid' => $aRow['STEP_UID_OBJ'], + 'input_doc_title' => $aRow['INP_DOC_TITLE']); $oDataset->next(); } return $aResp; @@ -341,13 +486,13 @@ class ProcessSupervisor * * @access public */ - public function getAvailableInputDocumentSupervisor($sProcessUID = '') + public function getAvailableProcessSupervisorInputDocument($sProcessUID = '') { try { - $oCriteria = $this->getInputDocumentSupervisor($sProcessUID); + $oCriteria = $this->getProcessSupervisorInputDocuments($sProcessUID); $aUIDS = array(); foreach ($oCriteria as $oCriteria => $value) { - $aUIDS[] = $value["step_uid_obj"]; + $aUIDS[] = $value["input_doc_uid"]; } $sDelimiter = \DBAdapter::getStringDelimiter(); $oCriteria = new \Criteria('workflow'); @@ -369,9 +514,8 @@ class ProcessSupervisor $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']); + $aResp[] = array('inp_doc_uid' => $aRow['INP_DOC_UID'], + 'inp_doc_title' => $aRow['INP_DOC_TITLE']); $oDataset->next(); } return $aResp; @@ -380,29 +524,86 @@ class ProcessSupervisor } } + /** + * Assign a supervisor of a process + * + * @param string $sProcessUID + * @param string $sUsrUID + * @param string $sTypeUID + * @access public + */ + public function addProcessSupervisor($sProcessUID, $sUsrUID, $sTypeUID) + { + $oProcessUser = new \ProcessUser ( ); + $oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sUsrUID ); + $oTypeAssigneeU = \UsersPeer::retrieveByPK( $sUsrUID ); + if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { + throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID )); + } + if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) { + if ( "SUPERVISOR"!= $sTypeUID ) { + throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID )); + } + } + if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { + if ( "GROUP_SUPERVISOR" != $sTypeUID ) { + throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID )); + } + } + $sPuUID = \G::generateUniqueID(); + $oProcessUser->create(array('PU_UID' => $sPuUID, + 'PRO_UID' => $sProcessUID, + 'USR_UID' => $sUsrUID, + 'PU_TYPE' => $sTypeUID)); + $oCriteria = $this->getProcessSupervisor($sProcessUID, $sPuUID); + return $oCriteria; + } + + /** + * Assign a dynaform supervisor of a process + * + * @param string $sProcessUID + * @param string $sDynUID + * @access public + */ + public function addProcessSupervisorDynaform($sProcessUID, $sDynUID) + { + $oStepSupervisor = new \StepSupervisor(); + $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, + 'STEP_TYPE_OBJ' => "DYNAFORM", + 'STEP_UID_OBJ' => $sDynUID, + 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); + return $oStepSupervisor; + } + + /** + * Assign a inputdocument supervisor of a process + * + * @param string $sProcessUID + * @param string $sInputDocumentUID + * @access public + */ + public function addProcessSupervisorInputDocument($sProcessUID, $sInputDocumentUID) + { + $oStepSupervisor = new \StepSupervisor(); + $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, + 'STEP_TYPE_OBJ' => "INPUT_DOCUMENT", + 'STEP_UID_OBJ' => $sInputDocumentUID, + 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); + } /** * Remove a supervisor * * @param string $sProcessUID - * @param string $sUserUID + * @param string $sPuUID * @access public */ - public function removeProcessSupervisor($sProcessUID, $sUserUID) + public function removeProcessSupervisor($sProcessUID, $sPuUID) { $oConnection = \Propel::getConnection(\ProcessUserPeer::DATABASE_NAME); try { - $oCriteria = new \Criteria('workflow'); - $oCriteria->addSelectColumn( \ProcessUserPeer::PU_UID ); - $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID); - $oCriteria->add(\ProcessUserPeer::USR_UID, $sUserUID); - $oPuUid = \ProcessUserPeer::doSelectRS($oCriteria); - $oPuUid->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - while ($oPuUid->next()) { - $aRow = $oPuUid->getRow(); - $iPuUid = $aRow['PU_UID']; - } - $oProcessUser = \ProcessUserPeer::retrieveByPK($iPuUid); + $oProcessUser = \ProcessUserPeer::retrieveByPK($sPuUID); if (!is_null($oProcessUser)) { $oConnection->begin(); $iResult = $oProcessUser->delete(); @@ -421,24 +622,14 @@ class ProcessSupervisor * Remove a dynaform supervisor * * @param string $sProcessUID - * @param string $sDynaformUID + * @param string $sPudUID * @access public */ - public function removeDynaformSupervisor($sProcessUID, $sDynaform) + public function removeDynaformSupervisor($sProcessUID, $sPudUID) { $oConnection = \Propel::getConnection(\StepSupervisorPeer::DATABASE_NAME); try { - $oCriteria = new \Criteria('workflow'); - $oCriteria->addSelectColumn( \StepSupervisorPeer::STEP_UID ); - $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID); - $oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sDynaform); - $oPuUid = \StepSupervisorPeer::doSelectRS($oCriteria); - $oPuUid->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - while ($oPuUid->next()) { - $aRow = $oPuUid->getRow(); - $iStepUid = $aRow['STEP_UID']; - } - $oDynaformSupervidor = \StepSupervisorPeer::retrieveByPK($iStepUid); + $oDynaformSupervidor = \StepSupervisorPeer::retrieveByPK($sPudUID); if (!is_null($oDynaformSupervidor)) { $oConnection->begin(); $iResult = $oDynaformSupervidor->delete(); @@ -457,24 +648,14 @@ class ProcessSupervisor * Remove a input document supervisor * * @param string $sProcessUID - * @param string $sInputDocumentUID + * @param string $sPuiUID * @access public */ - public function removeInputDocumentSupervisor($sProcessUID, $sInputDocumentUID) + public function removeInputDocumentSupervisor($sProcessUID, $sPuiUID) { $oConnection = \Propel::getConnection(\StepSupervisorPeer::DATABASE_NAME); try { - $oCriteria = new \Criteria('workflow'); - $oCriteria->addSelectColumn( \StepSupervisorPeer::STEP_UID ); - $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID); - $oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sInputDocumentUID); - $oPuUid = \StepSupervisorPeer::doSelectRS($oCriteria); - $oPuUid->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - while ($oPuUid->next()) { - $aRow = $oPuUid->getRow(); - $iStepUid = $aRow['STEP_UID']; - } - $oInputDocumentSupervidor = \StepSupervisorPeer::retrieveByPK($iStepUid); + $oInputDocumentSupervidor = \StepSupervisorPeer::retrieveByPK($sPuiUID); if (!is_null($oInputDocumentSupervidor)) { $oConnection->begin(); $iResult = $oInputDocumentSupervidor->delete(); @@ -488,72 +669,5 @@ class ProcessSupervisor throw ($oError); } } - - /** - * Assign a supervisor of a process - * - * @param string $sProcessUID - * @param string $sUsrUID - * @param string $sTypeUID - * @access public - */ - public function addSupervisor($sProcessUID, $sUsrUID, $sTypeUID) - { - $oProcessUser = new \ProcessUser ( ); - $puType = 'SUPERVISOR'; - if ($sTypeUID == 'Group') { - $puType = 'GROUP_SUPERVISOR'; - } - $oTypeAssigneeG = \GroupwfPeer::retrieveByPK( $sUsrUID ); - $oTypeAssigneeU = \UsersPeer::retrieveByPK( $sUsrUID ); - if (is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { - throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID )); - } - if (is_null( $oTypeAssigneeG ) && ! is_null( $oTypeAssigneeU) ) { - $type = "User"; - if ( $type != $sTypeUID ) { - throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID )); - } - } - if (! is_null( $oTypeAssigneeG ) && is_null( $oTypeAssigneeU ) ) { - $type = "Group"; - if ( $type != $sTypeUID ) { - throw (new \Exception( 'This id: '. $sUsrUID .' do not correspond to a registered ' .$sTypeUID )); - } - } - $oProcessUser->create(array('PU_UID' => \G::generateUniqueID(), 'PRO_UID' => $sProcessUID, 'USR_UID' => $sUsrUID, 'PU_TYPE' => $puType)); - } - - /** - * Assign a dynaform supervisor of a process - * - * @param string $sProcessUID - * @param string $sDynUID - * @access public - */ - public function addDynaformSupervisor($sProcessUID, $sDynUID) - { - $oStepSupervisor = new \StepSupervisor(); - $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, - 'STEP_TYPE_OBJ' => "DYNAFORM", - 'STEP_UID_OBJ' => $sDynUID, - 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); - } - - /** - * Assign a inputdocument supervisor of a process - * - * @param string $sProcessUID - * @param string $sInputDocumentUID - * @access public - */ - public function addInputDocumentSupervisor($sProcessUID, $sInputDocumentUID) - { - $oStepSupervisor = new \StepSupervisor(); - $oStepSupervisor->create(array('PRO_UID' => $sProcessUID, - 'STEP_TYPE_OBJ' => "INPUT_DOCUMENT", - 'STEP_UID_OBJ' => $sInputDocumentUID, - 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); - } } diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php index 58a123456..3b697c55a 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php @@ -13,17 +13,113 @@ class ProcessSupervisors extends Api { /** * @param string $prjUid {@min 32} {@max 32} - * @param string $filter - * @param int $start - * @param int $limit * - * @url GET /:prjUid/supervisors + * @url GET /:prjUid/process-supervisors */ - public function doGetSupervisors($prjUid, $filter = '', $start = null, $limit = null) + public function doGetProcessSupervisors($prjUid) { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->getSupervisors($prjUid, $filter, $start, $limit); + $arrayData = $supervisor->getProcessSupervisors($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} + * @param string $puUid {@min 32} {@max 32} + * + * @url GET /:prjUid/process-supervisor/:puUid + */ + public function doGetProcessSupervisor($prjUid, $puUid) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $objectData = $supervisor->getProcessSupervisor($prjUid, $puUid); + //Response + $response = $objectData; + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + /** + * @param string $prjUid {@min 32} {@max 32} + * @param string $obj_type {@choice user,group} + * + * @url GET /:prjUid/available-process-supervisors + */ + public function doGetAvailableSupervisors($prjUid, $obj_type = '') + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $arrayData = $supervisor->getAvailableProcessSupervisors($prjUid, $obj_type); + //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/process-supervisor/dynaforms + */ + public function doGetProcessSupervisorDynaforms($prjUid) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $arrayData = $supervisor->getProcessSupervisorDynaforms($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} + * @param string $pudUid {@min 32} {@max 32} + * + * @url GET /:prjUid/process-supervisor/dynaform/:pudUid + */ + public function doGetProcessSupervisorDynaform($prjUid, $pudUid) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $objectData = $supervisor->getProcessSupervisorDynaform($prjUid, $pudUid); + //Response + $response = $objectData; + } 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/process-supervisor/available-dynaforms + */ + public function doGetAvailableProcessSupervisorDynaform($prjUid) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $arrayData = $supervisor->getAvailableProcessSupervisorDynaform($prjUid); //Response $response = $arrayData; } catch (\Exception $e) { @@ -36,13 +132,13 @@ class ProcessSupervisors extends Api /** * @param string $prjUid {@min 32} {@max 32} * - * @url GET /:prjUid/inputdocument-supervisor + * @url GET /:prjUid/process-supervisor/input-documents */ - public function doGetInputDocumentSupervisor($prjUid) + public function doGetProcessSupervisorInputDocuments($prjUid) { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->getInputDocumentSupervisor($prjUid); + $arrayData = $supervisor->getProcessSupervisorInputDocuments($prjUid); //Response $response = $arrayData; } catch (\Exception $e) { @@ -54,38 +150,17 @@ class ProcessSupervisors extends Api /** * @param string $prjUid {@min 32} {@max 32} + * @param string $puiUid {@min 32} {@max 32} * - * @url GET /:prjUid/dynaform-supervisor + * @url GET /:prjUid/process-supervisor/input-document/:puiUid */ - public function doGetDynaformSupervisor($prjUid) + public function doGetProcessSupervisorInputDocument($prjUid, $puiUid) { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->getDynaformSupervisor($prjUid); + $objectData = $supervisor->getProcessSupervisorInputDocument($prjUid, $puiUid); //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} - * @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; + $response = $objectData; } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -96,13 +171,14 @@ class ProcessSupervisors extends Api /** * @param string $prjUid {@min 32} {@max 32} * - * @url GET /:prjUid/available-dynaform-supervisor + * @url GET /:prjUid/process-supervisor/available-input-documents */ - public function doGetAvailableDynaformSupervisor($prjUid) + public function doGetAvailableProcessSupervisorInputDocument($prjUid) + { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->getAvailableDynaformSupervisors($prjUid); + $arrayData = $supervisor->getAvailableProcessSupervisorInputDocument($prjUid); //Response $response = $arrayData; } catch (\Exception $e) { @@ -113,98 +189,21 @@ class ProcessSupervisors extends Api } /** - * @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 + * @url POST /:prjUid/process-supervisor * * @param string $prjUid - * @param string $supUid - * - */ - public function doDeleteSupervisor($prjUid, $supUid) - { - try { - $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->removeProcessSupervisor($prjUid, $supUid); - } catch (\Exception $e) { - //response - throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); - } - return $response; - } - - /** - * @url DELETE /:prjUid/dynaform-supervisor/:dynUid - * - * @param string $prjUid - * @param string $dynUid - * - */ - public function doDeleteDynaformSupervisor($prjUid, $dynUid) - { - try { - $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->removeDynaformSupervisor($prjUid, $dynUid); - } catch (\Exception $e) { - //response - throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); - } - return $response; - } - - /** - * @url DELETE /:prjUid/inputdocument-supervisor/:inputDocUid - * - * @param string $prjUid - * @param string $inputDocUid - * - */ - public function doDeleteInputDocumentSupervisor($prjUid, $inputDocUid) - { - try { - $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->removeInputDocumentSupervisor($prjUid, $inputDocUid); - } catch (\Exception $e) { - //response - throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); - } - return $response; - } - - /** - * @url POST /:prjUid/supervisor - * - * @param string $prjUid - * @param string $sup_uid - * @param string $sup_type {@choice user,group} + * @param string $usr_uid + * @param string $pu_type {@choice SUPERVISOR,GROUP_SUPERVISOR} * * @status 201 */ - public function doPostSupervisors($prjUid, $sup_uid, $sup_type) + public function doPostProcessSupervisor($prjUid, $usr_uid, $pu_type) { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $sup_type=ucwords($sup_type); - $arrayData = $supervisor->addSupervisor($prjUid, $sup_uid, $sup_type); + $objectData = $supervisor->addProcessSupervisor($prjUid, $usr_uid, $pu_type); + //Response + $response = $objectData; } catch (\Exception $e) { //Response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -213,18 +212,20 @@ class ProcessSupervisors extends Api } /** - * @url POST /:prjUid/dynaform-supervisor + * @url POST /:prjUid/process-supervisor/dynaform * * @param string $prjUid * @param string $dyn_uid * * @status 201 */ - public function doPostDynaformSupervisors($prjUid, $dyn_uid) + public function doPostProcessSupervisorDynaform($prjUid, $dyn_uid) { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->addDynaformSupervisor($prjUid, $dyn_uid); + $objectData = $supervisor->addProcessSupervisorDynaform($prjUid, $dyn_uid); + //Response + $response = $objectData; } catch (\Exception $e) { //Response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -233,18 +234,18 @@ class ProcessSupervisors extends Api } /** - * @url POST /:prjUid/inputdocument-supervisor + * @url POST /:prjUid/process-supervisor/input-document * * @param string $prjUid * @param string $inp_doc_uid * * @status 201 */ - public function doPostInputDocumentSupervisors($prjUid, $inp_doc_uid) + public function doPostProcessSupervisorInputDocument($prjUid, $inp_doc_uid) { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->addInputDocumentSupervisor($prjUid, $inp_doc_uid); + $arrayData = $supervisor->addProcessSupervisorInputDocument($prjUid, $inp_doc_uid); } catch (\Exception $e) { //Response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); @@ -252,4 +253,64 @@ class ProcessSupervisors extends Api return $response; } + /** + * @url DELETE /:prjUid/process-supervisor/:puUid + * + * @param string $prjUid + * @param string $puUid + * + */ + public function doDeleteSupervisor($prjUid, $puUid) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $arrayData = $supervisor->removeProcessSupervisor($prjUid, $puUid); + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + /** + * @url DELETE /:prjUid/process-supervisor/dynaform/:pudUid + * + * @param string $prjUid + * @param string $pudUid + * + */ + public function doDeleteDynaformSupervisor($prjUid, $pudUid) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $arrayData = $supervisor->removeDynaformSupervisor($prjUid, $pudUid); + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + /** + * @url DELETE /:prjUid/process-supervisor/input-document/:puiUid + * + * @param string $prjUid + * @param string $puiUid + * + */ + public function doDeleteInputDocumentSupervisor($prjUid, $puiUid) + { + try { + $supervisor = new \BusinessModel\ProcessSupervisor(); + $arrayData = $supervisor->removeInputDocumentSupervisor($prjUid, $puiUid); + } catch (\Exception $e) { + //response + throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); + } + return $response; + } + + + + } From 6c9d226ded89fa530b8ae91840ac950e8485fc33 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Thu, 9 Jan 2014 09:39:16 -0400 Subject: [PATCH 02/12] Se adiciona la respuesta para los casos de POST en PROCESS SUPERVISORS para dynanforms e inputdocuments --- .../src/BusinessModel/ProcessSupervisor.php | 67 ++++++++++++++++++- .../Project/ProcessSupervisors.php | 4 +- 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/BusinessModel/ProcessSupervisor.php b/workflow/engine/src/BusinessModel/ProcessSupervisor.php index 4cf848d8e..6e7c77e64 100644 --- a/workflow/engine/src/BusinessModel/ProcessSupervisor.php +++ b/workflow/engine/src/BusinessModel/ProcessSupervisor.php @@ -573,7 +573,39 @@ class ProcessSupervisor 'STEP_TYPE_OBJ' => "DYNAFORM", 'STEP_UID_OBJ' => $sDynUID, 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); - return $oStepSupervisor; + $sDelimiter = \DBAdapter::getStringDelimiter(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); + $oCriteria->addAsColumn('DYN_TITLE', 'C.CON_VALUE'); + $oCriteria->addAlias('C', 'CONTENT'); + $aConditions = array(); + $aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \DynaformPeer::DYN_UID ); + $aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'DYNAFORM' . $sDelimiter ); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $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(\StepSupervisorPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sDynUID); + $oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'DYNAFORM'); + $oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION); + $oDataset = \StepSupervisorPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aResp = array('pud_uid' => $aRow['STEP_UID'], + 'pud_position' => $aRow['STEP_POSITION'], + 'dyn_uid' => $aRow['STEP_UID_OBJ'], + 'dyn_title' => $aRow['DYN_TITLE']); + $oDataset->next(); + } + return $aResp; } /** @@ -590,6 +622,39 @@ class ProcessSupervisor 'STEP_TYPE_OBJ' => "INPUT_DOCUMENT", 'STEP_UID_OBJ' => $sInputDocumentUID, 'STEP_POSITION' => $oStepSupervisor->getNextPosition($sProcessUID, "DYNAFORM"))); + $sDelimiter = \DBAdapter::getStringDelimiter(); + $oCriteria = new \Criteria('workflow'); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::PRO_UID); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_TYPE_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_UID_OBJ); + $oCriteria->addSelectColumn(\StepSupervisorPeer::STEP_POSITION); + $oCriteria->addAsColumn('INP_DOC_TITLE', 'C.CON_VALUE'); + $oCriteria->addAlias('C', 'CONTENT'); + $aConditions = array(); + $aConditions[] = array(\StepSupervisorPeer::STEP_UID_OBJ, \InputDocumentPeer::INP_DOC_UID); + $aConditions[] = array(\StepSupervisorPeer::STEP_TYPE_OBJ, $sDelimiter . 'INPUT_DOCUMENT' . $sDelimiter); + $oCriteria->addJoinMC($aConditions, \Criteria::LEFT_JOIN); + $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(\StepSupervisorPeer::PRO_UID, $sProcessUID); + $oCriteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $sInputDocumentUID); + $oCriteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT'); + $oCriteria->addAscendingOrderByColumn(\StepSupervisorPeer::STEP_POSITION); + $oDataset = \StepSupervisorPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $aResp = array('pui_uid' => $aRow['STEP_UID'], + 'pui_position' => $aRow['STEP_POSITION'], + 'input_doc_uid' => $aRow['STEP_UID_OBJ'], + 'input_doc_title' => $aRow['INP_DOC_TITLE']); + $oDataset->next(); + } + return $aResp; } /** diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php index 3b697c55a..4bd44bea2 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php @@ -245,7 +245,9 @@ class ProcessSupervisors extends Api { try { $supervisor = new \BusinessModel\ProcessSupervisor(); - $arrayData = $supervisor->addProcessSupervisorInputDocument($prjUid, $inp_doc_uid); + $objectData = $supervisor->addProcessSupervisorInputDocument($prjUid, $inp_doc_uid); + //Response + $response = $objectData; } catch (\Exception $e) { //Response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); From abdaa67207b079fff14440f111be0e927c0c7150 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Thu, 9 Jan 2014 10:35:55 -0400 Subject: [PATCH 03/12] Se corrige bug de grupos disponibles para ASSIGNEES y ADHOC ASSIGNEES --- workflow/engine/src/BusinessModel/Task.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/engine/src/BusinessModel/Task.php b/workflow/engine/src/BusinessModel/Task.php index 32382932b..6c12efd2e 100644 --- a/workflow/engine/src/BusinessModel/Task.php +++ b/workflow/engine/src/BusinessModel/Task.php @@ -720,7 +720,7 @@ class Task $groups = new \Groupwf(); $result = $groups->getAllGroup($start, $limit, $filter); foreach ($result['rows'] as $results) { - if (in_array($results['GRP_UID'], $aUIDS1)) { + if (! in_array($results['GRP_UID'], $aUIDS1)) { $c++; $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn('COUNT(*) AS MEMBERS_NUMBER'); @@ -1116,7 +1116,7 @@ class Task $groups = new \Groupwf(); $result = $groups->getAllGroup($start, $limit, $filter); foreach ($result['rows'] as $results) { - if (in_array($results['GRP_UID'], $aUIDS1)) { + if (! in_array($results['GRP_UID'], $aUIDS1)) { $c++; $oCriteria = new \Criteria('workflow'); $oCriteria->addSelectColumn('COUNT(*) AS MEMBERS_NUMBER'); From 30dc9eb820528f936b6e15a52d0116ada3611a56 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 9 Jan 2014 10:36:59 -0400 Subject: [PATCH 04/12] Pull Request para el Feature Assignee Resources --- features/assignee/assignee.feature | 41 ++++++++++++------------------ features/bootstrap/RestContext.php | 19 ++++++++++++-- 2 files changed, 33 insertions(+), 27 deletions(-) diff --git a/features/assignee/assignee.feature b/features/assignee/assignee.feature index 7212486b3..9a7f6740b 100644 --- a/features/assignee/assignee.feature +++ b/features/assignee/assignee.feature @@ -1,5 +1,18 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Testing assignee +Feature: Project Properties Assignee Resources + + Background: + Given that I have a valid acess_token + + Scenario: Get a list of available users and groups to be assigned to an activity + Given that I have a valid access_token + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/available-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + Scenario: List assignees of an activity Given that I have a valid access_token And I request "project/14414793652a5d718b65590036026581/activity/13508932952a5d718ef56f6044945775/assignee" @@ -13,18 +26,7 @@ Feature: Testing assignee And the "aas_username" property in row 0 equals "admin" And the "aas_type" property in row 0 equals "user" - Scenario: Get a list of available users and groups to be assigned to an activity - Given that I have a valid access_token - And I request "project/14414793652a5d718b65590036026581/activity/13508932952a5d718ef56f6044945775/available-assignee" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "array" - And the "aas_uid" property in row 0 equals "1283376915224e7e5ccbfa0059627023" - And the "aas_name" property in row 0 equals "Juana" - And the "aas_lastname" property in row 0 equals "De Arco" - And the "aas_username" property in row 0 equals "juana" - And the "aas_type" property in row 0 equals "user" + Scenario: Get a single user or group of an activity Given that I have a valid access_token @@ -39,18 +41,7 @@ Feature: Testing assignee And the "aas_username" property equals "admin" And the "aas_type" property equals "user" - Scenario: Assign a user or group to an activity - Given that I have a valid access_token - And POST this data: -""" -{ - "ass_uid": "42713393551f2a8aae1fde2096962777", - "ass_type": "group" -} -""" - And I request "project/14414793652a5d718b65590036026581/activity/13508932952a5d718ef56f6044945775/assignee" - Then the response status code should be 201 - # And store "aas_uid" in session array + # Scenario: Unassign a user or group to an activity # Given that I have a valid access_token diff --git a/features/bootstrap/RestContext.php b/features/bootstrap/RestContext.php index b498ca832..1b2ad5249 100644 --- a/features/bootstrap/RestContext.php +++ b/features/bootstrap/RestContext.php @@ -1075,6 +1075,21 @@ class RestContext extends BehatContext { throw new PendingException(); } + + /** + * @Then /^the response has (\d+) records$/ + * @Then /^the response has (\d+) record$/ + */ + public function theResponseHasRecords($quantityOfRecords) + { + $data = $this->_data; + if (!is_array($data)) { + throw new Exception("the Response data is not an array!\n\n" ); + } + $currentRecordsCount=count($data); + if($currentRecordsCount!=$quantityOfRecords){ + throw new Exception('Records quantity not match ' . $quantityOfRecords . ' (actual: ' . $currentRecordsCount . ")\n\n"); + } + } -} - +} \ No newline at end of file From ccda9fc3cd522f756ea1e586d0608d5d584d21cd Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Thu, 9 Jan 2014 10:59:08 -0400 Subject: [PATCH 05/12] Se corrige respuesta para ADHOC ASSIGNEES --- workflow/engine/src/BusinessModel/Task.php | 60 +++++++++---------- .../Project/Activity/Assignee.php | 8 +-- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/workflow/engine/src/BusinessModel/Task.php b/workflow/engine/src/BusinessModel/Task.php index 6c12efd2e..7439cd74a 100644 --- a/workflow/engine/src/BusinessModel/Task.php +++ b/workflow/engine/src/BusinessModel/Task.php @@ -1027,14 +1027,14 @@ class Task $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); $aRow2 = $oDataset2->getRow(); - $aUsers[] = array('aas_uid' => $results['GRP_UID'], - 'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] . + $aUsers[] = array('ada_uid' => $results['GRP_UID'], + 'ada_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] . ' (' . $aRow2['MEMBERS_NUMBER'] . ' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')). ')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']), - 'aas_lastname' => "", - 'aas_username' => "", - 'aas_type' => "group" ); + 'ada_lastname' => "", + 'ada_username' => "", + 'ada_type' => "group" ); } } $oCriteria = new \Criteria('workflow'); @@ -1063,11 +1063,11 @@ class Task $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aUsers[] = array('aas_uid' => $aRow['USR_UID'], - 'aas_name' => $aRow['USR_FIRSTNAME'], - 'aas_lastname' => $aRow['USR_LASTNAME'], - 'aas_username' => $aRow['USR_USERNAME'], - 'aas_type' => "user" ); + $aUsers[] = array('ada_uid' => $aRow['USR_UID'], + 'ada_name' => $aRow['USR_FIRSTNAME'], + 'ada_lastname' => $aRow['USR_LASTNAME'], + 'ada_username' => $aRow['USR_USERNAME'], + 'ada_type' => "user" ); $oDataset->next(); } return $aUsers; @@ -1125,14 +1125,14 @@ class Task $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); $aRow2 = $oDataset2->getRow(); - $aUsers[] = array('aas_uid' => $results['GRP_UID'], - 'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] . + $aUsers[] = array('ada_uid' => $results['GRP_UID'], + 'ada_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] . ' (' . $aRow2['MEMBERS_NUMBER'] . ' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')). ')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']), - 'aas_lastname' => "", - 'aas_username' => "", - 'aas_type' => "group" ); + 'ada_lastname' => "", + 'ada_username' => "", + 'ada_type' => "group" ); } } $sDelimiter = \DBAdapter::getStringDelimiter(); @@ -1157,11 +1157,11 @@ class Task $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aUsers[] = array('aas_uid' => $aRow['USR_UID'], - 'aas_name' => $aRow['USR_FIRSTNAME'], - 'aas_lastname' => $aRow['USR_LASTNAME'], - 'aas_username' => $aRow['USR_USERNAME'], - 'aas_type' => "user" ); + $aUsers[] = array('ada_uid' => $aRow['USR_UID'], + 'ada_name' => $aRow['USR_FIRSTNAME'], + 'ada_lastname' => $aRow['USR_LASTNAME'], + 'ada_username' => $aRow['USR_USERNAME'], + 'ada_type' => "user" ); $oDataset->next(); } return $aUsers; @@ -1225,14 +1225,14 @@ class Task $oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset2->next(); $aRow2 = $oDataset2->getRow(); - $aUsers[] = array('aas_uid' => $results['GRP_UID'], - 'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] . + $aUsers[] = array('ada_uid' => $results['GRP_UID'], + 'ada_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] . ' (' . $aRow2['MEMBERS_NUMBER'] . ' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')). ')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']), - 'aas_lastname' => "", - 'aas_username' => "", - 'aas_type' => "group" ); + 'ada_lastname' => "", + 'ada_username' => "", + 'ada_type' => "group" ); } } $oCriteria = new \Criteria('workflow'); @@ -1253,11 +1253,11 @@ class Task $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aUsers = array('aas_uid' => $aRow['USR_UID'], - 'aas_name' => $aRow['USR_FIRSTNAME'], - 'aas_lastname' => $aRow['USR_LASTNAME'], - 'aas_username' => $aRow['USR_USERNAME'], - 'aas_type' => "user" ); + $aUsers = array('ada_uid' => $aRow['USR_UID'], + 'ada_name' => $aRow['USR_FIRSTNAME'], + 'ada_lastname' => $aRow['USR_LASTNAME'], + 'ada_username' => $aRow['USR_USERNAME'], + 'ada_type' => "user" ); $oDataset->next(); } if (empty($aUsers)) { diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php index 5d31be8f8..e6d727ec5 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php @@ -204,16 +204,16 @@ class Assignee extends Api * * @param string $prjUid * @param string $actUid - * @param string $ass_uid - * @param string $ass_type {@choice user,group} + * @param string $ada_uid + * @param string $ada_type {@choice user,group} * * @status 201 */ - public function doPostActivityAdhocAssignee($prjUid, $actUid, $ass_uid, $ass_type) + public function doPostActivityAdhocAssignee($prjUid, $actUid, $ada_uid, $ada_type) { try { $task = new \BusinessModel\Task(); - $arrayData = $task->addTaskAdhocAssignee($prjUid, $actUid, $ass_uid, $ass_type); + $arrayData = $task->addTaskAdhocAssignee($prjUid, $actUid, $ada_uid, $ada_type); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); From 127c87cec92aa6248b6cd0efb43e691b7a87ab4a Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Thu, 9 Jan 2014 11:44:48 -0400 Subject: [PATCH 06/12] Se agregan validaciones ASSIGNEES y PROCESS SUPERVISORS --- workflow/engine/src/BusinessModel/Task.php | 56 +++++++++---------- .../Project/Activity/Assignee.php | 8 +-- .../Project/ProcessSupervisors.php | 24 ++++---- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/workflow/engine/src/BusinessModel/Task.php b/workflow/engine/src/BusinessModel/Task.php index 7439cd74a..b7d5b3ee8 100644 --- a/workflow/engine/src/BusinessModel/Task.php +++ b/workflow/engine/src/BusinessModel/Task.php @@ -576,8 +576,8 @@ class Task /** * Return a assignee list of an activity * - * @param string $sProcessUID - * @param string $sTaskUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} * @param string $filter * @param int $start * @param int $limit @@ -680,8 +680,8 @@ class Task /** * Return the available users and users groups to assigned to an activity * - * @param string $sProcessUID - * @param string $sTaskUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} * @param string $filter * @param int $start * @param int $limit @@ -777,9 +777,9 @@ class Task /** * Return a single user or group assigned to an activity * - * @param string $sProcessUID - * @param string $sTaskUID - * @param string $sAssigneeUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} + * @param string $sAssigneeUID {@min 32} {@max 32} * * return array * @@ -877,9 +877,9 @@ class Task /** * Assign a user or group to an activity * - * @param string $sProcessUID - * @param string $sTaskUID - * @param string $sAssigneeUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} + * @param string $sAssigneeUID {@min 32} {@max 32} * @param string $assType {@choice user,group} * * return array @@ -943,9 +943,9 @@ class Task /** * Remove a assignee of an activity * - * @param string $sProcessUID - * @param string $sTaskUID - * @param string $sAssigneeUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} + * @param string $sAssigneeUID {@min 32} {@max 32} * * @access public */ @@ -978,8 +978,8 @@ class Task /** * Return a adhoc assignee list of an activity * - * @param string $sProcessUID - * @param string $sTaskUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} * * return array * @@ -1079,8 +1079,8 @@ class Task /** * Return the available adhoc users and users groups to assigned to an activity * - * @param string $sProcessUID - * @param string $sTaskUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} * * return array * @@ -1173,9 +1173,9 @@ class Task /** * Return a single Adhoc user or group assigned to an activity * - * @param string $sProcessUID - * @param string $sTaskUID - * @param string $sAssigneeUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} + * @param string $sAssigneeUID {@min 32} {@max 32} * * return array * @@ -1273,10 +1273,10 @@ class Task /** * Assign a Adhoc user or group to an activity * - * @param string $sProcessUID - * @param string $sTaskUID - * @param string $sAssigneeUID - * @param string $assType + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} + * @param string $sAssigneeUID {@min 32} {@max 32} + * @param string $assType {@choice user,group} * * return array * @@ -1339,9 +1339,9 @@ class Task /** * Remove a Adhoc assignee of an activity * - * @param string $sProcessUID - * @param string $sTaskUID - * @param string $sAssigneeUID + * @param string $sProcessUID {@min 32} {@max 32} + * @param string $sTaskUID {@min 32} {@max 32} + * @param string $sAssigneeUID {@min 32} {@max 32} * * @access public */ @@ -1362,7 +1362,7 @@ class Task } $oTaskUser = \TaskUserPeer::retrieveByPK($sTaskUID, $sAssigneeUID, $iType, $iRelation); if (! is_null( $oTaskUser )) { - OutputDocumentsTaskUserPeer::doDelete($oCriteria); + \TaskUserPeer::doDelete($oCriteria); } else { throw (new \Exception( 'This row does not exist!' )); } diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php index e6d727ec5..b251bebf7 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Assignee.php @@ -222,18 +222,18 @@ class Assignee extends Api } /** - * @url DELETE /:prjUid/activity/:actUid/adhoc-assignee/:assUid + * @url DELETE /:prjUid/activity/:actUid/adhoc-assignee/:adaUid * * @param string $prjUid * @param string $actUid - * @param string $assUid + * @param string $adaUid * */ - public function doDeleteActivityAdhocAssignee($prjUid, $actUid, $assUid) + public function doDeleteActivityAdhocAssignee($prjUid, $actUid, $adaUid) { try { $task = new \BusinessModel\Task(); - $arrayData = $task->removeTaskAdhocAssignee($prjUid, $actUid, $assUid); + $arrayData = $task->removeTaskAdhocAssignee($prjUid, $actUid, $adaUid); } catch (\Exception $e) { //response throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()); diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php index 4bd44bea2..67115e388 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php @@ -191,8 +191,8 @@ class ProcessSupervisors extends Api /** * @url POST /:prjUid/process-supervisor * - * @param string $prjUid - * @param string $usr_uid + * @param string $prjUid {@min 32} {@max 32} + * @param string $usr_uid {@min 32} {@max 32} * @param string $pu_type {@choice SUPERVISOR,GROUP_SUPERVISOR} * * @status 201 @@ -214,8 +214,8 @@ class ProcessSupervisors extends Api /** * @url POST /:prjUid/process-supervisor/dynaform * - * @param string $prjUid - * @param string $dyn_uid + * @param string $prjUid {@min 32} {@max 32} + * @param string $dyn_uid {@min 32} {@max 32} * * @status 201 */ @@ -236,8 +236,8 @@ class ProcessSupervisors extends Api /** * @url POST /:prjUid/process-supervisor/input-document * - * @param string $prjUid - * @param string $inp_doc_uid + * @param string $prjUid {@min 32} {@max 32} + * @param string $inp_doc_uid {@min 32} {@max 32} * * @status 201 */ @@ -258,8 +258,8 @@ class ProcessSupervisors extends Api /** * @url DELETE /:prjUid/process-supervisor/:puUid * - * @param string $prjUid - * @param string $puUid + * @param string $prjUid {@min 32} {@max 32} + * @param string $puUid {@min 32} {@max 32} * */ public function doDeleteSupervisor($prjUid, $puUid) @@ -277,8 +277,8 @@ class ProcessSupervisors extends Api /** * @url DELETE /:prjUid/process-supervisor/dynaform/:pudUid * - * @param string $prjUid - * @param string $pudUid + * @param string $prjUid {@min 32} {@max 32} + * @param string $pudUid {@min 32} {@max 32} * */ public function doDeleteDynaformSupervisor($prjUid, $pudUid) @@ -296,8 +296,8 @@ class ProcessSupervisors extends Api /** * @url DELETE /:prjUid/process-supervisor/input-document/:puiUid * - * @param string $prjUid - * @param string $puiUid + * @param string $prjUid {@min 32} {@max 32} + * @param string $puiUid {@min 32} {@max 32} * */ public function doDeleteInputDocumentSupervisor($prjUid, $puiUid) From b7873148ef3aaef9cab2347bc8bb2464e7e78168 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Thu, 9 Jan 2014 11:59:42 -0400 Subject: [PATCH 07/12] ProcessMaker-MA "Project Properties - Step Resources (behat)" - Se han implementado los siguientes features: GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/steps GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-steps GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid} POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid} DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid} GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/triggers GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/available-triggers/{type} GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type} POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid} DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type} Nota.- El endpoint: GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type} originalmente era: GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid} Se cambio esto, ya que se debe indicar de donde se obtendra el trigger (BEFORE o AFTER), tambien se cambio el formato de respuesta para este endpoint, pues habia una incoherencia Todos estos cambios estan en el documento word --- .../step.feature | 312 ++++++++++++++++-- workflow/engine/src/BusinessModel/Step.php | 16 +- .../engine/src/BusinessModel/Step/Trigger.php | 73 ++++ workflow/engine/src/BusinessModel/Trigger.php | 37 --- .../Project/Activity/Step/Trigger.php | 14 +- 5 files changed, 377 insertions(+), 75 deletions(-) diff --git a/features/backend/project_properties_step_resources/step.feature b/features/backend/project_properties_step_resources/step.feature index 3318c4fca..ce23727fc 100644 --- a/features/backend/project_properties_step_resources/step.feature +++ b/features/backend/project_properties_step_resources/step.feature @@ -1,39 +1,303 @@ @ProcessMakerMichelangelo @RestAPI Feature: Project Properties - Step Resources + #STEPS OF A ACTIVITY - Background: - Given that I have a valid access_token + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/steps + # List assigned Steps to an Activity + Scenario: List assigned Steps to "Task1" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/steps" + 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: List assigned steps to an Activity - Given this scenario is not implemented yet + #POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step + # Assign a Step to an Activity + Scenario: Assign "DynaForm Demo1" to "Task1" + Given that I have a valid access_token + And POST this data: + """ + { + "step_type_obj": "DYNAFORM", + "step_uid_obj": "50332332752cd9b9a7cc989003652905", + "step_condition": "", + "step_position": 1, + "step_mode": "EDIT" + } + """ + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/step" + 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 "step_uid" in session array as variable "step1" - Scenario: List available steps to assign to an Activity - Given this scenario is not implemented yet + #POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step + # Assign a Step to an Activity + Scenario: Assign "InputDocument Demo" to "Task1" + Given that I have a valid access_token + And POST this data: + """ + { + "step_type_obj": "INPUT_DOCUMENT", + "step_uid_obj": "83199959452cd62589576c1018679557", + "step_condition": "", + "step_position": 2, + "step_mode": "EDIT" + } + """ + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/step" + 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 "step_uid" in session array as variable "step2" - Scenario: Get a single step assigned to an Activity - Given this scenario is not implemented yet + #PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid} + # Update a Step assignation of an Activity + Scenario: Update Step "DynaForm Demo1" assigned to "Task1" + Given that I have a valid access_token + And PUT this data: + """ + { + "step_condition": "@@FIELD1 == 1", + "step_mode": "VIEW" + } + """ + And that I want to update a resource with the key "step1" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/step" + 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 "step_condition" is set to "@@FIELD1 == 1" - Scenario: Assing a step to a Activity - Given this scenario is not implemented yet + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/steps + # List assigned Steps to an Activity + Scenario: List assigned Steps to "Task1" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/steps" + 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 "step_type_obj" property in row 1 equals "INPUT_DOCUMENT" + And the "step_uid_obj" property in row 1 equals "83199959452cd62589576c1018679557" + And the "step_condition" property in row 1 equals "" + And the "step_position" property in row 1 equals "2" + And the "step_mode" property in row 1 equals "EDIT" + And the "obj_title" property in row 1 equals "InputDocument Demo" + And the "obj_description" property in row 1 equals "Description" - Scenario: Unassign a step from an activity - Given this scenario is not implemented yet + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-steps + # List available Steps to assign to an Activity + Scenario: List available Steps to assign to "Task1" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/available-steps" + 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 "obj_uid" property in row 1 equals "32743823452cd63105006e1076595203" + And the "obj_title" property in row 1 equals "OutputDocument Demo" + And the "obj_description" property in row 1 equals "Description" + And the "obj_type" property in row 1 equals "OUTPUT_DOCUMENT" - Scenario: List assigned triggers to a Step - Given this scenario is not implemented yet + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid} + # Get a single Step assigned to an Activity + Scenario: Get a single Step "DynaForm Demo1" assigned to "Task1" + Given that I have a valid access_token + And that I want to get a resource with the key "step1" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/step" + 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 "step_type_obj" is set to "DYNAFORM" + And that "step_uid_obj" is set to "50332332752cd9b9a7cc989003652905" + And that "step_condition" is set to "@@FIELD1 == 1" + And that "step_position" is set to "1" + And that "step_mode" is set to "VIEW" + And that "obj_title" is set to "DynaForm Demo1" + And that "obj_description" is set to "Description" - Scenario: List available triggers to assign to a Step - Given this scenario is not implemented yet + #DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid} + # Unassign a Step from an Activity + Scenario: Unassign "DynaForm Demo1" from "Task1" + Given that I have a valid access_token + And that I want to delete a resource with the key "step1" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/step" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" - Scenario: Get a single trigger assigned to a Step - Given this scenario is not implemented yet + #DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid} + # Unassign a Step from an Activity + Scenario: Unassign "InputDocument Demo" from "Task1" + Given that I have a valid access_token + And that I want to delete a resource with the key "step2" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/step" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" - Scenario: Assign a trigger to a Step - Given this scenario is not implemented yet + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/steps + # List assigned Steps to an Activity + Scenario: List assigned Steps to "Task1" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/10163687452cd6234e0dd25086954968/steps" + 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: Update a trigger assignation of a Step - Given this scenario is not implemented yet + #TRIGGERS OF A STEP - Scenario: Remove a trigger assignation of a Step - Given this scenario is not implemented yet + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/triggers + # List assigned Triggers to a Step + Scenario: List Triggers assigned to first Step of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/triggers" + 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}/activity/{act_uid}/step/{step_uid}/trigger + # Assign a Trigger to a Step + Scenario: Assign "Trigger Demo1" to first Step of "Task2" + Given that I have a valid access_token + And POST this data: + """ + { + "tri_uid": "81919273152cd636c665080083928728", + "st_type": "BEFORE", + "st_condition": "", + "st_position": 1 + } + """ + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger" + And the content type is "application/json" + Then the response status code should be 201 + And the response charset is "UTF-8" + + #POST /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger + # Assign a Trigger to a Step + Scenario: Assign "Trigger Demo2" to first Step of "Task2" + Given that I have a valid access_token + And POST this data: + """ + { + "tri_uid": "56359776552cd6378b38e47080912028", + "st_type": "BEFORE", + "st_condition": "", + "st_position": 2 + } + """ + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger" + And the content type is "application/json" + Then the response status code should be 201 + And the response charset is "UTF-8" + + #PUT /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid} + # Update a Trigger assignation of a Step + Scenario: Update "Trigger Demo1" assigned to first Step of "Task2" + Given that I have a valid access_token + And PUT this data: + """ + { + "st_type": "BEFORE", + "st_condition": "@@FIELD2 == 2" + } + """ + And that I want to update a resource with the key "tgr1" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/81919273152cd636c665080083928728" + 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 "st_condition" is set to "@@FIELD2 == 2" + + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/triggers + # List assigned Triggers to a Step + Scenario: List Triggers assigned to first Step of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/triggers" + 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 "tri_uid" property in row 1 equals "56359776552cd6378b38e47080912028" + And the "tri_title" property in row 1 equals "Trigger Demo2" + And the "tri_description" property in row 1 equals "Description" + And the "st_type" property in row 1 equals "BEFORE" + And the "st_condition" property in row 1 equals "" + And the "st_position" property in row 1 equals "2" + + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/available-triggers/{type} + # List available Triggers to assign to a Step + Scenario: List available Triggers to assign to first Step of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/available-triggers/before" + 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 "tri_uid" property in row 0 equals "57401970252cd6393531551040242546" + And the "tri_title" property in row 0 equals "Trigger Demo3" + And the "tri_description" property in row 0 equals "Description" + And the "tri_type" property in row 0 equals "SCRIPT" + And the "tri_webbot" property in row 0 equals "" + And the "tri_param" property in row 0 equals "" + + #GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type} + # Get a single Trigger assigned to a Step + Scenario: Get a single Trigger "Trigger Demo1" assigned to first Step of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/81919273152cd636c665080083928728/before" + 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 "tri_uid" is set to "81919273152cd636c665080083928728" + And that "tri_title" is set to "Trigger Demo1" + And that "tri_description" is set to "Description" + And that "st_type" is set to "BEFORE" + And that "st_condition" is set to "@@FIELD2 == 2" + And that "st_position" is set to "1" + + #DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type} + # Remove a Trigger assignation of a Step + Scenario: Remove "Trigger Demo1" assigned to first Step of "Task2" + Given that I have a valid access_token + And that I want to delete a resource with the key "tgr1" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/81919273152cd636c665080083928728/before" + 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}/activity/{act_uid}/step/{step_uid}/trigger/{tri_uid}/{type} + # Remove a Trigger assignation of a Step + Scenario: Remove "Trigger Demo2" assigned to first Step of "Task2" + Given that I have a valid access_token + And that I want to delete a resource with the key "tgr2" stored in session array + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/trigger/56359776552cd6378b38e47080912028/before" + 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}/activity/{act_uid}/step/{step_uid}/triggers + # List assigned Triggers to a Step + Scenario: List Triggers assigned to first Step of "Task2" + Given that I have a valid access_token + And I request "project/16062437052cd6141881e06088349078/activity/89706843252cd9decdcf9b3047762708/step/65093024352cd9df93d9675058012924/triggers" + 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 diff --git a/workflow/engine/src/BusinessModel/Step.php b/workflow/engine/src/BusinessModel/Step.php index 562d48503..926bb72a7 100644 --- a/workflow/engine/src/BusinessModel/Step.php +++ b/workflow/engine/src/BusinessModel/Step.php @@ -465,9 +465,11 @@ class Step public function getTriggers($stepUid) { try { + //Get data $arrayTrigger = array(); - $trigger = new \BusinessModel\Trigger(); + $bmTrigger = new \BusinessModel\Trigger(); + $bmStepTrigger = new \BusinessModel\Step\Trigger(); $arrayDataUid = $this->getDataUids($stepUid); @@ -508,8 +510,9 @@ class Step $stepTrigger->orderPosition($stepUid, $taskUid, $type); //Criteria - $criteria = $trigger->getTriggerCriteria(); + $criteria = $bmTrigger->getTriggerCriteria(); + $criteria->addSelectColumn(\StepTriggerPeer::ST_TYPE); $criteria->addSelectColumn(\StepTriggerPeer::ST_CONDITION); $criteria->addSelectColumn(\StepTriggerPeer::ST_POSITION); $criteria->addJoin(\StepTriggerPeer::TRI_UID, \TriggersPeer::TRI_UID, \Criteria::LEFT_JOIN); @@ -524,14 +527,7 @@ class Step while ($rsCriteria->next()) { $row = $rsCriteria->getRow(); - $arrayTrigger[] = array( - "tri_uid" => $row["TRI_UID"], - "tri_title" => $row["TRI_TITLE"], - "tri_description" => $row["TRI_DESCRIPTION"], - "st_type" => $triggerType, - "st_condition" => $row["ST_CONDITION"], - "st_position" => (int)($row["ST_POSITION"]) - ); + $arrayTrigger[] = $bmStepTrigger->getTriggerDataFromRecord($row); } } diff --git a/workflow/engine/src/BusinessModel/Step/Trigger.php b/workflow/engine/src/BusinessModel/Step/Trigger.php index f1f9ac62c..c22b91dfc 100644 --- a/workflow/engine/src/BusinessModel/Step/Trigger.php +++ b/workflow/engine/src/BusinessModel/Step/Trigger.php @@ -206,5 +206,78 @@ class Trigger throw $e; } } + + /** + * Get data of a Trigger from a record + * + * @param array $record Record + * + * return array Return an array with data of a Trigger + */ + public function getTriggerDataFromRecord($record) + { + try { + return array( + "tri_uid" => $record["TRI_UID"], + "tri_title" => $record["TRI_TITLE"], + "tri_description" => $record["TRI_DESCRIPTION"], + "st_type" => $record["ST_TYPE"], + "st_condition" => $record["ST_CONDITION"], + "st_position" => (int)($record["ST_POSITION"]) + ); + } catch (\Exception $e) { + throw $e; + } + } + + /** + * Get data of a Trigger + * + * @param string $stepUid Unique id of Step + * @param string $type Type (BEFORE, AFTER) + * @param string $triggerUid Unique id of Trigger + * + * return array Return an array with data of a Trigger + */ + public function getTrigger($stepUid, $type, $triggerUid) + { + try { + $step = new \BusinessModel\Step(); + + $arrayDataUid = $step->getDataUids($stepUid); + + $taskUid = $arrayDataUid["TAS_UID"]; + + //Verify data + if (!$this->existsRecord($stepUid, $type, $triggerUid)) { + throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid . ", " . $type . ", " . $triggerUid, "STEP_TRIGGER"), "The record \"{0}\", doesn't exist in table {1}"))); + } + + //Get data + $trigger = new \BusinessModel\Trigger(); + + $criteria = $trigger->getTriggerCriteria(); + + $criteria->addSelectColumn(\StepTriggerPeer::ST_TYPE); + $criteria->addSelectColumn(\StepTriggerPeer::ST_CONDITION); + $criteria->addSelectColumn(\StepTriggerPeer::ST_POSITION); + $criteria->addJoin(\StepTriggerPeer::TRI_UID, \TriggersPeer::TRI_UID, \Criteria::LEFT_JOIN); + $criteria->add(\TriggersPeer::TRI_UID, $triggerUid, \Criteria::EQUAL); + $criteria->add(\StepTriggerPeer::STEP_UID, $stepUid, \Criteria::EQUAL); + $criteria->add(\StepTriggerPeer::TAS_UID, $taskUid, \Criteria::EQUAL); + $criteria->add(\StepTriggerPeer::ST_TYPE, $type, \Criteria::EQUAL); + + $rsCriteria = \StepTriggerPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); + + $rsCriteria->next(); + + $row = $rsCriteria->getRow(); + + return $this->getTriggerDataFromRecord($row); + } catch (\Exception $e) { + throw $e; + } + } } diff --git a/workflow/engine/src/BusinessModel/Trigger.php b/workflow/engine/src/BusinessModel/Trigger.php index 357ac3bfb..4ff82a92e 100644 --- a/workflow/engine/src/BusinessModel/Trigger.php +++ b/workflow/engine/src/BusinessModel/Trigger.php @@ -43,43 +43,6 @@ class Trigger } } - /** - * Get data of a Trigger - * - * @param string $triggerUid Unique id of Trigger - * - * return array - */ - public function getTrigger($triggerUid) - { - try { - //Criteria - $criteria = $this->getTriggerCriteria(); - - $criteria->add(\TriggersPeer::TRI_UID, $triggerUid, \Criteria::EQUAL); - - $rsCriteria = \TriggersPeer::doSelectRS($criteria); - $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); - - $rsCriteria->next(); - - $row = $rsCriteria->getRow(); - - $arrayTrigger = array( - "tri_uid" => $row["TRI_UID"], - "tri_title" => $row["TRI_TITLE"], - "tri_description" => $row["TRI_DESCRIPTION"], - "tri_type" => $row["TRI_TYPE"], - "tri_webbot" => $row["TRI_WEBBOT"], - "tri_param" => $row["TRI_PARAM"] - ); - - return $arrayTrigger; - } catch (\Exception $e) { - throw $e; - } - } - /** * List of Triggers in process * @var string $sProcessUID. Uid for Process diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step/Trigger.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step/Trigger.php index d8019e0e7..c8f988dec 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step/Trigger.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Activity/Step/Trigger.php @@ -12,14 +12,20 @@ use \Luracast\Restler\RestException; class Trigger extends Api { /** - * @url GET /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid + * @url GET /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid/:type + * + * @param string $triggerUid + * @param string $stepUid + * @param string $activityUid + * @param string $projectUid + * @param string $type {@from body}{@choice before,after} */ - public function doGetActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid) + public function doGetActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid, $type) { try { - $trigger = new \BusinessModel\Trigger(); + $stepTrigger = new \BusinessModel\Step\Trigger(); - $response = $trigger->getTrigger($triggerUid); + $response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $triggerUid); return $response; } catch (\Exception $e) { From 015687f3388a3757895c48e370ed17e660f10f02 Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 9 Jan 2014 12:26:32 -0400 Subject: [PATCH 08/12] dummy change, to enable POST /test again --- workflow/engine/src/Services/Api/ProcessMaker/Test3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Test3.php b/workflow/engine/src/Services/Api/ProcessMaker/Test3.php index 0139a0464..171dfcf66 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Test3.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Test3.php @@ -15,7 +15,7 @@ class Test3 extends Api /** * @status 201 */ - function post() + function post2() { return array('success' => true); } From 29a0b005f44ea610bd8ce1b8594a49993b1d486b Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Thu, 9 Jan 2014 12:29:06 -0400 Subject: [PATCH 09/12] Se quita validacion innecesaria en available PROCESS SUPERVISOR --- .../Services/Api/ProcessMaker/Project/ProcessSupervisors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php index 67115e388..3c9b680c9 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/ProcessSupervisors.php @@ -52,7 +52,7 @@ class ProcessSupervisors extends Api /** * @param string $prjUid {@min 32} {@max 32} - * @param string $obj_type {@choice user,group} + * @param string $obj_type * * @url GET /:prjUid/available-process-supervisors */ From fba96169b683f79baea64d657352ebcc319bfea8 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Thu, 9 Jan 2014 12:56:23 -0400 Subject: [PATCH 10/12] Se cambia a objeto la respuesta para la solicitud de un input document especifico en PROCESS SUPERVISOR --- workflow/engine/src/BusinessModel/ProcessSupervisor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/src/BusinessModel/ProcessSupervisor.php b/workflow/engine/src/BusinessModel/ProcessSupervisor.php index 6e7c77e64..f80cf453d 100644 --- a/workflow/engine/src/BusinessModel/ProcessSupervisor.php +++ b/workflow/engine/src/BusinessModel/ProcessSupervisor.php @@ -466,7 +466,7 @@ class ProcessSupervisor $oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $oDataset->next(); while ($aRow = $oDataset->getRow()) { - $aResp[] = array('pui_uid' => $aRow['STEP_UID'], + $aResp = array('pui_uid' => $aRow['STEP_UID'], 'pui_position' => $aRow['STEP_POSITION'], 'input_doc_uid' => $aRow['STEP_UID_OBJ'], 'input_doc_title' => $aRow['INP_DOC_TITLE']); From c2cc4080011e531bb51f14335a9219a533ffefe8 Mon Sep 17 00:00:00 2001 From: Freddy Daniel Rojas Valda Date: Thu, 9 Jan 2014 15:04:37 -0400 Subject: [PATCH 11/12] BEHAT para process supervisor, todos los end points del apiary --- .../process_supervisor.feature | 203 ++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 features/backend/process_supervisor_resources/process_supervisor.feature diff --git a/features/backend/process_supervisor_resources/process_supervisor.feature b/features/backend/process_supervisor_resources/process_supervisor.feature new file mode 100644 index 000000000..3381689ef --- /dev/null +++ b/features/backend/process_supervisor_resources/process_supervisor.feature @@ -0,0 +1,203 @@ +@ProcessMakerMichelangelo @RestAPI +Feature: Process supervisor Resources + + #GET /api/1.0/{workspace}/project/{prj_uid}/process-supervisors + Scenario: Get a List of process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/process-supervisors" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + #GET /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/{pu_uid} + Scenario: Get a specific process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/process-supervisor/70662784652cef0878516f7085532841" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + + #GET /api/1.0/{workspace}/project/{prj_uid}/available-process-supervisors + Scenario: Get a List of available process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/available-process-supervisors" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + #GET /api/1.0/{workspace}/project/{prj_uid}/available-process-supervisors + Scenario: Get a List of available groups process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/available-process-supervisors?obj_type=group" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + #GET /api/1.0/{workspace}/project/{prj_uid}/available-process-supervisors + Scenario: Get a List of available users process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/available-process-supervisors?obj_type=user" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + #GET /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/dynaforms + Scenario: Get a List of dynaforms process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/process-supervisor/dynaforms" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + #GET /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/dynaform/{pu_uid} + Scenario: Get a specific process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/process-supervisor/dynaform/78069721352ceef1fd61878075214306" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + + #GET /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/available-dynaforms + Scenario: Get a List of available dynaforms process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/process-supervisor/available-dynaforms" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + #GET /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/input-documents + Scenario: Get a List of input-documents process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/process-supervisor/input-documents" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + #GET /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/available-input-documents + Scenario: Get a List of input-documents process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/process-supervisor/available-input-documents" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + + #GET /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/input-document/{pu_uid} + Scenario: Get a specific process supervisor of a project + Given that I have a valid access_token + And I request "project/85794888452ceeef3675164057928956/process-supervisor/input-document/37709187452ceef4f601dd3045365506" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + + #POST /api/1.0/{workspace}/project/{prj_uid}/process-supervisor + Scenario: Assign a group process supervisor of a project + Given that I have a valid access_token + And POST this data: + """ + { + "pu_type": "GROUP_SUPERVISOR", + "usr_uid": "46138556052cda43a051110007756836" + } + """ + And I request "project/85794888452ceeef3675164057928956/process-supervisor" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "pu_uid" in session array as variable "pug_uid" + + #POST /api/1.0/{workspace}/project/{prj_uid}/process-supervisor + Scenario: Assign a user process supervisor of a project + Given that I have a valid access_token + And POST this data: + """ + { + "pu_type": "SUPERVISOR", + "usr_uid": "00000000000000000000000000000001" + } + """ + And I request "project/85794888452ceeef3675164057928956/process-supervisor" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "pu_uid" in session array as variable "puu_uid" + + #POST /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/dynaform + Scenario: Assign a dynaform process supervisor of a project + Given that I have a valid access_token + And POST this data: + """ + { + "dyn_uid": "78212661352ceef2dc4e987081647602" + } + """ + And I request "project/85794888452ceeef3675164057928956/process-supervisor/dynaform" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "pud_uid" in session array as variable "pud_uid" + + #POST /api/1.0/{workspace}/project/{prj_uid}/process-supervisor/input-document + Scenario: Assign a dynaform process supervisor of a project + Given that I have a valid access_token + And POST this data: + """ + { + "inp_doc_uid": "25205290452ceef570741c3067266323" + } + """ + And I request "project/85794888452ceeef3675164057928956/process-supervisor/input-document" + Then the response status code should be 201 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And store "pui_uid" in session array as variable "pui_uid" + + #DELETE /api/1.0/{workspace}/project/{prj_uid}/process-supervisor + Scenario: Delete a user process supervisor of a project + Given that I have a valid access_token + And that I want to delete a resource with the key "pug_uid" stored in session array + And I request "project/85794888452ceeef3675164057928956/process-supervisor" + 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}/process-supervisor + Scenario: Delete a user process supervisor of a project + Given that I have a valid access_token + And that I want to delete a resource with the key "puu_uid" stored in session array + And I request "project/85794888452ceeef3675164057928956/process-supervisor" + 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}/process-supervisor/dynaform + Scenario: Delete a dynaform process supervisor of a project + Given that I have a valid access_token + And that I want to delete a resource with the key "pud_uid" stored in session array + And I request "project/85794888452ceeef3675164057928956/process-supervisor/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}/process-supervisor/input-document + Scenario: Delete a input-document process supervisor of a project + Given that I have a valid access_token + And that I want to delete a resource with the key "pui_uid" stored in session array + And I request "project/85794888452ceeef3675164057928956/process-supervisor/input-document" + And the content type is "application/json" + Then the response status code should be 200 + And the response charset is "UTF-8" \ No newline at end of file From 10325058723fead31a630f0faba1e2e7cabf7c93 Mon Sep 17 00:00:00 2001 From: Wendy Nestor Date: Thu, 9 Jan 2014 16:23:28 -0400 Subject: [PATCH 12/12] Automatizacion Assignee Ad-hoc y Assignee --- .../activity_adhoc_assignee.feature | 131 +++++++++++++++-- .../activity_assignee.feature | 133 ++++++++++++++++-- .../project_resources/projects.feature | 13 -- 3 files changed, 235 insertions(+), 42 deletions(-) delete mode 100644 features/backend/project_resources/projects.feature diff --git a/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature b/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature index 26ec23bd0..cda44c1dd 100644 --- a/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature +++ b/features/backend/project_properties_adhoc_assignee_resources/activity_adhoc_assignee.feature @@ -1,21 +1,122 @@ @ProcessMakerMichelangelo @RestAPI -Feature: Project Properties - Ad hoc Assignee Resources +Feature: Project Properties - Assignee Resources Background: Given that I have a valid access_token - Scenario: List AdHoc assignees of an activity - Given this scenario is not implemented yet - - Scenario: Get a list of available AdHoc users and groups to be assigned to an activity - Given this scenario is not implemented yet - - Scenario: Get a single AdHoc user or group of an activity - Given this scenario is not implemented yet - - Scenario: Assign an AdHoc user or group to an activity - Given this scenario is not implemented yet - - Scenario: Remove an AdHoc assignee from an activity - Given this scenario is not implemented yet + Scenario: Get a list of available users and groups to be assigned to an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-available-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 79 records + And the "aas_uid" property in row 0 equals "35762872152cda4323207c6035916735" + And the "aas_type" property in row 0 equals "group" +Scenario: Get a list of available users and groups to be assigned to an activity with filter + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-available-assignee?filter=departa&start=0&limit=50" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 3 records + And the "aas_uid" property in row 0 equals "90268877852b7b4b9f134b1096735994" + And the "aas_type" property in row 0 equals "group" + + Scenario: Assign a user or group to an activity + Given POST this data: +""" +{ + "ass_uid": "84643774552cda42dabb732033709262", + "ass_type": "user" +} +""" + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" + Then the response status code should be 201 + And the type is "object" + + Scenario: Assign a user or group to an activity + Given POST this data: +""" +{ + "ass_uid": "95888918452cda41a2b5d11013819411", + "ass_type": "user" +} +""" + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" + Then the response status code should be 201 + And the type is "object" + + Scenario: Assign a user or group to an activity + Given POST this data: +""" +{ + "ass_uid": "16698718252cda431814024050455569", + "ass_type": "group" +} +""" + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" + Then the response status code should be 201 + And the type is "object" + + Scenario: Assign a user or group to an activity + Given POST this data: +""" +{ + "ass_uid": "90706007452cda42ed1c326093152317", + "ass_type": "group" +} +""" + And I request "project/4224292655297723eb98691001100052/activity/68911670852a22d93c22c06005808422/adhoc-assignee" + Then the response status code should be 201 + And the type is "object" + + Scenario: List assignees of an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 7 records + And the "aas_uid" property in row 0 equals "10732248352cda434c43997043577116" + And the "aas_type" property in row 0 equals "group" + + Scenario: List assignees of an activity with filter + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee?filter=emi" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 1 record + And the "aas_uid" property in row 0 equals "84643774552cda42dabb732033709262" + And the "aas_type" property in row 0 equals "user" + + Scenario: Get a single user or group of an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee/95888918452cda41a2b5d11013819411" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And the "aas_uid" property equals "95888918452cda41a2b5d11013819411" + And the "aas_name" property equals "Mike" + And the "aas_lastname" property equals "Balisi" + And the "aas_username" property equals "mike" + And the "aas_type" property equals "user" + + Scenario: Remove assignee from an activity + Given that I want to delete a resource with the key "aas_uid" stored in session array + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee/91968412052cda4097270a3085279286" + Then the response status code should be 200 + + Scenario: List assignees of an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 6 records + + Scenario: List assignees of an activity + Given I request "project/4224292655297723eb98691001100052/activity/12345/adhoc-assignee" + Then the response status code should be 400 diff --git a/features/backend/project_property_assignee_resources/activity_assignee.feature b/features/backend/project_property_assignee_resources/activity_assignee.feature index 767728660..ff357de5c 100644 --- a/features/backend/project_property_assignee_resources/activity_assignee.feature +++ b/features/backend/project_property_assignee_resources/activity_assignee.feature @@ -4,18 +4,123 @@ Feature: Project Properties - Assignee Resources Background: Given that I have a valid access_token - Scenario: List assignees of an activity - Given this scenario is not implemented yet - - Scenario: Get a list of available users and groups to be assigned to an activity - Given this scenario is not implemented yet - - Scenario: Get a single user or group of an activity - Given this scenario is not implemented yet - - Scenario: Assign a user or group to an activity - Given this scenario is not implemented yet - - Scenario: Remove assignee from an activity - Given this scenario is not implemented yet + Scenario: Get a list of available users and groups to be assigned to an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/available-assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 79 records + And the "aas_uid" property in row 0 equals "35762872152cda4323207c6035916735" + And the "aas_type" property in row 0 equals "group" + +Scenario: Get a list of available users and groups to be assigned to an activity with filter + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/available-assignee?filter=departa&start=0&limit=50" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 3 records + And the "aas_uid" property in row 0 equals "90268877852b7b4b9f134b1096735994" + And the "aas_type" property in row 0 equals "group" + + Scenario: Assign a user or group to an activity + Given POST this data: +""" +{ + "ass_uid": "66386662252cda3f9a63226052377198", + "ass_type": "user" +} +""" + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" + Then the response status code should be 201 + And the type is "object" + + Scenario: Assign a user or group to an activity + Given POST this data: +""" +{ + "ass_uid": "69191356252cda41acde328048794164", + "ass_type": "user" +} +""" + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" + Then the response status code should be 201 + And the type is "object" + + Scenario: Assign a user or group to an activity + Given POST this data: +""" +{ + "ass_uid": "35762872152cda4323207c6035916735", + "ass_type": "group" +} +""" + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" + Then the response status code should be 201 + And the type is "object" + + Scenario: Assign a user or group to an activity + Given POST this data: +""" +{ + "ass_uid": "90706007452cda42ed1c326093152317", + "ass_type": "group" +} +""" + And I request "project/4224292655297723eb98691001100052/activity/68911670852a22d93c22c06005808422/assignee" + Then the response status code should be 201 + And the type is "object" + + Scenario: List assignees of an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 7 records + And the "aas_uid" property in row 0 equals "35762872152cda4323207c6035916735" + And the "aas_type" property in row 0 equals "group" + +Scenario: List assignees of an activity with filter + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee?filter=oli" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 1 record + And the "aas_uid" property in row 0 equals "69191356252cda41acde328048794164" + And the "aas_type" property in row 0 equals "user" + + Scenario: Get a single user or group of an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee/69191356252cda41acde328048794164" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "object" + And the "aas_uid" property equals "69191356252cda41acde328048794164" + And the "aas_name" property equals "Olivia" + And the "aas_lastname" property equals "Austin" + And the "aas_username" property equals "olivia" + And the "aas_type" property equals "user" + + Scenario: Remove assignee from an activity + Given that I want to delete a resource with the key "aas_uid" stored in session array + And I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee/69191356252cda41acde328048794164" + Then the response status code should be 200 + + Scenario: List assignees of an activity + Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee" + Then the response status code should be 200 + And the response charset is "UTF-8" + And the content type is "application/json" + And the type is "array" + And the response has 6 records + + Scenario: List assignees of an activity + Given I request "project/4224292655297723eb98691001100052/activity/12345/assignee" + Then the response status code should be 400 + + + diff --git a/features/backend/project_resources/projects.feature b/features/backend/project_resources/projects.feature deleted file mode 100644 index 7b57a1141..000000000 --- a/features/backend/project_resources/projects.feature +++ /dev/null @@ -1,13 +0,0 @@ -@ProcessMakerMichelangelo @RestAPI -Feature: Projects End Point. -Lists available projects/processes for an specific workspace - - Scenario: Get a list of projects - Given that I have a valid access_token - And I request "projects" - Then the response status code should be 200 - And the response charset is "UTF-8" - And the content type is "application/json" - And the type is "array" - -