Example #1
0
 /**
  * Constructor, takes one or more object guids and classnames and constructs a collector accordingly.
  *
  * Attention: At least one of these arguments has to be a string
  *
  * @param mixed $guids One or more object guids
  * @param mixed $classes One or more target classes
  * @param string $direction incoming or outgoing
  */
 public function __construct($guids, $classes, $direction = 'incoming')
 {
     $this->_set_direction($direction);
     if (is_string($guids)) {
         parent::__construct('org_openpsa_relatedto_dba', $this->_object_prefix . 'Guid', $guids);
         $this->initialize();
         if (is_string($classes)) {
             $this->add_constraint($this->_other_prefix . 'Class', '=', $classes);
         } else {
             $this->add_constraint($this->_other_prefix . 'Class', 'IN', $classes);
         }
     } else {
         if (is_string($classes)) {
             parent::__construct('org_openpsa_relatedto_dba', $this->_other_prefix . 'Class', $classes);
             $this->initialize();
             if (is_string($guids)) {
                 $this->add_constraint($this->_object_prefix . 'Guid', '=', $guids);
             } else {
                 $this->add_constraint($this->_object_prefix . 'Guid', 'IN', $guids);
             }
         } else {
             throw new midcom_error('None of the arguments was passed as a string');
         }
     }
     //save target classes for later use
     if (is_string($classes)) {
         $this->_target_classes = array($classes);
     } else {
         $this->_target_classes = $classes;
     }
     $this->add_value_property($this->_other_prefix . 'Guid');
 }
Example #2
0
 /**
  * This function will determine the correct type of midgard_collector that
  * has to be created. It will also call the _on_prepare_new_collector event handler.
  *
  * @param string $classname The name of the class for which you want to create a collector.
  * @param string $domain The domain property of the collector instance
  * @param mixed $value Value match for the collector instance
  * @return midcom_core_collector The initialized instance of the collector.
  * @see midcom_core_collector
  */
 function new_collector($classname, $domain, $value)
 {
     $mc = new midcom_core_collector($classname, $domain, $value);
     $mc->initialize();
     return $mc;
 }