1

I have used the TaxonomyFactory to get keywords:

var taxonomyUri = "tcm:304-4135-512";
var model = _taxonomyFactory.GetTaxonomyKeywords(taxonomyUri);

This gives me a response like:

{
  "name": "Test Category",
  "description": "",
  "isUsedForIdentification": false,
  "key": "",
  "keywordMeta": {
    "name": "custom-meta",
    "children": {},
    "nameValues": {}
  },
  "keywordChildren": [
    {
      "name": "Keyword A - Value",
      "description": "Keyword A - Desc",
      "isUsedForIdentification": false,
      "key": "Keyword A - Key",
      "keywordMeta": {
        "name": "custom-meta",
        "children": {},
        "nameValues": {
          "round_flag": {
            "valueType": 1,
            "name": "round_flag",
            "value": "tcm:304-156971",
            "firstValue": "tcm:304-156971",
            "multipleValues": [
              "tcm:304-156971"
            ]
          },
          "country_code": {
            "valueType": 1,
            "name": "country_code",
            "value": "Keyword A - Country Code",
            "firstValue": "Keyword A - Country Code",
            "multipleValues": [
              "Keyword A - Country Code"
            ]
          },
          "flag": {
            "valueType": 1,
            "name": "flag",
            "value": "tcm:304-156880",
            "firstValue": "tcm:304-156880",
            "multipleValues": [
              "tcm:304-156880"
            ]
          },
          "path": {
            "valueType": 1,
            "name": "path",
            "value": "Keyword A - Url Path",
            "firstValue": "Keyword A - Url Path",
            "multipleValues": [
              "Keyword A - Url Path"
            ]
          }
        }
      },
      "keywordChildren": []
    }
  ]
}

within the keywordMeta there is a list of nameValues containing other tcm ids, e.g. tcm:304-156971 = tcm:304-156971 which I know is an image.

How do I then use this id tcm:304-156971, to get that Component? I have tried to use the ModelServiceProvider.GetEntityModelData but it requires a template ID which I won't know.

2

See DefaultContentProvider.PopulateDynamicList for an example of how to build DXA Entity Models out of a list of Component TCM URIs.

Indeed, the first part of the solution is to get Component Meta. The DXA Model Builder Pipeline can then be used to build an Entity Model out of it. Note that Component Meta does not contain Component content, though. So, only metadata fields can be mapped.

Alternatively, you can use ContentProvider.GetEntityModel to get a fully mapped Entity Model for a DCP, but that indeed requires a CT ID (and the Component must be published as DCP in the first place).

0

You could retrieve Component meta information using Broker API (CIL) with the following (Java) code snippet:

    WebComponentMetaFactory cmf = new WebComponentMetaFactoryImpl("304");

    ComponentMeta componentMeta = cmf.getMeta("tcm:304-156880");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.