• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Moxkiriyaプロジェクト事前開発用の作業部屋


Commit MetaInfo

修订版a5aa3188af7ce071817add77b4c5dfbf35bc0d81 (tree)
时间2018-09-30 13:13:55
作者Harold_Andoh <andolloyd@gmai...>
CommiterHarold_Andoh

Log Message

[Moxkiriya7]

  • 細かい修正をいくつか
  • HistoryBack/Forward機能を追加

更改概述

差异

--- a/src/com/wiki/standalone/moxkiriya/Main.java
+++ b/src/com/wiki/standalone/moxkiriya/Main.java
@@ -64,6 +64,7 @@ public class Main extends Application {
6464 @Override
6565 public void start(Stage primaryStage) {
6666 primaryStage_ = primaryStage;
67+
6768 settingManager_ = SettingManager.getInstance();
6869
6970 try {
@@ -81,7 +82,7 @@ public class Main extends Application {
8182 */
8283 Stage stage = new Stage(StageStyle.UNDECORATED);
8384 stage.initOwner(primaryStage);
84- showInitialSettingsDialog(stage);
85+ showConfigSettingsDialog(stage);
8586 AppRoot = settingManager_.get(SettingManager.SETINGKEY_MOXKIRIYAROOT);
8687 }
8788
@@ -108,11 +109,11 @@ public class Main extends Application {
108109 }
109110
110111 /**
111- * WikirootInputDialogを表示する。
112+ * WikiConfigSettingDialogを表示する。
112113 * @param primaryStage
113114 * @throws Exception
114115 */
115- private void showInitialSettingsDialog(Stage stage) throws Exception {
116+ private void showConfigSettingsDialog(Stage stage) throws Exception {
116117 ConfigSettingsDialog dialog = new ConfigSettingsDialog();
117118 dialog.showDialog(stage, resources_);
118119 }
--- a/src/com/wiki/standalone/moxkiriya/WikiEngine.java
+++ b/src/com/wiki/standalone/moxkiriya/WikiEngine.java
@@ -42,10 +42,14 @@ public class WikiEngine {
4242 /** Page data map. */
4343 private HashMap<String, PageData> pageDataMap_ = null;
4444
45+ /** Wiki history manager. */
46+ private WikiHistory wikiHistory_ = null;
47+
4548 /**
4649 * Constructor.
4750 */
4851 public WikiEngine() {
52+ wikiHistory_ = new WikiHistory();
4953 }
5054
5155 /**
@@ -161,68 +165,39 @@ public class WikiEngine {
161165 * @throws Exception
162166 */
163167 public String parse() throws Exception {
164- WikiBodyBlockParser bodyBlockParser = new WikiBodyBlockParser(wikiRepository_);
165- String bodyHtml = "";
166-
167- PageData currentPageData = null;
168+ PageData pageData = null;
169+ String bodyHtml = "";
168170
169171 if(pageDataMap_.size() == 1) {
170- currentPageData = pageDataMap_.values().iterator().next();
171-
172- /*
173- * Contentsのparse & Body部の構築.
174- */
175- if(currentPageData != null) {
176- /*
177- * ページタイトルのparse.
178- */
179- bodyBlockParser.parsePageTitle(currentPageData.getTitle());
180- BufferedReader buffreader = FileIO.bufferedReader(new StringReader(currentPageData.getContent()));
181-
182- bodyHtml = bodyBlockParser.parse(buffreader)
183- + buildCategoryList(currentPageData);
184-
185- buffreader.close();
186- }
172+ pageData = pageDataMap_.values().iterator().next();
173+ wikiHistory_.add(pageData);
174+ bodyHtml = markupContents(pageData);
187175 }
188176 else {
189- StringBuffer bodybuf = new StringBuffer();
190- ResourceBundle resources_ = ResourceBundle.getBundle("com.wiki.standalone.moxkiriya.resources.moxkiriya");
177+ bodyHtml = markupContentsList();
178+ }
191179
192- bodybuf.append("<h1>" + resources_.getString("key.Search.Result") + "</h1>\n");
193- if(pageDataMap_.size() > 1) {
194- bodybuf.append("<div>\n");
195- bodybuf.append(resources_.getString("key.Message.found.pages") + "\n");
196- bodybuf.append("</div>\n");
197-
198- for(String uuid: pageDataMap_.keySet()) {
199- PageData pageData = pageDataMap_.get(uuid);
200-
201- bodybuf.append("<h3>\n");
202- bodybuf.append("<a href="
203- + "\"" + pageData.getTitle() + "\" "
204- + ATTRIBUTE_JCR_UUID + "="
205- + pageData.getNode().getProperty(Property.JCR_UUID).getString()
206- + ">");
207- bodybuf.append(pageData.getTitle());
208- bodybuf.append("</a>\n");
209- bodybuf.append("</h3>\n");
210- bodybuf.append("<div>\n");
211- bodybuf.append(pageData.getIntroduction());
212- bodybuf.append("</div>\n");
213- }
214- }
215- else {
216- /*
217- * No page was found.
218- */
219- bodybuf.append("<div>\n");
220- bodybuf.append(resources_.getString("key.search.result.message.nopage") + "\n");
221- bodybuf.append("</div>\n");
222- }
180+ /*
181+ * Header部の構築
182+ */
183+ String headerHtml = buildHtmlHeader();
184+ StringBuffer buf = new StringBuffer();
223185
224- bodyHtml = bodybuf.toString();
225- }
186+ buf.append(headerHtml);
187+ buf.append(bodyHtml);
188+ buf.append("</html>");
189+
190+ return buf.toString();
191+ }
192+
193+ /**
194+ * Wikiシンタックスの文字列をHTML形式に変換する。
195+ * @param pageData
196+ * @return HTMLコンテンツ
197+ * @throws Exception
198+ */
199+ public String parse(PageData pageData) throws Exception {
200+ String bodyHtml = markupContents(pageData);
226201
227202 /*
228203 * Header部の構築
@@ -233,9 +208,76 @@ public class WikiEngine {
233208 buf.append(headerHtml);
234209 buf.append(bodyHtml);
235210 buf.append("</html>");
236-
211+
237212 return buf.toString();
238213 }
214+
215+ /**
216+ * Wikiシンタックスの文字列をHTML形式に変換する。
217+ * @return HTMLコンテンツ
218+ * @throws Exception
219+ */
220+ public String markupContents(PageData pageData) throws Exception {
221+ WikiBodyBlockParser bodyBlockParser = new WikiBodyBlockParser(wikiRepository_);
222+ String bodyHtml = "";
223+
224+ /*
225+ * Contentsのparse & Body部の構築.
226+ */
227+ bodyBlockParser.parsePageTitle(pageData.getTitle());
228+ BufferedReader buffreader = FileIO.bufferedReader(new StringReader(pageData.getContent()));
229+
230+ bodyHtml = bodyBlockParser.parse(buffreader)
231+ + buildCategoryList(pageData);
232+
233+ buffreader.close();
234+
235+ return bodyHtml;
236+ }
237+
238+ /**
239+ * PageリストをHTML形式で生成する。
240+ * @return HTMLコンテンツ
241+ * @throws Exception
242+ */
243+ public String markupContentsList() throws Exception {
244+ StringBuffer bodybuf = new StringBuffer();
245+ ResourceBundle resources_ = ResourceBundle.getBundle("com.wiki.standalone.moxkiriya.resources.moxkiriya");
246+
247+ bodybuf.append("<h1>" + resources_.getString("key.Search.Result") + "</h1>\n");
248+ if(pageDataMap_.size() > 1) {
249+ bodybuf.append("<div>\n");
250+ bodybuf.append(resources_.getString("key.Message.found.pages") + "\n");
251+ bodybuf.append("</div>\n");
252+
253+ for(String uuid: pageDataMap_.keySet()) {
254+ PageData pageData = pageDataMap_.get(uuid);
255+
256+ bodybuf.append("<h3>\n");
257+ bodybuf.append("<a href="
258+ + "\"" + pageData.getTitle() + "\" "
259+ + ATTRIBUTE_JCR_UUID + "="
260+ + pageData.getNode().getProperty(Property.JCR_UUID).getString()
261+ + ">");
262+ bodybuf.append(pageData.getTitle());
263+ bodybuf.append("</a>\n");
264+ bodybuf.append("</h3>\n");
265+ bodybuf.append("<div>\n");
266+ bodybuf.append(pageData.getIntroduction());
267+ bodybuf.append("</div>\n");
268+ }
269+ }
270+ else {
271+ /*
272+ * No page was found.
273+ */
274+ bodybuf.append("<div>\n");
275+ bodybuf.append(resources_.getString("key.search.result.message.nopage") + "\n");
276+ bodybuf.append("</div>\n");
277+ }
278+
279+ return bodybuf.toString();
280+ }
239281
240282 /**
241283 * HTMLヘッダ部を構築する。
@@ -405,8 +447,45 @@ public class WikiEngine {
405447 PageData pageData = pageDataMap_.values().iterator().next();
406448 String uuid = pageData.getNode().getProperty(Property.JCR_UUID).getString();
407449
408- pageDataMap_ = wikiRepository_.queryPageUUID(uuid);
450+ pageDataMap_ = wikiRepository_.queryPageUUID(uuid);
409451 }
410452 }
411453 }
454+
455+ /**
456+ * Is there an older node on a history list.
457+ * @return boolean
458+ */
459+ public boolean canBack() {
460+ return wikiHistory_.canBack();
461+ }
462+
463+ /**
464+ * Is there an newer node on a history list.
465+ * @return boolean
466+ */
467+ public boolean canForward() {
468+ return wikiHistory_.canForward();
469+ }
470+
471+ /**
472+ * Execute history back.
473+ * @throws Exception
474+ */
475+ public String back() throws Exception {
476+ PageData pageData = wikiHistory_.back();
477+ setPageDataMap(pageData);
478+ return parse(pageData);
479+ }
480+
481+ /**
482+ * Execute history forward.
483+ * @return PageData
484+ * @throws Exception
485+ */
486+ public String forward() throws Exception {
487+ PageData pageData = wikiHistory_.forward();
488+ setPageDataMap(pageData);
489+ return parse(pageData);
490+ }
412491 }
--- /dev/null
+++ b/src/com/wiki/standalone/moxkiriya/WikiHistory.java
@@ -0,0 +1,123 @@
1+/**
2+ * Moxkiriya standalone Wiki.
3+ * WikiHistory.
4+ *
5+ * @author Ryuhei Terada
6+ * See the '<a href="{@docRoot}/copyright.html">Copyright</a>'
7+ */
8+package com.wiki.standalone.moxkiriya;
9+
10+import java.util.ArrayList;
11+
12+import javax.jcr.Property;
13+
14+/**
15+ * Manage wiki history.
16+ *
17+ *
18+ */
19+public class WikiHistory {
20+ /** History list*/
21+ private ArrayList<PageData> histories_ = new ArrayList<PageData>();
22+
23+ /** Position on history list. */
24+ private int position_ = 0;
25+
26+ /**
27+ * Constructor.
28+ */
29+ public WikiHistory() {
30+ histories_.clear();
31+ }
32+
33+ /**
34+ * Is there an older node on a history list.
35+ * @return boolean
36+ */
37+ public boolean canBack() {
38+ boolean canBack = false;
39+
40+ if(histories_.size() > 1) {
41+ if(position_ > 0) {
42+ canBack = true;
43+ }
44+ }
45+
46+ return canBack;
47+ }
48+
49+ /**
50+ * Is there an newer node on a history list.
51+ * @return boolean
52+ */
53+ public boolean canForward() {
54+ boolean canForward = false;
55+
56+ if(histories_.size() > 0) {
57+ if(position_ < histories_.size() - 1) {
58+ canForward = true;
59+ }
60+ }
61+
62+ return canForward;
63+ }
64+
65+ /**
66+ * Execute history back.
67+ * @return PageData
68+ */
69+ public PageData back() {
70+ PageData pageData = null;
71+
72+ if(canBack() == true) {
73+ position_--;
74+ pageData = histories_.get(position_);
75+ }
76+
77+ return pageData;
78+ }
79+
80+ /**
81+ * Execute history forward.
82+ * @return PageData
83+ */
84+ public PageData forward() {
85+ PageData pageData = null;
86+
87+ if(canForward() == true) {
88+ position_++;
89+ pageData = histories_.get(position_);
90+ }
91+
92+ return pageData;
93+ }
94+
95+ /**
96+ * Add PageData to history list.
97+ * @param pageData
98+ * @throws Exception
99+ */
100+ public void add(PageData pageData) throws Exception {
101+ if(histories_.size() > 0) {
102+ PageData latestPage = histories_.get(position_);
103+ String uuid = latestPage.getNode().getProperty(Property.JCR_UUID).getString();
104+
105+ if(pageData.getNode().getProperty(Property.JCR_UUID).getString().equals(uuid) == true) {
106+ /*
107+ * History中に同じページを連続登録しようとした場合、
108+ */
109+ histories_.remove(position_);
110+ }
111+ else {
112+ position_++;
113+ }
114+ }
115+
116+ for(int count = position_; count < histories_.size(); count++) {
117+ histories_.remove(count);
118+ }
119+
120+ histories_.add(pageData);
121+ position_ = histories_.size() - 1;
122+ }
123+}
--- a/src/com/wiki/standalone/moxkiriya/WikiMainWindow.fxml
+++ b/src/com/wiki/standalone/moxkiriya/WikiMainWindow.fxml
@@ -51,7 +51,7 @@
5151 <Font size="17.0" fx:id="x1" />
5252 </font>
5353 </Button>
54- <Button fx:id="webViewMenuAnchorPaneButtonForward" disable="true" font="$x1" maxHeight="-Infinity" maxWidth="-Infinity" mnemonicParsing="false" prefHeight="35.0" prefWidth="45.0" text="⇨" AnchorPane.leftAnchor="200.0" AnchorPane.topAnchor="4.0" />
54+ <Button fx:id="webViewMenuAnchorPaneButtonForward" disable="true" font="$x1" maxHeight="-Infinity" maxWidth="-Infinity" mnemonicParsing="false" onAction="#onActionButtonForward" prefHeight="35.0" prefWidth="45.0" text="⇨" AnchorPane.leftAnchor="200.0" AnchorPane.topAnchor="4.0" />
5555 <Button fx:id="webViewMenuAnchorPaneButtonReload" maxHeight="-Infinity" maxWidth="-Infinity" mnemonicParsing="false" onAction="#onActionButtonReload" prefHeight="35.0" prefWidth="45.0" text="↻" AnchorPane.leftAnchor="250.0" AnchorPane.topAnchor="4.0">
5656 <font>
5757 <Font size="20.0" fx:id="x2" />
@@ -90,7 +90,7 @@
9090 </items>
9191 </ComboBox>
9292 <Hyperlink fx:id="hyperlinkRedraw" onMouseClicked="#onMouseClickedHyperlinkRedraw" prefHeight="30.0" prefWidth="-1.0" text="%key.PageList.Label.Redraw" AnchorPane.leftAnchor="410.0" AnchorPane.topAnchor="80.0" />
93- <TableView id="TableViewContentList" fx:id="tableViewContentList" editable="true" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="400.0" prefWidth="825.0" AnchorPane.bottomAnchor="50.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="110.0">
93+ <TableView id="TableViewContentList" fx:id="tableViewContentList" editable="true" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="400.0" prefWidth="825.0" AnchorPane.bottomAnchor="50.0" AnchorPane.leftAnchor="150.0" AnchorPane.topAnchor="110.0">
9494 <columns>
9595 <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="45.0" text="" fx:id="tableColumnCheck" />
9696 <TableColumn maxWidth="5000.0" minWidth="10.0" prefWidth="190.0" text="%key.Table.Row.Title" fx:id="tableColumnTitle" />
@@ -110,7 +110,7 @@
110110 <Button fx:id="buttonSave" mnemonicParsing="false" onAction="#onActionButtonSave" prefWidth="90.0" text="%key.Button.Save" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="120.0" />
111111 <Button fx:id="buttonCancel" mnemonicParsing="false" onAction="#onActionButtonCancel" prefWidth="90.0" text="%key.Button.Cancel" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0" />
112112 <TextField fx:id="textFieldAttachFile" disable="true" prefHeight="30.0" prefWidth="716.0" promptText="%key.Edit.TextField.InputPathname" AnchorPane.bottomAnchor="37.0" AnchorPane.leftAnchor="150.0" AnchorPane.rightAnchor="108.0" />
113- <Label disable="true" prefHeight="30.0" prefWidth="166.0" text="%key.Edit.Label.AttachFile" AnchorPane.bottomAnchor="65.0" AnchorPane.leftAnchor="150.0" />
113+ <Label id="textLabelAttacheFile" fx:id="labelAttacheFile" disable="true" prefHeight="30.0" prefWidth="166.0" text="%key.Edit.Label.AttachFile" AnchorPane.bottomAnchor="65.0" AnchorPane.leftAnchor="150.0" />
114114 <Button fx:id="buttonChoiceFile" disable="true" mnemonicParsing="false" onAction="#onActionButtonChoiceFile" prefHeight="30.0" prefWidth="45.0" text="..." AnchorPane.bottomAnchor="35.0" AnchorPane.rightAnchor="55.0" />
115115 </children>
116116 </AnchorPane>
--- a/src/com/wiki/standalone/moxkiriya/WikiMainWindowController.java
+++ b/src/com/wiki/standalone/moxkiriya/WikiMainWindowController.java
@@ -39,6 +39,7 @@ import javafx.scene.control.Button;
3939 import javafx.scene.control.CheckBox;
4040 import javafx.scene.control.ComboBox;
4141 import javafx.scene.control.Hyperlink;
42+import javafx.scene.control.Label;
4243 import javafx.scene.control.MenuItem;
4344 import javafx.scene.control.TableCell;
4445 import javafx.scene.control.TableColumn;
@@ -109,6 +110,7 @@ public class WikiMainWindowController implements Initializable {
109110 @FXML private AnchorPane AnchorPaneEdit;
110111 @FXML private TextField textFieldTitle;
111112 @FXML private TextArea textAreaContents;
113+ @FXML private Label labelAttacheFile;
112114 @FXML private TextField textFieldAttachFile;
113115 @FXML private Button buttonChoiceFile;
114116
@@ -373,16 +375,51 @@ public class WikiMainWindowController implements Initializable {
373375
374376 @FXML
375377 public void onActionButtonBack(ActionEvent event) {
376- /*
377- * TODO implement.
378- */
378+ try {
379+ String content = wikiEngine_.back();
380+ WebEngine webEngine = webView.getEngine();
381+ webEngine.loadContent(content);
382+
383+ HashMap<String, PageData> map = wikiEngine_.getPageDataMap();
384+ boolean canEdit = (map.size() != 1) ? true : false;
385+
386+ choiceViewHyperlinkEdit.setDisable(canEdit);
387+ menuItemNew.setDisable(false);
388+
389+ AnchorPaneEdit.setVisible(false);
390+ AnchorPaneContentList.setVisible(false);
391+ AnchorPaneWebView.setVisible(true);
392+
393+ webViewMenuAnchorPaneButtonBack.setDisable(!wikiEngine_.canBack());
394+ webViewMenuAnchorPaneButtonForward.setDisable(!wikiEngine_.canForward());
395+ } catch (Exception e) {
396+ e.printStackTrace();
397+ }
398+
379399 }
380400
381401 @FXML
382402 public void onActionButtonForward(ActionEvent event) {
383- /*
384- * TODO implement.
385- */
403+ try {
404+ String content = wikiEngine_.forward();
405+ WebEngine webEngine = webView.getEngine();
406+ webEngine.loadContent(content);
407+
408+ HashMap<String, PageData> map = wikiEngine_.getPageDataMap();
409+ boolean canEdit = (map.size() != 1) ? true : false;
410+
411+ choiceViewHyperlinkEdit.setDisable(canEdit);
412+ menuItemNew.setDisable(false);
413+
414+ AnchorPaneEdit.setVisible(false);
415+ AnchorPaneContentList.setVisible(false);
416+ AnchorPaneWebView.setVisible(true);
417+
418+ webViewMenuAnchorPaneButtonBack.setDisable(!wikiEngine_.canBack());
419+ webViewMenuAnchorPaneButtonForward.setDisable(!wikiEngine_.canForward());
420+ } catch (Exception e) {
421+ e.printStackTrace();
422+ }
386423 }
387424
388425 @FXML
@@ -577,10 +614,12 @@ public class WikiMainWindowController implements Initializable {
577614 PageData pageData = new PageData();
578615 String pageTitle = title;
579616
580- namespace = title.substring(0, title.indexOf(":"));
581-
582617 pageData.setNamespace(WikiRepository.PROPERTY_MAIN);
583618
619+ if(title.contains(":")) {
620+ namespace = title.substring(0, title.indexOf(":"));
621+ }
622+
584623 if(namespace.isEmpty() != true) {
585624 pageTitle = title.substring(namespace.length() + ":".length(), title.length());
586625 if(wikiEngine_.isContainsNamespaceList(namespace) == true) {
@@ -597,14 +636,12 @@ public class WikiMainWindowController implements Initializable {
597636 }
598637 }
599638
600- if(namespace.equals(WikiEngine.NAMESPACE_FILE) == true) {
601- textFieldAttachFile.setDisable(false);
602- buttonChoiceFile.setDisable(false);
603- }
604- else {
605- textFieldAttachFile.setDisable(true);
606- buttonChoiceFile.setDisable(true);
607- }
639+ boolean cannotAttacheFile = namespace.equals(WikiEngine.NAMESPACE_FILE) == true
640+ ? false
641+ : true;
642+ textFieldAttachFile.setDisable(cannotAttacheFile);
643+ labelAttacheFile.setDisable(cannotAttacheFile);
644+ buttonChoiceFile.setDisable(cannotAttacheFile);
608645
609646 /*
610647 * 各コントロールの初期値を入力する。
@@ -632,19 +669,22 @@ public class WikiMainWindowController implements Initializable {
632669 */
633670 public void loadWikiContent() {
634671 try {
672+ WebEngine webEngine = webView.getEngine();
673+ webEngine.loadContent(wikiEngine_.parse());
674+
635675 HashMap<String, PageData> map = wikiEngine_.getPageDataMap();
636676 boolean canEdit = (map.size() != 1) ? true : false;
637677
638678 choiceViewHyperlinkEdit.setDisable(canEdit);
639679
640- WebEngine webEngine = webView.getEngine();
641-
642- webEngine.loadContent(wikiEngine_.parse());
643-
680+
644681 menuItemNew.setDisable(false);
645682 AnchorPaneEdit.setVisible(false);
646683 AnchorPaneContentList.setVisible(false);
647684 AnchorPaneWebView.setVisible(true);
685+
686+ webViewMenuAnchorPaneButtonBack.setDisable(!wikiEngine_.canBack());
687+ webViewMenuAnchorPaneButtonForward.setDisable(!wikiEngine_.canForward());
648688 } catch (Exception e) {
649689 e.printStackTrace();
650690 }
--- a/src/com/wiki/standalone/moxkiriya/WikiRepository.java
+++ b/src/com/wiki/standalone/moxkiriya/WikiRepository.java
@@ -20,14 +20,12 @@ import javax.jcr.NamespaceException;
2020 import javax.jcr.NamespaceRegistry;
2121 import javax.jcr.Node;
2222 import javax.jcr.NodeIterator;
23-import javax.jcr.PathNotFoundException;
2423 import javax.jcr.Property;
2524 import javax.jcr.Repository;
2625 import javax.jcr.RepositoryException;
2726 import javax.jcr.Session;
2827 import javax.jcr.Value;
2928 import javax.jcr.ValueFactory;
30-import javax.jcr.ValueFormatException;
3129 import javax.jcr.Workspace;
3230 import javax.jcr.nodetype.NodeType;
3331 import javax.jcr.query.Query;
@@ -215,18 +213,18 @@ public class WikiRepository {
215213 FileData fileData = pageData.getFileData();
216214
217215 if(fileData != null) {
218- Node fileNode = node.getNode(WikiRepository.NODE_FILE);
219-
220- if(fileNode == null) {
216+ Node fileNode;
217+ if(node.hasNode(WikiRepository.NODE_FILE) == true) {
218+ fileNode = node.getNode(WikiRepository.NODE_FILE);
219+ }
220+ else {
221221 fileNode = node.addNode(WikiRepository.NODE_FILE, NodeType.NT_FILE);
222222 fileNode.addNode(Property.JCR_CONTENT, NodeType.NT_RESOURCE);
223223 }
224224
225- Node nodeResource = fileNode.getNode(Property.JCR_CONTENT);
226-
225+ Node nodeResource = fileNode.getNode(Property.JCR_CONTENT);
227226 ValueFactory valueFactory = session_.getValueFactory();
228227
229-
230228 nodeResource.setProperty(Property.JCR_DATA, valueFactory.createBinary(fileData.getInputStream()));
231229 nodeResource.setProperty(Property.JCR_MIMETYPE, new StringValue(fileData.getMimeType()));
232230 nodeResource.setProperty(Property.JCR_LAST_MODIFIED, valueFactory.createValue(fileData.getLastModified()));
@@ -419,7 +417,7 @@ public class WikiRepository {
419417 createCategoryPages(node);
420418
421419 String uuid = node.getProperty(Property.JCR_UUID).getString();
422-
420+
423421 return new PageData(session_.getNodeByIdentifier(uuid));
424422 }
425423