com.versionone.apiclient

## Class Asset

- java.lang.Object
- - com.versionone.apiclient.Asset

-     public class Asset
      extends Object

  Represents one Asset in the VersionOne system. Assets are Projects, Stories, Tasks, etc

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Asset(IAssetType assetType)` Create based on type
    `Asset(Oid oid)` Create from Object Id

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `acceptChanges()` Accept changes to asset
    `void` | `addAttributeValue(IAttributeDefinition attributeDefinition, Object value)` Add an attribute value
    `void` | `clearAttributeCache(IAttributeDefinition attributeDefinition)` Clear an attribute from cache based on definition.
    `Attribute` | `ensureAttribute(IAttributeDefinition attributeDefinition)`
    `void` | `forceAttributeValue(IAttributeDefinition attributeDefinition, Object value)` Force an attribute to a value
    `IAssetType` | `getAssetType()` Get type information
    `Attribute` | `getAttribute(IAttributeDefinition attributeDefinition)` Get an attribute based on definition
    `Map<String,Attribute>` | `getAttributes()` Get asset attributes
    `List<Asset>` | `getChildren()` Get child assets
    `Map<String,Asset>` | `getNewAssets()` Used to add new relationships and get new assets
    `Oid` | `getOid()` Get Asset Object Identifier
    `boolean` | `hasChanged()` Determine if something changed
    `void` | `loadAttributeValue(IAttributeDefinition attributeDefinition, Object value)`
    `void` | `rejectChanges()` Reject changes to this asset
    `void` | `removeAttributeValue(IAttributeDefinition attributeDefinition, Object value)` Remove an attribute value
    `void` | `setAttributeValue(IAttributeDefinition attributeDefinition, Object value)` Set an attribute value
    `void` | `setOid(Oid value)` This method is used by Service after a new asset has been created.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Asset

          public Asset(Oid oid)

      Create from Object Id
      Parameters:
        `oid` - - Oid data

    - #### Asset

          public Asset(IAssetType assetType)

      Create based on type
      Parameters:
        `assetType` - - IAssetType

  - ### Method Detail

    - #### getAssetType

          public IAssetType getAssetType()

      Get type information
      Returns:
        IAssetType

    - #### getOid

          public Oid getOid()

      Get Asset Object Identifier
      Returns:
        Oid

    - #### setOid

          public void setOid(Oid value)
                      throws OidException

      This method is used by Service after a new asset has been created. the result of create returns the oid
      Parameters:
        `value` - - Oid
      Throws:
        `OidException` - - when the new oid is a different type of asset

    - #### getAttributes

          public Map<String,Attribute> getAttributes()

      Get asset attributes
      Returns:
        Map data

    - #### getNewAssets

          public Map<String,Asset> getNewAssets()

      Used to add new relationships and get new assets
      Returns:
        Map

    - #### getChildren

          public List<Asset> getChildren()

      Get child assets
      Returns:
        List

    - #### setAttributeValue

          public void setAttributeValue(IAttributeDefinition attributeDefinition,
                                        Object value)
                                 throws APIException

      Set an attribute value
      Parameters:
        `attributeDefinition` - attribute definition
        `value` - attribute value
      Throws:
        `APIException` - Throws APIException

    - #### forceAttributeValue

          public void forceAttributeValue(IAttributeDefinition attributeDefinition,
                                          Object value)
                                   throws APIException

      Force an attribute to a value
      Parameters:
        `attributeDefinition` - IAttributeDefinition
        `value` - Object
      Throws:
        `APIException` - APIException

    - #### addAttributeValue

          public void addAttributeValue(IAttributeDefinition attributeDefinition,
                                        Object value)
                                 throws APIException

      Add an attribute value
      Parameters:
        `attributeDefinition` - - IAttributeDefinition
        `value` - - Object
      Throws:
        `APIException` - - exception throws

    - #### removeAttributeValue

          public void removeAttributeValue(IAttributeDefinition attributeDefinition,
                                           Object value)
                                    throws APIException

      Remove an attribute value
      Parameters:
        `attributeDefinition` - - IAttributeDefinition
        `value` - - Object
      Throws:
        `APIException` - - APIException throws

    - #### clearAttributeCache

          public void clearAttributeCache(IAttributeDefinition attributeDefinition)

      Clear an attribute from cache based on definition.
      Parameters:
        `attributeDefinition` - definition of attribute to clear; if null, all attributes will be cleared from cache.

    - #### getAttribute

          public Attribute getAttribute(IAttributeDefinition attributeDefinition)
                                 throws MetaException

      Get an attribute based on definition
      Parameters:
        `attributeDefinition` - - IAttributeDefinition
      Returns:
        Attribute - Attribute
      Throws:
        `MetaException` - - MetaException

    - #### acceptChanges

          public void acceptChanges()

      Accept changes to asset

    - #### rejectChanges

          public void rejectChanges()

      Reject changes to this asset

    - #### hasChanged

          public boolean hasChanged()

      Determine if something changed
      Returns:
        boolean - return boolean value

    - #### loadAttributeValue

          public void loadAttributeValue(IAttributeDefinition attributeDefinition,
                                         Object value)
                                  throws APIException

      Throws:
        `APIException`

    - #### ensureAttribute

          public Attribute ensureAttribute(IAttributeDefinition attributeDefinition)
                                    throws APIException

      Throws:
        `APIException`

Copyright © 2022 VersionOne, Inc.. All rights reserved.