ProcessMaker-MA "Step & Group (Fixes)"

- Se han mejorado y corregido el nombre de las variables, esto
  segun lo establecido en http://docs.processmaker.apiary.io/
This commit is contained in:
Victor Saisa Lopez
2014-01-31 14:56:47 -04:00
parent 24a6b8767a
commit 4fe96c635c
5 changed files with 619 additions and 341 deletions

View File

@@ -4,7 +4,11 @@ namespace BusinessModel;
class Group
{
private $formatFieldNameInUppercase = true;
private $arrayMsgExceptionParam = array();
private $arrayParamException = array(
"groupUid" => "GRP_UID",
"groupTitle" => "GRP_TITLE",
"groupStatus" => "GRP_STATUS"
);
/**
* Set the format of the fields name (uppercase, lowercase)
@@ -17,6 +21,8 @@ class Group
{
try {
$this->formatFieldNameInUppercase = $flag;
$this->setArrayParamException($this->arrayParamException);
} catch (\Exception $e) {
throw $e;
}
@@ -29,10 +35,12 @@ class Group
*
* return void
*/
public function setArrayMsgExceptionParam($arrayData)
public function setArrayParamException($arrayData)
{
try {
$this->arrayMsgExceptionParam = $arrayData;
foreach ($arrayData as $key => $value) {
$this->arrayParamException[$key] = $this->getFieldNameByFormatFieldName($value);
}
} catch (\Exception $e) {
throw $e;
}
@@ -108,7 +116,7 @@ class Group
public function throwExceptionIfHaveInvalidValueInStatus($groupStatus)
{
if (!in_array($groupStatus, array("ACTIVE", "INACTIVE"))) {
$field = $this->getFieldNameByFormatFieldName("GRP_STATUS");
$field = $this->arrayParamException["groupStatus"];
throw (new \Exception(str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"")));
}
@@ -126,7 +134,7 @@ class Group
$group = new \Groupwf();
if (!$group->GroupwfExists($groupUid)) {
$field = $this->getFieldNameByFormatFieldName("GRP_UID");
$field = $this->arrayParamException["groupUid"];
$msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / ";
$msg = $msg . str_replace(array("{0}", "{1}"), array($groupUid, "GROUPWF"), "The UID \"{0}\" doesn't exist in table {1}");
@@ -146,7 +154,7 @@ class Group
public function throwExceptionIfExistsTitle($groupTitle, $groupUidExclude = "")
{
if ($this->existsTitle($groupTitle, $groupUidExclude)) {
$field = $this->getFieldNameByFormatFieldName("GRP_TITLE");
$field = $this->arrayParamException["groupTitle"];
$msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / ";
$msg = $msg . \G::LoadTranslation("ID_MSG_GROUP_NAME_EXISTS");
@@ -171,23 +179,23 @@ class Group
//Verify data
if (!isset($arrayData["GRP_TITLE"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_TITLE")), "The \"{0}\" attribute is not defined")));
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["groupTitle"]), "The \"{0}\" attribute is not defined")));
}
$arrayData["GRP_TITLE"] = trim($arrayData["GRP_TITLE"]);
if ($arrayData["GRP_TITLE"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_TITLE")), "The \"{0}\" attribute is empty")));
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["groupTitle"]), "The \"{0}\" attribute is empty")));
}
if (!isset($arrayData["GRP_STATUS"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_STATUS")), "The \"{0}\" attribute is not defined")));
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["groupStatus"]), "The \"{0}\" attribute is not defined")));
}
$arrayData["GRP_STATUS"] = trim($arrayData["GRP_STATUS"]);
if ($arrayData["GRP_STATUS"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_STATUS")), "The \"{0}\" attribute is empty")));
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["groupStatus"]), "The \"{0}\" attribute is empty")));
}
$this->throwExceptionIfHaveInvalidValueInStatus($arrayData["GRP_STATUS"]);
@@ -232,7 +240,7 @@ class Group
$arrayData["GRP_TITLE"] = trim($arrayData["GRP_TITLE"]);
if ($arrayData["GRP_TITLE"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_TITLE")), "The \"{0}\" attribute is empty")));
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["groupTitle"]), "The \"{0}\" attribute is empty")));
}
}
@@ -240,7 +248,7 @@ class Group
$arrayData["GRP_STATUS"] = trim($arrayData["GRP_STATUS"]);
if ($arrayData["GRP_STATUS"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_STATUS")), "The \"{0}\" attribute is empty")));
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["groupStatus"]), "The \"{0}\" attribute is empty")));
}
}

View File

