Rest List Read API supports transitions fields.
An example would be the object "Article" and it's field "Article.Status". Each item has a quality status, whose content resides in the "QualityStatus" object. If we want to obtain the quality status of a certain item for a specific data quality rule, we need to use a transition field with target "QualityStatusEntry.Status" and proper qualification for the "rule" logical key.
Transition field: <Fully qualified field> -> ... -> <n-Fully qualified field>
The quality status of an item of rule "CheckValidGTIN":
Article.Status -> QualityStatusEntry.Status(CheckValidGTIN)
so if i understand you right, i have to create a transition field for each quality and language combination ?
I would prefer to have a field "Product2GMediaAssetDocument.MyNewField" and then write into it via Rest api qualified -> "Product2GMediaAssetDocument.MyNewField(type,quality,language)".
This field would be a proxy for "MediaAssetDocument.MyNewField" which relies on "Res_Text_001".
Is this possible ?
so i found out what you mean. In my example i would request the following field with the rest-api:
"Product2GMediaAssetMap.MediaAsset(MEDIATYPE) -> MediaAssetDocument.MyNewField(LANGUAGE, TYPE)"
And this works!! For everyone "Product2GMediaAssetMap.MediaAsset" does not support Rest-Api by default, you have to enable it in the repository.
My Problem is now, that i also want to write to this field and i think the Rest List Write Api does not support this, right ?
When i write to the field i get the error: "Root entity of field 'Product2GMediaAssetMap.MediaAsset(TYPE) -> MediaAssetDocument.MyNewField(LANGUAGE, TYPE)' is not 'Product2G'". I also have tried to post to "rest/V1.0/list/Product2G/Product2GMediaAssetMap" but with the same result.
2 of 2 people found this helpful
As mentioned earlier Rest List Read API supports transitions fields. I think we can't write data in that fields through Rest API.
I think customization required for this.
Add new MediaAsset field
Let us assume that a text field is desired, then the reversed field type "MediaAssetType.Res_Text100_01" can be take for it.
Active the desired MediaAsset field type
active the reserved MediaAssetType.Res_Text100_01 in the repository
Add a new MediaAsset field for the activated field type:
create then a new field MediaAsset.Res_Text100_01 which has the field type MediaAssetType.Res_Text100_01
Map MediaAsset field to the objects of the field type "ArticleType" (optional)It is only necessary, if customer need the similar case like importing Item/Product2G/Variant with the above defined MediaAsset.Res_Text100_01 field value. Otherwise this step can be ignored, since the user can edit this field value in Desktop UI and Web UI.
Add mapped field type and field
Add a mapped ArticleMediaAssetMapType field type
add a new field type ArticleMediaAssetMapType.Res_Text100_01 which will be mapped to MediaAssetType.Res_Text100_01:
Add a corresponding ArticleMediaAssetMap field
add a new field ArticleMediaAssetMap.Res_Text100_01
Add a corresponding field for other objects
Add such field under Product2GMediaAssetMap, and also under VariantMediaAssetMap if 3ppd is activated.
It is similar to the ArticleMediaAssetMap.Res_Text100_01, e.g. a Product2GMediaAssetMap.Res_Text100_01 which has the same field type "ArticleMediaAssetMapType.Res_Text100_01".
Complete map logic with code
Set a NullPropertyMediator for the mapped field type
Contribute own PropertyMediator to replace the standard one for the mapped MediaAssetProxy field
The contributed class CustomAMAMMediaAssetProxyPropertyMediator should implement the interface methods like following:
- read( MediatorSession session, PropertyData propertyData ): extend the similar logic also for the reserved fields. As a rapid solution it can copy the code from AMAMMediaAssetProxyPropertyMediator and its super class EntityMAMMediaAssetProxyPropertyMediator, then call own JPQL(similar to the com.heiler.ppm.mediaasset.db.query.MediaAssetJPQL.QUERY_SEL_MEDIAASSET_FIELDS_BY_ID) to read the corresponding value for all standard fields and also for the reserved fields, and store them in the business object(see EntityMAMMediaAssetProxyPropertyMediator.setMediaAssetFields(...)).
- write( MediatorSession context, PropertyData propertyData, AttributeChange attributeChange ): same as the one of the standard AMAMMediaAssetProxyPropertyMediator, just copy it.
Add a PropertyPostSetter to transfer the field change
The field change should be transferred from mapped field type ArticleMediaAssetMapType.Res_Text100_01 to the field type MediaAssetType.Res_Text100_01.
The class CustomArticleMediaAssetMapPostSetter should be an implement of the interface PropertyPostSetter and transfer the field change from the mapped field type ArticleMediaAssetMapType.Res_Text100_01 to the MediaAsset field type MediaAssetType.Res_Text100_01. As a concrete example please visit the standard source code com.heiler.ppm.mediaasset.core.internal.command.ArticleMediaAssetMapPostSetter.
thats the answer is was looking for. Thank you. Sadly i can not see all of the pictures in your post, because i don't have access to octa, but i think i now what to do.
Sure Markus. Please try and let me know if you face any issue while working.
Were you able to get this working? We have the same requirement and getting stuck after the repository configuration.
We can see, edit, and export the values on our new articlemediaassetmap fields, but cannot import values to them - which we need to be able to do. I'm guessing this is why Sai is saying we need to complete map logic with code...
to be honest we decided to not build a customizing for this. Our Field is only filled automatically by values from an other system, so we have teached our interface to first add the medias to the products and then write the additional information directly to the media -> "MediaAssetDocument.???"
That was the best and easiest way for us.