1 Reply Latest reply on Aug 12, 2014 7:15 AM by Stephan Da Silva-Oracle

    Creating Flex attributes using asset api.

    Harish C Gowdra

      Hi All,

       

      I have a requirement where I need to create attributes dynamically and associate to Asset type. I'm trying to use asset api, below is the code. But it is not working. Any idea how can I proceed.

       

      AssetTypeDefManagerImpl atdImpl = new AssetTypeDefManagerImpl(ics);

       

      AttributeDef adef = atdImpl.newAttributeDef();

      aDef.setName("location");

      aDef.setDescription("Location");

      aDef.setType(AttributeTypeEnum.STRING);

      aDef.setIsMandatory(false);

      aDef.setIsMetadataAttribute(false);

       

      AttributeDefProperties aDefProp = new AttributeDefProperties();

      aDefProp.setAssetid(adef);

      aDefProp.setAttributeId(123126432443L);

      aDefProp.setDepType(DependencyTypeEnum.EXISTS);

      aDefProp.setEditable(true);

      aDefProp.setMultiple(adef);

      aDefProp.setOrdinal(adef);

      aDefProp.setRequired(adef);

      aDefProp.setStorageStyle("local");

      aDef.setProperties(aDefProp);

       

      ServicesManager serviceManager = (ServicesManager)ses.getManager(ServicesManager.class.getName());

      AssetService assetService =serviceManager.getAssetService();

       

      AssetTypeDef assetTypeDef = assetService.getDefinition("AVIArticle", "Article");

       

      List attributesList = new ArrayList();

      attributesList.add(aDef);

      assetTypeDef.setAttributeDefs(attributesList);

       

      Thanks,

      Harish