[SMSNIPPETS-1] How to process content in Java Created: 01/Aug/19  Updated: 23/Aug/19

Status: In Progress
Project: Smart Snippets
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Alex Day Assignee: Mariusz Chruscielewski
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Date of First Response:

 Description   

Howdy!

I'm wondering if there is any documentation available on the Java APIs made available though the smart snippets module?

Specifically my current question is:
I have some Java code that loads content that contains smart snippets and I want to process the content so that the smart snippet placeholders are replaced with their content. How would you recommend achieving this?

Thanks



 Comments   
Comment by Mariusz Chruscielewski [ 23/Aug/19 ]

Hi Ben, I'm affrraid I need some example of what are you trying to achieve, but basically smart snippets placeholders are replaced in ContentMap class, just like standard Magnolia links:

 

@Override 
public Object get(Object key) { 
Object property = super.get(key); 
if (property instanceof String && SmartSnippetsUtil.SNIPPET_PATTERN.matcher((String) property).find()) { 
return SmartSnippetsUtil.convertSnippetsFromUUIDPattern((String) property); 
} 
return property; }

Maybe you can try to use SmartSnippetsUtil.convertSnippetsFromUUIDPattern ?

Generated at Mon Feb 12 10:57:39 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.