comparison src/jungle/test/bbs/NetworkJungleBulletinBoard.java @ 57:1bfd13f831ea

add position field in DefaultTreeOperationLogContainer
author one
date Sun, 14 Jul 2013 21:46:40 +0900
parents ccfe9b5e8f11
children 4851344e120e
comparison
equal deleted inserted replaced
56:ccfe9b5e8f11 57:1bfd13f831ea
79 throw new IllegalStateException(); 79 throw new IllegalStateException();
80 } 80 }
81 final long timestamp = new Date().getTime(); 81 final long timestamp = new Date().getTime();
82 /* Put DataSegment */ 82 /* Put DataSegment */
83 try { 83 try {
84 putTreeOperationLog((NetworkDefaultJungleTreeEditor)editor, timestamp); 84 putTreeOperationLog((NetworkDefaultJungleTreeEditor)editor, 0, timestamp);
85 } catch (IOException e1) { 85 } catch (IOException e1) {
86 e1.printStackTrace(); 86 e1.printStackTrace();
87 } 87 }
88 88
89 tree = jungle.getTreeByName(_name); 89 tree = jungle.getTreeByName(_name);
111 } 111 }
112 editor = either.b(); 112 editor = either.b();
113 editor.success(); 113 editor.success();
114 /* Put DataSegment */ 114 /* Put DataSegment */
115 try { 115 try {
116 putTreeOperationLog((NetworkDefaultJungleTreeEditor)editor, timestamp); 116 putTreeOperationLog((NetworkDefaultJungleTreeEditor)editor, 0, timestamp);
117 } catch (IOException e1) { 117 } catch (IOException e1) {
118 e1.printStackTrace(); 118 e1.printStackTrace();
119 } 119 }
120 120
121 } 121 }
157 throw new IllegalStateException(); 157 throw new IllegalStateException();
158 } 158 }
159 editor = either.b(); 159 editor = either.b();
160 either = editor.success(); 160 either = editor.success();
161 try { 161 try {
162 putTreeOperationLog((NetworkDefaultJungleTreeEditor)editor, timestamp); 162 putTreeOperationLog((NetworkDefaultJungleTreeEditor)editor, size, timestamp);
163 } catch (IOException e1) { 163 } catch (IOException e1) {
164 e1.printStackTrace(); 164 e1.printStackTrace();
165 } 165 }
166 }while(either.isA()); 166 }while(either.isA());
167 /* Put DataSegment */ 167 /* Put DataSegment */
194 throw new IllegalStateException(); 194 throw new IllegalStateException();
195 } 195 }
196 editor = either.b(); 196 editor = either.b();
197 either = editor.success(); 197 either = editor.success();
198 try { 198 try {
199 putTreeOperationLog((NetworkDefaultJungleTreeEditor)editor, timestamp); 199 putTreeOperationLog((NetworkDefaultJungleTreeEditor)editor, Integer.parseInt(_uuid), timestamp);
200 } catch (IOException e1) { 200 } catch (IOException e1) {
201 e1.printStackTrace(); 201 e1.printStackTrace();
202 } 202 }
203 }while(either.isA()); 203 }while(either.isA());
204 } 204 }
221 }; 221 };
222 222
223 return new IterableConverter<BoardMessage,Node>(chs,converter); 223 return new IterableConverter<BoardMessage,Node>(chs,converter);
224 } 224 }
225 225
226 private void putTreeOperationLog(NetworkDefaultJungleTreeEditor editor, long timestamp) throws IOException { 226 private void putTreeOperationLog(NetworkDefaultJungleTreeEditor editor, int pos, long timestamp) throws IOException {
227 String uuid = editor.getID(); 227 String uuid = editor.getID();
228 String treeName = editor.getTreeName(); 228 String treeName = editor.getTreeName();
229 String updaterName = editor.getUpdaterName(); 229 String updaterName = editor.getUpdaterName();
230 String revision = editor.getRevision(); 230 String revision = editor.getRevision();
231 Iterable<TreeOperation> log = editor.getTreeOperationLog(); 231 Iterable<TreeOperation> log = editor.getTreeOperationLog();
232 putDataSegment(uuid, treeName, updaterName, log, revision, timestamp); 232 putDataSegment(uuid, treeName, updaterName, log, revision, pos,timestamp);
233 } 233 }
234 234
235 private void putDataSegment(String _uuid, String _treeName, String _updaterName, Iterable<TreeOperation> _log, String nextRevision, long timestamp) throws IOException { 235 private void putDataSegment(String _uuid, String _treeName, String _updaterName, Iterable<TreeOperation> _log, String nextRevision, int pos, long timestamp) throws IOException {
236 DefaultTreeOperationLogContainer container = new DefaultTreeOperationLogContainer(); 236 DefaultTreeOperationLogContainer container = new DefaultTreeOperationLogContainer();
237 container.setTreeName(_treeName); 237 container.setTreeName(_treeName);
238 container.setUUID(_uuid); 238 container.setUUID(_uuid);
239 container.setUpdaterName(_updaterName); 239 container.setUpdaterName(_updaterName);
240 container.setRevision(nextRevision); 240 container.setRevision(nextRevision);
241 container.setPosition(pos);
241 container.unconvert(_log); 242 container.unconvert(_log);
242 container.setTimeStamp(timestamp); 243 container.setTimeStamp(timestamp);
243 HashLogUpdateCodeSegment cs = new HashLogUpdateCodeSegment(); 244 HashLogUpdateCodeSegment cs = new HashLogUpdateCodeSegment();
244 container.getHashLogString(); 245 container.getHashLogString();
245 cs.ods.put("log", container); 246 cs.ods.put("log", container);