cancel
Showing results for 
Search instead for 
Did you mean: 

Available templates problem found

Victor_Sánchez
Confirmed Champ
Confirmed Champ

Hi team,

I found a problem with the available templates for a new Workspace creation. The problem is if you delete several TemplateRoot (and create others TemplateRoot) in your Domain and it (or them) keeps in the trash (TAB) the query to select available templates has a problem. It does not filter deleted document and the line templates = documentManager.getChildren(tl.get(0).getRef(), targetTypeName); with tl.get(0) is not correct.

Regards, VS!

The source code still on master branch:

https://github.com/nuxeo/nuxeo/blob/master/nuxeo-dm/nuxeo-platform-webapp-core/src/main/java/org/nux...

@Override
public DocumentModelList getTemplates(String targetTypeName) {
   ...
   String query = "SELECT * FROM Document where ecm:primaryType = '%s' AND ecm:path STARTSWITH %s";
   DocumentModelList tl = documentManager.query(String.format(query, TemplateRoot,
                NXQL.escapeString(navigationContext.getCurrentDomainPath())));
   if (tl.isEmpty()) {
      templates = tl;
   } else {
      templates = documentManager.getChildren(tl.get(0).getRef(), targetTypeName);
      List<DocumentModel> deleted = new ArrayList<>();
      for (DocumentModel current : templates) {
         if (current.isTrashed()) {
            deleted.add(current);
         }
      }
      templates.removeAll(deleted);
   }
}
1 ACCEPTED ANSWER

Florent_Guillau
World-Class Innovator
World-Class Innovator

Thanks for the report, NXP-24971 will track this issue.

View answer in original post

1 REPLY 1

Florent_Guillau
World-Class Innovator
World-Class Innovator

Thanks for the report, NXP-24971 will track this issue.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.