r23021 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23020‎ | r23021 | r23022 >
Date:00:31, 16 June 2007
Author:kim
Status:old
Tags:
Comment:
(implementing recordset save)
* RecordHelper s now all associated with the relevant Record s
Next: find correct WikiDataAPI call or INSERT for each.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Record.php (modified) (history)
  • /trunk/extensions/Wikidata/OmegaWiki/RecordHelper.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/Record.php
@@ -17,7 +17,6 @@
1818
1919 public function __construct($structure) {
2020 $this->structure = $structure;
21 - $this->helper=new RecordHelper($this);
2221 }
2322
2423 public function getStructure() {
@@ -45,6 +44,7 @@
4645
4746 public function setType($type) {
4847 $this->type=$type;
 48+ $this->helper=RecordHelperFactory::getRecordHelper($this);
4949 }
5050
5151 /**only setType if it wasn't set yet.
Index: trunk/extensions/Wikidata/OmegaWiki/RecordHelper.php
@@ -1,23 +1,227 @@
22 <?php
33
44 class RecordHelperFactory {
5 - function __construct() {
6 - # ---
7 - }
85
9 - function getRecordHelper($record) {
10 - $type=$record->type();
 6+ public static function getRecordHelper($record) {
 7+ $type=$record->getType();
118 if (empty($type))
129 return null;
 10+ echo "HELPING $type .... ";
1311 switch($type) {
 12+ case "definition":
 13+ return new DefinitionHelper();
 14+ case "translated-text":
 15+ return new TranslatedTextHelper();
 16+ case "object-attributes":
 17+ return new ObjectAttributesHelper();
 18+ case "synonyms-translations":
 19+ return new SynonymsTranslationsHelper();
 20+ break;
1421 case "expression":
15 - echo "express!";
 22+ return new ExpressionHelper();
1623 break;
17 - case "synonyms-translations":
18 - echo "sinner!";
 24+ case "relations":
 25+ return new RelationsHelper();
1926 break;
 27+ case "relation-type":
 28+ return new RelationTypeHelper();
 29+ break;
 30+ case "other-defined-meaning":
 31+ return new OtherDefinedMeaningHelper();
 32+ break;
 33+ case "reciprocal-relations":
 34+ return new ReciprocalRelationsHelper();
 35+ break;
 36+ case "collection-membership":
 37+ return new CollectionMembershipHelper();
 38+ break;
 39+ case "collection-meaning":
 40+ return new CollectionMeaningHelper();
 41+ case "goto-source":
 42+ return new GotoSourceHelper();
 43+ case "defined-meaning-attributes":
 44+ return new DefinedMeaningAttributesHelper();
 45+ default :
 46+ echo "IGIVEUP ($type) I Give Up! \n";
 47+ break;
2048 }
2149
2250 }
2351 }
 52+
 53+abstract class Helper {
 54+ public function __construct() {
 55+ }
 56+
 57+ public abstract function save();
 58+
 59+}
 60+
 61+class DefinitionHelper extends Helper {
 62+ public function __construct() {
 63+ echo "DefinitionHelper\n";
 64+ Helper::__construct();
 65+ }
 66+
 67+ public function save() {
 68+ /*what to do here eh?*/
 69+ }
 70+
 71+
 72+}
 73+
 74+class TranslatedTextHelper extends Helper {
 75+ public function __construct() {
 76+ echo "TranslatedTextHelper\n";
 77+ Helper::__construct();
 78+ }
 79+
 80+ public function save() {
 81+ /*what to do here eh?*/
 82+ }
 83+
 84+
 85+}
 86+
 87+class ObjectAttributesHelper extends Helper {
 88+ public function __construct() {
 89+ echo "ObjectAttributesHelper\n";
 90+ Helper::__construct();
 91+ }
 92+
 93+ public function save() {
 94+ /*what to do here eh?*/
 95+ }
 96+
 97+
 98+}
 99+
 100+class SynonymsTranslationsHelper extends Helper {
 101+ public function __construct() {
 102+ echo "SynonymsTranslationsHelper\n";
 103+ Helper::__construct();
 104+ }
 105+
 106+ public function save() {
 107+ /*what to do here eh?*/
 108+ }
 109+
 110+
 111+}
 112+
 113+class ExpressionHelper extends Helper {
 114+ public function __construct() {
 115+ echo "ExpressionHelper\n";
 116+ Helper::__construct();
 117+ }
 118+
 119+ public function save() {
 120+ /*what to do here eh?*/
 121+ }
 122+
 123+
 124+}
 125+
 126+
 127+class RelationsHelper extends Helper {
 128+ public function __construct() {
 129+ echo "RelationsHelper\n";
 130+ Helper::__construct();
 131+ }
 132+
 133+ public function save() {
 134+ /*what to do here eh?*/
 135+ }
 136+
 137+
 138+}
 139+
 140+class RelationTypeHelper extends Helper {
 141+ public function __construct() {
 142+ echo "RelationTypeHelper\n";
 143+ Helper::__construct();
 144+ }
 145+
 146+ public function save() {
 147+ /*what to do here eh?*/
 148+ }
 149+}
 150+
 151+class OtherDefinedMeaningHelper extends Helper {
 152+ public function __construct() {
 153+ echo "OtherDefinedMeaningHelper\n";
 154+ Helper::__construct();
 155+ }
 156+
 157+ public function save() {
 158+ /*what to do here eh?*/
 159+ }
 160+
 161+
 162+}
 163+
 164+class ReciprocalRelationsHelper extends Helper {
 165+ public function __construct() {
 166+ echo "ReciprocalRelationsHelper\n";
 167+ Helper::__construct();
 168+ }
 169+
 170+ public function save() {
 171+ /*what to do here eh?*/
 172+ }
 173+
 174+
 175+}
 176+
 177+class CollectionMembershipHelper extends Helper {
 178+ public function __construct() {
 179+ echo "CollectionMembershipHelper\n";
 180+ Helper::__construct();
 181+ }
 182+
 183+ public function save() {
 184+ /*what to do here eh?*/
 185+ }
 186+
 187+
 188+}
 189+
 190+class CollectionMeaningHelper extends Helper {
 191+ public function __construct() {
 192+ echo "CollectionMeaningHelper\n";
 193+ Helper::__construct();
 194+ }
 195+
 196+ public function save() {
 197+ /*what to do here eh?*/
 198+ }
 199+
 200+
 201+}
 202+
 203+class GotoSourceHelper extends Helper {
 204+ public function __construct() {
 205+ echo "GotoSourceHelper\n";
 206+ Helper::__construct();
 207+ }
 208+
 209+ public function save() {
 210+ /*what to do here eh?*/
 211+ }
 212+
 213+
 214+}
 215+
 216+class DefinedMeaningAttributesHelper extends Helper {
 217+ public function __construct() {
 218+ echo "DefinedMeaningAttributesHelper\n";
 219+ Helper::__construct();
 220+ }
 221+
 222+ public function save() {
 223+ /*what to do here eh?*/
 224+ }
 225+
 226+
 227+}
24228 ?>

Status & tagging log