2323import io .adminshell .aas .v3 .dataformat .core .util .AasUtils ;
2424import io .adminshell .aas .v3 .dataformat .mapping .MappingException ;
2525import io .adminshell .aas .v3 .model .File ;
26+
2627import java .beans .PropertyDescriptor ;
2728import java .util .List ;
2829
@@ -35,8 +36,8 @@ public class FileMapper extends DefaultMapper<File> {
3536 protected static PropertyDescriptor PROPERTY_MIME_TYPE = AasUtils .getProperty (File .class , "mimeType" );
3637
3738 private static final String FILE_DATA_REFERENCE = "AssetAdministrationShellInterfaceClassLib/FileDataReference" ;
38- private static final String MIME_TYPE_ATTRIBUTE_NAME = "MIMEType" ;
39- private static final String REF_URI_ATTRIBUTE_NAME = "refUri " ;
39+ private static final String MIME_TYPE_ATTRIBUTE_PATH = "AAS:File/ MIMEType" ;
40+ private static final String REF_URI_ATTRIBUTE_PATH = "AAS:File/refURI " ;
4041
4142 public FileMapper () {
4243 super (PROPERTY_VALUE .getName (), PROPERTY_MIME_TYPE .getName ());
@@ -56,11 +57,12 @@ protected void mapProperties(Object parent, AmlParser parser, MappingContext con
5657 throw new MappingException (String .format ("multiple external interfaces are found in file %s %s" , parser .getCurrent ().getID (), parser .getCurrent ().getName ()));
5758
5859 List <AttributeType > attributeTypes = externalInterfaces .get (0 ).getAttribute ();
60+
5961 AttributeType mimeTypeAttribute = attributeTypes .stream ()
60- .filter (x -> x .getName ().equalsIgnoreCase (MIME_TYPE_ATTRIBUTE_NAME ))
62+ .filter (x -> x .getRefSemantic ().get ( 0 ). getCorrespondingAttributePath (). equalsIgnoreCase (MIME_TYPE_ATTRIBUTE_PATH ))
6163 .findFirst ().orElse (null );
6264 AttributeType refUriAttribute = attributeTypes .stream ()
63- .filter (x -> x .getName ().equalsIgnoreCase (REF_URI_ATTRIBUTE_NAME )).findFirst ().orElse (null );
65+ .filter (x -> x .getRefSemantic ().get ( 0 ). getCorrespondingAttributePath (). equalsIgnoreCase (REF_URI_ATTRIBUTE_PATH )).findFirst ().orElse (null );
6466
6567 if (refUriAttribute != null )
6668 ((File ) parent ).setValue (refUriAttribute .getValue () == null ? null : refUriAttribute .getValue ().toString ());
0 commit comments