Start stabilising more Suite naming.
[gpl/argeo-suite.git] / org.argeo.suite.core / src / org / argeo / suite / core / SuiteMaintenanceService.java
index 7e54eaa5411bf93a246d3950b9c4759cb4db9f46..1117c5e317843dfd06cf3c0699f45762ac815c3d 100644 (file)
@@ -2,9 +2,12 @@ package org.argeo.suite.core;
 
 import java.io.IOException;
 
+import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
+import org.argeo.entity.EntityNames;
+import org.argeo.entity.EntityType;
 import org.argeo.maintenance.AbstractMaintenanceService;
 
 /** Initialises an Argeo Suite backend. */
@@ -12,8 +15,15 @@ public class SuiteMaintenanceService extends AbstractMaintenanceService {
 
        @Override
        public boolean prepareJcrTree(Session adminSession) throws RepositoryException, IOException {
-               //EntityJcrUtils.getOrAddFormFolder(adminSession.getRootNode(), EntityNames.FORM_BASE);
-               return adminSession.hasPendingChanges();
+               boolean modified = false;
+               Node rootNode = adminSession.getRootNode();
+               if (!rootNode.hasNode(EntityNames.TERM_BASE)) {
+                       rootNode.addNode(EntityNames.TERM_BASE, EntityType.typologies.qualified());
+                       modified = true;
+               }
+               if (modified)
+                       adminSession.save();
+               return modified;
        }
 
 }