Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Tweeted twitter.com/StackTridion/status/789744464130637825
Bumped by Community user
deleted 5 characters in body
Source Link
Josh Hebb
  • 2.9k
  • 14
  • 16

I'm working on an implementation that has "configuration" components attached in page metadata (as component links) for things like navigation visibility, SEO fields - etc. This is so the configuration content may be localized, without having localizing the pages (instead of putting the fields in page meta); nothing new here.

I've set the link levels on the PT TBBs appropriately so the metadata JSON is being included when published. I have validated on the CD side that in the Page model object, I can grab the metadata fields map and from that map, retrieve the component attached as a component link.

At this point, I can see the are fields being populated in the "Component" object - which means the data was published in the JSON as I'd expect. I am wondering how I can deserialize the Component object into a strongly-typed objectone of my classes - similar to how we dowhat is done with our view models (CPs added to the ViewModels in the CPs on the page)?

What I've tried:

  • I've scanned through the DD4T-2 source code and am able to find where the deserialization is happening - but in order to deserialize via the DataBindFactory I need the raw source for the component.
  • I'm unable to grab the raw source for the component. I've scoured through the models and can't find any simple ways to achieve grabbing the JSON.

I'm really just looking to avoid populating the objects fields manually (via grabbing each field individually out of the component attached in metadata and setting my strongly typed objects fields). I could just write some code to retrieve the values and populate the object, but for each new field I'd rather update / maintain the POJO rather than the class responsible for the field population.

Note that we're on DD4T-2 (Java) 2.0.3.

Any input would be greatly appreciated.

I'm working on an implementation that has "configuration" components attached in page metadata (as component links) for things like navigation visibility, SEO fields - etc. This is so the configuration content may be localized, without having localizing the pages (instead of putting the fields in page meta); nothing new here.

I've set the link levels on the PT TBBs appropriately so the metadata JSON is being included when published. I have validated on the CD side that in the Page model object, I can grab the metadata fields map and from that map, retrieve the component attached as a component link.

At this point, I can see the are fields being populated in the "Component" object - which means the data was published in the JSON as I'd expect. I am wondering how I can deserialize the Component object into a strongly-typed object - similar to how we do with our view models (CPs added to the page)?

What I've tried:

  • I've scanned through the DD4T-2 source code and am able to find where the deserialization is happening - but in order to deserialize via the DataBindFactory I need the raw source for the component.
  • I'm unable to grab the raw source for the component. I've scoured through the models and can't find any simple ways to achieve grabbing the JSON.

I'm really just looking to avoid populating the objects fields manually (via grabbing each field individually out of the component attached in metadata and setting my strongly typed objects fields). I could just write some code to retrieve the values and populate the object, but for each new field I'd rather update / maintain the POJO rather than the class responsible for the field population.

Note that we're on DD4T-2 (Java) 2.0.3.

Any input would be greatly appreciated.

I'm working on an implementation that has "configuration" components attached in page metadata (as component links) for things like navigation visibility, SEO fields - etc. This is so the configuration content may be localized, without having localizing the pages (instead of putting the fields in page meta); nothing new here.

I've set the link levels on the PT TBBs appropriately so the metadata JSON is being included when published. I have validated on the CD side that in the Page model object, I can grab the metadata fields map and from that map, retrieve the component attached as a component link.

At this point, I can see the are fields being populated in the "Component" object - which means the data was published in the JSON as I'd expect. I am wondering how I can deserialize the Component object into one of my classes - similar to what is done with the ViewModels in the CPs on the page?

What I've tried:

  • I've scanned through the DD4T-2 source code and am able to find where the deserialization is happening - but in order to deserialize via the DataBindFactory I need the raw source for the component.
  • I'm unable to grab the raw source for the component. I've scoured through the models and can't find any simple ways to achieve grabbing the JSON.

I'm really just looking to avoid populating the objects fields manually (via grabbing each field individually out of the component attached in metadata and setting my strongly typed objects fields). I could just write some code to retrieve the values and populate the object, but for each new field I'd rather update / maintain the POJO rather than the class responsible for the field population.

Note that we're on DD4T-2 (Java) 2.0.3.

Any input would be greatly appreciated.

Source Link
Josh Hebb
  • 2.9k
  • 14
  • 16

DD4T-2 Strongly-typed Page Metadata Component Links

I'm working on an implementation that has "configuration" components attached in page metadata (as component links) for things like navigation visibility, SEO fields - etc. This is so the configuration content may be localized, without having localizing the pages (instead of putting the fields in page meta); nothing new here.

I've set the link levels on the PT TBBs appropriately so the metadata JSON is being included when published. I have validated on the CD side that in the Page model object, I can grab the metadata fields map and from that map, retrieve the component attached as a component link.

At this point, I can see the are fields being populated in the "Component" object - which means the data was published in the JSON as I'd expect. I am wondering how I can deserialize the Component object into a strongly-typed object - similar to how we do with our view models (CPs added to the page)?

What I've tried:

  • I've scanned through the DD4T-2 source code and am able to find where the deserialization is happening - but in order to deserialize via the DataBindFactory I need the raw source for the component.
  • I'm unable to grab the raw source for the component. I've scoured through the models and can't find any simple ways to achieve grabbing the JSON.

I'm really just looking to avoid populating the objects fields manually (via grabbing each field individually out of the component attached in metadata and setting my strongly typed objects fields). I could just write some code to retrieve the values and populate the object, but for each new field I'd rather update / maintain the POJO rather than the class responsible for the field population.

Note that we're on DD4T-2 (Java) 2.0.3.

Any input would be greatly appreciated.