1212import org .slf4j .Logger ;
1313import org .slf4j .LoggerFactory ;
1414
15- @ ServiceName (value = "*" , type = ApplicationService .class )
1615public class AttachmentsHandlerUtils {
1716
1817 private static final Logger logger = LoggerFactory .getLogger (AttachmentsHandlerUtils .class );
@@ -55,7 +54,7 @@ public static Map<String, String> getAttachmentPathMapping(
5554
5655 return pathMapping ;
5756 } catch (Exception e ) {
58- logger .error ("Error getting attachment path mapping" , e );
57+ logger .error ("Error getting attachment path mapping" , e . getMessage () );
5958 return new HashMap <>();
6059 }
6160 }
@@ -64,11 +63,11 @@ private static void processDirectAttachmentComposition(
6463 CdsEntity entity , Map <String , String > pathMapping , Object composition ) {
6564 String compositionName = ((com .sap .cds .reflect .CdsElement ) composition ).getName ();
6665 if (((com .sap .cds .reflect .CdsElement ) composition ).getType ().isAssociation ()) {
67- CdsAssociationType assocType =
66+ CdsAssociationType associationType =
6867 (CdsAssociationType ) ((com .sap .cds .reflect .CdsElement ) composition ).getType ();
6968 String targetAspect =
70- assocType .getTargetAspect ().isPresent ()
71- ? assocType .getTargetAspect ().get ().getQualifiedName ()
69+ associationType .getTargetAspect ().isPresent ()
70+ ? associationType .getTargetAspect ().get ().getQualifiedName ()
7271 : null ;
7372
7473 if (isDirectAttachmentTargetAspect (targetAspect )) {
@@ -90,18 +89,18 @@ private static void processNestedAttachmentComposition(
9089 String compositionTargetEntityName = "" ;
9190
9291 if (((com .sap .cds .reflect .CdsElement ) composition ).getType ().isAssociation ()) {
93- CdsAssociationType assocType =
92+ CdsAssociationType associationType =
9493 (CdsAssociationType ) ((com .sap .cds .reflect .CdsElement ) composition ).getType ();
9594 String targetAspect =
96- assocType .getTargetAspect ().isPresent ()
97- ? assocType .getTargetAspect ().get ().getQualifiedName ()
95+ associationType .getTargetAspect ().isPresent ()
96+ ? associationType .getTargetAspect ().get ().getQualifiedName ()
9897 : null ;
9998
10099 if (isDirectAttachmentTargetAspect (targetAspect )) {
101100 return ; // Skip direct attachment compositions
102101 }
103102
104- compositionTargetEntityName = assocType .getTarget ().getQualifiedName ();
103+ compositionTargetEntityName = associationType .getTarget ().getQualifiedName ();
105104 }
106105
107106 processCompositionTargetEntity (
@@ -252,7 +251,6 @@ private static List<Map<String, Object>> processAttachmentKey(
252251 // Check if the parent matches (if parentKey is specified)
253252 if (parentKey == null || isCorrectParentContext (currentParentKey , parentKey )) {
254253 try {
255- @ SuppressWarnings ("unchecked" )
256254 List <Map <String , Object >> attachments = (List <Map <String , Object >>) value ;
257255 result .addAll (attachments );
258256 } catch (ClassCastException e ) {
@@ -268,7 +266,6 @@ private static List<Map<String, Object>> processNestedMap(
268266 List <Map <String , Object >> result = new ArrayList <>();
269267
270268 try {
271- @ SuppressWarnings ("unchecked" )
272269 Map <String , Object > nestedMap = (Map <String , Object >) value ;
273270 result .addAll (findNestedAttachments (nestedMap , attachmentKey , parentKey , key ));
274271 } catch (ClassCastException e ) {
@@ -286,7 +283,6 @@ private static List<Map<String, Object>> processNestedList(
286283 List <?> list = (List <?>) value ;
287284 for (Object item : list ) {
288285 if (item instanceof Map ) {
289- @ SuppressWarnings ("unchecked" )
290286 Map <String , Object > itemMap = (Map <String , Object >) item ;
291287 result .addAll (findNestedAttachments (itemMap , attachmentKey , parentKey , key ));
292288 }
0 commit comments