@@ -3,6 +3,70 @@ namespace BusinessModel;
class Step
{
private $formatFieldNameInUppercase = true;
private $arrayParamException = array(
"stepUid" => "STEP_UID",
"taskUid" => "TAS_UID",
"processUid" => "PRO_UID",
"stepTypeObj" => "STEP_TYPE_OBJ",
"stepUidObj" => "STEP_UID_OBJ",
"stepCondition" => "STEP_CONDITION",
"stepPosition" => "STEP_POSITION",
"stepMode" => "STEP_MODE"
);
/**
* Set the format of the fields name (uppercase, lowercase)
*
* @param bool $flag Value that set the format
*
* return void
*/
public function setFormatFieldNameInUppercase($flag)
{
try {
$this->formatFieldNameInUppercase = $flag;
$this->setArrayParamException($this->arrayParamException);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Set exception messages for parameters
*
* @param array $arrayData Data with the params
*
* return void
*/
public function setArrayParamException($arrayData)
{
try {
foreach ($arrayData as $key => $value) {
$this->arrayParamException[$key] = $this->getFieldNameByFormatFieldName($value);
}
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get the name of the field according to the format
*
* @param string $fieldName Field name
*
* return string Return the field name according the format
*/
public function getFieldNameByFormatFieldName($fieldName)
{
try {
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Verify if exists the record in table STEP
*
@@ -97,45 +161,168 @@ class Step
}
}
/**
* Verify if Type Object has invalid value
*
* @param string $stepTypeObj Type Object
*
* return void Throw exception if Type Object has invalid value
*/
public function throwExceptionIfHaveInvalidValueInTypeObj($stepTypeObj)
{
if (!in_array($stepTypeObj, array("DYNAFORM", "INPUT_DOCUMENT", "OUTPUT_DOCUMENT"))) {
$field = $this->arrayParamException["stepTypeObj"];
throw (new \Exception(str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"")));
}
}
/**
* Verify if Mode has invalid value
*
* @param string $stepMode Mode
*
* return void Throw exception if Mode has invalid value
*/
public function throwExceptionIfHaveInvalidValueInMode($stepMode)
{
if (!in_array($stepMode, array("EDIT", "VIEW"))) {
$field = $this->arrayParamException["stepMode"];
throw (new \Exception(str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"")));
}
}
/**
* Verify if doesn't exist the Step in table STEP
*
* @param string $stepUid Unique id of Step
*
* return void Throw exception if doesn't exist the Step in table STEP
*/
public function throwExceptionIfNoExistsStep($stepUid)
{
$step = new \Step();
if (!$step->StepExists($stepUid)) {
$field = $this->arrayParamException["stepUid"];
$msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / ";
$msg = $msg . str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}");
throw (new \Exception($msg));
}
}
/**
* Verify if doesn't exist the Task in table TASK
*
* @param string $taskUid Unique id of Task
*
* return void Throw exception if doesn't exist the Task in table TASK
*/
public function throwExceptionIfNoExistsTask($taskUid)
{
$task = new \Task();
if (!$task->taskExists($taskUid)) {
$field = $this->arrayParamException["taskUid"];
$msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / ";
$msg = $msg . str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}");
throw (new \Exception($msg));
}
}
/**
* Verify if doesn't exist the Process in table PROCESS
*
* @param string $processUid Unique id of Process
*
* return void Throw exception if doesn't exist the Process in table PROCESS
*/
public function throwExceptionIfNoExistsProcess($processUid)
{
$process = new \Process();
if (!$process->exists($processUid)) {
$field = $this->arrayParamException["processUid"];
$msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / ";
$msg = $msg . str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}");
throw (new \Exception($msg));
}
}
/**
* Create Step for a Task
*
* @param string $taskUid
* @param string $processUid
* @param array $arrayData
* @param string $taskUid Unique id of Task
* @param string $processUid Unique id of Process
* @param array $arrayData Data
*
* return array Data of the Step created
* return array Return data of the new Step created
*/
public function create($taskUid, $processUid, $arrayData)
{
try {
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
unset($arrayData["STEP_UID"]);
//Verify data
$process = new \Process();
$this->throwExceptionIfNoExistsTask($taskUid);
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
$this->throwExceptionIfNoExistsProcess($processUid);
if (!isset($arrayData["STEP_TYPE_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is not defined")));
}
$task = new \Task();
$arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]);
if (!$task->taskExists($taskUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}")));
if ($arrayData["STEP_TYPE_OBJ"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is empty")));
}
if (isset($arrayData["step_type_obj"]) && isset($arrayData["step_uid_obj"])) {
$msg = $this->existsObjectUid($arrayData["step_type_obj"], $arrayData["step_uid_obj"]);
if ($msg != "") {
throw (new \Exception($msg));
}
if ($this->existsRecord($taskUid, $arrayData["step_type_obj"], $arrayData["step_uid_obj"])) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid . ", " . $arrayData["step_type_obj"] . ", " . $arrayData["step_uid_obj"], "STEP"), "The record \"{0}\", exists in table {1}")));
}
if (!isset($arrayData["STEP_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "The \"{0}\" attribute is not defined")));
}
if (isset($arrayData["step_position"]) && $this->existsRecord($taskUid, "", "", $arrayData["step_position"])) {
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["step_position"], $taskUid . ", " . $arrayData["step_position"], "STEP"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
$arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]);
if ($arrayData["STEP_UID_OBJ"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "The \"{0}\" attribute is empty")));
}
if (!isset($arrayData["STEP_MODE"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "The \"{0}\" attribute is not defined")));
}
$arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]);
if ($arrayData["STEP_MODE"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "The \"{0}\" attribute is empty")));
}
$this->throwExceptionIfHaveInvalidValueInTypeObj($arrayData["STEP_TYPE_OBJ"]);
$this->throwExceptionIfHaveInvalidValueInMode($arrayData["STEP_MODE"]);
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"]);
if ($msg != "") {
throw (new \Exception($msg));
}
if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP"), "The record \"{0}\", exists in table {1}")));
}
if (isset($arrayData["STEP_POSITION"]) && $this->existsRecord($taskUid, "", "", $arrayData["STEP_POSITION"])) {
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["STEP_POSITION"], $taskUid . ", " . $arrayData["STEP_POSITION"], "STEP"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
}
//Create
@@ -143,16 +330,22 @@ class Step
$stepUid = $step->create(array("PRO_UID" => $processUid, "TAS_UID" => $taskUid));
if (!isset($arrayData["step_position"]) || $arrayData["step_position"] == "") {
$arrayData["step_position"] = $step->getNextPosition($taskUid) - 1;
if (!isset($arrayData["STEP_POSITION"]) || $arrayData["STEP_POSITION"] == "") {
$arrayData["STEP_POSITION"] = $step->getNextPosition($taskUid) - 1;
}
$arrayData = $this->update($stepUid, $arrayData);
//Return
unset($arrayData["step_uid"]);
unset($arrayData["STEP_UID"]);
return array_merge(array("step_uid" => $stepUid), $arrayData);
$arrayData = array_merge(array("STEP_UID" => $stepUid), $arrayData);
if (!$this->formatFieldNameInUppercase) {
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
}
return $arrayData;
} catch (\Exception $e) {
throw $e;
}
@@ -161,71 +354,98 @@ class Step
/**
* Update Step of a Task
*
* @param string $stepUid
* @param array $arrayData
* @param string $stepUid Unique id of Step
* @param array $arrayData Data
*
* return array Data of the Step updated
* return array Return data of the Step updated
*/
public function update($stepUid, $arrayData)
{
try {
$arrayDataUid = $this->getDataUids($stepUid);
$taskUid = $arrayDataUid["TAS_UID"];
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
//Verify data
$this->throwExceptionIfNoExistsStep($stepUid);
//Load Step
$step = new \Step();
if (!$step->StepExists($stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
$arrayStepData = $step->load($stepUid);
$taskUid = $arrayStepData["TAS_UID"];
//Verify data
if (isset($arrayData["STEP_TYPE_OBJ"]) && !isset($arrayData["STEP_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "The \"{0}\" attribute is not defined")));
}
if (isset($arrayData["step_type_obj"]) && isset($arrayData["step_uid_obj"])) {
$msg = $this->existsObjectUid($arrayData["step_type_obj"], $arrayData["step_uid_obj"]);
if (!isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is not defined")));
}
if (isset($arrayData["STEP_TYPE_OBJ"])) {
$arrayData["STEP_TYPE_OBJ"] = trim($arrayData["STEP_TYPE_OBJ"]);
if ($arrayData["STEP_TYPE_OBJ"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepTypeObj"]), "The \"{0}\" attribute is empty")));
}
}
if (isset($arrayData["STEP_UID_OBJ"])) {
$arrayData["STEP_UID_OBJ"] = trim($arrayData["STEP_UID_OBJ"]);
if ($arrayData["STEP_UID_OBJ"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepUidObj"]), "The \"{0}\" attribute is empty")));
}
}
if (isset($arrayData["STEP_MODE"])) {
$arrayData["STEP_MODE"] = trim($arrayData["STEP_MODE"]);
if ($arrayData["STEP_MODE"] == "") {
throw (new \Exception(str_replace(array("{0}"), array($this->arrayParamException["stepMode"]), "The \"{0}\" attribute is empty")));
}
}
if (isset($arrayData["STEP_TYPE_OBJ"])) {
$this->throwExceptionIfHaveInvalidValueInTypeObj($arrayData["STEP_TYPE_OBJ"]);
}
if (isset($arrayData["STEP_MODE"])) {
$this->throwExceptionIfHaveInvalidValueInMode($arrayData["STEP_MODE"]);
}
if (isset($arrayData["STEP_TYPE_OBJ"]) && isset($arrayData["STEP_UID_OBJ"])) {
$msg = $this->existsObjectUid($arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"]);
if ($msg != "") {
throw (new \Exception($msg));
}
if ($this->existsRecord($taskUid, $arrayData["step_type_obj"], $arrayData["step_uid_obj"], 0, $stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid . ", " . $arrayData["step_type_obj"] . ", " . $arrayData["step_uid_obj"], "STEP"), "The record \"{0}\", exists in table {1}")));
if ($this->existsRecord($taskUid, $arrayData["STEP_TYPE_OBJ"], $arrayData["STEP_UID_OBJ"], 0, $stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid . ", " . $arrayData["STEP_TYPE_OBJ"] . ", " . $arrayData["STEP_UID_OBJ"], "STEP"), "The record \"{0}\", exists in table {1}")));
}
}
if (isset($arrayData["step_position"]) && $this->existsRecord($taskUid, "", "", $arrayData["step_position"], $stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["step_position"], $taskUid . ", " . $arrayData["step_position"], "STEP"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
if (isset($arrayData["STEP_POSITION"]) && $this->existsRecord($taskUid, "", "", $arrayData["STEP_POSITION"], $stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}", "{2}"), array($arrayData["STEP_POSITION"], $taskUid . ", " . $arrayData["STEP_POSITION"], "STEP"), "The \"{0}\" position for the record \"{1}\", exists in table {2}")));
}
//Update
$step = new \Step();
$arrayUpdateData = array();
$arrayData["STEP_UID"] = $stepUid;
$arrayUpdateData["STEP_UID"] = $stepUid;
$result = $step->update($arrayData);
if (isset($arrayData["step_type_obj"]) && $arrayData["step_type_obj"] != "") {
$arrayUpdateData["STEP_TYPE_OBJ"] = $arrayData["step_type_obj"];
//Return
unset($arrayData["STEP_UID"]);
if (!$this->formatFieldNameInUppercase) {
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
}
if (isset($arrayData["step_uid_obj"]) && $arrayData["step_uid_obj"] != "") {
$arrayUpdateData["STEP_UID_OBJ"] = $arrayData["step_uid_obj"];
}
if (isset($arrayData["step_condition"])) {
$arrayUpdateData["STEP_CONDITION"] = $arrayData["step_condition"];
}
if (isset($arrayData["step_position"]) && $arrayData["step_position"] != "") {
$arrayUpdateData["STEP_POSITION"] = (int)($arrayData["step_position"]);
}
if (isset($arrayData["step_mode"]) && $arrayData["step_mode"] != "") {
$arrayUpdateData["STEP_MODE"] = $arrayData["step_mode"];
}
$step->update($arrayUpdateData);
return array_change_key_case($arrayUpdateData, CASE_LOWER);
return $arrayData;
} catch (\Exception $e) {
throw $e;
}
@@ -234,7 +454,7 @@ class Step
/**
* Delete Step of a Task
*
* @param string $stepUid
* @param string $stepUid Unique id of Step
*
* return void
*/
@@ -242,11 +462,7 @@ class Step
{
try {
//Verify data
$step = new \Step();
if (!$step->StepExists($stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
}
$this->throwExceptionIfNoExistsStep($stepUid);
//Get position
$criteria = new \Criteria("workflow");
@@ -277,13 +493,17 @@ class Step
*
* @param string $stepUid Unique id of Step
*
* return array
* return array Return an array with data of a Step
*/
public function getStep($stepUid)
{
try {
$arrayStep = array();
//Verify data
$this->throwExceptionIfNoExistsStep($stepUid);
//Get data
//Call plugin
$pluginRegistry = &\PMPluginRegistry::getSingleton();
$externalSteps = $pluginRegistry->getSteps();
@@ -345,15 +565,16 @@ class Step
break;
}
//Return
$arrayStep = array(
"step_uid" => $stepUid,
"step_type_obj" => $row["STEP_TYPE_OBJ"],
"step_uid_obj" => $row["STEP_UID_OBJ"],
"step_condition" => $row["STEP_CONDITION"],
"step_position" => (int)($row["STEP_POSITION"]),
"step_mode" => $row["STEP_MODE"],
"obj_title" => $titleObj,
"obj_description" => $descriptionObj
$this->getFieldNameByFormatFieldName("STEP_UID") => $stepUid,
$this->getFieldNameByFormatFieldName("STEP_TYPE_OBJ") => $row["STEP_TYPE_OBJ"],
$this->getFieldNameByFormatFieldName("STEP_UID_OBJ") => $row["STEP_UID_OBJ"],
$this->getFieldNameByFormatFieldName("STEP_CONDITION") => $row["STEP_CONDITION"],
$this->getFieldNameByFormatFieldName("STEP_POSITION") => (int)($row["STEP_POSITION"]),
$this->getFieldNameByFormatFieldName("STEP_MODE") => $row["STEP_MODE"],
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => $titleObj,
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $descriptionObj
);
return $arrayStep;
@@ -363,75 +584,49 @@ class Step
}
/**
* Get data of unique ids of a Step (Unique id of Task and Process)
*
* @param string $stepUid Unique id of Step
*
* return array
*/
public function getDataUids($stepUid)
{
try {
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\StepPeer::PRO_UID);
$criteria->addSelectColumn(\StepPeer::TAS_UID);
$criteria->add(\StepPeer::STEP_UID, $stepUid, \Criteria::EQUAL);
$rsCriteria = \StepPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
return $rsCriteria->getRow();
} else {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
}
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get available triggers of a Step
* Get available Triggers of a Step
*
* @param string $stepUid Unique id of Step
* @param string $type Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
* @param string $taskUid Unique id of Task
*
* return array
* return array Return an array with the Triggers available of a Step
*/
public function getAvailableTriggers($stepUid, $type, $taskUid = "")
{
try {
//Verify data
$step = new \Step();
$arrayAvailableTrigger = array();
if ($stepUid != "" && !$step->StepExists($stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
//Verify data
if ($stepUid != "") {
$this->throwExceptionIfNoExistsStep($stepUid);
}
$task = new \Task();
if ($stepUid == "" && !$task->taskExists($taskUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}")));
if ($stepUid == "") {
$this->throwExceptionIfNoExistsTask($taskUid);
}
//Get data
$arrayAvailableTrigger = array();
$trigger = new \BusinessModel\Trigger();
$flagStepAssignTask = 0;
if ($stepUid != "") {
$arrayDataUid = $this->getDataUids($stepUid);
//Load Step
$step = new \Step();
$processUid = $arrayDataUid["PRO_UID"];
$arrayStepData = $step->load($stepUid);
$processUid = $arrayStepData["PRO_UID"];
} else {
$arrayData = $task->load($taskUid);
//Load Task
$task = new \Task();
$processUid = $arrayData["PRO_UID"];
$arrayTaskData = $task->load($taskUid);
$processUid = $arrayTaskData["PRO_UID"];
//Set variables
$flagStepAssignTask = 1;
switch ($type) {
@@ -450,6 +645,7 @@ class Step
}
}
//Get data
//Get Uids
$arrayUid = array();
@@ -487,15 +683,16 @@ class Step
$row = $rsCriteria->getRow();
$arrayAvailableTrigger[] = 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"]
$this->getFieldNameByFormatFieldName("TRI_UID") => $row["TRI_UID"],
$this->getFieldNameByFormatFieldName("TRI_TITLE") => $row["TRI_TITLE"],
$this->getFieldNameByFormatFieldName("TRI_DESCRIPTION") => $row["TRI_DESCRIPTION"],
$this->getFieldNameByFormatFieldName("TRI_TYPE") => $row["TRI_TYPE"],
$this->getFieldNameByFormatFieldName("TRI_WEBBOT") => $row["TRI_WEBBOT"],
$this->getFieldNameByFormatFieldName("TRI_PARAM") => $row["TRI_PARAM"]
);
}
//Return
return $arrayAvailableTrigger;
} catch (\Exception $e) {
throw $e;
@@ -503,44 +700,42 @@ class Step
}
/**
* Get all triggers of a Step
* Get all Triggers of a Step
*
* @param string $stepUid Unique id of Step
* @param string $taskUid Unique id of Task
*
* return array
* return array Return an array with all Triggers of a Step
*/
public function getTriggers($stepUid, $taskUid = "")
{
try {
//Verify data
$step = new \Step();
$arrayTrigger = array();
if ($stepUid != "" && !$step->StepExists($stepUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($stepUid, "STEP"), "The UID \"{0}\" doesn't exist in table {1}")));
//Verify data
if ($stepUid != "") {
$this->throwExceptionIfNoExistsStep($stepUid);
}
$task = new \Task();
if ($stepUid == "" && !$task->taskExists($taskUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}")));
if ($stepUid == "") {
$this->throwExceptionIfNoExistsTask($taskUid);
}
//Get data
$arrayTrigger = array();
$bmTrigger = new \BusinessModel\Trigger();
$bmStepTrigger = new \BusinessModel\Step\Trigger();
if ($stepUid != "") {
$arrayDataUid = $this->getDataUids($stepUid);
$taskUid = $arrayDataUid["TAS_UID"];
}
$processMap = new \ProcessMap();
$stepTrigger = new \StepTrigger();
if ($stepUid != "") {
//Load Step
$step = new \Step();
$arrayStepData = $step->load($stepUid);
$taskUid = $arrayStepData["TAS_UID"];
}
$arrayTriggerType1 = array(
"BEFORE" => "BEFORE",
"AFTER" => "AFTER"

View File

@@ -5,6 +5,84 @@ use \G;
class Task
{
private $formatFieldNameInUppercase = true;
private $arrayParamException = array(
"taskUid" => "TAS_UID"
);
/**
* Set the format of the fields name (uppercase, lowercase)
*
* @param bool $flag Value that set the format
*
* return void
*/
public function setFormatFieldNameInUppercase($flag)
{
try {
$this->formatFieldNameInUppercase = $flag;
$this->setArrayParamException($this->arrayParamException);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Set exception messages for parameters
*
* @param array $arrayData Data with the params
*
* return void
*/
public function setArrayParamException($arrayData)
{
try {
foreach ($arrayData as $key => $value) {
$this->arrayParamException[$key] = $this->getFieldNameByFormatFieldName($value);
}
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get the name of the field according to the format
*
* @param string $fieldName Field name
*
* return string Return the field name according the format
*/
public function getFieldNameByFormatFieldName($fieldName)
{
try {
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Verify if doesn't exist the Task in table TASK
*
* @param string $taskUid Unique id of Task
*
* return void Throw exception if doesn't exist the Task in table TASK
*/
public function throwExceptionIfNoExistsTask($taskUid)
{
$task = new \Task();
if (!$task->taskExists($taskUid)) {
$field = $this->arrayParamException["taskUid"];
$msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / ";
$msg = $msg . str_replace(array("{0}", "{1}"), array($taskUid, "TASK"), "The UID \"{0}\" doesn't exist in table {1}");
throw (new \Exception($msg));
}
}
/**
* Get all properties of an Task
*
@@ -248,52 +326,33 @@ class Task
}
/**
* Get data of unique ids of a Task (Unique id of Process)
* Get available Steps of a Task
*
* @param string $taskUid Unique id of Task
*
* return array
*/
public function getDataUids($taskUid)
{
try {
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\TaskPeer::PRO_UID);
$criteria->add(\TaskPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
$rsCriteria = \TaskPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
return $rsCriteria->getRow();
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get available steps of a Task
*
* @param string $taskUid Unique id of Task
*
* return array
* return array Return an array with the Steps available of a Task
*/
public function getAvailableSteps($taskUid)
{
try {
$arrayAvailableStep = array();
$arrayDataUid = $this->getDataUids($taskUid);
//Verify data
$this->throwExceptionIfNoExistsTask($taskUid);
$processUid = $arrayDataUid["PRO_UID"];
//Load Task
$task = new \Task();
$arrayTaskData = $task->load($taskUid);
$processUid = $arrayTaskData["PRO_UID"];
//Get data
//Get Uids
$arrayUid = array();
$tasks = new \Tasks();
$arrayStep = $tasks->getStepsOfTask($taskUid);
$task = new \Tasks();
$arrayStep = $task->getStepsOfTask($taskUid);
foreach ($arrayStep as $step) {
$arrayUid[] = $step["STEP_UID_OBJ"];
@@ -303,10 +362,10 @@ class Task
$arraydbStep = array();
$arraydbStep[] = array(
"obj_uid" => "char",
"obj_title" => "char",
"obj_description" => "char",
"obj_type" => "char"
$this->getFieldNameByFormatFieldName("OBJ_UID") => "char",
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => "char",
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => "char",
$this->getFieldNameByFormatFieldName("OBJ_TYPE") => "char"
);
$delimiter = \DBAdapter::getStringDelimiter();
@@ -318,8 +377,8 @@ class Task
$criteria->addAsColumn("DYN_TITLE", "CT.CON_VALUE");
$criteria->addAsColumn("DYN_DESCRIPTION", "CD.CON_VALUE");
$criteria->addAlias("CT", "CONTENT");
$criteria->addAlias("CD", "CONTENT");
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
$criteria->addAlias("CD", \ContentPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\DynaformPeer::DYN_UID, "CT.CON_ID", \Criteria::EQUAL);
@@ -349,10 +408,10 @@ class Task
}
$arraydbStep[] = array(
"obj_uid" => $row["DYN_UID"],
"obj_title" => $row["DYN_TITLE"],
"obj_description" => $row["DYN_DESCRIPTION"],
"obj_type" => "DYNAFORM"
$this->getFieldNameByFormatFieldName("OBJ_UID") => $row["DYN_UID"],
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => $row["DYN_TITLE"],
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $row["DYN_DESCRIPTION"],
$this->getFieldNameByFormatFieldName("OBJ_TYPE") => "DYNAFORM"
);
}
@@ -363,8 +422,8 @@ class Task
$criteria->addAsColumn("INP_DOC_TITLE", "CT.CON_VALUE");
$criteria->addAsColumn("INP_DOC_DESCRIPTION", "CD.CON_VALUE");
$criteria->addAlias("CT", "CONTENT");
$criteria->addAlias("CD", "CONTENT");
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
$criteria->addAlias("CD", \ContentPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\InputDocumentPeer::INP_DOC_UID, "CT.CON_ID", \Criteria::EQUAL);
@@ -393,10 +452,10 @@ class Task
}
$arraydbStep[] = array(
"obj_uid" => $row["INP_DOC_UID"],
"obj_title" => $row["INP_DOC_TITLE"],
"obj_description" => $row["INP_DOC_DESCRIPTION"],
"obj_type" => "INPUT_DOCUMENT"
$this->getFieldNameByFormatFieldName("OBJ_UID") => $row["INP_DOC_UID"],
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => $row["INP_DOC_TITLE"],
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $row["INP_DOC_DESCRIPTION"],
$this->getFieldNameByFormatFieldName("OBJ_TYPE") => "INPUT_DOCUMENT"
);
}
@@ -407,8 +466,8 @@ class Task
$criteria->addAsColumn("OUT_DOC_TITLE", "CT.CON_VALUE");
$criteria->addAsColumn("OUT_DOC_DESCRIPTION", "CD.CON_VALUE");
$criteria->addAlias("CT", "CONTENT");
$criteria->addAlias("CD", "CONTENT");
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
$criteria->addAlias("CD", \ContentPeer::TABLE_NAME);
$arrayCondition = array();
$arrayCondition[] = array(\OutputDocumentPeer::OUT_DOC_UID, "CT.CON_ID", \Criteria::EQUAL);
@@ -437,10 +496,10 @@ class Task
}
$arraydbStep[] = array(
"obj_uid" => $row["OUT_DOC_UID"],
"obj_title" => $row["OUT_DOC_TITLE"],
"obj_description" => $row["OUT_DOC_DESCRIPTION"],
"obj_type" => "OUTPUT_DOCUMENT"
$this->getFieldNameByFormatFieldName("OBJ_UID") => $row["OUT_DOC_UID"],
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => $row["OUT_DOC_TITLE"],
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => $row["OUT_DOC_DESCRIPTION"],
$this->getFieldNameByFormatFieldName("OBJ_TYPE") => "OUTPUT_DOCUMENT"
);
}
@@ -451,10 +510,10 @@ class Task
if (is_array($externalSteps) && count($externalSteps) > 0) {
foreach ($externalSteps as $key => $value) {
$arraydbStep[] = array(
"obj_uid" => $value->sStepId,
"obj_title" => $value->sStepTitle,
"obj_description" => "",
"obj_type" => "EXTERNAL"
$this->getFieldNameByFormatFieldName("OBJ_UID") => $value->sStepId,
$this->getFieldNameByFormatFieldName("OBJ_TITLE") => $value->sStepTitle,
$this->getFieldNameByFormatFieldName("OBJ_DESCRIPTION") => "",
$this->getFieldNameByFormatFieldName("OBJ_TYPE") => "EXTERNAL"
);
}
}
@@ -471,8 +530,8 @@ class Task
$criteria = new \Criteria("dbarray");
$criteria->setDBArrayTable("STEP");
$criteria->addAscendingOrderByColumn("obj_type");
$criteria->addAscendingOrderByColumn("obj_title");
$criteria->addAscendingOrderByColumn($this->getFieldNameByFormatFieldName("OBJ_TYPE"));
$criteria->addAscendingOrderByColumn($this->getFieldNameByFormatFieldName("OBJ_TITLE"));
$rsCriteria = \ArrayBasePeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
@@ -483,6 +542,7 @@ class Task
$arrayAvailableStep[] = $row;
}
//Return
return $arrayAvailableStep;
} catch (\Exception $e) {
throw $e;
@@ -490,11 +550,11 @@ class Task
}
/**
* Get all steps of a Task
* Get all Steps of a Task
*
* @param string $taskUid Unique id of Task
*
* return array
* return array Return an array with all Steps of a Task
*/
public function getSteps($taskUid)
{
@@ -502,7 +562,13 @@ class Task
$arrayStep = array();
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
$step->setArrayParamException($this->arrayParamException);
//Verify data
$this->throwExceptionIfNoExistsTask($taskUid);
//Get data
$criteria = new \Criteria("workflow");
$criteria->add(\StepPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
@@ -521,6 +587,7 @@ class Task
}
}
//Return
return $arrayStep;
} catch (\Exception $e) {
throw $e;

View File

@@ -97,14 +97,19 @@ class Activity extends Api
}
/**
* @url GET /:projectUid/activity/:activityUid/steps
* @url GET /:prj_uid/activity/:act_uid/steps
*
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetActivitySteps($activityUid, $projectUid)
public function doGetActivitySteps($act_uid, $prj_uid)
{
try {
$task = new \BusinessModel\Task();
$task->setFormatFieldNameInUppercase(false);
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
$response = $task->getSteps($activityUid);
$response = $task->getSteps($act_uid);
return $response;
} catch (\Exception $e) {
@@ -113,14 +118,19 @@ class Activity extends Api
}
/**
* @url GET /:projectUid/activity/:activityUid/available-steps
* @url GET /:prj_uid/activity/:act_uid/available-steps
*
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetActivityAvailableSteps($activityUid, $projectUid)
public function doGetActivityAvailableSteps($act_uid, $prj_uid)
{
try {
$task = new \BusinessModel\Task();
$task->setFormatFieldNameInUppercase(false);
$task->setArrayParamException(array("taskUid" => "act_uid"));
$response = $task->getAvailableSteps($activityUid);
$response = $task->getAvailableSteps($act_uid);
return $response;
} catch (\Exception $e) {

View File

@@ -12,14 +12,20 @@ use \Luracast\Restler\RestException;
class Step extends Api
{
/**
* @url GET /:projectUid/activity/:activityUid/step/:stepUid
* @url GET /:prj_uid/activity/:act_uid/step/:step_uid
*
* @param string $step_uid {@min 32}{@max 32}
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetActivityStep($stepUid, $activityUid, $projectUid)
public function doGetActivityStep($step_uid, $act_uid, $prj_uid)
{
try {
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$response = $step->getStep($stepUid);
$response = $step->getStep($step_uid);
return $response;
} catch (\Exception $e) {
@@ -28,22 +34,35 @@ class Step extends Api
}
/**
* @url POST /:projectUid/activity/:activityUid/step
* @url POST /:prj_uid/activity/:act_uid/step
*
* @param string $activityUid
* @param string $projectUid
* @param StepPostStructure $request_data
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
* @param string $step_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}{@required true}
* @param string $step_uid_obj {@from body}{@min 32}{@max 32}{@required true}
* @param string $step_condition {@from body}
* @param int $step_position {@from body}{@min 1}
* @param string $step_mode {@from body}{@choice EDIT,VIEW}{@required true}
*
* @status 201
*/
public function doPostActivityStep($activityUid, $projectUid, StepPostStructure $request_data = null)
{
public function doPostActivityStep(
$act_uid,
$prj_uid,
$request_data,
$step_type_obj = "DYNAFORM",
$step_uid_obj = "00000000000000000000000000000000",
$step_condition = "",
$step_position = 1,
$step_mode = "EDIT"
) {
try {
$request_data = (array)($request_data);
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$arrayData = $step->create($activityUid, $projectUid, $request_data);
$arrayData = $step->create($act_uid, $prj_uid, $request_data);
$response = $arrayData;
@@ -54,49 +73,75 @@ class Step extends Api
}
/**
* @url PUT /:projectUid/activity/:activityUid/step/:stepUid
* @url PUT /:prj_uid/activity/:act_uid/step/:step_uid
*
* @param string $stepUid
* @param string $activityUid
* @param string $projectUid
* @param StepPutStructure $request_data
* @param string $step_uid {@min 32}{@max 32}
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
* @param string $step_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}
* @param string $step_uid_obj {@from body}{@min 32}{@max 32}
* @param string $step_condition {@from body}
* @param int $step_position {@from body}{@min 1}
* @param string $step_mode {@from body}{@choice EDIT,VIEW}
*/
public function doPutActivityStep($stepUid, $activityUid, $projectUid, StepPutStructure $request_data = null)
{
public function doPutActivityStep(
$step_uid,
$act_uid,
$prj_uid,
$request_data,
$step_type_obj = "DYNAFORM",
$step_uid_obj = "00000000000000000000000000000000",
$step_condition = "",
$step_position = 1,
$step_mode = "EDIT"
) {
try {
$request_data = (array)($request_data);
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$arrayData = $step->update($stepUid, $request_data);
$arrayData = $step->update($step_uid, $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url DELETE /:projectUid/activity/:activityUid/step/:stepUid
* @url DELETE /:prj_uid/activity/:act_uid/step/:step_uid
*
* @param string $step_uid {@min 32}{@max 32}
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doDeleteActivityStep($stepUid, $activityUid, $projectUid)
public function doDeleteActivityStep($step_uid, $act_uid, $prj_uid)
{
try {
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$step->delete($stepUid);
$step->delete($step_uid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:projectUid/activity/:activityUid/step/:stepUid/triggers
* @url GET /:prj_uid/activity/:act_uid/step/:step_uid/triggers
*
* @param string $step_uid {@min 32}{@max 32}
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetActivityStepTriggers($stepUid, $activityUid, $projectUid)
public function doGetActivityStepTriggers($step_uid, $act_uid, $prj_uid)
{
try {
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$response = $step->getTriggers($stepUid);
$response = $step->getTriggers($step_uid);
return $response;
} catch (\Exception $e) {
@@ -105,19 +150,21 @@ class Step extends Api
}
/**
* @url GET /:projectUid/activity/:activityUid/step/:stepUid/available-triggers/:type
* @url GET /:prj_uid/activity/:act_uid/step/:step_uid/available-triggers/:type
*
* @param string $stepUid
* @param string $activityUid
* @param string $projectUid
* @param string $type {@from body}{@choice before,after}
* @param string $step_uid {@min 32}{@max 32}
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param string $type {@choice before,after}
*/
public function doGetActivityStepAvailableTriggers($stepUid, $activityUid, $projectUid, $type)
public function doGetActivityStepAvailableTriggers($step_uid, $act_uid, $prj_uid, $type)
{
try {
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$response = $step->getAvailableTriggers($stepUid, strtoupper($type));
$response = $step->getAvailableTriggers($step_uid, strtoupper($type));
return $response;
} catch (\Exception $e) {
@@ -128,34 +175,41 @@ class Step extends Api
//Step "Assign Task"
/**
* @url GET /:projectUid/activity/:activityUid/step/triggers
*/
public function doGetActivityStepAssignTaskTriggers($activityUid, $projectUid)
{
try {
$step = new \BusinessModel\Step();
$response = $step->getTriggers("", $activityUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:projectUid/activity/:activityUid/step/available-triggers/:type
* @url GET /:prj_uid/activity/:act_uid/step/triggers
*
* @param string $activityUid
* @param string $projectUid
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetActivityStepAssignTaskAvailableTriggers($activityUid, $projectUid, $type)
public function doGetActivityStepAssignTaskTriggers($act_uid, $prj_uid)
{
try {
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$response = $step->getAvailableTriggers("", strtoupper(str_replace("-", "_", $type)), $activityUid);
$response = $step->getTriggers("", $act_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:prj_uid/activity/:act_uid/step/available-triggers/:type
*
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param string $type {@choice before-assignment,before-routing,after-routing}
*/
public function doGetActivityStepAssignTaskAvailableTriggers($act_uid, $prj_uid, $type)
{
try {
$step = new \BusinessModel\Step();
$step->setFormatFieldNameInUppercase(false);
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
$response = $step->getAvailableTriggers("", strtoupper(str_replace("-", "_", $type)), $act_uid);
return $response;
} catch (\Exception $e) {
@@ -164,59 +218,3 @@ class Step extends Api
}
}
class StepPostStructure
{
/**
* @var string {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}{@required true}
*/
public $step_type_obj;
/**
* @var string {@from body}{@min 32}{@max 32}{@required true}
*/
public $step_uid_obj;
/**
* @var string
*/
public $step_condition;
/**
* @var int {@from body}{@min 1}
*/
public $step_position;
/**
* @var string {@from body}{@choice EDIT,VIEW}{@required true}
*/
public $step_mode;
}
class StepPutStructure
{
/**
* @var string {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}
*/
public $step_type_obj;
/**
* @var string {@from body}{@min 32}{@max 32}
*/
public $step_uid_obj;
/**
* @var string
*/
public $step_condition;
/**
* @var int {@from body}{@min 1}
*/
public $step_position;
/**
* @var string {@from body}{@choice EDIT,VIEW}
*/
public $step_mode;
}