当前位置: 首页>>代码示例>>PHP>>正文


PHP core_kernel_classes_Resource::setPropertyValues方法代码示例

本文整理汇总了PHP中core_kernel_classes_Resource::setPropertyValues方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Resource::setPropertyValues方法的具体用法?PHP core_kernel_classes_Resource::setPropertyValues怎么用?PHP core_kernel_classes_Resource::setPropertyValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_kernel_classes_Resource的用法示例。


在下文中一共展示了core_kernel_classes_Resource::setPropertyValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setParallelActivities

 /**
  * Short description of method setParallelActivities
  *
  * @access public
  * @author Joel Bout, <joel.bout@tudor.lu>
  * @param  Resource connectorInstance
  * @param  array newActivitiesArray
  * @return boolean
  */
 public function setParallelActivities(core_kernel_classes_Resource $connectorInstance, $newActivitiesArray = array())
 {
     $returnValue = (bool) false;
     $this->setConnectorType($connectorInstance, new core_kernel_classes_Resource(INSTANCE_TYPEOFCONNECTORS_PARALLEL));
     $propNextActivities = new core_kernel_classes_Property(PROPERTY_STEP_NEXT);
     $cardinalityService = wfEngine_models_classes_ActivityCardinalityService::singleton();
     //remove old property values:
     $nextActivitiesCollection = $connectorInstance->getPropertyValuesCollection($propNextActivities);
     $oldSplitVariablesByActivity = array();
     foreach ($nextActivitiesCollection->getIterator() as $activityMultiplicityResource) {
         if ($cardinalityService->isCardinality($activityMultiplicityResource)) {
             //record the old split variables values in case it is needed (TODO: optimize this process)
             $activity = $cardinalityService->getDestination($activityMultiplicityResource);
             $splitVars = $cardinalityService->getSplitVariables($activityMultiplicityResource);
             if (!empty($splitVars)) {
                 $oldSplitVariablesByActivity[$activity->getUri()] = $splitVars;
             }
             //delete it
             $activityMultiplicityResource->delete();
         }
     }
     $returnValue = $connectorInstance->removePropertyValues($propNextActivities);
     //finally, set the next activities values to the parallel connector:
     $joinConnector = null;
     $processFlow = new wfEngine_models_classes_ProcessFlow();
     $i = 0;
     foreach ($newActivitiesArray as $activityUri => $count) {
         $activity = new core_kernel_classes_Resource($activityUri);
         //set multiplicity to the parallel connector:
         $cardinality = $cardinalityService->createCardinality($activity, $count);
         if (isset($oldSplitVariablesByActivity[$activityUri])) {
             if (!empty($oldSplitVariablesByActivity[$activityUri]) && !$cardinalityService->editSplitVariables($cardinality, $oldSplitVariablesByActivity[$activityUri])) {
                 throw new Exception('cannot set split variables to new cardinality resources');
             }
         }
         $returnValue = $connectorInstance->setPropertyValue($propNextActivities, $cardinality);
         //set multiplicity to the merge connector:
         $previousActvityUri = '';
         if ($i == 0) {
             //use the ProcessFlow service to find if a merge connector exists for the current parallel connector:
             //do it only once:
             $processFlow->resetCheckedResources();
             $joinConnector = $processFlow->findJoinFromActivityForward($activity);
             if (!is_null($joinConnector)) {
                 //if it exists, we erase all previous activities:
                 //the previous acitivites must be related to the *exact* same activity-multiplicity objects as the parallel but not necessarily the same (e.g. parallel thread with more than 1 acitivty)
                 //we suppose that the previous activities of the found merge connector come *exactly* from the thread generated by its parallel connector (condition for a valid process design)
                 $prevActivities = wfEngine_models_classes_ConnectorService::singleton()->getPreviousActivities($joinConnector);
                 foreach ($prevActivities as $activityMultiplicityResource) {
                     if ($cardinalityService->isCardinality($activityMultiplicityResource)) {
                         $activityMultiplicityResource->delete();
                     }
                     $prevActivities->removePropertyValues(new core_kernel_classes_Property(PROPERTY_STEP_NEXT));
                 }
                 /*
                 $prevActivitiesCollection = $joinConnector->getPropertyValuesCollection($propPreviousActivities);
                 foreach ($prevActivitiesCollection->getIterator() as $activityMultiplicityResource){
                 	if($cardinalityService->isCardinality($activityMultiplicityResource)){
                 		$activityMultiplicityResource->delete();
                 	}
                 }
                 $returnValue = $joinConnector->removePropertyValues($propPreviousActivities);
                 */
             }
             $toPop = $processFlow->getCheckedActivities();
             $previousActvityUri = array_pop($toPop);
         }
         if (!is_null($joinConnector)) {
             if (empty($previousActvityUri)) {
                 //if there are more than 1 activity in the newActivitiesArray:
                 $processFlow->resetCheckedResources();
                 $joinConnector = $processFlow->findJoinFromActivityForward($activity);
                 $previousActvityUri = array_pop($processFlow->getCheckedActivities());
             }
             if (!empty($previousActvityUri)) {
                 $previous = new core_kernel_classes_Resource($previousActvityUri);
                 $cardinality = $cardinalityService->createCardinality($joinConnector, $count);
                 $returnValue = $previous->setPropertyValues(new core_kernel_classes_Property(PROPERTY_STEP_NEXT), $cardinality);
                 /*
                 $multiplicity = $cardinalityService->createCardinality($previous, $count);
                 $returnValue = $joinConnector->setPropertyValue($propPreviousActivities, $multiplicity);
                 */
             }
         }
         $i++;
     }
     return (bool) $returnValue;
 }
开发者ID:oat-sa,项目名称:extension-tao-wfauthoring,代码行数:97,代码来源:class.ProcessService.php


注:本文中的core_kernel_classes_Resource::setPropertyValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。