Start stabilising more Suite naming.
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 2 Nov 2020 04:30:35 +0000 (05:30 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 2 Nov 2020 04:30:35 +0000 (05:30 +0100)
knowledge/org.argeo.support.odk/bnd.bnd
knowledge/org.argeo.support.odk/src/org/argeo/support/odk/OrxListType.java [new file with mode: 0644]
knowledge/org.argeo.support.xforms/src/org/argeo/support/xforms/xforms.cnd
org.argeo.entity.api/src/org/argeo/entity/EntityNames.java
org.argeo.entity.api/src/org/argeo/entity/EntityType.java
org.argeo.entity.api/src/org/argeo/entity/entity.cnd
org.argeo.suite.core/src/org/argeo/suite/core/SuiteMaintenanceService.java

index caa9dcee01431afc629017903613d091960c23e0..619b258f6b34bdbdc20185dd5043a7f2afa4dcd0 100644 (file)
@@ -13,4 +13,5 @@ OSGI-INF/odkSubmissionServlet.xml
 
 Import-Package:\
 org.osgi.service.http.context,\
 
 Import-Package:\
 org.osgi.service.http.context,\
+org.argeo.naming,\
 *
 *
diff --git a/knowledge/org.argeo.support.odk/src/org/argeo/support/odk/OrxListType.java b/knowledge/org.argeo.support.odk/src/org/argeo/support/odk/OrxListType.java
new file mode 100644 (file)
index 0000000..0b7a963
--- /dev/null
@@ -0,0 +1,27 @@
+package org.argeo.support.odk;
+
+import org.argeo.jcr.QualifiedName;
+
+/** Types related to the http://openrosa.org/xforms/xformsList namespace. */
+public enum OrxListType implements QualifiedName {
+       xform;
+
+       @Override
+       public String getPrefix() {
+               return prefix();
+       }
+
+       public static String prefix() {
+               return "orxList";
+       }
+
+       @Override
+       public String getNamespace() {
+               return namespace();
+       }
+
+       public static String namespace() {
+               return "http://openrosa.org/xforms/xformsList";
+       }
+
+}
index a9f986aeebf82c817801458ed827aaeace602316..c24dbaeed73e945167657c1989d0455608e56159 100644 (file)
@@ -1,10 +1,12 @@
 <xforms = "http://www.w3.org/2002/xforms">
 
 [xforms:model]
 <xforms = "http://www.w3.org/2002/xforms">
 
 [xforms:model]
-+ xforms:instance (nt:base) = nt:unstructured *
++ xforms:instance (xforms:instance) = xforms:instance *
 + xforms:bind (xforms:bind) = xforms:bind *
 + xforms:setvalue (xforms:setvalue) = xforms:setvalue *
 
 + xforms:bind (xforms:bind) = xforms:bind *
 + xforms:setvalue (xforms:setvalue) = xforms:setvalue *
 
+[xforms:instance] > nt:unstructured
+
 [xforms:bind]
 - * (STRING)
 
 [xforms:bind]
 - * (STRING)
 
index f8c88401ba36671bed308a2b5149c66ebcba1d4e..f32c262ab07fc36f1f3bd47f31def6980a8a33d7 100644 (file)
@@ -4,10 +4,12 @@ import org.argeo.naming.LdapAttrs;
 
 /** Constants used to name entity structures. */
 public interface EntityNames {
 
 /** Constants used to name entity structures. */
 public interface EntityNames {
-       final String ENTITY_DEFINITIONS_PATH = "/entity";
-       final String TYPOLOGIES_PATH = "/class";
        final String FORM_BASE = "form";
        final String FORM_BASE = "form";
+       final String TERM_BASE = "term";
 
 
+       final String ENTITY_DEFINITIONS_PATH = "/entity";
+       @Deprecated
+       final String TYPOLOGIES_PATH = "/" + TERM_BASE;
        /** Administrative units. */
        final String ADM = "adm";
 
        /** Administrative units. */
        final String ADM = "adm";
 
index f0905d8ea289e3d71d6b6705fe47986d9605d072..00a7803ecaf92c54f179596207403bb23079df78 100644 (file)
@@ -1,15 +1,13 @@
 package org.argeo.entity;
 
 package org.argeo.entity;
 
-import org.argeo.naming.QualifiedName;
+import org.argeo.jcr.QualifiedName;
 
 /** Types related to entities. */
 public enum EntityType implements QualifiedName {
        // entity
        entity, definition,
 
 /** Types related to entities. */
 public enum EntityType implements QualifiedName {
        // entity
        entity, definition,
-       // xml
-       xmlvalue, xmltext,
        // typology
        // typology
-       typology, term,
+       typologies, terms, term,
        // form
        form, formSet,
        // ldap
        // form
        form, formSet,
        // ldap
index 45be8adee863bbf59498f0f57c4127944e5e39d7..618487b572187d0fdc0b025df073dd7dda260cf0 100644 (file)
@@ -31,13 +31,16 @@ orderable
 //
 // TYPOLOGY
 //
 //
 // TYPOLOGY
 //
+[entity:typologies]
++ * (entity:terms) = entity:terms
+
 [entity:term]
 orderable
 [entity:term]
 orderable
-+ * (entity:term) *
++ * (entity:term) = entity:term *
 
 
-[entity:typology] > mix:referenceable, mix:created
+[entity:terms] > mix:referenceable
 orderable
 orderable
-+ * (entity:term) *
++ * (entity:term) = entity:term *
 
 //
 // FORM
 
 //
 // FORM
index 7e54eaa5411bf93a246d3950b9c4759cb4db9f46..1117c5e317843dfd06cf3c0699f45762ac815c3d 100644 (file)
@@ -2,9 +2,12 @@ package org.argeo.suite.core;
 
 import java.io.IOException;
 
 
 import java.io.IOException;
 
+import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
 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. */
 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 {
 
        @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;
        }
 
 }
        }
 
 }