[jboss-svn-commits] JBL Code SVN: r6025 - in labs/jbossrules/trunk/drools-repository/src: java/org/drools/repository node_type_definitions

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 30 11:34:07 EDT 2006


Author: michael.neale at jboss.com
Date: 2006-08-30 11:33:59 -0400 (Wed, 30 Aug 2006)
New Revision: 6025

Modified:
   labs/jbossrules/trunk/drools-repository/src/java/org/drools/repository/DslItem.java
   labs/jbossrules/trunk/drools-repository/src/java/org/drools/repository/RulesRepository.java
   labs/jbossrules/trunk/drools-repository/src/node_type_definitions/dsl_node_type.cnd
Log:
moved to use string note file

Modified: labs/jbossrules/trunk/drools-repository/src/java/org/drools/repository/DslItem.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/java/org/drools/repository/DslItem.java	2006-08-30 15:00:12 UTC (rev 6024)
+++ labs/jbossrules/trunk/drools-repository/src/java/org/drools/repository/DslItem.java	2006-08-30 15:33:59 UTC (rev 6025)
@@ -27,6 +27,8 @@
      * The name of the DSL node type
      */
     public static final String DSL_NODE_TYPE_NAME = "drools:dsl_node_type";
+
+    public static final String DSL_CONTENT = "drools:dsl_content";
     
     /**
      * Constructs a DslItem object with the specified node as its node attribute
@@ -69,9 +71,7 @@
                 dslNode = this.node;
             }
             
-            //grab the content of the node and dump it into a string
-            Node contentNode = dslNode.getNode("jcr:content");
-            Property data = contentNode.getProperty("jcr:data");
+            Property data = dslNode.getProperty( DSL_CONTENT );
             return data.getValue().getString();
         }
         catch(Exception e) {
@@ -110,14 +110,10 @@
         }
         
         try {
-            //create the mandatory child node - jcr:content
-            Node resNode = this.node.getNode("jcr:content");
-            resNode.setProperty("jcr:mimeType", "text/plain");
-            resNode.setProperty("jcr:encoding", System.getProperty("file.encoding")); //TODO: is this right?
-            resNode.setProperty("jcr:data", content);
+            
             Calendar lastModified = Calendar.getInstance();
-            lastModified.setTimeInMillis(System.currentTimeMillis());
-            resNode.setProperty("jcr:lastModified", lastModified);
+            this.node.setProperty(LAST_MODIFIED_PROPERTY_NAME, lastModified);
+            this.node.setProperty( DSL_CONTENT, content );
             
             this.node.getSession().save();                      
         }
@@ -153,28 +149,6 @@
         }
     }
     
-    /**
-     * @return a List of DslItem objects encapsulating each Version node in the VersionHistory 
-     *         of this Item's node
-     * @throws RulesRepositoryException
-     */
-    public List getHistory() throws RulesRepositoryException {
-        List returnList = new ArrayList();
-        try {
-            VersionIterator it = this.node.getVersionHistory().getAllVersions();
-            while(it.hasNext()) {
-                Version currentVersion = it.nextVersion();
-                DslItem item = new DslItem(this.rulesRepository, currentVersion);
-                returnList.add(item);
-            }
-        }
-        catch(Exception e) {
-            log.error("Caught exception: " + e);
-            throw new RulesRepositoryException(e);
-        }
-        return returnList;
-    }
-    
     public VersionableItem getPrecedingVersion() throws RulesRepositoryException {
         try {
             Node precedingVersionNode = this.getPrecedingVersionNode();

Modified: labs/jbossrules/trunk/drools-repository/src/java/org/drools/repository/RulesRepository.java
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/java/org/drools/repository/RulesRepository.java	2006-08-30 15:00:12 UTC (rev 6024)
+++ labs/jbossrules/trunk/drools-repository/src/java/org/drools/repository/RulesRepository.java	2006-08-30 15:33:59 UTC (rev 6025)
@@ -470,16 +470,8 @@
             dslNode.setProperty(DslItem.DESCRIPTION_PROPERTY_NAME, "");
             dslNode.setProperty(DslItem.FORMAT_PROPERTY_NAME, DslItem.DSL_FORMAT);
             
-            //create the mandatory child node - jcr:content
-            Node resNode = dslNode.addNode("jcr:content", "nt:resource");
-            resNode.setProperty("jcr:mimeType", "text/plain");
-            resNode.setProperty("jcr:encoding", System.getProperty("file.encoding")); //TODO: is this right?
-            resNode.setProperty("jcr:data", content);
-            Calendar lastModified = Calendar.getInstance();
-            lastModified.setTimeInMillis(System.currentTimeMillis());
-            resNode.setProperty("jcr:lastModified", lastModified);                
-                        
-            dslNode.setProperty(DslItem.LAST_MODIFIED_PROPERTY_NAME, lastModified);
+            dslNode.setProperty( DslItem.DSL_CONTENT, content );
+            dslNode.setProperty(DslItem.LAST_MODIFIED_PROPERTY_NAME, Calendar.getInstance());
             
             this.session.save();
             

Modified: labs/jbossrules/trunk/drools-repository/src/node_type_definitions/dsl_node_type.cnd
===================================================================
--- labs/jbossrules/trunk/drools-repository/src/node_type_definitions/dsl_node_type.cnd	2006-08-30 15:00:12 UTC (rev 6024)
+++ labs/jbossrules/trunk/drools-repository/src/node_type_definitions/dsl_node_type.cnd	2006-08-30 15:33:59 UTC (rev 6025)
@@ -11,4 +11,7 @@
 [drools:dsl_node_type]
 
 // Supertypes
-> 'drools:versionable_node_type','nt:file'
+> 'drools:versionable_node_type'
+
+// Properties
+- drools:dsl_content (string)




More information about the jboss-svn-commits mailing list