Merged in darojas/processmaker (pull request #835)

Fix. Adicion de funcionalidad de lanes y lanesets para project. Adicion de endpoint para steps. Modificacion de queries para doble conexion. Adicion end point suggest field
This commit is contained in:
Erik Amaru Ortiz
2014-10-14 09:37:11 -04:00
27 changed files with 1202 additions and 80 deletions

View File

@@ -32,8 +32,6 @@ class BpmnActivity extends BaseBpmnActivity
private function setBoundDefaults()
{
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
$this->bound->setBouElement('pm_canvas');
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setPrjUid($this->getPrjUid());
$this->bound->setElementUid($this->getActUid());
@@ -42,6 +40,13 @@ class BpmnActivity extends BaseBpmnActivity
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if (isset($this->getLnsUid)) {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->getLnsUid());
} else {
$this->bound->setBouContainer('bpmnDiagram');
}
$this->bound->setBouElement($process->getDiaUid());
}
}

View File

@@ -32,8 +32,6 @@ class BpmnArtifact extends BaseBpmnArtifact
private function setBoundDefaults()
{
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
$this->bound->setBouElement('pm_canvas');
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setPrjUid($this->getPrjUid());
$this->bound->setElementUid($this->getArtUid());
@@ -42,6 +40,13 @@ class BpmnArtifact extends BaseBpmnArtifact
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if (isset($this->getLnsUid)) {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->getLnsUid());
} else {
$this->bound->setBouContainer('bpmnDiagram');
}
$this->bound->setBouElement($process->getDiaUid());
}
}

View File

@@ -32,8 +32,6 @@ class BpmnData extends BaseBpmnData
private function setBoundDefaults()
{
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
$this->bound->setBouElement('pm_canvas');
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setPrjUid($this->getPrjUid());
$this->bound->setElementUid($this->getDatUid());
@@ -42,6 +40,13 @@ class BpmnData extends BaseBpmnData
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if (isset($this->getLnsUid)) {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->getLnsUid());
} else {
$this->bound->setBouContainer('bpmnDiagram');
}
$this->bound->setBouElement($process->getDiaUid());
}
}

View File

@@ -32,8 +32,6 @@ class BpmnEvent extends BaseBpmnEvent
private function setBoundDefaults()
{
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
$this->bound->setBouElement('pm_canvas');
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setPrjUid($this->getPrjUid());
$this->bound->setElementUid($this->getEvnUid());
@@ -42,6 +40,13 @@ class BpmnEvent extends BaseBpmnEvent
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if (isset($this->getLnsUid)) {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->getLnsUid());
} else {
$this->bound->setBouContainer('bpmnDiagram');
}
$this->bound->setBouElement($process->getDiaUid());
}
}

View File

@@ -32,8 +32,6 @@ class BpmnGateway extends BaseBpmnGateway
private function setBoundDefaults()
{
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
$this->bound->setBouElement('pm_canvas');
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setPrjUid($this->getPrjUid());
$this->bound->setElementUid($this->getGatUid());
@@ -42,6 +40,13 @@ class BpmnGateway extends BaseBpmnGateway
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if (isset($this->getLnsUid)) {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->getLnsUid());
} else {
$this->bound->setBouContainer('bpmnDiagram');
}
$this->bound->setBouElement($process->getDiaUid());
}
}

View File

