Permalink
Browse files

Fixed up templates to match new site design, added a few methods to t…

…he stack: isTransient, move, and modified some methods to do deep removal as an option. All improvements in this commit.
  • Loading branch information...
ncb000gt committed Mar 3, 2009
1 parent d650fe5 commit e87cdb74255174c93bd14a7a986090238627d5fa
View
@@ -1,42 +1,42 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/java"/>
- <classpathentry kind="src" path="utils/jsdoc-toolkit/java/src"/>
- <classpathentry kind="lib" path="lib/activation.jar"/>
- <classpathentry kind="lib" path="lib/axiom-lucene.jar"/>
- <classpathentry kind="lib" path="lib/axiom.jar"/>
- <classpathentry kind="lib" path="lib/commons-codec.jar"/>
- <classpathentry kind="lib" path="lib/commons-fileupload.jar"/>
- <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
- <classpathentry kind="lib" path="lib/commons-io.jar"/>
- <classpathentry kind="lib" path="lib/commons-logging.jar"/>
- <classpathentry kind="lib" path="lib/concurrent.jar"/>
- <classpathentry kind="lib" path="lib/ehcache.jar"/>
- <classpathentry kind="lib" path="lib/h2.jar"/>
- <classpathentry kind="lib" path="lib/jacob.jar"/>
- <classpathentry kind="lib" path="lib/jai_codec.jar"/>
- <classpathentry kind="lib" path="lib/jai_core.jar"/>
- <classpathentry kind="lib" path="lib/jetty-util.jar"/>
- <classpathentry kind="lib" path="lib/jetty.jar"/>
- <classpathentry kind="lib" path="lib/jimi.jar"/>
- <classpathentry kind="lib" path="lib/jmxri.jar"/>
- <classpathentry kind="lib" path="lib/js.jar"/>
- <classpathentry kind="lib" path="lib/jtidy-r8.jar"/>
- <classpathentry kind="lib" path="lib/junit-4.1.jar"/>
- <classpathentry kind="lib" path="lib/ldap.jar"/>
- <classpathentry kind="lib" path="lib/mail.jar"/>
- <classpathentry kind="lib" path="lib/netcomponents.jar"/>
- <classpathentry kind="lib" path="lib/PDFBox-0.7.2.jar"/>
- <classpathentry kind="lib" path="lib/poi-3.0-alpha2-20060616.jar"/>
- <classpathentry kind="lib" path="lib/poi-scratchpad-3.0-alpha2-20060616.jar"/>
- <classpathentry kind="lib" path="lib/servlet.jar"/>
- <classpathentry kind="lib" path="lib/Wrapper.jar"/>
- <classpathentry kind="lib" path="lib/xmlrpc.jar"/>
- <classpathentry kind="lib" path="utils/jsdoc-toolkit/java/classes/js.jar"/>
- <classpathentry kind="lib" path="utils/jsdoc-toolkit/jsdebug.jar"/>
- <classpathentry kind="lib" path="utils/jsdoc-toolkit/jsrun.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="lib/mime-util.jar"/>
- <classpathentry kind="lib" path="C:/Program Files/Java/jdk1.6.0_07/lib/tools.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="src" path="utils/jsdoc-toolkit/java/src"/>
+ <classpathentry kind="lib" path="lib/activation.jar"/>
+ <classpathentry kind="lib" path="lib/axiom-lucene.jar"/>
+ <classpathentry kind="lib" path="lib/axiom.jar"/>
+ <classpathentry kind="lib" path="lib/commons-codec.jar"/>
+ <classpathentry kind="lib" path="lib/commons-fileupload.jar"/>
+ <classpathentry kind="lib" path="lib/commons-httpclient-3.0.1.jar"/>
+ <classpathentry kind="lib" path="lib/commons-io.jar"/>
+ <classpathentry kind="lib" path="lib/commons-logging.jar"/>
+ <classpathentry kind="lib" path="lib/concurrent.jar"/>
+ <classpathentry kind="lib" path="lib/ehcache.jar"/>
+ <classpathentry kind="lib" path="lib/h2.jar"/>
+ <classpathentry kind="lib" path="lib/jacob.jar"/>
+ <classpathentry kind="lib" path="lib/jai_codec.jar"/>
+ <classpathentry kind="lib" path="lib/jai_core.jar"/>
+ <classpathentry kind="lib" path="lib/jetty-util.jar"/>
+ <classpathentry kind="lib" path="lib/jetty.jar"/>
+ <classpathentry kind="lib" path="lib/jimi.jar"/>
+ <classpathentry kind="lib" path="lib/jmxri.jar"/>
+ <classpathentry kind="lib" path="lib/js.jar" sourcepath="/home/ncampbell/Downloads/rhino1_7R1/xmlimplsrc"/>
+ <classpathentry kind="lib" path="lib/jtidy-r8.jar"/>
+ <classpathentry kind="lib" path="lib/junit-4.1.jar"/>
+ <classpathentry kind="lib" path="lib/ldap.jar"/>
+ <classpathentry kind="lib" path="lib/mail.jar"/>
+ <classpathentry kind="lib" path="lib/netcomponents.jar"/>
+ <classpathentry kind="lib" path="lib/PDFBox-0.7.2.jar"/>
+ <classpathentry kind="lib" path="lib/poi-3.0-alpha2-20060616.jar"/>
+ <classpathentry kind="lib" path="lib/poi-scratchpad-3.0-alpha2-20060616.jar"/>
+ <classpathentry kind="lib" path="lib/servlet.jar"/>
+ <classpathentry kind="lib" path="lib/Wrapper.jar"/>
+ <classpathentry kind="lib" path="lib/xmlrpc.jar"/>
+ <classpathentry kind="lib" path="utils/jsdoc-toolkit/java/classes/js.jar"/>
+ <classpathentry kind="lib" path="utils/jsdoc-toolkit/jsdebug.jar"/>
+ <classpathentry kind="lib" path="utils/jsdoc-toolkit/jsrun.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/mime-util.jar"/>
+ <classpathentry kind="lib" path="C:/Program Files/Java/jdk1.6.0_07/lib/tools.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
@@ -27,6 +27,7 @@
import axiom.framework.IPathElement;
import axiom.objectmodel.db.DbMapping;
+import axiom.objectmodel.db.Transactor;
import axiom.scripting.rhino.MultiValue;
import axiom.scripting.rhino.Reference;
@@ -240,6 +241,12 @@
*/
public boolean remove();
+ /**
+ *
+ *
+ */
+ public boolean remove(boolean deep);
+
/**
*
*
@@ -396,4 +403,8 @@
public void setMultiValue(String name, MultiValue value);
public void setXML(String name, Object value);
+
+ public boolean isTransient();
+
+ public Transactor getLock();
}
@@ -26,6 +26,7 @@
import axiom.framework.IPathElement;
import axiom.objectmodel.db.DbMapping;
import axiom.objectmodel.db.Relation;
+import axiom.objectmodel.db.Transactor;
import axiom.scripting.rhino.MultiValue;
import axiom.scripting.rhino.Reference;
import axiom.util.*;
@@ -480,7 +481,11 @@ public boolean remove() {
return true;
}
-
+
+ public boolean remove(boolean deep) {
+ return this.remove();
+ }
+
/**
*
*
@@ -1009,4 +1014,12 @@ public void setMultiValue(String propname, MultiValue value) {
public void setXML(String propname, Object value) {
// do nothing for now
}
+
+ public Transactor getLock() {
+ return null;
+ }
+
+ public boolean isTransient() {
+ return true;
+ }
}
@@ -1541,17 +1541,29 @@ protected Node getGroupbySubnode(String sid, boolean create) {
return null;
}
+ /**
+ * Remove a node including it's children.
+ *
+ * @return {Boolean} True if successful.
+ */
+ public boolean remove() {
+ return this.remove(true);
+ }
+
/**
*
*
* @return ...
*/
- public boolean remove() {
+ public boolean remove(boolean deep) {
INode parent = getParent();
if (parent != null) {
parent.removeNode(this);
}
- deepRemoveNode();
+
+ if (deep) {
+ deepRemoveNode();
+ }
return true;
}
@@ -3543,4 +3555,15 @@ protected void updateLayersOnReferences(int layer) {
}
}
+ public boolean isTransient() {
+ if (state == TRANSIENT) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public Transactor getLock() {
+ return lock;
+ }
}
@@ -339,6 +339,15 @@ protected void checkNode() {
}
}
+ /**
+ * Check whether the AxiomObject is transient or persisted.
+ *
+ * @return {Boolean} True if transient
+ */
+ public boolean jsFunction_isTransient() {
+ return node.isTransient();
+ }
+
/**
* Get the URL of this object within the application.
*
@@ -3173,7 +3182,11 @@ public static final String getModeStr(Key k) {
*/
public boolean jsFunction_del() throws Exception{
- boolean success = this.node.remove();
+ return jsFunction_del(true);
+ }
+
+ public boolean jsFunction_del(boolean deep) throws Exception{
+ boolean success = this.node.remove(deep);
if (success) {
String name;
@@ -3183,12 +3196,21 @@ public boolean jsFunction_del() throws Exception{
} else if ((name = node.getName()) != null &&
(parent = (AxiomObject) this.getInternalProperty("_parent")) != null) {
parent.calcComputedProps(name);
- }
+ }
this.calcComputedProps("_parent");
}
return success;
}
-
+ /**
+ * Move takes the current object and moves it from the current parent to the specified parent
+ *
+ *
+ * @param {Object} The new parent object
+ * @returns {Boolean} Whether the operation was a success or not
+ */
+ public boolean jsFunction_move(Object parent) throws Exception {
+ return this.setParent(parent);
+ }
}
@@ -84,6 +84,7 @@
public class LuceneQueryDispatcher extends QueryDispatcher {
public static final String PATH_FIELD = "path";
+ static final String EXTENDS_FIELD = "extend";
static final String RECURSE_PATH_MARKER = "**";
public LuceneQueryDispatcher(){
@@ -99,6 +100,11 @@ public ArrayList executeQuery(ArrayList prototypes, IFilter filter,
SortObject sort = getSortObject((Scriptable)options);
ArrayList opaths = getPaths((Scriptable)options);
int _layer = getLayer((Scriptable) options);
+ boolean ext = extendPrototypes((Scriptable) options);
+
+ if (ext) {
+ prototypes = getAllPrototypes(prototypes);
+ }
ArrayList results = new ArrayList();
IndexSearcher searcher = null;
@@ -1315,6 +1321,46 @@ private ArrayList getPaths(Object options) throws Exception{
}
+ private ArrayList<String> getAllPrototypes(ArrayList prototypes) {
+ ArrayList<String> newPrototypes = new ArrayList<String>(prototypes);
+ for (Object p : prototypes) {
+ String proto = p.toString();
+ Prototype childPrototypes = app.typemgr.getPrototype(proto);
+ if (childPrototypes != null) {
+ for (Prototype prototype : childPrototypes.getChildPrototypes()) {
+ newPrototypes.add(prototype.getName());
+ }
+ }
+ }
+ return newPrototypes;
+ }
+
+ private boolean extendPrototypes(Object options) throws Exception {
+ try {
+ boolean ext = false;
+ if (options != null) {
+ Object value = null;
+ if (options instanceof Scriptable) {
+ value = ((Scriptable) options).get(EXTENDS_FIELD, (Scriptable) options);
+ } else if (options instanceof Map) {
+ value = ((Map) options).get(EXTENDS_FIELD);
+ }
+ if (value != null) {
+ if (value instanceof Scriptable) {
+ ext = ScriptRuntime.toBoolean(value);
+ } else if (value instanceof Boolean) {
+ ext = ((Boolean) value).booleanValue();
+ } else if (value instanceof String) {
+ ext = Boolean.parseBoolean((String) value);
+ }
+ }
+ }
+ return ext;
+ } catch (Exception e) {
+ throw e;
+ }
+ }
+
public Object hits(ArrayList prototypes, IFilter filter, Object options) throws Exception {
Object results = null;
@@ -33,23 +33,21 @@
<a href="http://www.axiomstack.com/company/">COMPANY</a>
</li>
</ul>
- </div>
-
-
- <div class="headlines">
- <h1>Documentation</h1>
- <h2>tutorials, references and technical specifications</h2>
- </div>
-
<form action="http://www.axiomstack.com/search" class="search" method="GET" name="search">
<fieldset>
<input id="q" name="q" type="text"/>
</fieldset>
<fieldset>
- <input type="submit" value="Search"/>
+ <input type="submit" value=""/>
</fieldset>
</form>
+ </div>
+
+ <div class="headlines">
+ <h1>Documentation</h1>
+ <h2>tutorials, references and technical specifications</h2>
+ </div>
</div>
<div class="navwrap">
@@ -584,13 +582,5 @@
<div class="legal">&copy; 2008 Axiom Software, Inc. All Rights Reserved</div>
</div>
- <script type="text/javascript">
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-
- var pageTracker = _gat._getTracker("UA-796842-3");
- pageTracker._initData();
- pageTracker._trackPageview();
- </script>
</body>
</html>
Oops, something went wrong.

0 comments on commit e87cdb7

Please sign in to comment.