Package com.orchestranetworks.addon.dama.ext.componentcontroller


package com.orchestranetworks.addon.dama.ext.componentcontroller

Provides the interface to perform actions on media fields using Digital Asset Component services.

  1. Get an instance of DigitalAssetComponentServices:

            //Provides component context with the information referring to a specific digital asset component.
            DigitalAssetComponentContext componentContext = new DigitalAssetComponentContext(
                    aUserRecord,
                    aMediaPath,
                    aSession);
    
            DriveFactory driveFactory = DriveFactoryProvider.getDriveFactory();
    
            //Get an instance of DigitalAssetComponentServices from 'componentContext'.
            DigitalAssetComponentServices componentController = driveFactory
                    .getDigitalAssetComponentServices(componentContext);
    
  2. Upload, attach, detach assets and get keys of digital assets attached to a media field:

                                                    
            //Upload and attach assets to records
            File uploadFile = new File("sampleFile.png");
            FileResource fileResource = new FileResource(uploadFile);
            List<FileResource> fileResources = new ArrayList<FileResource>();
            fileResources.add(fileResource);
            componentController.upload(fileResources, Action.ATTACH);
    
            //Attach digital assets to the media field of a record
            DigitalAssetKey assetKey = new DigitalAssetKey(PrimaryKey.parseString("assetKey"));
            List<DigitalAssetKey> assetKeys = new ArrayList<DigitalAssetKey>();
            assetKeys.add(assetKey);
            componentController.attach(assetKeys);
    
            //Detach digital asset
            componentController.detach(assetKeys);
            
            //Get digital asset keys, which are attached in media field of a user record
            componentController.getDigitalAssetKeys();