@@ -16,4 +16,162 @@ require_once 'classes/model/om/BaseBpmnLane.php';
*/
class BpmnLane extends BaseBpmnLane {
private $bound;
public function __construct($generateUid = true)
{
$this->bound = new BpmnBound();
$this->setBoundDefaults();
}
public function getBound()
{
return $this->bound;
}
private function setBoundDefaults()
{
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
$this->bound->setPrjUid($this->getPrjUid());
$this->bound->setElementUid($this->getLanUid());
$project = BpmnProjectPeer::retrieveByPK($this->getPrjUid());
if (is_object($project)) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(BpmnProcessPeer::DIA_UID);
$criteria->add(BpmnProcessPeer::PRJ_UID, $this->getPrjUid(), \Criteria::EQUAL);
$rsCriteria = BpmnProcessPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
$row = $rsCriteria->getRow();
$this->bound->setDiaUid($row["DIA_UID"]);
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->getLnsUid());
}
}
public static function findOneBy($field, $value)
{
$rows = self::findAllBy($field, $value);
return empty($rows) ? null : $rows[0];
}
public static function findAllBy($field, $value)
{
$c = new Criteria('workflow');
$c->add($field, $value, Criteria::EQUAL);
return BpmnLanePeer::doSelect($c);
}
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
{
$c = new Criteria('workflow');
$c->addSelectColumn("BPMN_LANE.*");
$c->addSelectColumn("BPMN_BOUND.*");
$c->addJoin(BpmnLanePeer::LAN_UID, BpmnBoundPeer::ELEMENT_UID, Criteria::LEFT_JOIN);
if (! is_null($prjUid)) {
$c->add(BpmnLanePeer::PRJ_UID, $prjUid, Criteria::EQUAL);
}
$rs = BpmnLanePeer::doSelectRS($c);
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$lanes = array();
while ($rs->next()) {
$lanes[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
}
return $lanes;
}
// OVERRIDES
public function setLanUid($actUid)
{
parent::setLanUid($actUid);
$this->bound->setElementUid($this->getLanUid());
}
public function setPrjUid($prjUid)
{
parent::setPrjUid($prjUid);
$this->bound->setPrjUid($this->getPrjUid());
}
public function save($con = null)
{
parent::save($con);
$this->setBoundDefaults();
if ($this->bound->getBouUid() == "") {
$this->bound->setBouUid(\ProcessMaker\Util\Common::generateUID());
}
$this->bound->save($con);
}
public function delete($con = null)
{
// first, delete the related bound object
if (! is_object($this->bound) || $this->bound->getBouUid() == "") {
$this->bound = BpmnBound::findByElement('Lane', $this->getLanUid());
}
if (is_object($this->bound)) {
$this->bound->delete($con);
}
parent::delete($con);
}
public function fromArray($data, $type = BasePeer::TYPE_FIELDNAME)
{
parent::fromArray($data, $type);
$bound = BpmnBound::findByElement('Lane', $this->getLanUid());
if (is_object($bound)) {
$this->bound = $bound;
} else {
$this->bound = new BpmnBound();
$this->bound->setBouUid(ProcessMaker\Util\Common::generateUID());
}
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
}
public function toArray($type = BasePeer::TYPE_FIELDNAME)
{
$data = parent::toArray($type);
$bouUid = $this->bound->getBouUid();
if (empty($bouUid)) {
$bound = BpmnBound::findByElement('Lane', $this->getLanUid());
if (is_object($bound)) {
$this->bound = $bound;
}
}
$data = array_merge($data, $this->bound->toArray($type));
return $data;
}
public static function exists($actUid)
{
$c = new Criteria("workflow");
$c->add(BpmnlanesPeer::LAN_UID, $actUid);
return BpmnlanesPeer::doCount($c) > 0 ? true : false;
}
} // BpmnLane

View File

