JavaScript methods for the AVM repository

Each of these root objects has different APIs. For more details on this, you can refer to the Alfresco wiki's JavaScript API page at http://wiki.alfresco.com/wiki/3.2_JavaScript_API and see some examples at http://wiki.alfresco.com/wiki/JavaScript_API_Cookbook. In the next section, we will talk about FreeMarker APIs that are available for the AVM repository.

AVM API

avm is the root object for JavaScript APIs, and with this root object you can access the AVM repository. The available APIs for the avm root node are as follows:

  • stores: This returns all store objects in the AVM repository
  • lookupStore(storeid): This returns the store object for the specified store ID
  • lookupStoreRoot(storeid): This returns the root node for the specified store ID
  • lookupNode(path): This returns a single AVM node based on the given full path, including store to the node
  • webappsFolderPath(storeid): This returns the root path to the AVM webapps folder for the specified store ID

AVM store API

When you use any of the previous mentioned AVM API, you will get the object of the AVM store. This store object can have the APIs described next:

  • id: This returns the internal ID of the store
  • name: This returns the name of the store
  • creator: This returns the user who has created this store
  • createdDate: This returns the date on which the store was created
  • lookupRoot: This returns the root node for the store
  • lookupNode(path): This returns the node for the specified path relative to the AVM webapps root folder for the store
  • luceneSearch(query): This executes a search against the store and returns an array of AVM nodes as the result

AVM node API

  • version: Returns node's version. Generally it will be 1 (Head revision).
  • path: Returns fully qualified AVM path to the node.
  • parentPath: Returns fully qualified AVM path to the parent of the node.
  • isDirectory: Returns true if this node is a directory.
  • isFile: Returns true if this node is a file.
  • isLocked: Returns true if this node is currently locked.
  • isLockOwner: Returns true if this node is locked by the current user.
  • hasLockAccess: Returns true if this user has the permission to perform operations on the node when locked. This is true if the item is either unlocked, locked by the current user, or locked and the current user has the Content Manager role in the associated web project.
  • rename(name): This renames the node. In AVM you cannot change the cm:name property directly to change the name.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset