projects
/
gpl
/
argeo-suite.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve DocBook support.
[gpl/argeo-suite.git]
/
publishing
/
org.argeo.publishing.ui
/
src
/
org
/
argeo
/
docbook
/
ui
/
DbkTextInterpreter.java
diff --git
a/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkTextInterpreter.java
b/publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkTextInterpreter.java
index f13826bd693f1d66aff097f78e7923db1b79aa7c..51af55e46f02544b1f983515330a914dc57c3ac3 100644
(file)
--- a/
publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkTextInterpreter.java
+++ b/
publishing/org.argeo.publishing.ui/src/org/argeo/docbook/ui/DbkTextInterpreter.java
@@
-5,8
+5,10
@@
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
-import org.argeo.cms.CmsException;
import org.argeo.cms.text.TextInterpreter;
import org.argeo.cms.text.TextInterpreter;
+import org.argeo.jcr.Jcr;
+import org.argeo.jcr.JcrException;
+import org.argeo.jcr.JcrxType;
/** Based on HTML with a few Wiki-like shortcuts. */
public class DbkTextInterpreter implements TextInterpreter {
/** Based on HTML with a few Wiki-like shortcuts. */
public class DbkTextInterpreter implements TextInterpreter {
@@
-20,13
+22,13
@@
public class DbkTextInterpreter implements TextInterpreter {
String raw = convertToStorage(node, content);
validateBeforeStoring(raw);
Node jcrText;
String raw = convertToStorage(node, content);
validateBeforeStoring(raw);
Node jcrText;
- if (!node.hasNode(
DocBookNames
.JCR_XMLTEXT))
- jcrText = node.addNode(
DocBookNames.JCR_XMLTEXT, DocBookTypes.
XMLTEXT);
+ if (!node.hasNode(
Jcr
.JCR_XMLTEXT))
+ jcrText = node.addNode(
Jcr.JCR_XMLTEXT, JcrxType.JCRX_
XMLTEXT);
else
else
- jcrText = node.getNode(
DocBookNames
.JCR_XMLTEXT);
- jcrText.setProperty(
DocBookNames
.JCR_XMLCHARACTERS, raw);
+ jcrText = node.getNode(
Jcr
.JCR_XMLTEXT);
+ jcrText.setProperty(
Jcr
.JCR_XMLCHARACTERS, raw);
} else {
} else {
- throw new
Cms
Exception("Don't know how to interpret " + node);
+ throw new
IllegalArgument
Exception("Don't know how to interpret " + node);
}
} else {// property
Property property = (Property) item;
}
} else {// property
Property property = (Property) item;
@@
-34,7
+36,7
@@
public class DbkTextInterpreter implements TextInterpreter {
}
// item.getSession().save();
} catch (RepositoryException e) {
}
// item.getSession().save();
} catch (RepositoryException e) {
- throw new
Cms
Exception("Cannot set content on " + item, e);
+ throw new
Jcr
Exception("Cannot set content on " + item, e);
}
}
}
}
@@
-44,7
+46,7
@@
public class DbkTextInterpreter implements TextInterpreter {
String raw = raw(item);
return convertFromStorage(item, raw);
} catch (RepositoryException e) {
String raw = raw(item);
return convertFromStorage(item, raw);
} catch (RepositoryException e) {
- throw new
Cms
Exception("Cannot get " + item + " for edit", e);
+ throw new
Jcr
Exception("Cannot get " + item + " for edit", e);
}
}
}
}
@@
-55,20
+57,20
@@
public class DbkTextInterpreter implements TextInterpreter {
if (item instanceof Node) {
Node node = (Node) item;
if (node.isNodeType(DocBookTypes.PARA)) {
if (item instanceof Node) {
Node node = (Node) item;
if (node.isNodeType(DocBookTypes.PARA)) {
- Node jcrText = node.getNode(
DocBookNames
.JCR_XMLTEXT);
- String txt = jcrText.getProperty(
DocBookNames
.JCR_XMLCHARACTERS).getString();
+ Node jcrText = node.getNode(
Jcr
.JCR_XMLTEXT);
+ String txt = jcrText.getProperty(
Jcr
.JCR_XMLCHARACTERS).getString();
// TODO make it more robust
txt = txt.replace("\n", "").replace("\t", "");
return txt;
} else {
// TODO make it more robust
txt = txt.replace("\n", "").replace("\t", "");
return txt;
} else {
- throw new
Cms
Exception("Don't know how to interpret " + node);
+ throw new
IllegalArgument
Exception("Don't know how to interpret " + node);
}
} else {// property
Property property = (Property) item;
return property.getString();
}
} catch (RepositoryException e) {
}
} else {// property
Property property = (Property) item;
return property.getString();
}
} catch (RepositoryException e) {
- throw new
Cms
Exception("Cannot get " + item + " content", e);
+ throw new
Jcr
Exception("Cannot get " + item + " content", e);
}
}
}
}