@@ -15,5 +15,164 @@ require_once 'classes/model/om/BaseBpmnLaneset.php';
* @package classes.model
*/
class BpmnLaneset extends BaseBpmnLaneset {
private $bound;
public function __construct($generateUid = true)
{
$this->bound = new BpmnBound();
$this->setBoundDefaults();
}
public function getBound()
{
return $this->bound;
}
private function setBoundDefaults()
{
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
$this->bound->setPrjUid($this->getPrjUid());
$this->bound->setElementUid($this->getLnsUid());
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setBouElement($process->getDiaUid());
}
}
public static function findOneBy($field, $value)
{
$rows = self::findAllBy($field, $value);
return empty($rows) ? null : $rows[0];
}
public static function findAllBy($field, $value)
{
$c = new Criteria('workflow');
$c->add($field, $value, Criteria::EQUAL);
return BpmnLanesetPeer::doSelect($c);
}
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
{
$c = new Criteria('workflow');
$c->addSelectColumn("BPMN_LANESET.*");
$c->addSelectColumn("BPMN_BOUND.*");
$c->addJoin(BpmnLanesetPeer::LNS_UID, BpmnBoundPeer::ELEMENT_UID, Criteria::LEFT_JOIN);
if (! is_null($prjUid)) {
$c->add(BpmnLanesetPeer::PRJ_UID, $prjUid, Criteria::EQUAL);
}
$rs = BpmnLanesetPeer::doSelectRS($c);
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$laneSet = array();
while ($rs->next()) {
$laneSet[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
}
return $laneSet;
}
// OVERRIDES
public function setLnsUid($actUid)
{
parent::setLnsUid($actUid);
$this->bound->setElementUid($this->getLnsUid());
}
public function setPrjUid($prjUid)
{
parent::setPrjUid($prjUid);
$this->bound->setPrjUid($this->getPrjUid());
}
public function setProUid($proUid)
{
parent::setProUid($proUid);
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
$this->bound->setDiaUid($process->getDiaUid());
}
public function save($con = null)
{
parent::save($con);
$this->setBoundDefaults();
if ($this->bound->getBouUid() == "") {
$this->bound->setBouUid(\ProcessMaker\Util\Common::generateUID());
}
$this->bound->save($con);
}
public function delete($con = null)
{
// first, delete the related bound object
if (! is_object($this->bound) || $this->bound->getBouUid() == "") {
$this->bound = BpmnBound::findByElement('LaneSet', $this->getLnsUid());
}
if (is_object($this->bound)) {
$this->bound->delete($con);
}
parent::delete($con);
}
public function fromArray($data, $type = BasePeer::TYPE_FIELDNAME)
{
parent::fromArray($data, $type);
$bound = BpmnBound::findByElement('LaneSet', $this->getLnsUid());
if (is_object($bound)) {
$this->bound = $bound;
} else {
$this->bound = new BpmnBound();
$this->bound->setBouUid(ProcessMaker\Util\Common::generateUID());
}
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
}
public function toArray($type = BasePeer::TYPE_FIELDNAME)
{
$data = parent::toArray($type);
$bouUid = $this->bound->getBouUid();
if (empty($bouUid)) {
$bound = BpmnBound::findByElement('LaneSet', $this->getLnsUid());
if (is_object($bound)) {
$this->bound = $bound;
}
}
$data = array_merge($data, $this->bound->toArray($type));
return $data;
}
public static function exists($actUid)
{
$c = new Criteria("workflow");
$c->add(BpmnLanesetPeer::LNS_UID, $actUid);
return BpmnLanesetPeer::doCount($c) > 0 ? true : false;
}
} // BpmnLaneset

View File

@@ -32,8 +32,6 @@ class BpmnParticipant extends BaseBpmnParticipant
private function setBoundDefaults()
{
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
$this->bound->setBouElement('pm_canvas');
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setPrjUid($this->getPrjUid());
$this->bound->setElementUid($this->getParUid());
@@ -42,6 +40,13 @@ class BpmnParticipant extends BaseBpmnParticipant
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if (isset($this->getLnsUid)) {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->getLnsUid());
} else {
$this->bound->setBouContainer('bpmnDiagram');
}
$this->bound->setBouElement($process->getDiaUid());
}
}

View File

