У меня есть служба, которая пытается импортировать страницы блога в CQ 5.5.0. Я могу успешно создать страницу, но когда я добавляю узлы, представляющие контент, узлы не сохраняются. CQ не сообщает об ошибках, и я вижу узлы в сервисе сразу после создания. Но когда я смотрю на страницу в CRXDE Light, узлы не являются частью содержимого страницы. Раздел кода, который добавляет узлы, находится здесь:
Node blogNode = blogPage.adaptTo(Node.class);
logOutput( INFO, "blogPage name = "+ blogPage.getName() );
// Create the author date node
Node authorDateNode = blogNode.addNode("jcr:content/authorDate", "nt:unstructured");
authorDateNode.setProperty("author", blog.getCreator());
authorDateNode.setProperty("date", sdf.format(blog.getPublishDate().getTime()));
authorDateNode.setProperty("sling:resourceType", "history/components/blog/authordate");
// Create the content node
Node blogPostNode = blogNode.addNode("jcr:content/blogPostBodyParSys", "nt:unstructured");
blogPostNode.setProperty("sling:resourceType", "history/components/parsys");
Node blogContentNode = blogNode.addNode("jcr:content/blogPostBodyParSys/text", "nt:unstructured");
blogContentNode.setProperty("sling:resourceType", "history/components/text");
blogContentNode.setProperty("text", blog.getContent());
blogContentNode.setProperty("textIsRich", "true");
// TODO: Test code only
NodeIterator itr = blogNode.getNode("jcr:content").getNodes();
while(itr.hasNext()) {
Node child = itr.nextNode();
logOutput(INFO, "Child node: " + child.getName(), 1 );
PropertyIterator propItr = child.getProperties();
while( propItr.hasNext() ) {
Property prop = propItr.nextProperty();
logOutput(INFO, "Property " + prop.getName() + ", value " + prop.getValue().getString(),2);
}
}
Тестовый код внизу отображает вновь созданные узлы и значения, как и ожидалось. Последнее, что происходит, — это вызов session.save перед выходом из службы.
Об ошибках не сообщается, но я не вижу узлов, когда смотрю на страницу. Кто-нибудь знает, что здесь может быть не так?