33import com .sap .cds .reflect .CdsAssociationType ;
44import com .sap .cds .reflect .CdsEntity ;
55import com .sap .cds .reflect .CdsModel ;
6+ import com .sap .cds .sdm .constants .SDMConstants ;
67import com .sap .cds .sdm .handler .common .SDMAssociationCascader ;
78import com .sap .cds .sdm .handler .common .SDMAttachmentsReader ;
89import com .sap .cds .services .persistence .PersistenceService ;
@@ -81,7 +82,7 @@ public static Map<String, String> getAttachmentPathMapping(
8182
8283 return pathMapping ;
8384 } catch (Exception e ) {
84- logger .error ("Error getting attachment path mapping" , e .getMessage ());
85+ logger .error (SDMConstants . FETCH_ATTACHMENT_COMPOSITION_ERROR , e .getMessage ());
8586 return new HashMap <>();
8687 }
8788 }
@@ -228,11 +229,7 @@ private static String buildEntityPath(
228229 return serviceName + "." + targetEntityName + "." + attachmentPart ;
229230 }
230231 } catch (Exception e ) {
231- logger .warn (
232- "Failed to build entity path for target entity '{}' and attachment path '{}'" ,
233- targetEntity .getName (),
234- attachmentPath ,
235- e );
232+ logger .warn (SDMConstants .FETCH_ATTACHMENT_COMPOSITION_ERROR , e .getMessage ());
236233 }
237234 return null ;
238235 }
@@ -253,11 +250,7 @@ private static String buildActualPath(
253250 return serviceName + "." + compositionPropertyName + "." + attachmentPart ;
254251 }
255252 } catch (Exception e ) {
256- logger .warn (
257- "Failed to build actual path for composition '{}' and attachment path '{}'" ,
258- compositionPropertyName ,
259- attachmentPath ,
260- e );
253+ logger .warn (SDMConstants .FETCH_ATTACHMENT_COMPOSITION_ERROR , e .getMessage ());
261254 }
262255 return null ;
263256 }
@@ -297,7 +290,7 @@ private static List<Map<String, Object>> processAttachmentKey(
297290 List <Map <String , Object >> attachments = (List <Map <String , Object >>) value ;
298291 result .addAll (attachments );
299292 } catch (ClassCastException e ) {
300- logger .warn ("Failed to cast attachments list for key '{}': {}" , key , e .getMessage ());
293+ logger .warn (SDMConstants . FETCH_ATTACHMENT_COMPOSITION_ERROR , e .getMessage ());
301294 }
302295 }
303296
@@ -312,7 +305,7 @@ private static List<Map<String, Object>> processNestedMap(
312305 Map <String , Object > nestedMap = (Map <String , Object >) value ;
313306 result .addAll (findNestedAttachments (nestedMap , attachmentKey , parentKey , key ));
314307 } catch (ClassCastException e ) {
315- logger .warn ("Failed to cast nested map for key '{}': {}" , key , e .getMessage ());
308+ logger .warn (SDMConstants . FETCH_ATTACHMENT_COMPOSITION_ERROR , e .getMessage ());
316309 }
317310
318311 return result ;
@@ -331,7 +324,7 @@ private static List<Map<String, Object>> processNestedList(
331324 }
332325 }
333326 } catch (ClassCastException e ) {
334- logger .warn ("Failed to process list for key '{}': {}" , key , e .getMessage ());
327+ logger .warn (SDMConstants . FETCH_ATTACHMENT_COMPOSITION_ERROR , e .getMessage ());
335328 }
336329
337330 return result ;
0 commit comments