- setup a multiple repositories (check attached template to setup Oracle DB in this case)
- login in
- select the second repository
- create a workspace
- create a file
- add a comment
- it is not visible
- check the DB table COMMENT, the comment has been created
- there is nothing in the RELATION table though
- check the logs, it shows:
2016-09-08 11:51:34,339 WARN [http-bio-0.0.0.0-8080-exec-19] [org.nuxeo.ecm.platform.comment.impl.CommentManagerImpl] Could not adapt comment relation subject to a document model; check the service relation adapters configur ation
The error is due to problems while retrieving comments in the CommentManagerImpl.getComments method. While debugging it shows that the default repository is used. For example id secondrepo/47b5fd33-3a30-4524-8d23-94f39679136a becomes default/47b5fd33-3a30-4524-8d23-94f39679136a.
Check around this code in CommentManagerImpl.getComments:
List<Statement> statementList = graph.getStatements(null, null, docResource); if (graph instanceof JenaGraph) { // XXX AT: BBB for when repository name was not included in the // resource uri Resource oldDocResource = new QNameResourceImpl(config.documentNamespace, docModel.getId()); statementList.addAll(graph.getStatements(null, null, oldDocResource)); }
The resulting statementList contains mismatched repositories.
Looking at CoreGraph.run(), a call to createId returns wrong localName in QNameResource objects. While graph.getStatements passes oldDocResource to the Graph, it is not used to create the QName Resource:
protected QNameResource createId(String id) { return NodeFactory.createQNameResource(DOCUMENT_NAMESPACE, session.getRepositoryName() + '/' + id); }
Since the session is not passed as a parameter to the graph, it is created in the graph itself:
StatementFinder statementFinder = session == null ? new StatementFinder(statement) : new StatementFinder( statement, session);
As a result, the default repository is used.
maybe adding methods taking the session as a parameter could fix this:
getStatements(Statement statement, Session session) getStatements(Node subject, Node predicate, Node object, Session)
This way the StatementFinder would be created with the proper session, using the right repository.
Also please note that this may be only one issue. After fixing this, one has to check a comment is correctly created and read.