@@ -274,7 +274,7 @@ class Process extends BaseProcess
if (! $getAllLang) {
$c->add( ContentPeer::CON_LANG, $lang );
}
$rs = ProcessPeer::doSelectRS( $c );
$rs = ProcessPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();
@@ -352,7 +352,7 @@ class Process extends BaseProcess
$oCriteria->add( ProcessPeer::PRO_STATUS, 'DISABLED', Criteria::NOT_EQUAL );
//execute the query
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
$oDataset = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$processes = Array ();
$uids = array ();
@@ -369,7 +369,7 @@ class Process extends BaseProcess
$c->add( ContentPeer::CON_LANG, defined( 'SYS_LANG' ) ? SYS_LANG : 'en', Criteria::EQUAL );
$c->add( ContentPeer::CON_ID, $uids, Criteria::IN );
$dt = ContentPeer::doSelectRS( $c );
$dt = ContentPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
$dt->setFetchmode( ResultSet::FETCHMODE_ASSOC );
while ($dt->next()) {
@@ -484,7 +484,7 @@ class Process extends BaseProcess
// validate if the category exists
$criteria = new Criteria( 'workflow' );
$criteria->add( ProcessCategoryPeer::CATEGORY_UID, $aData['PRO_CATEGORY'] );
$ds = ProcessCategoryPeer::doSelectRS( $criteria );
$ds = ProcessCategoryPeer::doSelectRS( $criteria, Propel::getDbConnection('workflow_ro') );
$ds->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$ds->next();
// if it is not set, set value as empty "No Category"
@@ -576,7 +576,7 @@ class Process extends BaseProcess
$oCriteria->add( ContentPeer::CON_CATEGORY, 'PRO_TITLE' );
$oCriteria->add( ContentPeer::CON_LANG, SYS_LANG );
$oCriteria->add( ContentPeer::CON_VALUE, $PRO_TITLE );
$oDataset = ContentPeer::doSelectRS( $oCriteria );
$oDataset = ContentPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
@@ -590,7 +590,7 @@ class Process extends BaseProcess
$c = $this->tmpCriteria;
$c->clearSelectColumns();
$c->addSelectColumn( 'COUNT(*)' );
$oDataset = ProcessPeer::doSelectRS( $c );
$oDataset = ProcessPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
$oDataset->next();
$aRow = $oDataset->getRow();
@@ -660,7 +660,7 @@ class Process extends BaseProcess
// getting bpmn projects
$c = new Criteria('workflow');
$c->addSelectColumn(BpmnProjectPeer::PRJ_UID);
$ds = ProcessPeer::doSelectRS($c);
$ds = ProcessPeer::doSelectRS($c, Propel::getDbConnection('workflow_ro') );
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$bpmnProjects = array();
@@ -690,7 +690,7 @@ class Process extends BaseProcess
$c->add( ContentPeer::CON_LANG, defined( 'SYS_LANG' ) ? SYS_LANG : 'en', Criteria::EQUAL );
$c->add( ContentPeer::CON_ID, $uids, Criteria::IN );
$dt = ContentPeer::doSelectRS( $c );
$dt = ContentPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
$dt->setFetchmode( ResultSet::FETCHMODE_ASSOC );
while ($dt->next()) {
@@ -807,7 +807,7 @@ class Process extends BaseProcess
$oCriteria->addGroupByColumn( ApplicationPeer::PRO_UID );
$oCriteria->addGroupByColumn( ApplicationPeer::APP_STATUS );
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
$oDataset = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aProcesses = Array ();
@@ -825,7 +825,7 @@ class Process extends BaseProcess
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'COUNT(*) AS TOTAL_CASES' );
$oCriteria->add( ApplicationPeer::PRO_UID, $pro_uid );
$oDataset = ApplicationPeer::doSelectRS( $oCriteria );
$oDataset = ApplicationPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
@@ -839,7 +839,7 @@ class Process extends BaseProcess
$oCriteria->addSelectColumn( ProcessPeer::PRO_CATEGORY );
$oCriteria->addSelectColumn( 'COUNT(*) AS CNT' );
$oCriteria->addGroupByColumn( ProcessPeer::PRO_CATEGORY );
$oDataSet = ProcessPeer::doSelectRS( $oCriteria );
$oDataSet = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
$oDataSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$aProc = Array ();
while ($oDataSet->next()) {
@@ -883,7 +883,7 @@ class Process extends BaseProcess
$oCriteria->addSelectColumn( TriggersPeer::TRI_WEBBOT );
$oCriteria->addJoin( $var, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN );
$oCriteria->add( ProcessPeer::PRO_UID, $proUid );
$oDataSet = ProcessPeer::doSelectRS( $oCriteria );
$oDataSet = ProcessPeer::doSelectRS( $oCriteria, Propel::getDbConnection('workflow_ro') );
$oDataSet->setFetchmode( ResultSet::FETCHMODE_ASSOC );
if ($oDataSet->next()) {

View File

@@ -212,7 +212,7 @@ class Users extends BaseUsers
public function loadByUsernameInArray ($sUsername)
{
$c = $this->loadByUsername( $sUsername );
$rs = UsersPeer::doSelectRS( $c );
$rs = UsersPeer::doSelectRS( $c, Propel::getDbConnection('workflow_ro') );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$row = $rs->getRow();