AxiomObject is the base prototype that all user defined prototypes extend. Below are all the built-in properties and methods defined on AxiomObject.
AxiomObject._accessname
Description
AxiomObject._accessname
(String) - The property on this Axiom Object that serves as it's access name.
Also See...
AxiomObject._created
Description
AxiomObject._created
(Date) - The date/time of this Axiom Object's creation.
AxiomObject._id
Description
AxiomObject._id
(Number) - The numeric unique id number associated to this particular instance of an Axiom Object. The "Root" Axiom Object has an id of 0.
Also See...
AxiomObject._lastmodified
Description
AxiomObject._lastmodified
(Date) - The date/time of the last modification made to this Axiom Object.
AxiomObject._parent
Description
AxiomObject._parent
(AxiomObject) - The parent of this Axiom Object.
Examples
obj._parent.remove(obj)
This will call the remove method on the parent of the Axiom Object "obj", removing "obj" from the site.
AxiomObject._prototype
Description
AxiomObject._prototype
(String) - The name of the prototype this Axiom Object is an instance of.
AxiomObject._status
Description
AxiomObject._status
(String) - The current status of this Axiom Object.
Also See...
AxiomObject.length
Description
AxiomObject.length
(Number) - The number of child Axiom Objects the current Axiom Object has.
AxiomObject.accessvalue()
Description
AxiomObject.accessvalue()
Returns the value stored in this Axiom Object's accessname property.
Returns
(String) - Value stored in this Axiom Object's accessname property.
Also See...
AxiomObject.add()
Description
AxiomObject.add(object)
Parameters
- object (AxiomObject) - The Axiom Object to add. It will be added as an immediate child to the current Axiom Object.
Notes
It is important to note that no Axiom Objects are persisted in the data store until they added using AxiomObject.add().
Examples
var cat = new Category(); cat.title = "Axiom"; root.add(cat);
In this example, the Category titled "Axiom" is not persisted until the last line of code.
Also See...
AxiomObject.copy()
Description
AxiomObject.copy(prop, value)
Returns a copy of the current Axiom Object.
Parameters
- prop (String, Optional) - Property to replace in the copy that is returned.
- value (String, Optional) - Value of the specified property to replace in the copy that is returned.
Returns
(AxiomObject) - The copy of the current Axiom Object.
AxiomObject.edit()
Description
AxiomObject.edit(data)
Saves this object, editing properties according to the data passed in.
Parameters
- data (Object) - A JavaScript Object with properties/new values to set for this Axiom Object.
Returns
(Object) - A JavaScript Object with an "errors" property, which contains another JavaScript Object with specifics on the error. This is only returned if an error occurs, otherwise, nothing is returned.
Notes
When setting new values for Reference properties, the path of the Axiom Object to be referenced must be used. For MultiValue Reference properties, the paths of all Axiom Objects to reference (in correct order) separated by a comma must be used.
Examples
Assuming we have a prototype called "Post", an instance of it could be created like this:
var post = new Post(); root.add(post);
Next, we can set many properties on this object as follows:
post.edit({ title: "New Post!", body: new XML("<p>Here is my post!</p>"), categories: "/categories/category1,/category/category2" });
This call to edit will set the title (String), body (XML or XHTML), and categories (MultiValue(Reference)) properties on the Post Axiom Object.
Also See...
AxiomObject.get()
Description
AxiomObject.get(accessname)
Retrieves the child Axiom Object with the specified accessname.
Parameters
- accessname (String) - The accessname of the child Axiom Object.
Returns
(AxiomObject) - The child Axiom Object with the specified accessname.
Examples
var cats = root.get("categories")
This example will retrieve the child Axiom Object whose accessname is "categories".
Also See...
AxiomObject.getAncestor()
Description
AxiomObject.getAncestor(prototype, inclusive)
Returns the most immediate ancestor to the current Axiom Object, based on the prototype passed in.
Parameters
- prototype (String) - Prototype of the Ancestor to return.
- inclusive (Boolean, Optional) - If this is set to true, and the current Axiom Object matches the prototype passed in, the current Axiom Object will be returned.
Returns
(AxiomObject) - The most immediate ancestor to the current Axiom Object, based on the prototype passed in.
AxiomObject.getById()
Description
AxiomObject.getById(id)
Retrieves the child Axiom Object with the specified _id.
Parameters
- id (Number) - The _id number for the child Axiom Object being retrieved.
Returns
(AxiomObject) - The child Axiom Object with the specified _id.
Also See...
AxiomObject.getChildren()
Description
AxiomObject.getChildren(prototypes, filter, options)
Returns an Array of child Axiom Objects that match the criteria specified in the parameters.
Parameters
- prototypes (String or Array, Optional) - A String or Array of Strings of Prototype names that will be searched for matches.
- filter (Filter, Optional) - A search Filter object.
- options (Object, Optional) - An options Object with the following properties/values:
- sort (Sort) - A Sort object. The properties are the fields to sort on, the values are either 'asc' for Ascending, or 'desc' for descending.
- maxlength (Number) - Limit on total number or results returned.
- path (String) - Match objects in the given path.
- unique (Boolean) - Only return unique matches.
Returns
(Array) - An Array of child Axiom Objects that match the criteria specified in the parameters.
AxiomObject.getChildCount()
Description
AxiomObject.getChildCount(prototypes, filter)
Returns the number of child Axiom Objects that match the criteria specified in the parameters.
Parameters
- prototypes (String or Array, Optional) - A String or Array of Strings of Prototype names that will be searched for matches.
- filter (Filter, Optional) - A search Filter object.
Returns
(Number) - The number of child Axiom Objects that match the criteria specified in the parameters.
AxiomObject.getParentPath()
Description
AxiomObject.getParentPath()
Returns the path of the current Axiom Object's parent from the Root.
Returns
(String) - The path of the current Axiom Object's parent from the Root.
Also See...
AxiomObject.getPath()
Description
AxiomObject.getPath()
Returns the path of the current Axiom Object from the Root.
Returns
(String) - The path of the current Axiom Object from the Root.
Also See...
AxiomObject.getPropertyNames()
Description
AxiomObject.getPropertyNames()
Returns an Array of all the properties defined in the current Axiom Object's prototype.properties file.
Returns
(Array) - An Array of Strings consisting of all the properties defined in the current Axiom Object's prototype.properties file.
AxiomObject.getSchema()
Description
AxiomObject.getSchema(showInternal)
Returns the schema of the current Axiom Object.
Parameters
- showInternal (Boolean, Optional) - Shows internal properties (those that start with _) that are set in prototype.properties.
Returns
(Object) - An Object containing the schema of the current Axiom Object.
Examples
If the prototype.properties for the current Axiom Object (current_object) looked like this:
title title.type = String title.default = 'Default Title'
then calling this:
current_object.getSchema()
will return a JavaScript Object whose literal notation would look like this:
{title:{type:{value:"String"}, 'default':{value:"'Default Title'"}, value:""}
AxiomObject.getTALXml()
Description
AxiomObject.getTALXml(tal)
Returns the unevaluated TAL in an XML Object.
Parameters
- tal (String) - Name of the tal file (without the .tal extension) that exists in this Prototype's directory.
Returns
(XML) - The unevaluated TAL in an XML Object.
AxiomObject.getTypePropertyValue()
Description
AxiomObject.getTypePropertyValue(prop)
Returns the value of the specified property from the prototype.properties of this Axiom Object.
Parameters
- prop (String) - The property from prototype.properties to retrieve the value of.
Returns
(String) - The value of the specified property
Examples
If the prototype.properties for the current Axiom Object (current_object) looked like this:
title title.type = String title.default = 'Default Title'
then calling this:
current_object.getTypePropertyValue('title.type')
will return:
String
AxiomObject.getURI()
Description
AxiomObject.getURI(action)
Returns the URI of the current AxiomObject without a trailing slash.
Parameters
- action (String, Optional) - Appends the specified action to the end of the URI.
Returns
(String) - The URI of the current AxiomObject.
Examples
For the following examples, we're assuming "cats" is an Axiom Object that is a child of the "Root" Axiom Object and has an accessname of "categories".
cats.getURI()
This might return something like the following:
/categories
Another Example:
cats.getURI("test")
This might return something like the following:
/categories/test
Also See...
AxiomObject.hasChildren()
Description
AxiomObject.hasChildren()
Returns true if the current Axiom Object has children.
Returns
(Boolean) - True if the current Axiom Object has children.
AxiomObject.href()
Description
AxiomObject.href(action)
Returns the URI of the current AxiomObject with a trailing slash.
Parameters
- action (String, Optional) - Appends the specified action to the end of the URI.
Returns
(String) - The URI of the current AxiomObject.
Examples
For the following examples, we're assuming "cats" is an Axiom Object that is a child of the "Root" Axiom Object and has an accessname of "categories".
cats.href()
This might return something like the following:
/categories/
Another Example:
cats.href("test")
This might return something like the following:
/categories/test/
Also See...
AxiomObject.invalidate()
Description
AxiomObject.invalidate()
Invalidates the node from the internal Axiom object cache, so it is refetched from the database the next time. This is useful in the case of relational database backed objects, where the data in the database tables might have changed from an outside source and you would like to refetch it.
AxiomObject.invalidateResultsCache()
Description
AxiomObject.invalidateResultsCache(functionName)
Invalidates the result in the cache for this Axiom Object, causing it to be refetched at next access. Cache settings can be set using cache.properties.
Parameters
- functionName (String, Optional) - The specific function (function name or tal file name without the extension) that you want to invalidate. If this is not given, all of the function results for this Axiom Object will be invalidated.
Also See...
AxiomObject.isChild()
Description
AxiomObject.isChild(object)
Returns true if the Axiom Object passed in is a child of the current Axiom Object.
Parameters
- object (AxiomObject) - child Axiom Object to check.
Returns
(Boolean) - True if the Axiom Object passed in is a child of the current Axiom Object.
AxiomObject.prefetchChildren()
Description
AxiomObject.prefetchChildren(start, end)
Prefetch the children of an Axiom Object that is backed by relational database storage. It is a way to preload the children from a relational database to save time for future retrieval of those children.
Parameters
- start (Number, Optional) - The index of the child Axiom Object to begin prefetching.
- end (Number, Optional) - The index of the child Axiom Object to end prefetching with.
AxiomObject.remove()
Description
AxiomObject.remove(object)
Removes the specified child object.
Parameters
- object (AxiomObject) - The child object to remove.
Notes Removing a node also deletes it permanently from the data store.
Also See...
AxiomObject.renderTAL()
Description
AxiomObject.renderTAL(tal, data)
Returns the evaluated tal for the specified tal file, using the specified data.
Parameters
- tal (String) - Name of the tal file (without the .tal extension) that exists in this Prototype's directory.
- data (Object) - Object consisting of property/value pairs that will be passed into the TAL file.
Returns
(XML) - The evaluated tal for the specified tal file, using the specified data.
Notes
If the current Prototype has a tal file named "content.tal", then the following two are equivalent:
// Both are equal
var xml1 = AxiomObject.renderTAL("content",data);
var xml2 = AxiomObject.content(data);
AxiomObject.setStatus()
Description
AxiomObject.setStatus(status)
Sets the status of the current Axiom Object.
Parameters
- status (String) - The new status for this object.
Also See...
