Long story short, we need to build a link (via a slot) between two content items in the cms. We know the slot name, the template to use, and the two content ids (of the parent and child).
Looking at the java api, it appears that creating a “PSAaRelationship” and then using PSOSlotRelations (from the toolkit) methods of “addSlotRelations” and “saveSlotRelations” is straight forward. However, the documentation states that "These methods should only be used when the Java Service API cannot be used for some reason. "
Is there a better way to create a slot link between two content items via the Java API? Does any one have a really simple example?
For “modern” API programs (that is, Rhythmyx 6.0 and higher) we recommend you use IPSContentWs.addContentRelations() rather than building your own PSAaRelationship Objects. There are 3 different signatures, depending on what info you already have.
However, there are a couple of cases where the modern API is very inconvenient (or indeed impossible) to use. One of these use cases is examining and reordering the contents of a single slot.
For these use cases, I created the PSOSlotRelations class, which is a wrapper on the old “legacy” API and can manipulate the contents of a single slot without the need to understand the intricacies of the legacy API.
If all you want to do is add a single item to the end of an existing slot, ISPContentWs.addContentRelations() is the simplest way to go. If you need, for example to re-order that slot, you’ll need to use PSOSlotRelations.
Just what i was looking for! Previously, I was looking at it from the standpoint of PSCoreItem to getAllRelatedItems to setting a PSItemRelatedItem… and thought that there just had to be a better way to do this.