Se adiciona funcionalidad de lanes y lanesets para project

This commit is contained in:
Freddy Daniel Rojas Valda
2014-09-29 14:44:37 -04:00
parent ea211b4c82
commit 7b9e7fffeb
10 changed files with 600 additions and 29 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());
@@ -41,7 +39,16 @@ class BpmnActivity extends BaseBpmnActivity
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if ($this->bound->getBouElement() == null && $this->bound->getBouElement() == '' && $this->bound->getBouElement() == $process->getDiaUid()) {
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setBouElement($process->getDiaUid());
} else {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->bound->getBouElement());
}
}
}

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());
@@ -41,7 +39,16 @@ class BpmnArtifact extends BaseBpmnArtifact
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if ($this->bound->getBouElement() == null && $this->bound->getBouElement() == '' && $this->bound->getBouElement() == $process->getDiaUid()) {
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setBouElement($process->getDiaUid());
} else {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->bound->getBouElement());
}
}
}

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());
@@ -41,7 +39,16 @@ class BpmnData extends BaseBpmnData
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if ($this->bound->getBouElement() == null && $this->bound->getBouElement() == '' && $this->bound->getBouElement() == $process->getDiaUid()) {
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setBouElement($process->getDiaUid());
} else {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->bound->getBouElement());
}
}
}

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());
@@ -41,7 +39,16 @@ class BpmnEvent extends BaseBpmnEvent
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if ($this->bound->getBouElement() == null && $this->bound->getBouElement() == '' && $this->bound->getBouElement() == $process->getDiaUid()) {
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setBouElement($process->getDiaUid());
} else {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->bound->getBouElement());
}
}
}

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());
@@ -41,7 +39,16 @@ class BpmnGateway extends BaseBpmnGateway
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if ($this->bound->getBouElement() == null && $this->bound->getBouElement() == '' && $this->bound->getBouElement() == $process->getDiaUid()) {
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setBouElement($process->getDiaUid());
} else {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->bound->getBouElement());
}
}
}

View File

@@ -16,4 +16,161 @@ 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('bpmnDiagram');
$this->bound->setBouElement($row["DIA_UID"]);
}
}
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,170 @@ 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());
if ($this->bound->getBouElement() == null && $this->bound->getBouElement() == '' && $this->bound->getBouElement() == $process->getDiaUid()) {
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setBouElement($process->getDiaUid());
} else {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->bound->getBouElement());
}
}
}
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());
@@ -41,7 +39,16 @@ class BpmnParticipant extends BaseBpmnParticipant
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
if (is_object($process)) {
$this->bound->setDiaUid($process->getDiaUid());
if ($this->bound->getBouElement() == null && $this->bound->getBouElement() == '' && $this->bound->getBouElement() == $process->getDiaUid()) {
$this->bound->setBouContainer('bpmnDiagram');
$this->bound->setBouElement($process->getDiaUid());
} else {
$this->bound->setBouContainer('bpmnLane');
$this->bound->setBouElement($this->bound->getBouElement());
}
}
}