org.alfresco.wcm.sandbox.script
Class Asset

java.lang.Object
  extended by org.alfresco.wcm.sandbox.script.Asset
All Implemented Interfaces:
java.io.Serializable

public class Asset
extends java.lang.Object
implements java.io.Serializable

WCM Asset in a sandbox exposed over Java Script API.

See Also:
Serialized Form

Constructor Summary
Asset(Sandbox sandbox, AssetInfo asset)
           
 
Method Summary
 void createFile(java.lang.String name, java.lang.String stringContent)
          create a new file with the specified properties and content.
 void createFolder(java.lang.String name)
          create a new folder
 void deleteAsset()
          Delete this asset, after it has been deleted do not use this asset.
 Asset[] getChildren()
          Get children of this asset, returns an empty array if there are no children.
 java.util.Date getCreatedDate()
           
 java.lang.String getCreatedDateAsISO8601()
           
 java.lang.String getCreator()
          The creator of this asset
 long getFileSize()
           
 java.util.Date getModifiedDate()
           
 java.lang.String getModifiedDateAsISO8601()
           
 java.lang.String getModifier()
           
 java.lang.String getName()
           
 java.lang.String getPath()
          Get the full path of this asset eg.
 java.util.Map getProperties()
          Get the properties as a key value pair.
 Sandbox getSandbox()
          Get the parent sandbox which contains this asset
 int getVersion()
           
 boolean isDeleted()
           
 boolean isFile()
           
 boolean isFolder()
           
 boolean isLocked()
           
 java.lang.String lockOwner()
           
 Asset move(java.lang.String newPath)
          move this asset
 Asset rename(java.lang.String newName)
          rename this asset
 void revert()
          revert this asset
 void submit(java.lang.String submitLabel, java.lang.String submitComment)
          Submit this asset to staging
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Asset

public Asset(Sandbox sandbox,
             AssetInfo asset)
Method Detail

getCreator

public java.lang.String getCreator()
The creator of this asset

Returns:
the creator

getCreatedDate

public java.util.Date getCreatedDate()

getFileSize

public long getFileSize()

getCreatedDateAsISO8601

public java.lang.String getCreatedDateAsISO8601()

getModifier

public java.lang.String getModifier()

getModifiedDate

public java.util.Date getModifiedDate()

getModifiedDateAsISO8601

public java.lang.String getModifiedDateAsISO8601()

rename

public Asset rename(java.lang.String newName)
rename this asset

Parameters:
newName -

move

public Asset move(java.lang.String newPath)
move this asset

Parameters:
newPath -

getName

public java.lang.String getName()

getPath

public java.lang.String getPath()
Get the full path of this asset eg. /www/avm_webapps/ROOT/myFile.jpg

Returns:
the path of this asset.

isFile

public boolean isFile()

isFolder

public boolean isFolder()

isDeleted

public boolean isDeleted()

isLocked

public boolean isLocked()

lockOwner

public java.lang.String lockOwner()

getVersion

public int getVersion()

getProperties

public java.util.Map getProperties()
Get the properties as a key value pair. The key will be either a local qname e.g. "cm:content" or a global qname e.g. "{http://www.alfresco.com/content/1.0}content". Some properties will be updatable, protected properties are not.

Returns:
the properties in a key, value pair

submit

public void submit(java.lang.String submitLabel,
                   java.lang.String submitComment)
Submit this asset to staging

Parameters:
submitLabel -
submitComment -

deleteAsset

public void deleteAsset()
Delete this asset, after it has been deleted do not use this asset.


revert

public void revert()
revert this asset


getChildren

public Asset[] getChildren()
Get children of this asset, returns an empty array if there are no children. Only folders have children.


createFile

public void createFile(java.lang.String name,
                       java.lang.String stringContent)
create a new file with the specified properties and content.

Parameters:
name - the name of the file
stringContent - the content of the file. Can be null.

createFolder

public void createFolder(java.lang.String name)
create a new folder

Parameters:
name - the name of the new folder

getSandbox

public Sandbox getSandbox()
Get the parent sandbox which contains this asset

Returns:
the parent sandbox which contains this asset


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.