1 //!-- UTF8 2 /* 3 Oregano Multiuser Server - Version 1.2.0 - January 4th, 2005 4 5 Web: www.oregano-server.org 6 Mail: info@oregano-server.org 7 8 Copyright 2003 - 2004 - 2004 Jens Halm / Cologne, Germany 9 10 This library is free software; you can redistribute it and/or 11 modify it under the terms of the GNU Lesser General Public 12 License as published by the Free Software Foundation; either 13 version 2.1 of the License, or (at your option) any later version. 14 15 This library is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 Lesser General Public License for more details. 19 20 You should have received a copy of the GNU Lesser General Public 21 License along with this library; if not, write to the Free Software 22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 */ 24 25 /* 26 ------------------------------------------- 27 Classe UpdateRow 28 29 @description : 30 Gère la mise à jour des données d'une Table. 31 32 33 @author Jens Halm copyright http://www.spicefactory.org/ 34 @author erixtekila copyleft http://www.v-i-a.net 35 ------------------------------------------- 36 version history : 37 1.2.0 : 17/01/05 38 - Portage en actionscript 2 pour le 39 compile time type checking 40 ------------------------------------------- 41 */ 42 43 import org.omus.data.Table; 44 45 46 /** 47 * Portion de UpdateSequence. 48 * 49 * @see org.omus.data.UpdateSequence 50 * 51 * @author Jens Halm copyright http://www.spicefactory.org/ 52 * @author erixtekila copyleft http://www.v-i-a.net 53 * @version 1.2.0 54 */ 55 class org.omus.data.UpdateRow 56 { 57 //-------------------- 58 // PROPRIETES 59 //-------------------- 60 /** 61 * Identifiant. 62 */ 63 private var rowID:Number; 64 65 /** 66 * Objet enregistrement. 67 */ 68 private var row:Object; 69 70 //-------------------- 71 // CONSTRUCTEUR 72 //-------------------- 73 /** 74 * 75 * @param id Identifiant de l'enregistrement. 76 * @param obj Enregistrement. 77 */ 78 public function UpdateRow(id:Number, obj:Object) 79 { 80 // Proppriétés. 81 rowID = id; 82 row = obj; 83 84 // trace(this+ " installé."); 85 } 86 87 //-------------------- 88 // METHODES PUBLIQUES 89 //-------------------- 90 /** 91 * Utilisé dans un contexte littéral 92 * @return Une chaine définissant l'objet 93 */ 94 public function toString ():String 95 { 96 return format(0); 97 } 98 99 /** 100 * Initialisation des valeurs à mettre à jour. 101 * 102 * @param table Une référence à la Table à mettre à jour. 103 * @param clientReq true si c'est le client qui effectue la requette, false si cela vient d'un autre utilisateur. 104 */ 105 public function execute (table:Table, clientReq:Boolean):Void 106 { 107 var colNames = table.getDefinition().getColumnNames(); 108 this.row = org.omus.data.DataParser.arrayToRow(row, colNames); 109 if (row != null) table.updateEvent(rowID, row, clientReq); 110 } 111 112 /** 113 * Encodage. 114 * 115 * @return Une chaîne encodée. 116 */ 117 public function getMarshalledSequence ():String 118 { 119 // TODO : Passer la constante dans cette classe. 120 return "#p" + org.omus.data.UpdateSequence.UPDATE_ROW + "#x" + rowID + "#x" + row + "#z"; 121 } 122 123 //-------------------- 124 // METHODES PRIVEES 125 //-------------------- 126 /** 127 * Formatage d'une chaine d'informations sur cet objet. 128 * 129 * @param indent Un nombre d'espace d'indentation. 130 * @return Une chaine formatée. 131 */ 132 private function format (indent:Number):String 133 { 134 var s = "org.omus.UpdateRow - rowID = " + rowID; 135 s += "\n"; 136 for (var idx = 0; idx < indent; idx++) s += " "; 137 s += "row = " + org.omus.util.Log.format(row, indent+1); 138 return s; 139 } 140 141 //-------------------- 142 // METHODES STATIQUES 143 //-------------------- 144 /** 145 * Utilisé dans un contexte littéral 146 * @return Une chaine définissant l'objet 147 */ 148 public static function toLog():String 149 { 150 return "[Object UpdateRow]"; 151 } 152 }