{"id":19622223,"url":"https://github.com/commercetools/commercetools-sunrise-java-cms","last_synced_at":"2025-02-26T19:20:24.974Z","repository":{"id":145047390,"uuid":"59130746","full_name":"commercetools/commercetools-sunrise-java-cms","owner":"commercetools","description":"Module for Sunrise Java to use CMS","archived":false,"fork":false,"pushed_at":"2019-12-17T09:20:20.000Z","size":270,"stargazers_count":1,"open_issues_count":10,"forks_count":3,"subscribers_count":81,"default_branch":"master","last_synced_at":"2025-02-25T14:56:07.774Z","etag":null,"topics":["cms","sunrise","sunrise-java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commercetools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-18T15:58:30.000Z","updated_at":"2020-01-20T20:58:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"ee2b7d7d-d400-470e-8f59-7832fa975e8d","html_url":"https://github.com/commercetools/commercetools-sunrise-java-cms","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-sunrise-java-cms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-sunrise-java-cms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-sunrise-java-cms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commercetools%2Fcommercetools-sunrise-java-cms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commercetools","download_url":"https://codeload.github.com/commercetools/commercetools-sunrise-java-cms/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240917876,"owners_count":19878337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cms","sunrise","sunrise-java"],"created_at":"2024-11-11T11:26:43.174Z","updated_at":"2025-02-26T19:20:24.951Z","avatar_url":"https://github.com/commercetools.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Sunrise Java CMS :sunrise: :pencil2:\n==================\n\n[![Build Status](https://travis-ci.org/commercetools/commercetools-sunrise-java-cms.svg?branch=master)](https://travis-ci.org/commercetools/commercetools-sunrise-java-cms)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.commercetools.sunrise.cms/cms-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.commercetools.sunrise.cms/cms-api)\n[![Stories in Ready](https://badge.waffle.io/commercetools/commercetools-sunrise-java-cms.png?label=ready\u0026title=Ready)](https://waffle.io/commercetools/commercetools-sunrise-java-cms)\n\nModule for [Sunrise Java](https://github.com/sphereio/commercetools-sunrise-java)\ndefining unified API to fetch content from different CMS.\n\n* [Javadoc](https://commercetools.github.io/commercetools-sunrise-java-cms/javadoc/index.html)\n\n## Installation\nChoose the CMS adapter and follow its installation instructions:\n\n- [Contentful Sunrise Adapter](/cms-contentful)\n\nNote that if you are not using a Sunrise-based project, you'll additionally need to use as dependency:\n```\nlibraryDependencies += \"com.commercetools.sunrise.cms\" % \"cms-api\" % \"0.1.0\"\n```\n\n## Architecture\n\nThis API consists of five abstractions that reflect CMS hierarchical content structure:\n\n* page\n* field\n* entry\n* array\n* path\n\nA page represents uniquely identifiable and thus searchable entity.\nIt can be defined for several locales and access to all its\nlocalized instances is possible using this API.\nIt is convenient to see a page as a subtree of underlying CMS with its\nhierarchy of traversable fields.\n\nA field is contained inside a page and is identifiable inside it by\na path. It constitutes a single string-representable piece of content\nthat can be accessed using this API.\n\nAn entry is an independent identifiable piece of content that can be requested by this service as a page.\nIn the repository it can be nested inside other entries or arrays to form more complex trees of content.\n\nAn array, non-identifiable in itself and thus can't be fetched as a page. Can be nested inside entries. Provides index-based access to it's items.\nDepending on content model array item might be a directly retrievable field or an entry.\n\nA path is a field identifier in the scope of given page.\nBecause of hierarchical structure of underlying content this identifier\nis expected to form \"path like\" syntax which resembles XPath and will be\nexplained in the following sections.\n\n### Tree structure\n\nThis section describes accessing a sample repository.\n\n![Hierarchical Content](doc/tree.png)\n\nThere are three entries that can be requested by this service and fetched as traversable `pages`.\n\nLet's say we'd like to fetch **`entry1`**.\n\n```Java\nOptional\u003cCmsPage\u003e pageOpt = service.page(\"entry1\", locales);\n```\n\nA `CmsPage` model is created as the result of that operation and its subtree content is available by invoking:\n\n```Java\nOptional\u003cString\u003e fieldOpt = page.field(\"path.to.a.field\");\n```\n\nIn order for `field` operation to succeed given path has to refer to one of the leaves of the tree.\nAny intermediary nodes are not representable as strings.\n\nHere are some of correct paths:\n\nfield | path | result\n----- | ---- | ------\nlocationField1 | `locationField1` | \"{long=19.62, lat=51.37}\"\nlocationField2 | `entry3.locationField2` | \"{long=21.62, lat=11.37}\"\nimageAssetField2 | `array1[0].entry2.imageAssetField2` | \"http://host/file2.img\"\narray2's 1. item | `entry1.array1[1]` | \"text2\"\n\nSample invalid paths are:\n\npath | reason of failure\n---- | -----------------\n`array1` | refers to whole array\n`array1[0]` | refers to whole entry\n`array1.entry2[0]` | entry2 forms an entry, not an array\n`array1[2]` | index out of bounds in array\n`array1[1]` | refers to an array\n`array1[0].nonExistingField` | no such field\n\nEmpty result is returned for all of those paths.\n\nWhen service is requested to fetch page `entry2` the only correct paths are: `textField1` and `imageAssetField2` as there are no other fields or entries in this subtree.\n\n## Error handling\n\n`CmsServiceException` is thrown in the following situations:\n\n- requested page is not unique - there are more than one results for given page identifier in repository\n- problems with data transfer - forbidden access, request badly formed etc.\n\n## Locale\n\nUnderlying repository might provide localization of content. To leverage that this service can provide a page\nfor the list of locales. The first locale on the list is matched against the repository content.\nIf it's missing the second one is matched and so forth. An empty list can be provided and the behavior is \ndependent on underlying implementation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fcommercetools-sunrise-java-cms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommercetools%2Fcommercetools-sunrise-java-cms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommercetools%2Fcommercetools-sunrise-java-cms/lists"}