Beispiel #1
0
 /**
  * get all the lists class
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @return array
  */
 public function getLists()
 {
     $returnValue = array();
     $returnValue[] = new core_kernel_classes_Class(GENERIS_BOOLEAN);
     foreach ($this->parentListClass->getSubClasses(false) as $list) {
         $returnValue[] = $list;
     }
     return (array) $returnValue;
 }
Beispiel #2
0
 /**
  * Create method
  *
  * @param  string   $token optional token for payment creation
  * @return Response
  */
 public function create($token = null)
 {
     if ($token) {
         $this->model->setToken($token);
     }
     return $this->request->create($this->model);
 }
 /**
  * Get items of a specific model
  * @param string|core_kernel_classes_Resource $itemModel - the item model URI
  * @return core_kernel_classes_Resource[] the found items
  */
 public function getAllByModel($itemModel)
 {
     if (!empty($itemModel)) {
         $uri = $itemModel instanceof core_kernel_classes_Resource ? $itemModel->getUri() : $itemModel;
         return $this->itemClass->searchInstances(array($this->itemModelProperty->getUri() => $uri), array('recursive' => true));
     }
     return array();
 }
 /**
  * delete a test class or sublcass
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Class clazz
  * @return boolean
  */
 public function deleteTestClass(core_kernel_classes_Class $clazz)
 {
     $returnValue = (bool) false;
     if (!is_null($clazz)) {
         if ($this->isTestClass($clazz) && $clazz->getUri() != $this->testClass->getUri()) {
             $returnValue = $clazz->delete();
         }
     }
     return (bool) $returnValue;
 }
 /**
  * Found all the properties of the class. 
  * It gets also the parent's properties between
  * the class and the topclass. 
  * If the topclass is not defined, the GenerisResource class is used.
  * If there is more than one parent's class, the best path is calculated.
  *
  * @access protected
  * @author Bertrand Chevrier, <*****@*****.**>
  * @return array
  */
 protected function findProperties()
 {
     $returnValue = array();
     if (is_null($this->topclass)) {
         $parents = $this->class->getParentClasses(true);
     } else {
         //determine the parent path
         $parents = array();
         $top = false;
         do {
             if (!isset($lastLevelParents)) {
                 $parentClasses = $this->class->getParentClasses(false);
             } else {
                 $parentClasses = array();
                 foreach ($lastLevelParents as $parent) {
                     $parentClasses = array_merge($parentClasses, $parent->getParentClasses(false));
                 }
             }
             if (count($parentClasses) == 0) {
                 break;
             }
             $lastLevelParents = array();
             foreach ($parentClasses as $parentClass) {
                 if ($parentClass->getUri() == RDFS_CLASS) {
                     continue;
                 }
                 if ($parentClass->equals($this->topclass)) {
                     $parents[$parentClass->getUri()] = $parentClass;
                     $top = true;
                     break;
                 }
                 $allParentClasses = $parentClass->getParentClasses(true);
                 if (array_key_exists($this->topclass->getUri(), $allParentClasses)) {
                     $parents[$parentClass->getUri()] = $parentClass;
                 }
                 $lastLevelParents[$parentClass->getUri()] = $parentClass;
             }
         } while (!$top);
     }
     $returnValue = array_merge(array(RDFS_LABEL => new \core_kernel_classes_Property(RDFS_LABEL), RDFS_COMMENT => new \core_kernel_classes_Property(RDFS_COMMENT)), $this->class->getProperties(false));
     foreach ($parents as $parent) {
         $returnValue = array_merge($returnValue, $parent->getProperties(false));
     }
     $this->_properties = $returnValue;
     return (array) $returnValue;
 }
 /**
  * Short description of method createNotification
  *
  * @access public
  * @author Somsack Sipasseuth, <*****@*****.**>
  * @param  Resource connector
  * @param  Resource user
  * @param  Resource activityExecution
  * @param  Resource processExecution
  * @return core_kernel_classes_Resource
  */
 public function createNotification(core_kernel_classes_Resource $connector, core_kernel_classes_Resource $user, core_kernel_classes_Resource $activityExecution, core_kernel_classes_Resource $processExecution = null)
 {
     $returnValue = null;
     $activityExecutionService = wfEngine_models_classes_ActivityExecutionService::singleton();
     if (is_null($processExecution)) {
         $processExecution = $activityExecutionService->getRelatedProcessExecution($activityExecution);
     }
     $notification = $this->notificationClass->createInstance();
     $notification->setPropertyValue($this->notificationToProp, $user);
     $notification->setPropertyValue($this->notificationProcessExecProp, $processExecution);
     $notification->setPropertyValue($this->notificationConnectorProp, $connector);
     $notification->setPropertyValue($this->notificationSentProp, GENERIS_FALSE);
     $notification->setPropertyValue($this->notificationDateProp, date("Y-m-d H:i:s"));
     //get the message content from the connector
     $content = (string) $connector->getOnePropertyValue($this->connectorNotificationProp);
     if (strlen(trim($content)) > 0) {
         $matches = array();
         $expr = "/{{((http|https|file|ftp):\\/\\/[\\/.A-Za-z0-9_-]+#[A-Za-z0-9]+)}}/";
         if (preg_match_all($expr, $content, $matches)) {
             if (isset($matches[1])) {
                 $termUris = $matches[1];
                 $activity = $activityExecutionService->getExecutionOf($activityExecution);
                 foreach ($termUris as $termUri) {
                     $term = new core_kernel_rules_Term($termUri);
                     $replacement = $term->evaluate(array(VAR_PROCESS_INSTANCE => $processExecution->getUri(), VAR_ACTIVITY_INSTANCE => $activityExecution->getUri(), VAR_ACTIVITY_DEFINITION => $activity->getUri(), VAR_CURRENT_USER => $user->getUri()));
                     if ($replacement instanceof core_kernel_classes_Resource && $replacement->getUri() == INSTANCE_TERM_IS_NULL) {
                         $replacement = '';
                     }
                     $content = str_replace('{{' . $termUri . '}}', $replacement, $content);
                 }
             }
         }
     }
     if (empty($content)) {
         throw new common_Exception('empty notification message');
     }
     $notification->setPropertyValue($this->notificationMessageProp, $content);
     $returnValue = $notification;
     return $returnValue;
 }
Beispiel #7
0
 /**
  * keygen
  * 
  * @param string $data
  * @return string
  */
 public static function keygen($clear_text, $length = 32)
 {
     self::__init(null);
     return self::$CryptAesClass->keygen($clear_text, $length);
 }
Beispiel #8
0
 /**
  * Exclude object from result
  *
  * @param     Class $class Object to remove from the list of results
  *
  * @return    ClassQuery The current query, for fluid interface
  */
 public function prune($class = null)
 {
     if ($class) {
         $this->addUsingAlias(ClassPeer::ID, $class->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Beispiel #9
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->object = new Logger();
     $this->logger = new MY_Logger();
     $this->object->addLogger($this->logger);
 }