Skip navigation links

Package com.orchestranetworks.addon.dama.models

Provide class to retrieve attached assets from media field.

See: Description

Package com.orchestranetworks.addon.dama.models Description

Provide class to retrieve attached assets from media field.

Examples of getting an asset's UUID from a field using the 'MediaType' field

  1. Get the value from the 'MediaType' field:

    The data model used in the following example has a table that contains a field with './Media' path, which is associated with {addon.label}'s 'MediaType' field:

            Adaptation aRecord = aTable.lookUpAdaptationByPrimaryKey(recordPrimaryKey);
            SchemaNode schemaNode = aRecord.getSchemaNode().getNode(Path.parse("./Media"));
            int maxOccurs = schemaNode.getMaxOccurs();
    
            List<MediaType> mediaTypes = new ArrayList<MediaType>();
            Object value = aRecord.get(Path.parse("./Media"));
            if (maxOccurs <= 1)
            {
                    mediaTypes.add((MediaType) value);
            }
            else
            {
                    mediaTypes.addAll((List<MediaType>) value);
            }
    
  2. Get the asset's UUID from the Java bean object 'MediaType':

            String assetUUID = aMediaType.getAttachment();
    
  3. Attaching asset

            //After uploading, an object DigitalAsset is returned. You can get the digital asset primary key from this.
            String assetUUID = digitalAsset.getDigitalAssetContext().getDigitalAssetKey().getDigitalAssetPrimaryKey().format();
            //Create a new procedure to update new value to the MediaType field. 
            //Note: The Drive of new uploaded asset and the Drive of target 'MediaType' field should be the same.
            int maxOccurs = aNode.getMaxOccurs();
            ValueContextForUpdate contextForUpdate = pContext.getContext(aRecordName);
            if (maxOccurs <= 1) {
                    MediaType mediaType = new MediaType();
                    mediaType.setAttachment(assetUUID);
                    contextForUpdate.setValue(mediaType, aPath);
            }
            else
            {
                    List<MediaType> mediaTypes = new ArrayList<MediaType>();
                    MediaType mediaType = new MediaType();
                    mediaType.setAttachment(assetUUID);
                    mediaTypes.add(mediaType);
                    contextForUpdate.setValue(mediaTypes, aPath);
            }
            aProcedure.doModifyContent(aRecord, contextForUpdate);
    
Skip navigation links

Add-ons Version 4.5.22.

Copyright 2001-2025. Cloud Software Group, Inc. All rights reserved.
All third party product and company names and third party marks mentioned in this document are the property of their respective owners and are mentioned for identification.