Massive Argeo APIs refactoring
[gpl/argeo-suite.git] / org.argeo.entity.core / src / org / argeo / entity / core / JcrEntityDefinition.java
index f76eb63fa96491b4df5874f246ff896de56cdfa1..d6d124680d15750bf315aa95cfb72babfc8cea25 100644 (file)
@@ -7,13 +7,10 @@ import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.argeo.api.NodeUtils;
+import org.argeo.cms.jcr.CmsJcrUtils;
 import org.argeo.entity.EntityConstants;
 import org.argeo.entity.EntityDefinition;
-import org.argeo.entity.EntityNames;
-import org.argeo.entity.EntityTypes;
 import org.argeo.jcr.Jcr;
-import org.argeo.jcr.JcrUtils;
 import org.osgi.framework.BundleContext;
 
 /** An entity definition based on a JCR data structure. */
@@ -21,21 +18,21 @@ public class JcrEntityDefinition implements EntityDefinition {
        private Repository repository;
 
        private String type;
-       private String defaultEditoryId;
+       private String defaultEditorId;
 
        public void init(BundleContext bundleContext, Map<String, String> properties) throws RepositoryException {
-               Session adminSession = NodeUtils.openDataAdminSession(repository, null);
+               Session adminSession = CmsJcrUtils.openDataAdminSession(repository, null);
                try {
                        type = properties.get(EntityConstants.TYPE);
                        if (type == null)
                                throw new IllegalArgumentException("Entity type property " + EntityConstants.TYPE + " must be set.");
-                       defaultEditoryId = properties.get(EntityConstants.DEFAULT_EDITORY_ID);
-                       String definitionPath = EntityNames.ENTITY_DEFINITIONS_PATH + '/' + type;
-                       if (!adminSession.itemExists(definitionPath)) {
-                               Node entityDefinition = JcrUtils.mkdirs(adminSession, definitionPath, EntityTypes.ENTITY_DEFINITION);
-//                             entityDefinition.addMixin(EntityTypes.ENTITY_DEFINITION);
-                               adminSession.save();
-                       }
+                       defaultEditorId = properties.get(EntityConstants.DEFAULT_EDITOR_ID);
+//                     String definitionPath = EntityNames.ENTITY_DEFINITIONS_PATH + '/' + type;
+//                     if (!adminSession.itemExists(definitionPath)) {
+//                             Node entityDefinition = JcrUtils.mkdirs(adminSession, definitionPath, EntityTypes.ENTITY_DEFINITION);
+////                           entityDefinition.addMixin(EntityTypes.ENTITY_DEFINITION);
+//                             adminSession.save();
+//                     }
                        initJcr(adminSession);
                } finally {
                        Jcr.logout(adminSession);
@@ -53,7 +50,7 @@ public class JcrEntityDefinition implements EntityDefinition {
 
        @Override
        public String getEditorId(Node entity) {
-               return defaultEditoryId;
+               return defaultEditorId;
        }
 
        @Override