## helma.scripting.rhino
Class HopObject

    java.lang.Object
      org.mozilla.javascript.ScriptableObject
          helma.scripting.rhino.HopObject

All Implemented Interfaces:
  PropertyRecorder, java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable, org.mozilla.javascript.Wrapper

    public class HopObject

extends org.mozilla.javascript.ScriptableObject
implements org.mozilla.javascript.Wrapper, PropertyRecorder

See Also:
  Serialized Form

Field Summary

Fields inherited from class org.mozilla.javascript.ScriptableObject
`CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST`

Fields inherited from interface org.mozilla.javascript.Scriptable
`NOT_FOUND`

Constructor Summary
`protected` `HopObject(java.lang.String className, RhinoCore core)` Creates a new HopObject prototype.
`protected` `HopObject(java.lang.String className, RhinoCore core, INode node, org.mozilla.javascript.Scriptable proto)` Creates a new HopObject.

Method Summary
`void` `clearChangeSet()` Clear the set of changed properties.
`void` `defineProperty(java.lang.String propertyName, java.lang.Object value, int attributes)` Overwritten to not define constructor property as constant - we need to have the constructor property resettable in Helma.
`void` `delete(java.lang.String name)`
`java.lang.Object` `get(int idx, org.mozilla.javascript.Scriptable start)`
`java.lang.Object` `get(java.lang.String name, org.mozilla.javascript.Scriptable start)`
`java.lang.Object[]` `getAllIds()` Return all property names of this object.
`java.util.Set` `getChangeSet()` Returns a set containing the names of properties changed since the last time startRecording() was called.
`java.lang.String` `getClassName()`
`java.lang.Object` `getDefaultValue(java.lang.Class hint)` Return a primitive representation for this object.
`java.lang.Object[]` `getIds()` Return all "ordinary" property ids of this object.
`INode` `getNode()` Return the INode wrapped by this HopObject.
`boolean` `has(int idx, org.mozilla.javascript.Scriptable start)`
`boolean` `has(java.lang.String name, org.mozilla.javascript.Scriptable start)` Check if a property is set in this HopObject
`static HopObject` `init(RhinoCore core)` Initialize HopObject prototype for Rhino scope.
`boolean` `jsFunction_add(java.lang.Object child)`
`boolean` `jsFunction_addAt(int index, java.lang.Object child)`
`void` `jsFunction_clearCache()` Clear the node's cache node.
`int` `jsFunction_contains(java.lang.Object obj)` Deprecated. use indexOf(Object) instead.
`int` `jsFunction_count()`
`java.lang.Object` `jsFunction_get(java.lang.Object id)` Get a childObject by name/id or index
`java.lang.Object` `jsFunction_getById(java.lang.Object id)` Get a child object by ID
`java.lang.Object` `jsFunction_getOrderedView(java.lang.String expr)` Retrieve a view having a different order from this Node's subnodelist.
`java.lang.Object` `jsFunction_getResource(java.lang.String resourceName)` Returns a prototype's resource of a given name.
`java.lang.Object` `jsFunction_getResources(java.lang.String resourceName)` Returns an array containing the prototype's resource with a given name.
`java.lang.Object` `jsFunction_href(java.lang.Object action)` Get the href (URL path) of this object within the application.
`int` `jsFunction_indexOf(java.lang.Object obj)` Check if node is contained in the subnode collection.
`boolean` `jsFunction_invalidate(java.lang.Object childId)` Invalidate the node itself or a subnode
`boolean` `jsFunction_isPersistent()` Check whether the wrapped Node is persistent.
`boolean` `jsFunction_isTransient()` Check whether the wrapped Node is transient.
`org.mozilla.javascript.Scriptable` `jsFunction_list(java.lang.Object startArg, java.lang.Object lengthArg)` Return a JS array of child objects with the given start and length.
`java.lang.Object` `jsFunction_persist()` Makes the HopObject and all its reachable descendants persistent.
`void` `jsFunction_prefetchChildren(java.lang.Object startArg, java.lang.Object lengthArg)` Prefetch child objects from (relational) database.
`boolean` `jsFunction_remove(java.lang.Object arg)` Remove this object from the database.
`boolean` `jsFunction_removeChild(java.lang.Object child)` Remove a child node from this node's collection without deleting it from the database.
`boolean` `jsFunction_renderSkin(java.lang.Object skinobj, java.lang.Object paramobj)` Render a skin to the response buffer.
`java.lang.String` `jsFunction_renderSkinAsString(java.lang.Object skinobj, java.lang.Object paramobj)` Render a skin and return its output as string.
`boolean` `jsFunction_set(java.lang.Object id, java.lang.Object value)` Set a property on this HopObject
`int` `jsFunction_size()`
`int` `jsFunction_update()` This method represents the Java-Script-exposed function for updating Subnode-Collections.
`java.lang.Object` `jsGet_cache()`
`void` `put(java.lang.String name, org.mozilla.javascript.Scriptable start, java.lang.Object value)` Set a property in this HopObject
`void` `startRecording()` Tell this PropertyRecorder to start recording changes to properties
`void` `stopRecording()` Tell this PropertyRecorder to stop recording changes to properties
`java.lang.String` `toString()` Return a string representation of this HopObject.
`java.lang.Object` `unwrap()` Returns the wrapped Node.

