Oracle WebCenter Sites (MOSC)

MOSC Banner

update existing assets | Asset API

edited Mar 16, 2016 4:56AM in Oracle WebCenter Sites (MOSC) 5 commentsAnswered

Dears, I have been using Asset API read and write operations, to update an attribute inside a link asset which is contained in a content asset. But the problem is read and update are done successfully but when i check the attribute updated from the contributor UI, i found it not changed.

Here is the code:

I try to read the link attribute (external URL) then updating it to append some text to it

and please note that link asset is contained as an attribute of a content asset

// read asset attributes given asset ID      
Session ses = SessionFactory.getSession();    
   AssetDataManager mgr =(AssetDataManager)
ses.getManager( AssetDataManager.class.getName() );         
  AssetId id = new AssetIdImpl( "Link",linkId );     
  linkId = Long.valueOf(inputLinkValue);    
  List attrNames = new ArrayList();     
  attrNames.add( "externalUrl" );     


  AssetData data = mgr.readAttributes( id, attrNames );   
    AttributeData linkUrlDataName = data.getAttributeData("externalUrl");     
  externalLinkUrl = (String) linkUrlDataName.getData();

// this works fine and link external url is retrieved correctly

// then i will try to update its value:          
   Session ses = SessionFactory.getSession();     
  AssetDataManager adm = (AssetDataManager) ses.getManager( AssetDataManager.class.getName() );      
Iterable assets = adm.read( Arrays.asList( new AssetIdImpl( "Content", Long.valueOf(instance.getAssetID())),new AssetIdImpl( "Link", linkId))

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center