/**
  * The singleton method
  *
  * @return Tracker_Semantic_StatusFactory an instance of the factory
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
 public function testImport()
 {
     $xml = simplexml_load_file(dirname(__FILE__) . '/_fixtures/ImportTrackerSemanticStatusTest.xml');
     $tracker = new MockTracker();
     $f1 = new MockTracker_FormElement_Field_List();
     $f1->setReturnValue('getId', 111);
     $f2 = new MockTracker_FormElement_Field_List();
     $f2->setReturnValue('getId', 112);
     $f3 = new MockTracker_FormElement_Field_List();
     $f3->setReturnValue('getId', 113);
     $mapping = array('F9' => $f1, 'F14' => $f3, 'F13' => $f2, 'F14-V61' => 801, 'F14-V62' => 802, 'F14-V63' => 803, 'F14-V64' => 804, 'F14-V65' => 805, 'F14-V66' => 806, 'F14-V67' => 807, 'F14-V68' => 808, 'F14-V69' => 809);
     $semantic_status = Tracker_Semantic_StatusFactory::instance()->getInstanceFromXML($xml, $mapping, $tracker);
     $this->assertEqual($semantic_status->getShortName(), 'status');
     $this->assertEqual($semantic_status->getFieldId(), 113);
     $this->assertEqual(count($semantic_status->getOpenValues()), 4);
     $this->assertTrue(in_array(806, $semantic_status->getOpenValues()));
     $this->assertTrue(in_array(809, $semantic_status->getOpenValues()));
     $this->assertTrue(in_array(807, $semantic_status->getOpenValues()));
     $this->assertTrue(in_array(808, $semantic_status->getOpenValues()));
 }
 /**
  * Returns an instance of Tracker_Semantic_StatusFactory
  *
  * @return Tracker_Semantic_StatusFactory an instance of the factory
  */
 function getSemanticStatusFactory()
 {
     return Tracker_Semantic_StatusFactory::instance();
 }
 public function getCriteriaBuilder($user, $trackers)
 {
     $artifact_factory = Tracker_ArtifactFactory::instance();
     $semantic_title_factory = Tracker_Semantic_TitleFactory::instance();
     $semantic_status_factory = Tracker_Semantic_StatusFactory::instance();
     $tracker_factory = TrackerFactory::instance();
     $semantic_value_factory = new Tracker_CrossSearch_SemanticValueFactory($artifact_factory, $semantic_title_factory, $semantic_status_factory, $tracker_factory);
     return new Tracker_CrossSearch_CriteriaBuilder(Tracker_FormElementFactory::instance(), $semantic_value_factory, $trackers);
 }
 /**
  * Retrieves the semantic status field of the given artifact
  * 
  * @return Tracker_FormElement_Field_Selectbox
  */
 public function getField(Tracker_Artifact $artifact)
 {
     $tracker = $artifact->getTracker();
     return Tracker_Semantic_StatusFactory::instance()->getByTracker($tracker)->getField();
 }
 /**
  * Retrieves the semantic status field of the given artifact
  * 
  * @return Tracker_FormElement_Field_Selectbox
  */
 public function getField(Tracker $tracker)
 {
     return Tracker_Semantic_StatusFactory::instance()->getByTracker($tracker)->getField();
 }