Methods inherited from class org.mozilla.javascript.ScriptableObject

`associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, equivalentValues, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### HopObject

    protected HopObject(java.lang.String className,
                        RhinoCore core)

  Creates a new HopObject prototype.

  Parameters:
    `className` - the prototype name
    `core` - the RhinoCore

### HopObject

    protected HopObject(java.lang.String className,
                        RhinoCore core,
                        INode node,
                        org.mozilla.javascript.Scriptable proto)

  Creates a new HopObject.

  Parameters:
    `className` - the className
    `core` - the RhinoCore
    `node` - the wrapped node
    `proto` - the object's prototype

Method Detail

### init

    public static HopObject init(RhinoCore core)

  Initialize HopObject prototype for Rhino scope.

  Parameters:
    `core` - the RhinoCore
  Returns:
    the HopObject prototype

### getClassName

    public java.lang.String getClassName()

  Specified by:
    `getClassName` in interface `org.mozilla.javascript.Scriptable`
  Specified by:
    `getClassName` in class `org.mozilla.javascript.ScriptableObject`
  Returns:
    ...

### defineProperty

    public void defineProperty(java.lang.String propertyName,
                               java.lang.Object value,
                               int attributes)

  Overwritten to not define constructor property as constant - we need to have the constructor property resettable in Helma.

  Overrides:
    `defineProperty` in class `org.mozilla.javascript.ScriptableObject`
  Parameters:
    `propertyName` - the property name
    `value` - the proeprty value
    `attributes` - the property attributs

### getDefaultValue

    public java.lang.Object getDefaultValue(java.lang.Class hint)

  Return a primitive representation for this object. FIXME: We always return a string representation.

  Specified by:
    `getDefaultValue` in interface `org.mozilla.javascript.Scriptable`
  Overrides:
    `getDefaultValue` in class `org.mozilla.javascript.ScriptableObject`
  Parameters:
    `hint` - the type hint
  Returns:
    the default value for the object

### getNode

    public INode getNode()

  Return the INode wrapped by this HopObject.

  Returns:
    the wrapped INode instance

### unwrap

    public java.lang.Object unwrap()

  Returns the wrapped Node. Implements unwrap() in interface Wrapper.

  Specified by:
    `unwrap` in interface `org.mozilla.javascript.Wrapper`

### jsGet_cache

    public java.lang.Object jsGet_cache()

  Returns:
    ...

### jsFunction_renderSkin

    public boolean jsFunction_renderSkin(java.lang.Object skinobj,
                                         java.lang.Object paramobj)
                                  throws java.io.UnsupportedEncodingException,
                                         java.io.IOException

  Render a skin to the response buffer.

  Parameters:
    `skinobj` - The skin object or name
    `paramobj` - An optional parameter object
  Returns:
    ...
  Throws:
    `java.io.UnsupportedEncodingException`
    `java.io.IOException`

### jsFunction_getResource

    public java.lang.Object jsFunction_getResource(java.lang.String resourceName)

  Returns a prototype's resource of a given name. Walks up the prototype's inheritance chain if the resource is not found

  Parameters:
    `resourceName` - the name of the resource, e.g. "type.properties", "messages.properties", "script.js", etc.
  Returns:
    the resource, if found, null otherwise

### jsFunction_getResources

    public java.lang.Object jsFunction_getResources(java.lang.String resourceName)

  Returns an array containing the prototype's resource with a given name.

  Parameters:
    `resourceName` - the name of the resource, e.g. "type.properties", "messages.properties", "script.js", etc.
  Returns:
    an array of resources with the given name

### jsFunction_renderSkinAsString

    public java.lang.String jsFunction_renderSkinAsString(java.lang.Object skinobj,
                                                          java.lang.Object paramobj)
                                                   throws java.io.UnsupportedEncodingException,
                                                          java.io.IOException

  Render a skin and return its output as string.

  Parameters:
    `skinobj` - The skin object or name
    `paramobj` - An optional parameter object
  Returns:
    ...
  Throws:
    `java.io.UnsupportedEncodingException`
    `java.io.IOException`

### jsFunction_href

    public java.lang.Object jsFunction_href(java.lang.Object action)
                                     throws java.io.UnsupportedEncodingException,
                                            java.io.IOException

  Get the href (URL path) of this object within the application.

  Parameters:
    `action` - the action name, or null/undefined for the "main" action.
  Returns:
    ...
  Throws:
    `java.io.UnsupportedEncodingException`
    `java.io.IOException`

### jsFunction_get

    public java.lang.Object jsFunction_get(java.lang.Object id)

  Get a childObject by name/id or index

  Parameters:
    `id` - The name/id or index, depending if the argument is a String or Number.
  Returns:
    ...

### jsFunction_getById

    public java.lang.Object jsFunction_getById(java.lang.Object id)

  Get a child object by ID

  Parameters:
    `id` - the child id.
  Returns:
    ...

### jsFunction_set

    public boolean jsFunction_set(java.lang.Object id,
                                  java.lang.Object value)

  Set a property on this HopObject

  Parameters:
    `id` - The name/id or index, depending if the argument is a String or Number.
  Returns:
    ...

### jsFunction_count

    public int jsFunction_count()

  Returns:
    ...

### jsFunction_size

    public int jsFunction_size()

  Returns:
    ...

### jsFunction_prefetchChildren

    public void jsFunction_prefetchChildren(java.lang.Object startArg,
                                            java.lang.Object lengthArg)

  Prefetch child objects from (relational) database.

### jsFunction_clearCache

    public void jsFunction_clearCache()

  Clear the node's cache node.

### jsFunction_list

    public org.mozilla.javascript.Scriptable jsFunction_list(java.lang.Object startArg,
                                                             java.lang.Object lengthArg)

  Return a JS array of child objects with the given start and length.

  Returns:
    A JavaScript Array containing the specified child objects

### jsFunction_add

    public boolean jsFunction_add(java.lang.Object child)

  Parameters:
    `child` - ...
  Returns:
    ...

### jsFunction_addAt

    public boolean jsFunction_addAt(int index,
                                    java.lang.Object child)

  Parameters:
    `index` - ...
    `child` - ...
  Returns:
    ...

### jsFunction_remove

    public boolean jsFunction_remove(java.lang.Object arg)

  Remove this object from the database.

### jsFunction_removeChild

    public boolean jsFunction_removeChild(java.lang.Object child)

  Remove a child node from this node's collection without deleting it from the database.

### jsFunction_persist

    public java.lang.Object jsFunction_persist()

  Makes the HopObject and all its reachable descendants persistent.

  Returns:
    the ID of the newly persisted HopObject or null if operation failed

### jsFunction_invalidate

    public boolean jsFunction_invalidate(java.lang.Object childId)

  Invalidate the node itself or a subnode

### jsFunction_isPersistent

    public boolean jsFunction_isPersistent()

  Check whether the wrapped Node is persistent. This also returns true if the Node is being inserted in the database, or it has been in database and is in the proces of being deleted.

  Returns:
    true if the the wrapped Node has a valid database id.

### jsFunction_isTransient

    public boolean jsFunction_isTransient()

  Check whether the wrapped Node is transient. This also returns false if the Node is being inserted in the database, or it has been in database and is in the proces of being deleted.

  Returns:
    true if the the wrapped Node is not stored in a database.

### jsFunction_indexOf

    public int jsFunction_indexOf(java.lang.Object obj)

  Check if node is contained in the subnode collection. Return its index position if it is, and -1 otherwise.

### jsFunction_contains

    public int jsFunction_contains(java.lang.Object obj)

  Deprecated. use indexOf(Object) instead.

  Check if node is contained in the subnode collection. Return its index position if it is, and -1 otherwise.

### put

    public void put(java.lang.String name,
                    org.mozilla.javascript.Scriptable start,
                    java.lang.Object value)

  Set a property in this HopObject

  Specified by:
    `put` in interface `org.mozilla.javascript.Scriptable`
  Overrides:
    `put` in class `org.mozilla.javascript.ScriptableObject`
  Parameters:
    `name` - property name
    `start` -
    `value` - ...

### has

    public boolean has(java.lang.String name,
                       org.mozilla.javascript.Scriptable start)

  Check if a property is set in this HopObject

  Specified by:
    `has` in interface `org.mozilla.javascript.Scriptable`
  Overrides:
    `has` in class `org.mozilla.javascript.ScriptableObject`
  Parameters:
    `name` - the property name
    `start` - the object in which the lookup began
  Returns:
    true if the property was found

### delete

    public void delete(java.lang.String name)

  Specified by:
    `delete` in interface `org.mozilla.javascript.Scriptable`
  Overrides:
    `delete` in class `org.mozilla.javascript.ScriptableObject`
  Parameters:
    `name` - ...

### get

    public java.lang.Object get(java.lang.String name,
                                org.mozilla.javascript.Scriptable start)

  Specified by:
    `get` in interface `org.mozilla.javascript.Scriptable`
  Overrides:
    `get` in class `org.mozilla.javascript.ScriptableObject`
  Parameters:
    `name` - ...
    `start` - ...
  Returns:
    ...

### getAllIds

    public java.lang.Object[] getAllIds()

  Return all property names of this object. This method is used by debugger.

  Specified by:
    `getAllIds` in interface `org.mozilla.javascript.debug.DebuggableObject`
  Overrides:
    `getAllIds` in class `org.mozilla.javascript.ScriptableObject`
  Returns:
    array containing the names of all properties defined in this object

### getIds

    public java.lang.Object[] getIds()

  Return all "ordinary" property ids of this object. This "hides" the prototype methods.

  Specified by:
    `getIds` in interface `org.mozilla.javascript.Scriptable`
  Overrides:
    `getIds` in class `org.mozilla.javascript.ScriptableObject`
  Returns:
    array containing the names of this object's data properties

### has

    public boolean has(int idx,
                       org.mozilla.javascript.Scriptable start)

  Specified by:
    `has` in interface `org.mozilla.javascript.Scriptable`
  Overrides:
    `has` in class `org.mozilla.javascript.ScriptableObject`
  Parameters:
    `idx` - ...
    `start` - ...
  Returns:
    ...

### get

    public java.lang.Object get(int idx,
                                org.mozilla.javascript.Scriptable start)

  Specified by:
    `get` in interface `org.mozilla.javascript.Scriptable`
  Overrides:
    `get` in class `org.mozilla.javascript.ScriptableObject`
  Parameters:
    `idx` - ...
    `start` - ...
  Returns:
    ...

### toString

    public java.lang.String toString()

  Return a string representation of this HopObject.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representing this HopObject

### startRecording

    public void startRecording()

  Tell this PropertyRecorder to start recording changes to properties

  Specified by:
    `startRecording` in interface `PropertyRecorder`

### stopRecording

    public void stopRecording()

  Tell this PropertyRecorder to stop recording changes to properties

  Specified by:
    `stopRecording` in interface `PropertyRecorder`

### getChangeSet

    public java.util.Set getChangeSet()

  Returns a set containing the names of properties changed since the last time startRecording() was called.

  Specified by:
    `getChangeSet` in interface `PropertyRecorder`
  Returns:
    a Set containing the names of changed properties

### clearChangeSet

    public void clearChangeSet()

  Clear the set of changed properties.

  Specified by:
    `clearChangeSet` in interface `PropertyRecorder`

### jsFunction_update

    public int jsFunction_update()

  This method represents the Java-Script-exposed function for updating Subnode-Collections. The following conditions must be met to make a subnodecollection updateable. .) the collection must be specified with collection.updateable=true .) the id's of this collection must be in ascending order, meaning, that new records do have a higher id than the last record loaded by this collection

### jsFunction_getOrderedView

    public java.lang.Object jsFunction_getOrderedView(java.lang.String expr)

  Retrieve a view having a different order from this Node's subnodelist. The underlying OrderedSubnodeList will keep those views and updates them if the original collection has been updated.

  Parameters:
    `expr` - the order (like sql-order using the properties instead)
  Returns:
    ListViewWrapper holding the information of the ordered view

Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.