Category Relationship Format
Method Documentation: getRelationshipInfo
This method parses a provided string, representing category relationship information, into an object format that simplifies subsequent operations. The string, denoted as categoryDefinition
, can contain specifications for the category, whether it's a default relationship, and an optional display order.
String Format:
The categoryDefinition
is expected to follow the format:
<external-id-or-category>[:default][:<displayOrder>]
Components:
<external-id-or-category>
: This part is mandatory and can either be an external ID retrieved using {@link Category#getExternalId()} or the primary key from the Broadleaf database.:default
: A constant string ":default" that signifies whether the category relationship is a default one.:displayOrder
: A numeric value indicating the desired display order for this relationship (e.g., ":10").
Examples of Valid Formats:
cat-1:default:10
: Looks up a category using its external id "cat-1", assigning it as the default relationship with a display order of 10.cat-1
: Associates with a category having an external id of "cat-1".1234
: Establishes a relationship with a category having the primary key 1234 (or external id "1234" based on the database).cat5:5
: Forms a relationship with a category of external id "cat5" and a display order of 5.