├── .gitattributes ├── .github └── workflows │ ├── maven.yml │ └── release.yml ├── .gitignore ├── README.md ├── dxa-dd4t-ms-provider ├── pom.xml └── src │ ├── main │ └── java │ │ └── com │ │ └── sdl │ │ └── dxa │ │ └── dd4t │ │ ├── DropInExperienceConfiguration.java │ │ └── providers │ │ ├── ModelServiceComponentPresentationProvider.java │ │ └── ModelServicePageProvider.java │ └── test │ ├── java │ └── com │ │ └── sdl │ │ └── dxa │ │ └── dd4t │ │ ├── DropInExperienceConfigurationTest.java │ │ └── providers │ │ ├── ModelServiceComponentPresentationProviderTest.java │ │ └── ModelServicePageProviderTest.java │ └── resources │ └── dcp.json ├── dxa-framework ├── dxa-common-api │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── sdl │ │ │ │ ├── dxa │ │ │ │ ├── DxaSpringInitialization.java │ │ │ │ ├── DxaWebInitialization.java │ │ │ │ ├── IshModuleInitializer.java │ │ │ │ ├── caching │ │ │ │ │ ├── CompositeOutputCacheKeyBase.java │ │ │ │ │ ├── VolatileModel.java │ │ │ │ │ ├── WebRequestContextLocalizationIdProvider.java │ │ │ │ │ └── wrapper │ │ │ │ │ │ ├── CopyingCache.java │ │ │ │ │ │ ├── EntitiesCache.java │ │ │ │ │ │ ├── OutputCache.java │ │ │ │ │ │ ├── PagesCopyingCache.java │ │ │ │ │ │ ├── SimpleCacheWrapper.java │ │ │ │ │ │ └── package-info.java │ │ │ │ └── mvc │ │ │ │ │ ├── ViewNameResolver.java │ │ │ │ │ └── package-info.java │ │ │ │ └── webapp │ │ │ │ └── common │ │ │ │ ├── api │ │ │ │ ├── MediaHelper.java │ │ │ │ ├── ScreenWidth.java │ │ │ │ ├── ThreadLocalManager.java │ │ │ │ ├── WebRequestContext.java │ │ │ │ ├── content │ │ │ │ │ ├── ConditionalEntityEvaluator.java │ │ │ │ │ ├── ContentProvider.java │ │ │ │ │ ├── Dxa22ContentProvider.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── contextengine │ │ │ │ │ ├── ContextClaims.java │ │ │ │ │ ├── ContextClaimsProvider.java │ │ │ │ │ ├── ContextEngine.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── formats │ │ │ │ │ ├── DataFormatter.java │ │ │ │ │ ├── DefaultDataFormatter.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── formatters │ │ │ │ │ ├── AtomFormatter.java │ │ │ │ │ ├── BaseFormatter.java │ │ │ │ │ ├── DataFormatter.java │ │ │ │ │ ├── FeedFormatter.java │ │ │ │ │ ├── JsonFormatter.java │ │ │ │ │ ├── RssFormatter.java │ │ │ │ │ ├── package-info.java │ │ │ │ │ └── support │ │ │ │ │ │ ├── FeedItem.java │ │ │ │ │ │ ├── FeedItemsProvider.java │ │ │ │ │ │ └── package-info.java │ │ │ │ ├── localization │ │ │ │ │ ├── Localization.java │ │ │ │ │ ├── LocalizationFactory.java │ │ │ │ │ ├── LocalizationFactoryException.java │ │ │ │ │ ├── LocalizationNotFoundException.java │ │ │ │ │ ├── LocalizationNotResolvedException.java │ │ │ │ │ ├── LocalizationResolver.java │ │ │ │ │ ├── LocalizationResolverException.java │ │ │ │ │ ├── SiteLocalization.java │ │ │ │ │ ├── UnknownLocalizationHandler.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── mapping │ │ │ │ │ ├── semantic │ │ │ │ │ │ ├── FieldData.java │ │ │ │ │ │ ├── SemanticFieldDataProvider.java │ │ │ │ │ │ ├── SemanticMapper.java │ │ │ │ │ │ ├── SemanticMappingException.java │ │ │ │ │ │ ├── SemanticMappingRegistry.java │ │ │ │ │ │ ├── annotations │ │ │ │ │ │ │ ├── SemanticEntities.java │ │ │ │ │ │ │ ├── SemanticEntity.java │ │ │ │ │ │ │ ├── SemanticEntityInfo.java │ │ │ │ │ │ │ ├── SemanticMappingIgnore.java │ │ │ │ │ │ │ ├── SemanticProperties.java │ │ │ │ │ │ │ ├── SemanticProperty.java │ │ │ │ │ │ │ └── SemanticPropertyInfo.java │ │ │ │ │ │ ├── config │ │ │ │ │ │ │ ├── EntitySemantics.java │ │ │ │ │ │ │ ├── FieldSemantics.java │ │ │ │ │ │ │ ├── SemanticField.java │ │ │ │ │ │ │ ├── SemanticSchema.java │ │ │ │ │ │ │ └── SemanticVocabulary.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ └── views │ │ │ │ │ │ ├── AbstractInitializer.java │ │ │ │ │ │ ├── AbstractModuleInitializer.java │ │ │ │ │ │ ├── ModuleInfo.java │ │ │ │ │ │ ├── RegisteredViewModel.java │ │ │ │ │ │ ├── RegisteredViewModels.java │ │ │ │ │ │ └── package-info.java │ │ │ │ ├── model │ │ │ │ │ ├── AbstractViewModel.java │ │ │ │ │ ├── CanFilterEntities.java │ │ │ │ │ ├── EntityModel.java │ │ │ │ │ ├── KeywordModel.java │ │ │ │ │ ├── MvcData.java │ │ │ │ │ ├── PageModel.java │ │ │ │ │ ├── RegionModel.java │ │ │ │ │ ├── RegionModelSet.java │ │ │ │ │ ├── RichText.java │ │ │ │ │ ├── RichTextFragment.java │ │ │ │ │ ├── RichTextFragmentImpl.java │ │ │ │ │ ├── ViewModel.java │ │ │ │ │ ├── ViewModelRegistry.java │ │ │ │ │ ├── entity │ │ │ │ │ │ ├── AbstractEntityModel.java │ │ │ │ │ │ ├── Configuration.java │ │ │ │ │ │ ├── DynamicList.java │ │ │ │ │ │ ├── EclItem.java │ │ │ │ │ │ ├── ExceptionEntity.java │ │ │ │ │ │ ├── GenericTopic.java │ │ │ │ │ │ ├── GenericWidget.java │ │ │ │ │ │ ├── Link.java │ │ │ │ │ │ ├── MediaItem.java │ │ │ │ │ │ ├── NameValuePair.java │ │ │ │ │ │ ├── NavigationLinks.java │ │ │ │ │ │ ├── RedirectEntity.java │ │ │ │ │ │ ├── SitemapItem.java │ │ │ │ │ │ ├── Tag.java │ │ │ │ │ │ ├── TaxonomyNode.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── mvcdata │ │ │ │ │ │ ├── DefaultsMvcData.java │ │ │ │ │ │ ├── MvcDataCreator.java │ │ │ │ │ │ ├── MvcDataImpl.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── package-info.java │ │ │ │ │ ├── page │ │ │ │ │ │ ├── DefaultPageModel.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── query │ │ │ │ │ │ ├── AbstractQuery.java │ │ │ │ │ │ ├── ComponentMetadata.java │ │ │ │ │ │ └── SimpleBrokerQuery.java │ │ │ │ │ ├── region │ │ │ │ │ │ ├── RegionModelImpl.java │ │ │ │ │ │ └── RegionModelSetImpl.java │ │ │ │ │ ├── sorting │ │ │ │ │ │ └── SortableSiteMap.java │ │ │ │ │ └── validation │ │ │ │ │ │ ├── DynamicCodeResolver.java │ │ │ │ │ │ └── DynamicValidationMessage.java │ │ │ │ ├── navigation │ │ │ │ │ ├── NavigationProvider.java │ │ │ │ │ ├── NavigationProviderException.java │ │ │ │ │ ├── OnDemandNavigationProvider.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ ├── serialization │ │ │ │ │ └── json │ │ │ │ │ │ ├── DxaViewModelJsonChainFilter.java │ │ │ │ │ │ ├── DxaViewModelJsonPropertyFilter.java │ │ │ │ │ │ ├── annotation │ │ │ │ │ │ └── JsonXpmAware.java │ │ │ │ │ │ ├── filter │ │ │ │ │ │ ├── IgnoreByNameInRequestFilter.java │ │ │ │ │ │ └── XpmAwareJsonFilter.java │ │ │ │ │ │ └── package-info.java │ │ │ │ └── xpm │ │ │ │ │ ├── ComponentType.java │ │ │ │ │ ├── OccurrenceConstraint.java │ │ │ │ │ ├── XpmRegion.java │ │ │ │ │ └── XpmRegionConfig.java │ │ │ │ ├── controller │ │ │ │ ├── BaseController.java │ │ │ │ ├── ControllerUtils.java │ │ │ │ ├── EntityController.java │ │ │ │ ├── ListController.java │ │ │ │ ├── NavigationController.java │ │ │ │ ├── PageController.java │ │ │ │ ├── RegionController.java │ │ │ │ ├── RequestAttributeNames.java │ │ │ │ ├── SiteMapXmlController.java │ │ │ │ ├── api │ │ │ │ │ └── OnDemandNavigationController.java │ │ │ │ ├── exception │ │ │ │ │ ├── DocsExceptionHandler.java │ │ │ │ │ ├── ForbiddenException.java │ │ │ │ │ ├── NotFoundException.java │ │ │ │ │ └── SearchParametersProcessingException.java │ │ │ │ └── package-info.java │ │ │ │ ├── impl │ │ │ │ ├── DefaultMediaHelper.java │ │ │ │ ├── DefaultViewResolver.java │ │ │ │ ├── SpringConfiguration.java │ │ │ │ ├── ThreadLocalManagerImpl.java │ │ │ │ ├── WebRequestContextImpl.java │ │ │ │ ├── contextengine │ │ │ │ │ ├── BrowserClaims.java │ │ │ │ │ ├── ContextEngineImpl.java │ │ │ │ │ ├── DeviceClaims.java │ │ │ │ │ ├── DeviceFamiliesEvaluator.java │ │ │ │ │ └── OperatingSystemClaims.java │ │ │ │ ├── interceptor │ │ │ │ │ ├── HealthCheckFilter.java │ │ │ │ │ ├── StaticContentInterceptor.java │ │ │ │ │ └── ThreadLocalInterceptor.java │ │ │ │ ├── localization │ │ │ │ │ ├── DocsLocalization.java │ │ │ │ │ ├── LocalizationFactoryImpl.java │ │ │ │ │ ├── LocalizationImpl.java │ │ │ │ │ ├── SiteLocalizationImpl.java │ │ │ │ │ └── semantics │ │ │ │ │ │ └── SemanticsConverter.java │ │ │ │ ├── mapping │ │ │ │ │ ├── SemanticAnnotationException.java │ │ │ │ │ ├── SemanticMapperImpl.java │ │ │ │ │ └── SemanticMappingRegistryImpl.java │ │ │ │ ├── markup │ │ │ │ │ ├── MarkupDecoratorRegistryImpl.java │ │ │ │ │ ├── MarkupImpl.java │ │ │ │ │ └── PluggableMarkupRegistryImpl.java │ │ │ │ ├── model │ │ │ │ │ ├── ErrorMessage.java │ │ │ │ │ └── ViewModelRegistryImpl.java │ │ │ │ ├── taglib │ │ │ │ │ ├── dxa │ │ │ │ │ │ ├── AbstractGoogleMapTag.java │ │ │ │ │ │ ├── DefinePluggableMarkupTag.java │ │ │ │ │ │ ├── EntitiesTag.java │ │ │ │ │ │ ├── EntityTag.java │ │ │ │ │ │ ├── GoogleMapTag.java │ │ │ │ │ │ ├── GoogleStaticMapTag.java │ │ │ │ │ │ ├── HtmlElementTag.java │ │ │ │ │ │ ├── HtmlNodeTag.java │ │ │ │ │ │ ├── LinkTag.java │ │ │ │ │ │ ├── MediaTag.java │ │ │ │ │ │ ├── PageTag.java │ │ │ │ │ │ ├── PluggableMarkupTag.java │ │ │ │ │ │ ├── RegionTag.java │ │ │ │ │ │ ├── RegionsTag.java │ │ │ │ │ │ ├── ResourceTag.java │ │ │ │ │ │ └── RichTextTag.java │ │ │ │ │ └── xpm │ │ │ │ │ │ ├── XpmButtonTag.java │ │ │ │ │ │ ├── XpmEntityMarkupTag.java │ │ │ │ │ │ ├── XpmIfEnabledTag.java │ │ │ │ │ │ ├── XpmMarkupTag.java │ │ │ │ │ │ ├── XpmPageMarkupTag.java │ │ │ │ │ │ ├── XpmPropertyMarkupTag.java │ │ │ │ │ │ └── XpmRegionMarkupTag.java │ │ │ │ └── util │ │ │ │ │ └── LogbackRepeatingToSingleFilter.java │ │ │ │ ├── markup │ │ │ │ ├── AbstractMarkupTag.java │ │ │ │ ├── Markup.java │ │ │ │ ├── MarkupDecorator.java │ │ │ │ ├── MarkupDecoratorRegistry.java │ │ │ │ ├── PluggableMarkupRegistry.java │ │ │ │ ├── html │ │ │ │ │ ├── HtmlAttribute.java │ │ │ │ │ ├── HtmlCommentNode.java │ │ │ │ │ ├── HtmlElement.java │ │ │ │ │ ├── HtmlEndTag.java │ │ │ │ │ ├── HtmlMultiNode.java │ │ │ │ │ ├── HtmlNode.java │ │ │ │ │ ├── HtmlRenderable.java │ │ │ │ │ ├── HtmlStartTag.java │ │ │ │ │ ├── HtmlTextNode.java │ │ │ │ │ ├── ParsableHtmlNode.java │ │ │ │ │ ├── builders │ │ │ │ │ │ ├── AbstractElementBuilder.java │ │ │ │ │ │ ├── AnchorElementBuilder.java │ │ │ │ │ │ ├── ButtonElementBuilder.java │ │ │ │ │ │ ├── HtmlBuilders.java │ │ │ │ │ │ ├── ImgElementBuilder.java │ │ │ │ │ │ ├── SimpleElementBuilder.java │ │ │ │ │ │ └── SrcElementBuilder.java │ │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ │ │ ├── util │ │ │ │ ├── ApplicationContextHolder.java │ │ │ │ ├── CollectionUtils.java │ │ │ │ ├── InitializationUtils.java │ │ │ │ ├── LocalizationUtils.java │ │ │ │ ├── MimeUtils.java │ │ │ │ ├── PackageUtils.java │ │ │ │ ├── SimpleNamespaceContext.java │ │ │ │ └── package-info.java │ │ │ │ └── views │ │ │ │ ├── AtomView.java │ │ │ │ ├── JsonView.java │ │ │ │ └── RssView.java │ │ └── resources │ │ │ ├── META-INF │ │ │ └── resources │ │ │ │ └── WEB-INF │ │ │ │ ├── Views │ │ │ │ └── RedirectView.jsp │ │ │ │ ├── dxa.tld │ │ │ │ └── xpm.tld │ │ │ ├── dxa.addons.device-families.properties │ │ │ ├── dxa.defaults.properties │ │ │ ├── dxa.mimetypes.properties │ │ │ └── semantic-schemas │ │ │ ├── README │ │ │ ├── schemas.json │ │ │ └── vocabularies.json │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── sdl │ │ │ ├── dxa │ │ │ ├── DxaSpringInitializationTest.java │ │ │ ├── DxaWebInitializationTest.java │ │ │ └── caching │ │ │ │ ├── LocalizationAwareKeyGeneratorTest.java │ │ │ │ └── wrapper │ │ │ │ ├── CacheTest.java │ │ │ │ ├── CopyingCacheTest.java │ │ │ │ └── PagesCopyingCacheTest.java │ │ │ └── webapp │ │ │ └── common │ │ │ ├── api │ │ │ ├── contextengine │ │ │ │ └── ContextClaimsTest.java │ │ │ ├── formats │ │ │ │ └── DefaultDataFormatterTest.java │ │ │ ├── formatters │ │ │ │ ├── AtomFormatterTest.java │ │ │ │ ├── BaseFormatterTest.java │ │ │ │ ├── FeedFormatterTest.java │ │ │ │ ├── JsonFormatterTest.java │ │ │ │ └── RssFormatterTest.java │ │ │ ├── mapping │ │ │ │ ├── semantic │ │ │ │ │ ├── annotations │ │ │ │ │ │ ├── SemanticEntityInfoTest.java │ │ │ │ │ │ └── SemanticPropertyInfoTest.java │ │ │ │ │ └── config │ │ │ │ │ │ └── SemanticFieldTest.java │ │ │ │ └── views │ │ │ │ │ └── AbstractInitializerTest.java │ │ │ ├── model │ │ │ │ ├── AbstractViewModelTest.java │ │ │ │ ├── KeywordModelTest.java │ │ │ │ ├── PojosTest.java │ │ │ │ ├── TestEntity.java │ │ │ │ ├── entity │ │ │ │ │ ├── AbstractEntityModelTest.java │ │ │ │ │ ├── ConfigurationTest.java │ │ │ │ │ ├── DynamicListTest.java │ │ │ │ │ ├── EclItemTest.java │ │ │ │ │ ├── LinkTest.java │ │ │ │ │ ├── MediaItemTest.java │ │ │ │ │ ├── SitemapItemTest.java │ │ │ │ │ ├── TagTest.java │ │ │ │ │ └── TaxonomyNodeTest.java │ │ │ │ ├── mvcdata │ │ │ │ │ ├── DefaultsMvcDataTest.java │ │ │ │ │ └── MvcDataCreatorTest.java │ │ │ │ ├── page │ │ │ │ │ └── DefaultPageModelTest.java │ │ │ │ ├── region │ │ │ │ │ ├── RegionModelImplTest.java │ │ │ │ │ └── RegionModelSetImplTest.java │ │ │ │ └── validation │ │ │ │ │ └── DynamicCodeResolverTest.java │ │ │ └── serialization │ │ │ │ └── json │ │ │ │ ├── DxaViewModelJsonChainFilterTest.java │ │ │ │ └── filter │ │ │ │ ├── IgnoreByNameInRequestFilterTest.java │ │ │ │ └── XpmAwareJsonFilterTest.java │ │ │ ├── controller │ │ │ ├── BaseControllerTest.java │ │ │ ├── EntityControllerTest.java │ │ │ ├── ListControllerTest.java │ │ │ ├── NavigationControllerTest.java │ │ │ ├── PageControllerTest.java │ │ │ └── api │ │ │ │ └── OnDemandNavigationControllerTest.java │ │ │ ├── impl │ │ │ ├── DefaultMediaHelperTest.java │ │ │ ├── WebRequestContextImplTest.java │ │ │ ├── contextengine │ │ │ │ ├── BrowserClaimsTest.java │ │ │ │ ├── Claims.java │ │ │ │ ├── ContextEngineImplTest.java │ │ │ │ ├── DeviceClaimsTest.java │ │ │ │ ├── DeviceFamiliesEvaluatorTest.java │ │ │ │ └── OperatingSystemClaimsTest.java │ │ │ ├── interceptor │ │ │ │ └── HealthCheckFilterTest.java │ │ │ ├── localization │ │ │ │ ├── LocalizationFactoryImplTest.java │ │ │ │ └── LocalizationImplTest.java │ │ │ ├── mapping │ │ │ │ ├── SemanticMapperImplTest.java │ │ │ │ ├── SemanticMappingRegistryImplDefaultsTest.java │ │ │ │ ├── SemanticMappingRegistryImplErrorsTest.java │ │ │ │ ├── SemanticMappingRegistryImplIgnoreTest.java │ │ │ │ └── SemanticMappingRegistryImplTest.java │ │ │ ├── markup │ │ │ │ ├── MarkupImplTest.java │ │ │ │ └── MarkupTest.java │ │ │ ├── model │ │ │ │ └── ViewModelRegistryImplTest.java │ │ │ └── taglib │ │ │ │ ├── dxa │ │ │ │ └── EntityTagTest.java │ │ │ │ └── xpm │ │ │ │ ├── XpmButtonTagTest.java │ │ │ │ ├── XpmEntityMarkupTagTest.java │ │ │ │ ├── XpmIfEnabledTagTest.java │ │ │ │ ├── XpmPageMarkupTagTest.java │ │ │ │ └── XpmPropertyMarkupTagTest.java │ │ │ ├── markup │ │ │ └── html │ │ │ │ ├── HtmlAttributeTest.java │ │ │ │ ├── HtmlCommentNodeTest.java │ │ │ │ ├── HtmlElementTest.java │ │ │ │ ├── HtmlEndTagTest.java │ │ │ │ ├── HtmlMultiNodeTest.java │ │ │ │ ├── HtmlStartTagTest.java │ │ │ │ ├── HtmlTextNodeTest.java │ │ │ │ ├── ParsableHtmlNodeTest.java │ │ │ │ └── builders │ │ │ │ ├── AnchorElementBuilderTest.java │ │ │ │ ├── ButtonElementBuilderTest.java │ │ │ │ ├── HtmlBuildersTest.java │ │ │ │ ├── ImgElementBuilderTest.java │ │ │ │ └── SimpleElementBuilderTest.java │ │ │ └── util │ │ │ ├── CollectionUtilsTest.java │ │ │ ├── InitializationUtilsTest.java │ │ │ ├── LocalizationUtilsTest.java │ │ │ └── MimeUtilsTest.java │ │ └── resources │ │ ├── WEB-INF │ │ └── Views │ │ │ ├── Override.android.jsp │ │ │ ├── Override │ │ │ ├── Override.android.jsp │ │ │ └── TestView2.jsp │ │ │ ├── TestView.android.jsp │ │ │ └── TestView.jsp │ │ ├── device-families.xml │ │ ├── dxa.addons.device-families.properties │ │ ├── dxa.addons.staging.properties │ │ ├── dxa.addons.tests.properties │ │ ├── dxa.addons.utf8-bom.properties │ │ ├── dxa.defaults.properties │ │ ├── dxa.modules.cid.properties │ │ ├── dxa.modules.xo.properties │ │ ├── dxa.properties │ │ ├── dxa.user.mimetypes.properties │ │ ├── logback-test.xml │ │ └── notdxa.properties ├── dxa-common │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── sdl │ │ │ ├── dxa │ │ │ ├── caching │ │ │ │ ├── ConditionalKey.java │ │ │ │ ├── LocalizationAwareCacheKey.java │ │ │ │ ├── LocalizationAwareKeyGenerator.java │ │ │ │ ├── LocalizationIdProvider.java │ │ │ │ ├── NamedCacheProvider.java │ │ │ │ ├── NeverCached.java │ │ │ │ ├── NoOutputCache.java │ │ │ │ ├── package-info.java │ │ │ │ └── statistics │ │ │ │ │ └── CacheStatisticsProvider.java │ │ │ ├── common │ │ │ │ ├── ClaimValues.java │ │ │ │ ├── dto │ │ │ │ │ ├── ClaimHolder.java │ │ │ │ │ ├── ContentType.java │ │ │ │ │ ├── DataModelType.java │ │ │ │ │ ├── DepthCounter.java │ │ │ │ │ ├── EntityRequestDto.java │ │ │ │ │ ├── PageRequestDto.java │ │ │ │ │ ├── SitemapRequestDto.java │ │ │ │ │ └── StaticContentRequestDto.java │ │ │ │ └── util │ │ │ │ │ ├── MvcUtils.java │ │ │ │ │ ├── PathUtils.java │ │ │ │ │ ├── StacktraceShortener.java │ │ │ │ │ └── package-info.java │ │ │ ├── modelservice │ │ │ │ └── service │ │ │ │ │ ├── EntityModelService.java │ │ │ │ │ ├── EntityModelServiceSuppressLinks.java │ │ │ │ │ ├── ModelServiceProvider.java │ │ │ │ │ └── PageModelService.java │ │ │ ├── performance │ │ │ │ └── Performance.java │ │ │ └── tridion │ │ │ │ ├── annotations │ │ │ │ ├── AnnotationFetcherForValue.java │ │ │ │ └── impl │ │ │ │ │ └── ValueAnnotationLogger.java │ │ │ │ └── navigation │ │ │ │ └── dynamic │ │ │ │ ├── NavigationModelProvider.java │ │ │ │ └── OnDemandNavigationModelProvider.java │ │ │ └── webapp │ │ │ ├── common │ │ │ ├── api │ │ │ │ ├── content │ │ │ │ │ ├── ContentProviderException.java │ │ │ │ │ ├── LinkResolver.java │ │ │ │ │ ├── PageNotFoundException.java │ │ │ │ │ ├── StaticContentItem.java │ │ │ │ │ ├── StaticContentNotFoundException.java │ │ │ │ │ └── StaticContentNotLoadedException.java │ │ │ │ ├── mapping │ │ │ │ │ └── semantic │ │ │ │ │ │ └── config │ │ │ │ │ │ ├── FieldPath.java │ │ │ │ │ │ └── WithXPath.java │ │ │ │ └── navigation │ │ │ │ │ ├── NavigationFilter.java │ │ │ │ │ └── TaxonomyUrisHolder.java │ │ │ ├── controller │ │ │ │ └── exception │ │ │ │ │ ├── BadRequestException.java │ │ │ │ │ └── InternalServerErrorException.java │ │ │ ├── exceptions │ │ │ │ ├── DxaException.java │ │ │ │ ├── DxaItemNotFoundException.java │ │ │ │ ├── DxaRuntimeException.java │ │ │ │ └── package-info.java │ │ │ ├── impl │ │ │ │ └── localization │ │ │ │ │ └── semantics │ │ │ │ │ ├── JsonFieldSemantics.java │ │ │ │ │ ├── JsonSchema.java │ │ │ │ │ ├── JsonSchemaField.java │ │ │ │ │ ├── JsonSchemaFieldType.java │ │ │ │ │ ├── JsonSchemaSemantics.java │ │ │ │ │ └── JsonVocabulary.java │ │ │ └── util │ │ │ │ ├── FileUtils.java │ │ │ │ ├── ImageUtils.java │ │ │ │ ├── StringUtils.java │ │ │ │ ├── TcmUtils.java │ │ │ │ ├── UrlEncoder.java │ │ │ │ └── XpmUtils.java │ │ │ └── tridion │ │ │ └── linking │ │ │ └── AbstractLinkResolver.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── sdl │ │ │ ├── dxa │ │ │ └── common │ │ │ │ ├── dto │ │ │ │ ├── DepthCounterTest.java │ │ │ │ ├── EntityRequestDtoTest.java │ │ │ │ ├── PageRequestDtoTest.java │ │ │ │ ├── SitemapRequestDtoTest.java │ │ │ │ └── StaticContentRequestDtoTest.java │ │ │ │ └── util │ │ │ │ ├── MvcUtilsTest.java │ │ │ │ ├── PathUtilsTest.java │ │ │ │ └── StacktraceShortenerTest.java │ │ │ └── webapp │ │ │ ├── common │ │ │ ├── api │ │ │ │ ├── mapping │ │ │ │ │ └── semantic │ │ │ │ │ │ └── config │ │ │ │ │ │ └── FieldPathTest.java │ │ │ │ └── navigation │ │ │ │ │ └── TaxonomyUrisHolderTest.java │ │ │ └── util │ │ │ │ ├── FileUtilsTest.java │ │ │ │ ├── StringUtilsTest.java │ │ │ │ ├── TcmUtilsTest.java │ │ │ │ └── UrlEncoderTest.java │ │ │ └── tridion │ │ │ └── linking │ │ │ └── AbstractLinkResolverTest.java │ │ └── resources │ │ └── logback-test.xml ├── dxa-data-model │ ├── pom.xml │ └── src │ │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── sdl │ │ │ └── dxa │ │ │ └── api │ │ │ └── datamodel │ │ │ ├── Constants.java │ │ │ ├── DataModelSpringConfiguration.java │ │ │ ├── json │ │ │ ├── ModelDataTypeIdResolver.java │ │ │ ├── ModelDataTypeResolver.java │ │ │ ├── Polymorphic.java │ │ │ └── PolymorphicObjectMixin.java │ │ │ ├── model │ │ │ ├── BinaryContentData.java │ │ │ ├── ComponentTemplateData.java │ │ │ ├── ContentModelData.java │ │ │ ├── EntityModelData.java │ │ │ ├── ExternalContentData.java │ │ │ ├── KeywordModelData.java │ │ │ ├── MvcModelData.java │ │ │ ├── PageModelData.java │ │ │ ├── PageTemplateData.java │ │ │ ├── RegionModelData.java │ │ │ ├── RichTextData.java │ │ │ ├── SitemapItemModelData.java │ │ │ ├── TaxonomyNodeModelData.java │ │ │ ├── ViewModelData.java │ │ │ ├── unknown │ │ │ │ ├── UnknownModelData.java │ │ │ │ ├── UnknownModelDataDeserializer.java │ │ │ │ └── UnknownModelDataSerializer.java │ │ │ └── util │ │ │ │ ├── CanCopyValues.java │ │ │ │ ├── CanGetAndCast.java │ │ │ │ ├── CanWrapContentAndMetadata.java │ │ │ │ ├── DelegatesToList.java │ │ │ │ ├── HandlesHierarchyTypeInformation.java │ │ │ │ ├── ListWrapper.java │ │ │ │ └── ModelDataWrapper.java │ │ │ ├── package-info.java │ │ │ └── processing │ │ │ └── DataModelDeepFirstSearcher.java │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── sdl │ │ │ └── dxa │ │ │ └── api │ │ │ └── datamodel │ │ │ ├── DeserializationTest.java │ │ │ ├── json │ │ │ └── ModelDataTypeResolverTest.java │ │ │ ├── model │ │ │ ├── RegionModelDataTest.java │ │ │ ├── SitemapItemModelDataTest.java │ │ │ ├── TaxonomyNodeModelDataJsonTest.java │ │ │ └── known │ │ │ │ ├── FirstChildKnownClass.java │ │ │ │ ├── KnownClass.java │ │ │ │ ├── KnownParentClass.java │ │ │ │ └── SecondChildKnownClass.java │ │ │ └── processing │ │ │ └── DataModelDeepFirstSearcherTest.java │ │ └── resources │ │ ├── dxa20json │ │ ├── pageModel.json │ │ └── unknown │ │ │ ├── DeserializerTest │ │ │ ├── UnknownClass │ │ │ ├── UnknownClassNoType │ │ │ ├── UnknownClasses │ │ │ └── UnknownParentClasses │ │ └── logback-test.xml ├── dxa-tridion-common │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── sdl │ │ │ │ └── dxa │ │ │ │ ├── caching │ │ │ │ ├── DefaultNamedCacheProvider.java │ │ │ │ ├── SpringJCacheManagerAdapter.java │ │ │ │ ├── TridionCacheConfiguration.java │ │ │ │ └── TridionNoCacheConfiguration.java │ │ │ │ ├── exception │ │ │ │ └── DxaTridionCommonException.java │ │ │ │ └── tridion │ │ │ │ ├── TridionCommonSpringConfiguration.java │ │ │ │ ├── common │ │ │ │ ├── ConfigurationConstants.java │ │ │ │ └── ContextDataCreator.java │ │ │ │ ├── content │ │ │ │ ├── BinaryContentDownloader.java │ │ │ │ ├── CilStaticContentResolver.java │ │ │ │ ├── GenericStaticContentResolver.java │ │ │ │ ├── GraphQLStaticContentResolver.java │ │ │ │ ├── StaticContentResolver.java │ │ │ │ └── package-info.java │ │ │ │ ├── linking │ │ │ │ ├── GraphQLLinkResolver.java │ │ │ │ └── TridionLinkResolver.java │ │ │ │ └── pcaclient │ │ │ │ ├── ApiClientAuthentication.java │ │ │ │ ├── ApiClientConfigurationException.java │ │ │ │ ├── ApiClientConfigurationLoader.java │ │ │ │ ├── ApiClientProvider.java │ │ │ │ ├── DXAGraphQLClient.java │ │ │ │ ├── DefaultApiClientProvider.java │ │ │ │ ├── GraphQLUtils.java │ │ │ │ └── GraphQlServiceConfigurationLoader.java │ │ └── resources │ │ │ └── dxa.modules.tridioncommon.properties │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── sdl │ │ │ └── dxa │ │ │ └── tridion │ │ │ ├── common │ │ │ └── ContextDataCreatorTest.java │ │ │ ├── content │ │ │ ├── CilStaticContentResolverTest.java │ │ │ ├── GenericStaticContentResolverTest.java │ │ │ └── GraphQLStaticContentResolverTest.java │ │ │ ├── linking │ │ │ └── GraphQLLinkResolverTest.java │ │ │ └── pcaclient │ │ │ ├── ApiClientAuthenticationTest.java │ │ │ ├── DefaultApiClientProviderTest.java │ │ │ └── GraphQlServiceConfigurationLoaderTest.java │ │ └── resources │ │ ├── cd_client_conf.xml │ │ └── logback-test.xml ├── dxa-tridion-provider │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── sdl │ │ │ │ ├── dxa │ │ │ │ ├── api │ │ │ │ │ └── datamodel │ │ │ │ │ │ └── model │ │ │ │ │ │ ├── condition │ │ │ │ │ │ ├── Condition.java │ │ │ │ │ │ ├── ConditionOperator.java │ │ │ │ │ │ ├── CustomerCharacteristicCondition.java │ │ │ │ │ │ ├── TargetGroupCondition.java │ │ │ │ │ │ └── TrackingKeyCondition.java │ │ │ │ │ │ └── targetgroup │ │ │ │ │ │ └── TargetGroup.java │ │ │ │ └── tridion │ │ │ │ │ ├── R2SpringConfiguration.java │ │ │ │ │ ├── broker │ │ │ │ │ ├── GraphQLQueryProvider.java │ │ │ │ │ └── QueryProvider.java │ │ │ │ │ ├── graphql │ │ │ │ │ └── GraphQLProvider.java │ │ │ │ │ ├── mapping │ │ │ │ │ ├── EntityModelBuilder.java │ │ │ │ │ ├── ModelBuilder.java │ │ │ │ │ ├── ModelBuilderPipeline.java │ │ │ │ │ ├── PageModelBuilder.java │ │ │ │ │ ├── converter │ │ │ │ │ │ ├── ContentModelDataConverter.java │ │ │ │ │ │ ├── EntityModelDataConverter.java │ │ │ │ │ │ ├── GenericSemanticModelDataConverter.java │ │ │ │ │ │ ├── KeywordModelDataConverter.java │ │ │ │ │ │ ├── ListWrapperConverter.java │ │ │ │ │ │ ├── NumberConverter.java │ │ │ │ │ │ ├── RichTextDataConverter.java │ │ │ │ │ │ ├── SemanticModelConverter.java │ │ │ │ │ │ ├── StringModelConverter.java │ │ │ │ │ │ ├── TypeInformation.java │ │ │ │ │ │ └── source │ │ │ │ │ │ │ └── keyword │ │ │ │ │ │ │ └── Converter.java │ │ │ │ │ ├── impl │ │ │ │ │ │ ├── AbstractContentProvider.java │ │ │ │ │ │ ├── DefaultContentProvider.java │ │ │ │ │ │ ├── DefaultModelBuilder.java │ │ │ │ │ │ ├── DefaultSemanticFieldDataProvider.java │ │ │ │ │ │ ├── GraphQLContentProvider.java │ │ │ │ │ │ ├── ModelBuilderPipelineImpl.java │ │ │ │ │ │ ├── StronglyTypedTopicBuilder.java │ │ │ │ │ │ └── package-info.java │ │ │ │ │ └── package-info.java │ │ │ │ │ ├── modelservice │ │ │ │ │ ├── DefaultModelServiceProvider.java │ │ │ │ │ └── GraphQLModelServiceProvider.java │ │ │ │ │ └── navigation │ │ │ │ │ ├── GraphQLDynamicNavigationModelProvider.java │ │ │ │ │ └── RestDynamicNavigationModelProvider.java │ │ │ │ └── webapp │ │ │ │ ├── config │ │ │ │ └── TridionSpringConfiguration.java │ │ │ │ └── tridion │ │ │ │ ├── GraphQLLocalizationResolver.java │ │ │ │ ├── PublicationMappingNotFoundException.java │ │ │ │ ├── TridionLocalizationResolver.java │ │ │ │ ├── config │ │ │ │ └── ExternalFiltersWebConfiguration.java │ │ │ │ ├── contextengine │ │ │ │ ├── AdfContextClaimsProvider.java │ │ │ │ └── ContextServiceClaimsProvider.java │ │ │ │ ├── fields │ │ │ │ └── exceptions │ │ │ │ │ ├── FieldConverterException.java │ │ │ │ │ ├── TaxonomyNotFoundException.java │ │ │ │ │ └── UnsupportedTargetTypeException.java │ │ │ │ ├── navigation │ │ │ │ ├── DynamicNavigationProvider.java │ │ │ │ └── StaticNavigationProvider.java │ │ │ │ └── xpm │ │ │ │ ├── ComponentTypeImpl.java │ │ │ │ ├── OccurrenceConstraintImpl.java │ │ │ │ ├── XpmRegionConfigImpl.java │ │ │ │ ├── XpmRegionImpl.java │ │ │ │ ├── filter │ │ │ │ ├── AbstractAmbientDataServletFilter.java │ │ │ │ ├── AmbientClientFilter.java │ │ │ │ ├── BinaryContentFilter.java │ │ │ │ ├── ClientBinaryContentFilter.java │ │ │ │ ├── ClientPageContentFilter.java │ │ │ │ ├── ContentFilter.java │ │ │ │ ├── PageContentFilter.java │ │ │ │ └── util │ │ │ │ │ └── SessionRequestDetails.java │ │ │ │ └── markup │ │ │ │ ├── EntityXpmMarkup.java │ │ │ │ ├── RegionXpmMarkup.java │ │ │ │ └── XpmMarkupInitializer.java │ │ └── resources │ │ │ └── dxa.modules.tridion.properties │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── sdl │ │ │ ├── dxa │ │ │ ├── api │ │ │ │ └── datamodel │ │ │ │ │ └── model │ │ │ │ │ └── condition │ │ │ │ │ └── ConditionTest.java │ │ │ └── tridion │ │ │ │ ├── graphql │ │ │ │ └── GraphQLProviderTest.java │ │ │ │ ├── mapping │ │ │ │ ├── converter │ │ │ │ │ ├── EntityModelDataConverterTest.java │ │ │ │ │ ├── RichTextDataConverterTest.java │ │ │ │ │ └── StringModelConverterTest.java │ │ │ │ └── impl │ │ │ │ │ ├── DefaultContentProviderTest.java │ │ │ │ │ ├── DefaultModelBuilderOnMocksTest.java │ │ │ │ │ ├── DefaultModelBuilderTest.java │ │ │ │ │ ├── GraphQLContentProviderTest.java │ │ │ │ │ ├── ModelBuilderPipelineTest.java │ │ │ │ │ └── StronglyTypedTopicBuilderTest.java │ │ │ │ ├── models │ │ │ │ ├── entity │ │ │ │ │ ├── Article.java │ │ │ │ │ └── Image.java │ │ │ │ └── topic │ │ │ │ │ ├── SpecializedBodyTest.java │ │ │ │ │ ├── SpecializedSectionTest.java │ │ │ │ │ ├── SpecializedTopicTest.java │ │ │ │ │ └── StronglyTypedTopicTest.java │ │ │ │ ├── modelservice │ │ │ │ ├── DefaultModelServiceProviderTest.java │ │ │ │ └── GraphQLModelServiceProviderTest.java │ │ │ │ └── navigation │ │ │ │ ├── GraphQLDynamicNavigationModelProviderTest.java │ │ │ │ └── RestDynamicNavigationModelProviderTest.java │ │ │ └── webapp │ │ │ └── tridion │ │ │ ├── GraphQLLocalizationResolverTest.java │ │ │ ├── config │ │ │ └── ExternalFiltersWebConfigurationTest.java │ │ │ ├── contextengine │ │ │ ├── AdfContextClaimsProviderTest.java │ │ │ └── ContextServiceClaimsProviderTest.java │ │ │ └── navigation │ │ │ ├── DynamicNavigationProviderTest.java │ │ │ └── StaticNavigationProviderTest.java │ │ └── resources │ │ ├── cd_client_conf.xml │ │ ├── home_page_json_full.json │ │ ├── logback-test.xml │ │ ├── navigation.json │ │ ├── pageModel-Conditions.json │ │ ├── pcaEntityModel.json │ │ ├── pcaPageModel.json │ │ └── pcaPageModelExpected.json └── pom.xml ├── dxa-model-service-client ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── sdl │ │ └── dxa │ │ └── tridion │ │ └── modelservice │ │ ├── ModelServiceClient.java │ │ ├── ModelServiceClientConfiguration.java │ │ └── exceptions │ │ ├── ItemNotFoundInModelServiceException.java │ │ ├── ModelServiceBadRequestException.java │ │ └── ModelServiceInternalServerErrorException.java │ └── resources │ └── dxa.modules.ms.properties ├── dxa-webapp ├── archetype.properties ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── example │ │ │ ├── SpringInitializer.java │ │ │ ├── WebAppInitializer.java │ │ │ ├── controller │ │ │ └── AdminController.java │ │ │ └── service │ │ │ └── AdminService.java │ ├── resources │ │ ├── Configuration_Quick_Reference.md │ │ ├── cd_ambient_conf.xml │ │ ├── cd_client_conf.xml │ │ ├── device-families.xml │ │ ├── dxa.properties │ │ ├── ehcache.xml │ │ ├── logback.xml │ │ └── schemas │ │ │ └── cd_ambient_conf.xsd │ └── webapp │ │ └── WEB-INF │ │ └── Views │ │ └── Shared │ │ ├── Entity │ │ └── ExceptionEntity.jsp │ │ └── Error │ │ ├── NotFoundError.jsp │ │ ├── SectionError.jsp │ │ └── ServerError.jsp │ └── test │ └── java │ └── org │ └── example │ ├── controller │ └── AdminControllerTest.java │ └── service │ └── AdminServiceTest.java ├── generate-from-archetype.cmd ├── get-started.cmd ├── gpgwrapper.sh ├── pom.xml └── release.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | # Windows 4 | *.bat text eol=crlf 5 | *.cmd text eol=crlf 6 | 7 | # Unix 8 | *.sh text eol=lf 9 | gradlew text eol=lf 10 | install text eol=lf -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Maven 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven 3 | 4 | name: Build 5 | 6 | on: 7 | push: 8 | branches: [ develop ] 9 | pull_request: 10 | branches: [ develop ] 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Set up JDK 17 20 | uses: actions/setup-java@v3 21 | with: 22 | java-version: '17' 23 | distribution: 'temurin' 24 | - name: Build with Maven 25 | run: mvn install --batch-mode --no-transfer-progress -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --file pom.xml 26 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | release: 5 | types: [ created ] 6 | 7 | jobs: 8 | release: 9 | name: Release on Sonatype OSS 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Set up JDK 17 15 | uses: actions/setup-java@v3 16 | with: 17 | java-version: '17' 18 | distribution: 'temurin' 19 | - name: Build with Maven 20 | run: chmod +x release.sh; ./release.sh 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .classpath 2 | .project 3 | .checkstyle 4 | *.iml 5 | .idea 6 | .settings/ 7 | target/ 8 | cd_licenses.xml 9 | .metadata/ 10 | temp/ 11 | .gradle 12 | build/ 13 | logs/ 14 | pom.xml.versionsBackup 15 | release.ps1 -------------------------------------------------------------------------------- /dxa-dd4t-ms-provider/src/test/resources/dcp.json: -------------------------------------------------------------------------------- 1 | { 2 | "Meta": { 3 | "ContentType": "HTML Fragment", 4 | "NamespaceId": 0, 5 | "TemplatePriority": 300, 6 | "TemplateId": 9195, 7 | "ComponentId": 1468, 8 | "PublicationId": 1065, 9 | "Encoding": "UTF8", 10 | "ObjectSize": 98 11 | }, 12 | "FileLocation": "file", 13 | "NamespaceId": 1, 14 | "PublicationId": 2, 15 | "ComponentId": 3, 16 | "ComponentTemplateId": 4, 17 | "Content": "content", 18 | "Dynamic": true, 19 | "ObjectSize": 3748 20 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/IshModuleInitializer.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa; 2 | 3 | import com.sdl.webapp.common.api.mapping.views.AbstractModuleInitializer; 4 | import com.sdl.webapp.common.api.mapping.views.RegisteredViewModel; 5 | import com.sdl.webapp.common.api.mapping.views.RegisteredViewModels; 6 | import com.sdl.webapp.common.api.model.entity.GenericTopic; 7 | 8 | /** 9 | * In order to work with Tridion Docs content, it is necessary to register GenericTopic as a View. 10 | * A DXA Web Application/Module that wants to work with Tridion Docs content should include this module 11 | * unless it defines its own View Model Type for generic Topics. 12 | * 13 | * This module is enabled by default in {@link DxaSpringInitialization} it can be disabled by enabling 14 | * the Spring profile "dxa.generictopic.disabled" 15 | */ 16 | @RegisteredViewModels({ 17 | @RegisteredViewModel(viewName = "Topic", modelClass = GenericTopic.class) 18 | }) 19 | public class IshModuleInitializer extends AbstractModuleInitializer { 20 | 21 | @Override 22 | protected String getAreaName() { 23 | return "ish"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/caching/CompositeOutputCacheKeyBase.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | import com.sdl.webapp.common.api.model.MvcData; 4 | import lombok.Value; 5 | 6 | import jakarta.servlet.http.HttpServletRequest; 7 | 8 | /** 9 | * Composite key (DTO) for output caching. 10 | */ 11 | @Value 12 | public class CompositeOutputCacheKeyBase { 13 | 14 | private String pageId; 15 | 16 | private String name; 17 | 18 | private String include; 19 | 20 | private MvcData mvcData; 21 | 22 | private HttpServletRequest request; 23 | } 24 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/caching/WebRequestContextLocalizationIdProvider.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | import com.sdl.webapp.common.api.WebRequestContext; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Component 8 | public class WebRequestContextLocalizationIdProvider implements LocalizationIdProvider { 9 | 10 | @Autowired 11 | private WebRequestContext webRequestContext; 12 | 13 | @Override 14 | public String getId() { 15 | return webRequestContext.getLocalization().getId(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/caching/wrapper/CopyingCache.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching.wrapper; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | /** 7 | * @deprecated 8 | * Cache wrapper abstract class that always returns a deep clone of the value from cache. 9 | * 10 | * @param base type used for a key calculation in {@link #getSpecificKey(Object, Object...)} 11 | * @param value type of the cache 12 | */ 13 | @Slf4j 14 | @Deprecated 15 | public abstract class CopyingCache extends SimpleCacheWrapper { 16 | 17 | /** 18 | * {@inheritDoc} 19 | *

Returns deep copy of the instance from cache.

20 | */ 21 | @Override 22 | public V addAndGet(Object key, V value) { 23 | return checkAndCopy(super.addAndGet(key, value)); 24 | } 25 | 26 | @Nullable 27 | @Override 28 | public V get(Object key) { 29 | return checkAndCopy(super.get(key)); 30 | } 31 | 32 | protected abstract V copy(V value); 33 | 34 | private V checkAndCopy(V value) { 35 | if (value == null) { 36 | return null; 37 | } 38 | return isCachingEnabled() ? copy(value) : value; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/caching/wrapper/EntitiesCache.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching.wrapper; 2 | 3 | import com.sdl.dxa.api.datamodel.model.EntityModelData; 4 | import com.sdl.webapp.common.api.model.EntityModel; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * @deprecated 9 | * Default implementation of entities cache for manual access. 10 | */ 11 | @Deprecated 12 | @Component 13 | public class EntitiesCache extends SimpleCacheWrapper { 14 | 15 | @Override 16 | public String getCacheName() { 17 | return "entities"; 18 | } 19 | 20 | @Override 21 | public Class getValueType() { 22 | return EntityModel.class; 23 | } 24 | 25 | @Override 26 | public Object getSpecificKey(EntityModelData entityModelData, Object... other) { 27 | if (other.length == 0 || (other.length == 1 && other[0] == null) ){ 28 | return getKey(entityModelData.getId(), entityModelData.getContextId(), 29 | entityModelData.getSchemaId(), entityModelData.getMvcData()); 30 | } 31 | return getKey(entityModelData.getId(), entityModelData.getSchemaId(), entityModelData.getMvcData(),other); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/caching/wrapper/PagesCopyingCache.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching.wrapper; 2 | 3 | import com.sdl.dxa.api.datamodel.model.PageModelData; 4 | import com.sdl.webapp.common.api.model.PageModel; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * @deprecated 9 | * Default implementation of pages cache for manual access. By cache retrieval makes a deep copy instead of returning an object from cache. 10 | */ 11 | @Component 12 | @Deprecated 13 | public class PagesCopyingCache extends CopyingCache { 14 | 15 | @Override 16 | public String getCacheName() { 17 | return "pages"; 18 | } 19 | 20 | @Override 21 | public Class getValueType() { 22 | return PageModel.class; 23 | } 24 | 25 | @Override 26 | public Object getSpecificKey(PageModelData pageModelData, Object... keyParams) { 27 | return getKey(pageModelData.getUrlPath(), pageModelData.getMvcData()); 28 | } 29 | 30 | @Override 31 | protected PageModel copy(PageModel value) { 32 | return value.deepCopy(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/caching/wrapper/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains implementation of the main caches used in DXA for manual access. 3 | */ 4 | package com.sdl.dxa.caching.wrapper; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/mvc/ViewNameResolver.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.mvc; 2 | 3 | import com.sdl.webapp.common.api.model.MvcData; 4 | 5 | /** 6 | * Resolves a view name based on MVC data and view's type. 7 | * 8 | * @since 1.5 9 | */ 10 | @FunctionalInterface 11 | public interface ViewNameResolver { 12 | 13 | /** 14 | * Resolves a view name from {@link MvcData}, view type and a request. 15 | * 16 | * @param mvcData mvc data with information about the view needed 17 | * @param viewType type of the view 18 | * @return view name for the given {@link MvcData} 19 | */ 20 | String resolveView(MvcData mvcData, String viewType); 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/dxa/mvc/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Interfaces and classes related to the MVC support in DXA. 3 | */ 4 | package com.sdl.dxa.mvc; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/ThreadLocalManager.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api; 2 | 3 | /** 4 | * ThreadLocal Manager. 5 | * Manage all registered thread local variables and clear them after each request. 6 | * 7 | * @author nic 8 | */ 9 | public interface ThreadLocalManager { 10 | 11 | /** 12 | *

registerThreadLocal.

13 | * 14 | * @param threadLocal a {@link java.lang.ThreadLocal} object. 15 | */ 16 | void registerThreadLocal(ThreadLocal threadLocal); 17 | 18 | /** 19 | *

unregisterThreadLocal.

20 | * 21 | * @param threadLocal a {@link java.lang.ThreadLocal} object. 22 | */ 23 | void unregisterThreadLocal(ThreadLocal threadLocal); 24 | 25 | /** 26 | *

clearAll.

27 | */ 28 | void clearAll(); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/content/ConditionalEntityEvaluator.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.content; 2 | 3 | import com.sdl.webapp.common.api.model.EntityModel; 4 | 5 | /** 6 | * Conditional Entity Evaluator evaluates whether the entity should be included in a page. 7 | * 8 | */ 9 | @FunctionalInterface 10 | public interface ConditionalEntityEvaluator { 11 | 12 | /** 13 | * Evaluates if the entity should be included. 14 | * 15 | * @param entity entity to evaluate 16 | * @return true if should be included, false otherwise 17 | */ 18 | boolean includeEntity(EntityModel entity) throws ContentProviderException; 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/content/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Interfaces and classes related to content retrieval. 3 | */ 4 | package com.sdl.webapp.common.api.content; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/contextengine/ContextEngine.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.contextengine; 2 | 3 | import org.jetbrains.annotations.Nullable; 4 | 5 | /** 6 | * Context engine gives you access to a request-scoped collection of claims and other context data. 7 | * 8 | */ 9 | public interface ContextEngine { 10 | 11 | /** 12 | * Returns specific strongly-typed claims wrapper. 13 | * 14 | * @param cls claims wrapper class 15 | * @param type of these specific claims 16 | * @return a strongly-typed claims wrapper 17 | */ 18 | //todo dxa2 return not-generic value? if not, refactor in another way 19 | @Nullable 20 | T getClaims(Class cls); 21 | 22 | /** 23 | * Returns a predefined name of a device family. 24 | * 25 | * @return a device family name 26 | */ 27 | String getDeviceFamily(); 28 | } 29 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/contextengine/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Context engine details. 3 | */ 4 | package com.sdl.webapp.common.api.contextengine; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/formats/DataFormatter.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.formats; 2 | 3 | import org.springframework.web.servlet.ModelAndView; 4 | 5 | /** 6 | * DataFormatter is to be implemented by the class wiring the different format responses. 7 | * 8 | */ 9 | @FunctionalInterface 10 | public interface DataFormatter { 11 | 12 | /** 13 | * Returns the {@link ModelAndView} to render the different formats. 14 | */ 15 | ModelAndView view(Object model); 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/formats/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Data formats and formatters. 3 | */ 4 | package com.sdl.webapp.common.api.formats; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/formatters/JsonFormatter.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.formatters; 2 | 3 | import com.sdl.webapp.common.api.WebRequestContext; 4 | import com.sdl.webapp.common.api.formatters.support.FeedItem; 5 | 6 | import jakarta.servlet.http.HttpServletRequest; 7 | 8 | /** 9 | * Produces the feed in json format. 10 | */ 11 | public class JsonFormatter extends BaseFormatter { 12 | 13 | public JsonFormatter(HttpServletRequest request, WebRequestContext context) { 14 | super(request, context); 15 | this.addMediaType("application/json"); 16 | } 17 | 18 | /** 19 | * JSON formatter doesn't need any processing and returns model as it is. 20 | */ 21 | @Override 22 | public Object formatData(Object model) { 23 | return model; 24 | } 25 | 26 | /** 27 | * JSON formatter doesn't need any processing and returns model as it is. 28 | */ 29 | @Override 30 | public Object getSyndicationItem(FeedItem item) { 31 | throw new UnsupportedOperationException("This method shall not be called!"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/formatters/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Data formats and formatters. 3 | */ 4 | package com.sdl.webapp.common.api.formatters; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/formatters/support/FeedItem.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.formatters.support; 2 | 3 | import com.sdl.webapp.common.api.formatters.FeedFormatter; 4 | import com.sdl.webapp.common.api.model.RichText; 5 | import com.sdl.webapp.common.api.model.entity.Link; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Builder; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | import java.util.Date; 12 | 13 | /** 14 | * Feed item class is used to hold the data for {@link FeedFormatter}. 15 | */ 16 | @Data 17 | @Builder 18 | @NoArgsConstructor 19 | @AllArgsConstructor 20 | public class FeedItem { 21 | 22 | private String headline; 23 | 24 | private Link link; 25 | 26 | private RichText summary; 27 | 28 | private Date date; 29 | } 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/formatters/support/FeedItemsProvider.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.formatters.support; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Indicates that an implementor can generate a list of {@link FeedItem} out of its data. 7 | * 8 | */ 9 | @FunctionalInterface 10 | public interface FeedItemsProvider { 11 | 12 | List extractFeedItems(); 13 | } 14 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/formatters/support/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Data formats and formatters. 3 | */ 4 | package com.sdl.webapp.common.api.formatters.support; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/localization/LocalizationFactory.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.localization; 2 | 3 | @FunctionalInterface 4 | public interface LocalizationFactory { 5 | 6 | /** 7 | * Creates a localization with the specified ID and path. 8 | * 9 | * @param id The localization ID. 10 | * @param path The localization path. 11 | * @return A {@code Localization} with the specified ID and path. 12 | * @throws com.sdl.webapp.common.api.localization.LocalizationFactoryException If an error occurs so that the localization cannot be created. 13 | */ 14 | Localization createLocalization(String id, String path) throws LocalizationFactoryException; 15 | } 16 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/localization/LocalizationFactoryException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.localization; 2 | 3 | /** 4 | * Thrown when an error occurs in a localization factory while creating a localization. 5 | */ 6 | public class LocalizationFactoryException extends Exception { 7 | 8 | public LocalizationFactoryException() { 9 | } 10 | 11 | public LocalizationFactoryException(String message) { 12 | super(message); 13 | } 14 | 15 | public LocalizationFactoryException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public LocalizationFactoryException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public LocalizationFactoryException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/localization/LocalizationNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.localization; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Localization not found!") 7 | public class LocalizationNotFoundException extends LocalizationNotResolvedException { 8 | 9 | public LocalizationNotFoundException(String message) { 10 | super(message); 11 | } 12 | 13 | public LocalizationNotFoundException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/localization/LocalizationResolver.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.localization; 2 | 3 | /** 4 | * Localization resolver. 5 | */ 6 | public interface LocalizationResolver { 7 | 8 | /** 9 | * Gets the localization for a specified URL. 10 | * 11 | * @param url The URL. 12 | * @return The {@code Localization} for this URL. 13 | * @throws com.sdl.webapp.common.api.localization.LocalizationResolverException If an error occurred so that the localization could not be determined. 14 | */ 15 | Localization getLocalization(String url) throws LocalizationResolverException; 16 | 17 | /** 18 | * Refreshes the specified localization, so that its configuration is reloaded. 19 | * 20 | * @param localization localization to be refreshed 21 | * @return a boolean. 22 | */ 23 | boolean refreshLocalization(Localization localization); 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/localization/LocalizationResolverException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.localization; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | /** 7 | * Thrown when an error occurs in a localization resolver when resolving a localization. 8 | */ 9 | @ResponseStatus(HttpStatus.NOT_FOUND) 10 | public class LocalizationResolverException extends Exception { 11 | 12 | public LocalizationResolverException() { 13 | } 14 | 15 | public LocalizationResolverException(String message) { 16 | super(message); 17 | } 18 | 19 | public LocalizationResolverException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | 23 | public LocalizationResolverException(Throwable cause) { 24 | super(cause); 25 | } 26 | 27 | public LocalizationResolverException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 28 | super(message, cause, enableSuppression, writableStackTrace); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/localization/SiteLocalization.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.localization; 2 | 3 | /** 4 | * Site localization - contains information on related localizations for a localization (for example different language 5 | * variants of the same website). 6 | */ 7 | public interface SiteLocalization { 8 | 9 | /** 10 | *

getId.

11 | * 12 | * @return a {@link java.lang.String} object. 13 | */ 14 | String getId(); 15 | 16 | /** 17 | *

getPath.

18 | * 19 | * @return a {@link java.lang.String} object. 20 | */ 21 | String getPath(); 22 | 23 | /** 24 | *

getLanguage.

25 | * 26 | * @return a {@link java.lang.String} object. 27 | */ 28 | String getLanguage(); 29 | 30 | /** 31 | *

isMaster.

32 | * 33 | * @return a boolean. 34 | */ 35 | boolean isMaster(); 36 | } 37 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/localization/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Localization interfaces and classes. 3 | */ 4 | package com.sdl.webapp.common.api.localization; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/FieldData.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * Field data, which consists of a field value and property data for a field. This is returned by 7 | * {@code SemanticFieldDataProvider}. 8 | *

9 | * The field value is the actual value for the field of an entity. The property data is extra data which is stored in 10 | * the entity and which is used for semantic markup. 11 | */ 12 | @Getter 13 | public class FieldData { 14 | 15 | private final Object fieldValue; 16 | 17 | private final String propertyData; 18 | 19 | /** 20 | *

Constructor for FieldData.

21 | * 22 | * @param fieldValue a {@link java.lang.Object} object. 23 | * @param propertyData a {@link java.lang.String} object. 24 | */ 25 | public FieldData(Object fieldValue, String propertyData) { 26 | this.fieldValue = fieldValue; 27 | this.propertyData = propertyData; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/SemanticMappingException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic; 2 | 3 | import com.sdl.webapp.common.exceptions.DxaException; 4 | 5 | public class SemanticMappingException extends DxaException { 6 | 7 | public SemanticMappingException() { 8 | } 9 | 10 | public SemanticMappingException(String message) { 11 | super(message); 12 | } 13 | 14 | public SemanticMappingException(String message, Throwable cause) { 15 | super(message, cause); 16 | } 17 | 18 | public SemanticMappingException(Throwable cause) { 19 | super(cause); 20 | } 21 | 22 | public SemanticMappingException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 23 | super(message, cause, enableSuppression, writableStackTrace); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/annotations/SemanticEntities.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | *

SemanticEntities class.

10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(ElementType.TYPE) 13 | public @interface SemanticEntities { 14 | 15 | SemanticEntity[] value() default {}; 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/annotations/SemanticEntity.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | *

SemanticEntity class.

10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(ElementType.TYPE) 13 | public @interface SemanticEntity { 14 | 15 | String entityName() default ""; 16 | 17 | String value() default ""; 18 | 19 | String vocabulary() default ""; 20 | 21 | String prefix() default ""; 22 | 23 | boolean public_() default false; 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/annotations/SemanticMappingIgnore.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | *

SemanticMappingIgnore class.

10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target({ElementType.TYPE, ElementType.FIELD}) 13 | public @interface SemanticMappingIgnore { 14 | } 15 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/annotations/SemanticProperties.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | *

SemanticProperties class.

10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(ElementType.FIELD) 13 | public @interface SemanticProperties { 14 | 15 | SemanticProperty[] value() default {}; 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/annotations/SemanticProperty.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.annotations; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | *

SemanticProperty class.

10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target(ElementType.FIELD) 13 | public @interface SemanticProperty { 14 | 15 | String propertyName() default ""; 16 | 17 | String value() default ""; 18 | } 19 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/config/EntitySemantics.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.config; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | @Getter 8 | @ToString 9 | @EqualsAndHashCode 10 | public final class EntitySemantics { 11 | 12 | private final SemanticVocabulary vocabulary; 13 | 14 | private final String entityName; 15 | 16 | public EntitySemantics(SemanticVocabulary vocabulary, String entityName) { 17 | this.vocabulary = vocabulary; 18 | this.entityName = entityName; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/config/FieldSemantics.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.config; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import lombok.ToString; 6 | 7 | import java.util.Objects; 8 | 9 | @Getter 10 | @ToString 11 | @EqualsAndHashCode 12 | public final class FieldSemantics { 13 | 14 | private final SemanticVocabulary vocabulary; 15 | 16 | private final String entityName; 17 | 18 | private final String propertyName; 19 | 20 | public FieldSemantics(SemanticVocabulary vocabulary, String entityName, String propertyName) { 21 | this.vocabulary = vocabulary; 22 | this.entityName = entityName; 23 | this.propertyName = propertyName; 24 | } 25 | 26 | public boolean isStandardMetadataField() { 27 | return Objects.equals(this.entityName, "StandardMetadata"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/config/SemanticField.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.config; 2 | 3 | import com.google.common.collect.ImmutableMap; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import lombok.ToString; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.jetbrains.annotations.NotNull; 9 | import org.jetbrains.annotations.Nullable; 10 | 11 | import java.util.Map; 12 | 13 | @Getter 14 | @ToString 15 | @EqualsAndHashCode 16 | @Slf4j 17 | public final class SemanticField implements WithXPath { 18 | 19 | private final String name; 20 | 21 | private final FieldPath path; 22 | 23 | private final boolean multiValue; 24 | 25 | private final Map embeddedFields; 26 | 27 | public SemanticField(String name, String path, boolean multiValue, 28 | Map embeddedFields) { 29 | this.name = name; 30 | this.path = new FieldPath(path); 31 | this.multiValue = multiValue; 32 | this.embeddedFields = ImmutableMap.copyOf(embeddedFields); 33 | } 34 | 35 | @Override 36 | @NotNull 37 | public String getXPath(@Nullable String contextXPath) { 38 | return path.getXPath(contextXPath); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/config/SemanticVocabulary.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.config; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import lombok.ToString; 7 | 8 | @ToString 9 | @EqualsAndHashCode 10 | public final class SemanticVocabulary { 11 | 12 | public static final String SDL_CORE = "http://www.sdl.com/web/schemas/core"; 13 | 14 | /** 15 | * The internal/built-in Vocabulary ID used for DITA mapping. 16 | */ 17 | public static final String SDL_DITA = "http://www.sdl.com/web/schemas/dita"; 18 | 19 | public static final String SCHEMA_ORG = "http://schema.org/"; 20 | 21 | public static final SemanticVocabulary SDL_CORE_VOCABULARY = new SemanticVocabulary(SDL_CORE); 22 | 23 | public static final SemanticVocabulary SDL_DITA_VOCABULARY = new SemanticVocabulary(SDL_DITA); 24 | 25 | public static final SemanticVocabulary SCHEMA_ORG_VOCABULARY = new SemanticVocabulary(SCHEMA_ORG); 26 | 27 | @Getter 28 | private final String id; 29 | 30 | @Getter 31 | @Setter 32 | private String prefix; 33 | 34 | @Getter 35 | @Setter 36 | private String vocab; 37 | 38 | public SemanticVocabulary(String id) { 39 | this.id = id; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/semantic/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Interfaces and classes related to semantic mapping. 3 | */ 4 | package com.sdl.webapp.common.api.mapping.semantic; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/views/AbstractInitializer.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.views; 2 | 3 | /** 4 | * Compatibility layer. 5 | * @deprecated since 2.0, use {@link AbstractModuleInitializer} instead 6 | */ 7 | @Deprecated 8 | public abstract class AbstractInitializer extends AbstractModuleInitializer { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/views/ModuleInfo.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.views; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Module formal description. 10 | */ 11 | @Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface ModuleInfo { 14 | /** 15 | * Name of a module. 16 | * @return name of a module 17 | */ 18 | String name(); 19 | 20 | /** 21 | * Name of the Mvc area. 22 | * @return name of the Mvc area 23 | */ 24 | String areaName(); 25 | 26 | /** 27 | * Short description of a module. 28 | * @return a short description of a module 29 | */ 30 | String description() default ""; 31 | 32 | /** 33 | * If this module initialization should be skipped. 34 | * @return whether this module shouldn't be initialized 35 | */ 36 | boolean skip() default false; 37 | } 38 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/views/RegisteredViewModel.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.views; 2 | 3 | import com.sdl.webapp.common.api.model.ViewModel; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * Annotation that wires view name and a model class representing data for this view with optional controller name. 12 | */ 13 | @Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface RegisteredViewModel { 16 | 17 | String viewName() default ""; 18 | 19 | Class modelClass(); 20 | 21 | String controllerName() default ""; 22 | } 23 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/views/RegisteredViewModels.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.views; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Set of viewModels to be registered by {@link AbstractModuleInitializer}. 10 | * 11 | */ 12 | @Target(ElementType.TYPE) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface RegisteredViewModels { 15 | 16 | RegisteredViewModel[] value(); 17 | } 18 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/mapping/views/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * View and modules registration classes and interfaces. 3 | */ 4 | package com.sdl.webapp.common.api.mapping.views; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/CanFilterEntities.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model; 2 | 3 | import com.sdl.webapp.common.api.content.ConditionalEntityEvaluator; 4 | import com.sdl.webapp.common.api.content.ContentProviderException; 5 | 6 | import java.util.Collection; 7 | 8 | /** 9 | * The implementor can filter {@link EntityModel} accepting a list of {@link ConditionalEntityEvaluator}. 10 | * 11 | */ 12 | public interface CanFilterEntities { 13 | 14 | /** 15 | * Default implementation does not filter anything. 16 | * 17 | * @param evaluators list of evaluators to evaluate entities against. 18 | */ 19 | default void filterConditionalEntities(Collection evaluators) throws ContentProviderException { 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/EntityModel.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model; 2 | 3 | import com.sdl.webapp.common.exceptions.DxaException; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * EntityModel interface represents an entity. 9 | *

It is important to know about single/plural ending convention for fields mapping. 10 | * Schema.org & CM say that a single element even if we have a list of those, 11 | * because CM operates with the whole collection as with single entities. 12 | * So if we actually have multiple elements it was decided to call the field in plural in DXA.

13 | *

14 |  *     // is mapped to 'element' in singular form
15 |  *     private List<String> elements;
16 |  * 
17 | * 18 | */ 19 | public interface EntityModel extends ViewModel, RichTextFragment { 20 | 21 | String getId(); 22 | 23 | Map getXpmPropertyMetadata(); 24 | 25 | EntityModel deepCopy(); 26 | 27 | void setEmbedded(boolean b); 28 | 29 | boolean isEmbedded(); 30 | } 31 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/MvcData.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * Data for the MVC framework to determine how a view model object should be handled. 7 | * 8 | */ 9 | public interface MvcData { 10 | 11 | String getControllerAreaName(); 12 | 13 | String getControllerName(); 14 | 15 | String getActionName(); 16 | 17 | String getAreaName(); 18 | 19 | String getViewName(); 20 | 21 | String getRegionAreaName(); 22 | 23 | String getRegionName(); 24 | 25 | Map getRouteValues(); 26 | 27 | /** 28 | * Makes a deep copy of the current object. 29 | * It is important that {@code mvcData.deepCopy != mvcData && mvcData.equals(mvcData.deepCopy())} evaluates to {@code true} 30 | * 31 | * @return a deep copy 32 | */ 33 | MvcData deepCopy(); 34 | 35 | Map getMetadata(); 36 | 37 | void addMetadataValue(String key, Object obj); 38 | } 39 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/RegionModelSet.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model; 2 | 3 | import java.util.Set; 4 | 5 | /** 6 | *

RegionModelSet interface.

7 | */ 8 | public interface RegionModelSet extends Set { 9 | 10 | RegionModel get(String name); 11 | 12 | Set get(Class clazz); 13 | 14 | boolean containsName(String name); 15 | 16 | boolean containsClass(Class clazz); 17 | } 18 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/RichTextFragment.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model; 2 | 3 | import com.sdl.webapp.common.exceptions.DxaException; 4 | import com.sdl.webapp.common.markup.html.HtmlElement; 5 | 6 | @FunctionalInterface 7 | public interface RichTextFragment { 8 | 9 | HtmlElement toHtmlElement() throws DxaException; 10 | } 11 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/RichTextFragmentImpl.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.sdl.webapp.common.markup.html.HtmlElement; 5 | import com.sdl.webapp.common.markup.html.builders.HtmlBuilders; 6 | import lombok.Data; 7 | 8 | @Data 9 | public class RichTextFragmentImpl implements RichTextFragment { 10 | 11 | @JsonProperty("Html") 12 | private String html; 13 | 14 | public RichTextFragmentImpl(String html) { 15 | this.html = html; 16 | } 17 | 18 | @Override 19 | public HtmlElement toHtmlElement() { 20 | return HtmlBuilders.empty().withPureHtmlContent(html).build(); 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return toHtmlElement().toHtml(); 26 | } 27 | 28 | public String getHtml() { 29 | return toHtmlElement().toHtml(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/entity/Configuration.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticProperty; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | /** 11 | * Very generic Entity Model which maps all CM fields to a Settings dictionary (effectively bypassing semantic mapping). 12 | */ 13 | @Data 14 | @EqualsAndHashCode(callSuper = true) 15 | public class Configuration extends AbstractEntityModel { 16 | 17 | @SemanticProperty("_all") 18 | private Map settings = new HashMap<>(); 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/entity/GenericWidget.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticEntity; 4 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticProperty; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | import java.util.Map; 9 | 10 | import static com.sdl.webapp.common.api.mapping.semantic.config.SemanticVocabulary.SDL_CORE; 11 | 12 | /** 13 | * @deprecated since 1.6 14 | */ 15 | @SemanticEntity(entityName = "GenericWidget", vocabulary = SDL_CORE, prefix = "gw", public_ = true) 16 | @Data 17 | @EqualsAndHashCode(callSuper = true) 18 | @Deprecated 19 | public class GenericWidget extends AbstractEntityModel { 20 | 21 | @SemanticProperty("gw:parameters") 22 | private Map parameters; 23 | 24 | // Link to same widget with "full" CT 25 | // 26 | @SemanticProperty("gw:_self") 27 | private String link; 28 | 29 | // TODO: Introduce also named links so the widget can find links to other widgets 30 | } 31 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/entity/NameValuePair.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticEntity; 5 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticProperty; 6 | import lombok.Data; 7 | import lombok.EqualsAndHashCode; 8 | 9 | import static com.sdl.webapp.common.api.mapping.semantic.config.SemanticVocabulary.SDL_CORE; 10 | 11 | /** 12 | * @deprecated since 1.6 13 | */ 14 | @SemanticEntity(entityName = "NameValuePair", vocabulary = SDL_CORE, prefix = "nv") 15 | @Data 16 | @EqualsAndHashCode 17 | @Deprecated 18 | public class NameValuePair { 19 | 20 | @SemanticProperty("nv:name") 21 | @JsonProperty("Name") 22 | private String name; 23 | 24 | @SemanticProperty("nv:value") 25 | @JsonProperty("Value") 26 | private String value; 27 | } 28 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/entity/NavigationLinks.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.NoArgsConstructor; 8 | 9 | import java.util.List; 10 | 11 | @Data 12 | @EqualsAndHashCode(callSuper = true) 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | public class NavigationLinks extends AbstractEntityModel { 16 | 17 | @JsonProperty("Items") 18 | private List items; 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/entity/RedirectEntity.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | /** 8 | * Entity that forces page to redirect to the given URL. 9 | * 10 | */ 11 | @Data 12 | @EqualsAndHashCode(callSuper = true) 13 | @AllArgsConstructor 14 | public class RedirectEntity extends AbstractEntityModel { 15 | 16 | private String url; 17 | } 18 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/entity/Tag.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.sdl.webapp.common.api.model.KeywordModel; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | 8 | /** 9 | * Represents a Keyword in CM. 10 | *

11 | * This class has hard-coded mappings to Keyword properties and does not support custom metadata on Keywords. 12 | * If this is too limiting for your implementation, use class {@link KeywordModel} instead. 13 | * Since there is no use in subclassing this class (unlike {@link KeywordModel}), it has been declared as sealed in DXA 1.7. 14 | *

15 | * 16 | * @see KeywordModel 17 | */ 18 | @Data 19 | @EqualsAndHashCode 20 | public final class Tag { 21 | 22 | @JsonProperty("DisplayText") 23 | private String displayText; 24 | 25 | @JsonProperty("Key") 26 | private String key; 27 | 28 | @JsonProperty("TagCategory") 29 | private String tagCategory; 30 | } 31 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/entity/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * EntityModel abstraction. 3 | */ 4 | package com.sdl.webapp.common.api.model.entity; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * MVC data implementation and utils. 3 | */ 4 | package com.sdl.webapp.common.api.model.mvcdata; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * View Model abstraction. 3 | */ 4 | package com.sdl.webapp.common.api.model; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/page/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * PageModel abstraction. 3 | */ 4 | package com.sdl.webapp.common.api.model.page; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/query/AbstractQuery.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.query; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | @Data 8 | @AllArgsConstructor 9 | @NoArgsConstructor 10 | public abstract class AbstractQuery { 11 | 12 | private int resultLimit; 13 | 14 | private int startAt; 15 | 16 | private int pageSize; 17 | 18 | private boolean hasMore; 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/query/ComponentMetadata.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.query; 2 | 3 | import lombok.Builder; 4 | import lombok.Value; 5 | 6 | import java.util.Date; 7 | import java.util.Map; 8 | 9 | /** 10 | * Component metadata DTO, structure is aligned with CD broker API metadata. 11 | */ 12 | @Value 13 | @Builder 14 | public class ComponentMetadata { 15 | 16 | private String id; 17 | 18 | private String componentUrl; 19 | 20 | private String publicationId; 21 | 22 | private String owningPublicationId; 23 | 24 | private String schemaId; 25 | 26 | private String title; 27 | 28 | private Date modificationDate; 29 | 30 | private Date initialPublicationDate; 31 | 32 | private Date lastPublicationDate; 33 | 34 | private Date creationDate; 35 | 36 | private String author; 37 | 38 | private boolean multimedia; 39 | 40 | private Map custom; 41 | 42 | /** 43 | * Type of the meta entry. 44 | */ 45 | public enum MetaType { 46 | DATE, FLOAT, STRING 47 | } 48 | 49 | @Value 50 | @Builder 51 | public static class MetaEntry { 52 | 53 | private Object value; 54 | 55 | private MetaType metaType; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/query/SimpleBrokerQuery.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.query; 2 | 3 | import com.google.common.collect.ArrayListMultimap; 4 | import com.google.common.collect.Multimap; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Builder; 7 | import lombok.Data; 8 | import lombok.EqualsAndHashCode; 9 | import lombok.NoArgsConstructor; 10 | import lombok.ToString; 11 | 12 | @Data 13 | @EqualsAndHashCode(callSuper = true) 14 | @NoArgsConstructor 15 | @Builder 16 | @AllArgsConstructor 17 | @ToString 18 | public class SimpleBrokerQuery extends AbstractQuery { 19 | 20 | private int publicationId; 21 | 22 | private int schemaId; 23 | 24 | private String path; 25 | 26 | private String sort; 27 | 28 | private String cursor; 29 | 30 | private Multimap keywordFilters = ArrayListMultimap.create(); 31 | } 32 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/validation/DynamicValidationMessage.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.validation; 2 | 3 | import com.sdl.webapp.common.api.model.ViewModel; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * Marks a method as a provider of custom validation message with a code. 12 | * That means that error code is to be resolved by {@link DynamicCodeResolver#resolveCode(String, ViewModel)}. 13 | */ 14 | @Target({ElementType.METHOD}) 15 | @Retention(RetentionPolicy.RUNTIME) 16 | public @interface DynamicValidationMessage { 17 | 18 | String errorCode(); 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/navigation/NavigationProviderException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.navigation; 2 | 3 | import com.sdl.webapp.common.api.content.ContentProviderException; 4 | 5 | /** 6 | * Thrown when an error occurs related to a navigation provider. 7 | */ 8 | public class NavigationProviderException extends ContentProviderException { 9 | 10 | public NavigationProviderException() { 11 | } 12 | 13 | public NavigationProviderException(String message) { 14 | super(message); 15 | } 16 | 17 | public NavigationProviderException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public NavigationProviderException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public NavigationProviderException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/navigation/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Navigation provider abstraction. 3 | */ 4 | package com.sdl.webapp.common.api.navigation; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Common API package. 3 | */ 4 | package com.sdl.webapp.common.api; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/serialization/json/DxaViewModelJsonPropertyFilter.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.serialization.json; 2 | 3 | import com.fasterxml.jackson.databind.ser.PropertyWriter; 4 | import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; 5 | import com.sdl.webapp.common.api.model.AbstractViewModel; 6 | import com.sdl.webapp.common.views.JsonView; 7 | 8 | /** 9 | * Interface for JSON filter that will be chained as {@link SimpleBeanPropertyFilter}. 10 | * Used to filter out dynamically properties that are serialized in JSON, for example by {@link JsonView}. 11 | * All subclass beans of this that are found in current Spring Context will be applied by default to {@link AbstractViewModel}. 12 | * The instance should be instantiated in a current Spring context to be picked up. 13 | * 14 | */ 15 | @FunctionalInterface 16 | public interface DxaViewModelJsonPropertyFilter { 17 | 18 | /** 19 | * Return whether current element should be included in JSON serialization. 20 | * 21 | * @param writer current element writer 22 | * @return true to include, false to exclude 23 | */ 24 | boolean include(PropertyWriter writer); 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/serialization/json/annotation/JsonXpmAware.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.serialization.json.annotation; 2 | 3 | import com.sdl.webapp.common.api.serialization.json.filter.XpmAwareJsonFilter; 4 | 5 | import java.lang.annotation.ElementType; 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | import java.lang.annotation.Target; 9 | 10 | /** 11 | * Tells {@link XpmAwareJsonFilter} to hide the specified element if XPM is not enabled. 12 | */ 13 | @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface JsonXpmAware { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/serialization/json/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Filters and utils related to JSON serialization. 3 | */ 4 | package com.sdl.webapp.common.api.serialization.json; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/xpm/ComponentType.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.xpm; 2 | 3 | public interface ComponentType { 4 | 5 | /** 6 | *

getSchemaId.

7 | * 8 | * @return a {@link java.lang.String} object. 9 | */ 10 | String getSchemaId(); 11 | 12 | /** 13 | *

setSchemaId.

14 | * 15 | * @param schemaId a {@link java.lang.String} object. 16 | */ 17 | void setSchemaId(String schemaId); 18 | 19 | /** 20 | *

getTemplateId.

21 | * 22 | * @return a {@link java.lang.String} object. 23 | */ 24 | String getTemplateId(); 25 | 26 | /** 27 | *

setTemplateId.

28 | * 29 | * @param templateId a {@link java.lang.String} object. 30 | */ 31 | void setTemplateId(String templateId); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/xpm/OccurrenceConstraint.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.xpm; 2 | 3 | public interface OccurrenceConstraint { 4 | 5 | /** 6 | *

getMinOccurs.

7 | * 8 | * @return a {@link int} object. 9 | */ 10 | int getMinOccurs(); 11 | 12 | /** 13 | *

setMinOccurs.

14 | * 15 | * @param minOccurs a {@link int} object. 16 | */ 17 | void setMinOccurs(int minOccurs); 18 | 19 | /** 20 | *

getMaxOccurs.

21 | * 22 | * @return a {@link int} object. 23 | */ 24 | int getMaxOccurs(); 25 | 26 | /*** 27 | *

setMaxOccurs

28 | * @param maxOccurs 29 | */ 30 | void setMaxOccurs(int maxOccurs); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/xpm/XpmRegion.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.xpm; 2 | 3 | import java.util.List; 4 | 5 | public interface XpmRegion { 6 | /** 7 | *

getRegionName.

8 | * 9 | * @return a {@link java.lang.String} object. 10 | */ 11 | String getRegionName(); 12 | 13 | /** 14 | *

setRegionName.

15 | * 16 | * @param regionName a {@link java.lang.String} object. 17 | */ 18 | void setRegionName(String regionName); 19 | 20 | /** 21 | *

getComponentTypes.

22 | * 23 | * @return a {@link java.util.List} object. 24 | */ 25 | List getComponentTypes(); 26 | 27 | /** 28 | *

setComponentTypes.

29 | * 30 | * @param componentTypes a {@link java.util.List} object. 31 | */ 32 | void setComponentTypes(List componentTypes); 33 | 34 | /*** 35 | * getOccurrenceConstraint 36 | * @return a {@link OccurrenceConstraint} object; 37 | */ 38 | OccurrenceConstraint getOccurrenceConstraint(); 39 | 40 | /** 41 | *

setOccurrenceConstraint.

42 | * 43 | * @param occurrenceConstraint a {@link OccurrenceConstraint} object. 44 | */ 45 | void setOccurrenceConstraint(OccurrenceConstraint occurrenceConstraint); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/xpm/XpmRegionConfig.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.xpm; 2 | 3 | import com.sdl.webapp.common.api.localization.Localization; 4 | 5 | @FunctionalInterface 6 | public interface XpmRegionConfig { 7 | 8 | XpmRegion getXpmRegion(String regionName, Localization localization); 9 | } 10 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/RequestAttributeNames.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.controller; 2 | 3 | public interface RequestAttributeNames { 4 | 5 | String PAGE_MODEL = "pageModel"; // NOTE: Cannot be "page" because that interferes with the built-in "page" variable in JSPs 6 | 7 | String REGION_MODEL = "region"; 8 | 9 | String ENTITY_MODEL = "entity"; 10 | 11 | String PAGE_ID = "pageId"; 12 | 13 | String LOCALIZATION = "localization"; 14 | 15 | String MARKUP = "markup"; 16 | 17 | String MEDIAHELPER = "mediaHelper"; 18 | 19 | String SCREEN_WIDTH = "screenWidth"; 20 | 21 | String SOCIALSHARE_URL = "socialshareUrl"; 22 | 23 | String CONTEXTENGINE = "contextengine"; 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/exception/NotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.controller.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | @ResponseStatus(HttpStatus.NOT_FOUND) 7 | public class NotFoundException extends RuntimeException { 8 | 9 | public NotFoundException(String message) { 10 | super(message); 11 | } 12 | 13 | public NotFoundException(String message, Throwable cause) { 14 | super(message, cause); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/exception/SearchParametersProcessingException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.controller.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | /** 7 | * Used for wrapping exceptions related to parsing search parameters. 8 | */ 9 | @ResponseStatus(HttpStatus.BAD_REQUEST) 10 | public class SearchParametersProcessingException extends IllegalArgumentException { 11 | 12 | /** 13 | * Creates new instance of SearchParametersProcessingException. 14 | * @param message Message 15 | */ 16 | public SearchParametersProcessingException(String message) { 17 | super(message); 18 | } 19 | 20 | /** 21 | * Creates new instance of SearchParametersProcessingException. 22 | * @param message Message 23 | * @param cause Original exception 24 | */ 25 | public SearchParametersProcessingException(String message, Throwable cause) { 26 | super(message, cause); 27 | } 28 | 29 | /** 30 | * Creates new instance of SearchParametersProcessingException. 31 | * @param cause Original exception 32 | */ 33 | public SearchParametersProcessingException(Throwable cause) { 34 | super(cause); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Base DXA MVC controllers. 3 | */ 4 | package com.sdl.webapp.common.controller; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/DefaultViewResolver.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl; 2 | 3 | import com.sdl.dxa.mvc.ViewNameResolver; 4 | import com.sdl.webapp.common.api.model.MvcData; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | @Slf4j 10 | public class DefaultViewResolver implements ViewNameResolver { 11 | 12 | @Override 13 | public String resolveView(MvcData mvcData, String viewType) { 14 | return mvcData.getAreaName() + '/' + viewType + '/' + mvcData.getViewName(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/ThreadLocalManagerImpl.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl; 2 | 3 | import com.sdl.webapp.common.api.ThreadLocalManager; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | @Component 10 | /** 11 | *

ThreadLocalManagerImpl class.

12 | */ 13 | public class ThreadLocalManagerImpl implements ThreadLocalManager { 14 | 15 | private List> threadLocals = new ArrayList<>(); 16 | 17 | /** 18 | * {@inheritDoc} 19 | */ 20 | @Override 21 | synchronized public void registerThreadLocal(ThreadLocal threadLocal) { 22 | this.threadLocals.add(threadLocal); 23 | } 24 | 25 | /** 26 | * {@inheritDoc} 27 | */ 28 | @Override 29 | synchronized public void unregisterThreadLocal(ThreadLocal threadLocal) { 30 | this.threadLocals.remove(threadLocal); 31 | } 32 | 33 | /** 34 | *

clearAll.

35 | */ 36 | synchronized public void clearAll() { 37 | for (ThreadLocal threadLocal : this.threadLocals) { 38 | threadLocal.remove(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/interceptor/HealthCheckFilter.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.interceptor; 2 | 3 | import org.apache.http.HttpStatus; 4 | 5 | import jakarta.servlet.Filter; 6 | import jakarta.servlet.FilterChain; 7 | import jakarta.servlet.FilterConfig; 8 | import jakarta.servlet.ServletRequest; 9 | import jakarta.servlet.ServletResponse; 10 | import jakarta.servlet.http.HttpServletResponse; 11 | 12 | /** 13 | * Health check filter that goes before {@link com.sdl.webapp.common.api.WebRequestContext}, and thus does not fail 14 | * when localization is not resolved. Always returns {@code 200 HTTP} and stops chaining. 15 | */ 16 | public class HealthCheckFilter implements Filter { 17 | 18 | @Override 19 | public void init(FilterConfig filterConfig) { 20 | // nothing here 21 | } 22 | 23 | @Override 24 | public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) { 25 | ((HttpServletResponse) servletResponse).setStatus(HttpStatus.SC_OK); 26 | } 27 | 28 | @Override 29 | public void destroy() { 30 | // nothing here 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/interceptor/ThreadLocalInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.interceptor; 2 | 3 | import com.sdl.webapp.common.api.ThreadLocalManager; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.servlet.HandlerInterceptor; 6 | 7 | import jakarta.servlet.DispatcherType; 8 | import jakarta.servlet.http.HttpServletRequest; 9 | import jakarta.servlet.http.HttpServletResponse; 10 | 11 | /** 12 | *

ThreadLocalInterceptor class.

13 | */ 14 | public class ThreadLocalInterceptor implements HandlerInterceptor { 15 | 16 | @Autowired 17 | private ThreadLocalManager threadLocalManager; 18 | 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { 23 | if (request.getDispatcherType() != DispatcherType.INCLUDE) { 24 | this.threadLocalManager.clearAll(); 25 | } 26 | } 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/localization/SiteLocalizationImpl.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.localization; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.sdl.webapp.common.api.localization.SiteLocalization; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | import lombok.ToString; 8 | 9 | @Setter 10 | @Getter 11 | @ToString 12 | public class SiteLocalizationImpl implements SiteLocalization { 13 | 14 | @JsonProperty("Id") 15 | private String id; 16 | 17 | @JsonProperty("Path") 18 | private String path; 19 | 20 | @JsonProperty("Language") 21 | private String language; 22 | 23 | @JsonProperty("IsMaster") 24 | private boolean master; 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/mapping/SemanticAnnotationException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.mapping; 2 | 3 | /** 4 | * To be thrown when semantic annotations are specified incorrectly on an entity class or a field of an entity class. 5 | *

This is a {@link RuntimeException} because when this happens, it most likely means there is a bug in the code.

6 | */ 7 | public class SemanticAnnotationException extends RuntimeException { 8 | 9 | public SemanticAnnotationException(String message) { 10 | super(message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/model/ErrorMessage.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import org.springframework.http.HttpStatus; 8 | 9 | /** 10 | * The ErrorMessage class. It holds error message with its Http response code. 11 | */ 12 | @Data 13 | @AllArgsConstructor 14 | @JsonIgnoreProperties({"httpStatus"}) 15 | public class ErrorMessage { 16 | 17 | @JsonProperty("Message") 18 | private String message; 19 | 20 | private HttpStatus httpStatus; 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/taglib/dxa/HtmlNodeTag.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.taglib.dxa; 2 | 3 | import com.sdl.webapp.common.markup.html.HtmlNode; 4 | 5 | import jakarta.servlet.jsp.JspException; 6 | import jakarta.servlet.jsp.JspWriter; 7 | import jakarta.servlet.jsp.tagext.TagSupport; 8 | import java.io.IOException; 9 | 10 | public abstract class HtmlNodeTag extends TagSupport { 11 | 12 | /** 13 | *

generateNode.

14 | * 15 | * @return a {@link HtmlNode} object. 16 | */ 17 | protected abstract HtmlNode generateNode(); 18 | 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | @Override 23 | public int doStartTag() throws JspException { 24 | final HtmlNode node = generateNode(); 25 | if (node != null) { 26 | write(node.toHtml()); 27 | } 28 | return SKIP_BODY; 29 | } 30 | 31 | private void write(String text) throws JspException { 32 | final JspWriter out = pageContext.getOut(); 33 | try { 34 | out.write(text); 35 | } catch (IOException e) { 36 | throw new JspException(e); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/taglib/xpm/XpmEntityMarkupTag.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.taglib.xpm; 2 | 3 | import com.sdl.webapp.common.api.WebRequestContext; 4 | import com.sdl.webapp.common.api.localization.Localization; 5 | import com.sdl.webapp.common.api.model.EntityModel; 6 | import com.sdl.webapp.common.markup.html.HtmlNode; 7 | import lombok.Setter; 8 | import org.springframework.web.context.support.WebApplicationContextUtils; 9 | 10 | @Setter 11 | public class XpmEntityMarkupTag extends XpmMarkupTag { 12 | 13 | private EntityModel entity; 14 | 15 | /** 16 | * {@inheritDoc} 17 | */ 18 | @Override 19 | public HtmlNode generateXpmMarkup() { 20 | //noinspection ReturnOfInnerClass 21 | return new HtmlNode() { 22 | @Override 23 | public String renderHtml() { 24 | return entity.getXpmMarkup(getLocalization()); 25 | } 26 | }; 27 | 28 | } 29 | 30 | private Localization getLocalization() { 31 | if (pageContext == null) 32 | return null; 33 | return WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext()) 34 | .getBean(WebRequestContext.class).getLocalization(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/taglib/xpm/XpmIfEnabledTag.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.taglib.xpm; 2 | 3 | import com.sdl.webapp.common.api.WebRequestContext; 4 | import org.springframework.web.context.support.WebApplicationContextUtils; 5 | 6 | import jakarta.servlet.jsp.JspException; 7 | import jakarta.servlet.jsp.tagext.TagSupport; 8 | 9 | public class XpmIfEnabledTag extends TagSupport { 10 | 11 | @Override 12 | public int doStartTag() throws JspException { 13 | return isPreview() ? EVAL_BODY_INCLUDE : SKIP_BODY; 14 | } 15 | 16 | /** 17 | * Checks if XPM Preview is enabled. 18 | * 19 | * @return whether this is preview mode 20 | */ 21 | protected boolean isPreview() { 22 | return WebApplicationContextUtils.getRequiredWebApplicationContext(pageContext.getServletContext()) 23 | .getBean(WebRequestContext.class).getLocalization().isStaging(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/taglib/xpm/XpmMarkupTag.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.taglib.xpm; 2 | 3 | import com.sdl.webapp.common.markup.html.HtmlNode; 4 | 5 | import jakarta.servlet.jsp.JspException; 6 | import jakarta.servlet.jsp.JspWriter; 7 | import java.io.IOException; 8 | 9 | public abstract class XpmMarkupTag extends XpmIfEnabledTag { 10 | 11 | /** 12 | *

generateXpmMarkup.

13 | * 14 | * @return a {@link HtmlNode} object. 15 | */ 16 | protected abstract HtmlNode generateXpmMarkup(); 17 | 18 | /** 19 | * {@inheritDoc} 20 | */ 21 | @Override 22 | public int doStartTag() throws JspException { 23 | if (isPreview()) { 24 | final HtmlNode xpmMarkup = generateXpmMarkup(); 25 | if (xpmMarkup != null) { 26 | 27 | // TODO: Invoke Markup Decorators here... 28 | 29 | 30 | final JspWriter out = pageContext.getOut(); 31 | try { 32 | out.write(xpmMarkup.toHtml()); 33 | } catch (IOException e) { 34 | throw new JspException(e); 35 | } 36 | } 37 | } 38 | 39 | return SKIP_BODY; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/impl/taglib/xpm/XpmPropertyMarkupTag.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.taglib.xpm; 2 | 3 | import com.google.common.base.Strings; 4 | import com.sdl.webapp.common.api.model.EntityModel; 5 | import com.sdl.webapp.common.markup.html.HtmlCommentNode; 6 | import com.sdl.webapp.common.markup.html.HtmlNode; 7 | import lombok.Setter; 8 | 9 | import java.util.Map; 10 | 11 | @Setter 12 | public class XpmPropertyMarkupTag extends XpmMarkupTag { 13 | 14 | private static final String FIELD_PATTERN = "Start Component Field: {\"XPath\":\"%s\"}"; 15 | 16 | private EntityModel entity; 17 | 18 | private String property; 19 | 20 | private int index; 21 | 22 | /** 23 | * {@inheritDoc} 24 | */ 25 | @Override 26 | protected HtmlNode generateXpmMarkup() { 27 | final Map propertyData = entity.getXpmPropertyMetadata(); 28 | if (propertyData == null) { 29 | return null; 30 | } 31 | 32 | final String xpath = propertyData.get(property); 33 | if (Strings.isNullOrEmpty(xpath)) { 34 | return null; 35 | } 36 | 37 | final String suffix = xpath.endsWith("]") ? "" : ("[" + (index + 1) + ']'); 38 | 39 | return new HtmlCommentNode(String.format(FIELD_PATTERN, xpath + suffix)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/Markup.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup; 2 | 3 | import com.sdl.webapp.common.api.WebRequestContext; 4 | import com.sdl.webapp.common.api.model.EntityModel; 5 | import com.sdl.webapp.common.api.model.PageModel; 6 | import com.sdl.webapp.common.api.model.RegionModel; 7 | import com.sdl.webapp.common.api.model.entity.SitemapItem; 8 | import org.joda.time.DateTime; 9 | 10 | public interface Markup { 11 | 12 | String url(String path); 13 | 14 | String versionedContent(String path); 15 | 16 | String region(RegionModel region); 17 | 18 | String entity(EntityModel entity); 19 | 20 | String page(PageModel page); 21 | 22 | String property(EntityModel entity, String fieldName); 23 | 24 | String property(PageModel page, String fieldName); 25 | 26 | String property(EntityModel entity, String fieldName, int index); 27 | 28 | String resource(String key); 29 | 30 | String formatDate(DateTime dateTime); 31 | 32 | String formatDateDiff(DateTime dateTime); 33 | 34 | String formatMessage(String pattern, Object... args); 35 | 36 | String replaceLineEndsWithHtmlBreaks(String text); 37 | 38 | String siteMapList(SitemapItem item); 39 | 40 | WebRequestContext getWebRequestContext(); 41 | } 42 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/MarkupDecorator.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup; 2 | 3 | import com.sdl.webapp.common.api.WebRequestContext; 4 | import com.sdl.webapp.common.api.model.ViewModel; 5 | import com.sdl.webapp.common.markup.html.HtmlNode; 6 | import org.springframework.core.Ordered; 7 | 8 | public interface MarkupDecorator extends Ordered { 9 | 10 | HtmlNode process(HtmlNode markup, ViewModel model, WebRequestContext webRequestContext); 11 | } 12 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/MarkupDecoratorRegistry.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | *

MarkupDecoratorRegistry interface.

7 | * @deprecated since DXA 1.4, todo dxa2 remove in preference of autowired bean list 8 | */ 9 | @Deprecated 10 | public interface MarkupDecoratorRegistry { 11 | 12 | /** 13 | *

registerDecorator.

14 | * 15 | * @param decoratorId a {@link java.lang.String} object. 16 | * @param decorator a {@link com.sdl.webapp.common.markup.MarkupDecorator} object. 17 | */ 18 | void registerDecorator(String decoratorId, MarkupDecorator decorator); 19 | 20 | /** 21 | *

getDecorators.

22 | * 23 | * @param decoratorId a {@link java.lang.String} object. 24 | * @return a {@link java.util.List} object. 25 | */ 26 | List getDecorators(String decoratorId); 27 | } 28 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlAttribute.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import org.springframework.web.util.HtmlUtils; 6 | 7 | @Getter 8 | @EqualsAndHashCode(callSuper = false) 9 | public final class HtmlAttribute extends HtmlRenderable { 10 | 11 | private final String name; 12 | 13 | private final String value; 14 | 15 | public HtmlAttribute(String name, String value) { 16 | this.name = name; 17 | this.value = value; 18 | } 19 | 20 | @Override 21 | public String renderHtml() { 22 | return String.format("%s=\"%s\"", name, HtmlUtils.htmlEscape(value == null ? "" : value)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlCommentNode.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | 6 | @Getter 7 | @EqualsAndHashCode(callSuper = false) 8 | public final class HtmlCommentNode extends HtmlNode { 9 | 10 | private final String text; 11 | 12 | public HtmlCommentNode(String text) { 13 | this.text = text; 14 | } 15 | 16 | @Override 17 | public String renderHtml() { 18 | return "", "") + " -->"; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlElement.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | 7 | import java.util.List; 8 | 9 | @Getter 10 | @EqualsAndHashCode(callSuper = false) 11 | public final class HtmlElement extends HtmlNode { 12 | 13 | private final HtmlStartTag startTag; 14 | 15 | private final List content; 16 | 17 | private final HtmlEndTag endTag; 18 | 19 | public HtmlElement(String tagName, boolean closeTag, List attributes, List content) { 20 | this.startTag = new HtmlStartTag(tagName, attributes); 21 | this.content = ImmutableList.copyOf(content); 22 | this.endTag = closeTag ? new HtmlEndTag(tagName) : null; 23 | } 24 | 25 | @Override 26 | public String renderHtml() { 27 | final StringBuilder sb = new StringBuilder(1024).append(startTag.toHtml()); 28 | for (HtmlNode node : content) { 29 | sb.append(node.toHtml()); 30 | } 31 | if (endTag != null) { 32 | sb.append(endTag.toHtml()); 33 | } 34 | return sb.toString(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlEndTag.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import org.apache.commons.lang3.StringUtils; 6 | 7 | @Getter 8 | @EqualsAndHashCode(callSuper = false) 9 | public final class HtmlEndTag extends HtmlRenderable { 10 | 11 | private final String tagName; 12 | 13 | public HtmlEndTag(String tagName) { 14 | this.tagName = tagName; 15 | } 16 | 17 | @Override 18 | public String renderHtml() { 19 | return StringUtils.isEmpty(tagName) ? "" : "'; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlMultiNode.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | 6 | @Getter 7 | @EqualsAndHashCode(callSuper = false) 8 | public class HtmlMultiNode extends HtmlNode { 9 | 10 | private final HtmlNode[] nodes; 11 | 12 | public HtmlMultiNode(HtmlNode... nodes) { 13 | this.nodes = nodes; 14 | } 15 | 16 | @Override 17 | public String renderHtml() { 18 | final StringBuilder sb = new StringBuilder(); 19 | for (HtmlNode node : nodes) { 20 | sb.append(node.toHtml()); 21 | } 22 | return sb.toString(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlNode.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | public abstract class HtmlNode extends HtmlRenderable { 4 | } 5 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlRenderable.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | public abstract class HtmlRenderable { 4 | 5 | // Cached HTML string, to avoid rendering multiple times 6 | private volatile String html; 7 | 8 | public final String toHtml() { 9 | // NOTE: Double-checked locking idiom to avoid unnecessary synchronization 10 | // See http://en.wikipedia.org/wiki/Double-checked_locking 11 | String result = html; 12 | if (result == null) { 13 | synchronized (this) { 14 | result = html; 15 | if (result == null) { 16 | html = result = renderHtml(); 17 | } 18 | } 19 | } 20 | return result; 21 | } 22 | 23 | public abstract String renderHtml(); 24 | 25 | @Override 26 | public String toString() { 27 | return getClass().getSimpleName() + ": " + toHtml(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlStartTag.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import com.google.common.collect.ImmutableList; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.Getter; 6 | import org.apache.commons.lang3.StringUtils; 7 | 8 | import java.util.List; 9 | 10 | @Getter 11 | @EqualsAndHashCode(callSuper = false) 12 | public final class HtmlStartTag extends HtmlRenderable { 13 | 14 | private final String tagName; 15 | 16 | private final List attributes; 17 | 18 | public HtmlStartTag(String tagName, List attributes) { 19 | this.tagName = tagName; 20 | this.attributes = ImmutableList.copyOf(attributes); 21 | } 22 | 23 | @Override 24 | public String renderHtml() { 25 | if (StringUtils.isEmpty(tagName)) { 26 | return ""; 27 | } 28 | 29 | final StringBuilder sb = new StringBuilder(16).append('<').append(tagName); 30 | for (HtmlAttribute attribute : attributes) { 31 | sb.append(' ').append(attribute.toHtml()); 32 | } 33 | return sb.append('>').toString(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/HtmlTextNode.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.Getter; 5 | import org.springframework.web.util.HtmlUtils; 6 | 7 | import java.util.Objects; 8 | 9 | @EqualsAndHashCode(callSuper = false) 10 | public final class HtmlTextNode extends HtmlNode { 11 | 12 | private final String text; 13 | 14 | private final boolean escape; 15 | 16 | /** 17 | *

Constructor for HtmlTextNode.

18 | * 19 | * @param text a {@link java.lang.String} object. 20 | * @param escape a boolean. 21 | */ 22 | public HtmlTextNode(String text, boolean escape) { 23 | this.text = text; 24 | this.escape = escape; 25 | } 26 | 27 | /** 28 | *

Constructor for HtmlTextNode.

29 | * 30 | * @param text a {@link java.lang.String} object. 31 | */ 32 | public HtmlTextNode(String text) { 33 | this(text, true); 34 | } 35 | 36 | /** 37 | * {@inheritDoc} 38 | */ 39 | @Override 40 | public String renderHtml() { 41 | return escape ? HtmlUtils.htmlEscape(text) : text; 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/builders/AnchorElementBuilder.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html.builders; 2 | 3 | public final class AnchorElementBuilder extends AbstractElementBuilder { 4 | 5 | public AnchorElementBuilder() { 6 | super("a", true); 7 | } 8 | 9 | public AnchorElementBuilder withHref(String href) { 10 | return withAttribute("href", href); 11 | } 12 | 13 | public AnchorElementBuilder withTitle(String title) { 14 | return withAttributeIfNotEmpty("title", title); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/builders/ButtonElementBuilder.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html.builders; 2 | 3 | public final class ButtonElementBuilder extends AbstractElementBuilder { 4 | 5 | public ButtonElementBuilder() { 6 | super("button", true); 7 | } 8 | 9 | public ButtonElementBuilder ofType(String type) { 10 | return withAttribute("type", type); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/builders/ImgElementBuilder.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html.builders; 2 | 3 | public final class ImgElementBuilder extends SrcElementBuilder { 4 | 5 | public ImgElementBuilder() { 6 | super("img", false); 7 | } 8 | 9 | public ImgElementBuilder withAlt(String alt) { 10 | return withAttributeIfNotEmpty("alt", alt); 11 | } 12 | 13 | public ImgElementBuilder withWidth(String width) { 14 | return withAttributeIfNotEmpty("width", width); 15 | } 16 | 17 | public ImgElementBuilder withWidth(int width) { 18 | return withWidth(Integer.toString(width)); 19 | } 20 | 21 | public ImgElementBuilder withHeight(String height) { 22 | return withAttributeIfNotEmpty("height", height); 23 | } 24 | 25 | public ImgElementBuilder withHeight(int height) { 26 | return withHeight(Integer.toString(height)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/builders/SimpleElementBuilder.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html.builders; 2 | 3 | public final class SimpleElementBuilder extends AbstractElementBuilder { 4 | 5 | public SimpleElementBuilder(String tagName, boolean closeTag) { 6 | super(tagName, closeTag); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/builders/SrcElementBuilder.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html.builders; 2 | 3 | public class SrcElementBuilder> extends AbstractElementBuilder { 4 | 5 | public SrcElementBuilder(String tagName, boolean closeTag) { 6 | super(tagName, closeTag); 7 | } 8 | 9 | public B withSrc(String src) { 10 | return withAttribute("src", src); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/html/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * HTML builders and generators. 3 | */ 4 | package com.sdl.webapp.common.markup.html; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/markup/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Markup decorators. 3 | */ 4 | package com.sdl.webapp.common.markup; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/util/ApplicationContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.util; 2 | 3 | import org.springframework.beans.BeansException; 4 | import org.springframework.context.ApplicationContext; 5 | import org.springframework.context.ApplicationContextAware; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * Application context holder that allows to get the Spring Context in a static context. 10 | * 11 | */ 12 | @Component 13 | public class ApplicationContextHolder implements ApplicationContextAware { 14 | 15 | private static ApplicationContext context; 16 | 17 | public static ApplicationContext getContext() { 18 | return context; 19 | } 20 | 21 | @Override 22 | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { 23 | context = applicationContext; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Basic DXA util classes. 3 | */ 4 | package com.sdl.webapp.common.util; -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/views/JsonView.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.views; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import com.sdl.webapp.common.api.WebRequestContext; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.servlet.view.json.MappingJackson2JsonView; 7 | 8 | import jakarta.servlet.http.HttpServletRequest; 9 | import jakarta.servlet.http.HttpServletResponse; 10 | import java.util.Map; 11 | 12 | public class JsonView extends MappingJackson2JsonView { 13 | 14 | @Autowired 15 | private WebRequestContext context; 16 | 17 | @Autowired 18 | private ObjectMapper objectMapper; 19 | 20 | /** 21 | * {@inheritDoc} 22 | */ 23 | @Override 24 | protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception { 25 | // If manipulation of the page is needed it can be performed here 26 | setModelKey("data"); 27 | setObjectMapper(objectMapper); 28 | super.renderMergedOutputModel(model, request, response); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/resources/META-INF/resources/WEB-INF/Views/RedirectView.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | 3 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/resources/dxa.addons.device-families.properties: -------------------------------------------------------------------------------- 1 | dxa.context.deviceFamilies.file=device-families.xml -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/resources/dxa.defaults.properties: -------------------------------------------------------------------------------- 1 | #@formatter:off 2 | 3 | # Global 4 | # Web Properties, 5 | dxa.web.views.folder=/META-INF/resources/ 6 | dxa.web.views.override.folder=Override/ 7 | dxa.web.views.prefix=/WEB-INF/Views/ 8 | dxa.web.views.suffix=.jsp 9 | dxa.web.default.init=true 10 | 11 | dxa.web.default.area.name=Core 12 | dxa.web.default.region.name=Main 13 | dxa.web.default.controller.name=Entity 14 | dxa.web.default.controller.area.name=Framework 15 | dxa.web.default.action.name=Entity 16 | 17 | dxa.json.xpm.aware=true 18 | 19 | #DXA Tridion 2013 Provider 20 | dxa.tridion.2013.context.repository.url=https://context.sdl.com/seed 21 | dxa.tridion.2013.context.repository.location=../repository 22 | dxa.tridion.2013.context.repository.load.enabled=true 23 | 24 | #@formatter:on -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/resources/semantic-schemas/README: -------------------------------------------------------------------------------- 1 | These files are used by the DocsLocalization. 2 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/resources/semantic-schemas/schemas.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Id": 1, 4 | "RootElement": "Topic", 5 | "Fields": [ 6 | { 7 | "Name": "topicBody", 8 | "Path": "/Topic/topicBody", 9 | "IsMultiValue": false, 10 | "Semantics": [ 11 | { 12 | "Prefix": "tri", 13 | "Entity": "Topic", 14 | "Property": "topicBody" 15 | }, 16 | { 17 | "Prefix": "s", 18 | "Entity": "Topic", 19 | "Property": "topicBody" 20 | } 21 | ], 22 | "Fields": [] 23 | }, 24 | { 25 | "Name": "topicTitle", 26 | "Path": "/Topic/topicTitle", 27 | "IsMultiValue": false, 28 | "Semantics": [ 29 | { 30 | "Prefix": "tri", 31 | "Entity": "Topic", 32 | "Property": "topicTitle" 33 | }, 34 | { 35 | "Prefix": "s", 36 | "Entity": "Topic", 37 | "Property": "topicTitle" 38 | } 39 | ], 40 | "Fields": [] 41 | } 42 | ], 43 | "Semantics": [ 44 | { 45 | "Prefix": "tri", 46 | "Entity": "Topic" 47 | }, 48 | { 49 | "Prefix": "s", 50 | "Entity": "Topic" 51 | } 52 | ] 53 | } 54 | ] 55 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/main/resources/semantic-schemas/vocabularies.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Prefix": "tri", 4 | "Vocab": "http://www.sdl.com/web/schemas/core" 5 | }, 6 | { 7 | "Prefix": "s", 8 | "Vocab": "http://schema.org/" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/dxa/DxaWebInitializationTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | import static org.springframework.core.Ordered.HIGHEST_PRECEDENCE; 7 | 8 | public class DxaWebInitializationTest { 9 | 10 | @Test 11 | public void shouldHaveHighestPrecedenceOrder() throws Exception { 12 | assertEquals(HIGHEST_PRECEDENCE, new DxaWebInitialization().getOrder()); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/formats/DefaultDataFormatterTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.formats; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | 7 | public class DefaultDataFormatterTest { 8 | 9 | @Test 10 | public void shouldGetScoreFromAcceptString() throws Exception { 11 | //given 12 | 13 | //when 14 | double q02 = DefaultDataFormatter.getScoreFromAcceptString("audio/*; q=0.2"); 15 | double q00 = DefaultDataFormatter.getScoreFromAcceptString("audio/*; q=0.0"); 16 | double q10 = DefaultDataFormatter.getScoreFromAcceptString("audio/*; q=1.0"); 17 | double q10implicit = DefaultDataFormatter.getScoreFromAcceptString("audio/*"); 18 | 19 | //then 20 | assertEquals(0.2, q02, 0.0); 21 | assertEquals(0.0, q00, 0.0); 22 | assertEquals(1.0, q10, 0.0); 23 | assertEquals(1.0, q10implicit, 0.0); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/KeywordModelTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.junit.jupiter.api.Assertions.assertEquals; 7 | 8 | @Slf4j 9 | public class KeywordModelTest extends PojosTest { 10 | 11 | @Test 12 | public void shouldReturnEmptyStringAsXpmMarkup() { 13 | //given 14 | 15 | //when 16 | String xpmMarkup = new KeywordModel().getXpmMarkup(null); 17 | 18 | //then 19 | assertEquals("", xpmMarkup); 20 | } 21 | 22 | @Override 23 | protected Class getPojoClass() { 24 | return KeywordModel.class; 25 | } 26 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/TestEntity.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model; 2 | 3 | import com.google.common.collect.Lists; 4 | import com.sdl.webapp.common.api.formatters.support.FeedItem; 5 | import com.sdl.webapp.common.api.formatters.support.FeedItemsProvider; 6 | import com.sdl.webapp.common.api.model.entity.AbstractEntityModel; 7 | 8 | import static org.mockito.Mockito.*; 9 | 10 | public abstract class TestEntity extends AbstractEntityModel implements FeedItemsProvider { 11 | 12 | public static TestEntity entity(FeedItem feedItem) { 13 | TestEntity testEntity = mock(TestEntity.class); 14 | lenient().when(testEntity.extractFeedItems()).thenReturn(Lists.newArrayList(feedItem)); 15 | return testEntity; 16 | } 17 | 18 | public static FeedItem feedItem(String headline) { 19 | FeedItem feedItem = new FeedItem(); 20 | feedItem.setHeadline(headline); 21 | return feedItem; 22 | } 23 | 24 | public static class TestEntityNoFeed extends AbstractEntityModel { 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/entity/ConfigurationTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import com.sdl.webapp.common.api.model.PojosTest; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | import static org.junit.jupiter.api.Assertions.assertEquals; 10 | 11 | public class ConfigurationTest extends PojosTest { 12 | 13 | @Test 14 | public void shouldReturnConfiguration() { 15 | //given 16 | Configuration configuration = new Configuration(); 17 | Map settings = new HashMap<>(); 18 | settings.put("key1", "value1"); 19 | settings.put("key2", "value2"); 20 | 21 | //when 22 | configuration.setSettings(settings); 23 | 24 | //then 25 | assertEquals(settings, configuration.getSettings()); 26 | assertEquals("Configuration(" + 27 | "settings=" + settings.toString() + 28 | ")", 29 | configuration.toString()); 30 | } 31 | 32 | @Override 33 | protected Class getPojoClass() { 34 | return Configuration.class; 35 | } 36 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/entity/LinkTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import com.sdl.webapp.common.api.localization.Localization; 4 | import com.sdl.webapp.common.api.model.PojosTest; 5 | import org.junit.jupiter.api.Test; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertFalse; 8 | import static org.junit.jupiter.api.Assertions.assertTrue; 9 | import static org.mockito.Mockito.*; 10 | 11 | public class LinkTest extends PojosTest { 12 | 13 | @Test 14 | public void shouldDecideWhetherTheRequestIsInContextOfLink() { 15 | //given 16 | Link link = new Link(); 17 | link.setUrl("/page"); 18 | 19 | //when 20 | assertTrue(link.isCurrentContext("/page", localization("/"))); 21 | assertFalse(link.isCurrentContext("/other", localization("/"))); 22 | assertFalse(link.isCurrentContext("/", localization("/"))); 23 | } 24 | 25 | private Localization localization(String url) { 26 | Localization localization = mock(Localization.class); 27 | lenient().when(localization.getPath()).thenReturn(url); 28 | return localization; 29 | } 30 | 31 | @Override 32 | protected Class getPojoClass() { 33 | return Link.class; 34 | } 35 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/entity/TagTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.model.entity; 2 | 3 | import com.sdl.webapp.common.api.model.PojosTest; 4 | 5 | public class TagTest extends PojosTest { 6 | 7 | @Override 8 | protected Class getPojoClass() { 9 | return Tag.class; 10 | } 11 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/controller/EntityControllerTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.controller; 2 | 3 | import com.sdl.webapp.common.api.model.ViewModel; 4 | import com.sdl.webapp.common.api.model.entity.Link; 5 | import com.sdl.webapp.common.api.model.entity.RedirectEntity; 6 | import org.junit.jupiter.api.Test; 7 | import org.springframework.mock.web.MockHttpServletRequest; 8 | 9 | import jakarta.servlet.http.HttpServletRequest; 10 | 11 | import static org.junit.jupiter.api.Assertions.assertEquals; 12 | 13 | public class EntityControllerTest { 14 | 15 | @Test 16 | public void shouldReturnRedirectViewInCaseOfRedirectEntity() throws Exception { 17 | //given 18 | MockHttpServletRequest request = new MockHttpServletRequest(); 19 | request.setAttribute("_entity_", new Link()); 20 | 21 | //when 22 | String viewName = new EntityController() { 23 | @Override 24 | protected ViewModel enrichModel(ViewModel model, HttpServletRequest httpServletRequest) throws Exception { 25 | return new RedirectEntity("path"); 26 | } 27 | }.handleGetEntity(request, "id"); 28 | 29 | //then 30 | assertEquals("RedirectView", viewName); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/impl/interceptor/HealthCheckFilterTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.interceptor; 2 | 3 | import org.apache.http.HttpStatus; 4 | import org.junit.jupiter.api.Test; 5 | import org.springframework.mock.web.MockHttpServletResponse; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | 9 | public class HealthCheckFilterTest { 10 | 11 | @Test 12 | public void shouldReturn200() throws Exception { 13 | //given 14 | HealthCheckFilter filter = new HealthCheckFilter(); 15 | MockHttpServletResponse response = new MockHttpServletResponse(); 16 | 17 | //when 18 | filter.doFilter(null, response, null); 19 | 20 | //then 21 | assertEquals(HttpStatus.SC_OK, response.getStatus()); 22 | } 23 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/impl/taglib/dxa/EntityTagTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.taglib.dxa; 2 | 3 | import com.sdl.webapp.common.api.model.EntityModel; 4 | import com.sdl.webapp.common.api.model.entity.AbstractEntityModel; 5 | import com.sdl.webapp.common.api.model.mvcdata.MvcDataCreator; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import static org.junit.jupiter.api.Assertions.assertEquals; 9 | 10 | public class EntityTagTest { 11 | 12 | @Test 13 | public void shouldReplaceViewNameIfItIsSet() throws Exception { 14 | //given 15 | EntityModel entity = new AbstractEntityModel() { 16 | }; 17 | entity.setMvcData(MvcDataCreator.creator().create()); 18 | EntityTag tag = new EntityTag(); 19 | tag.setEntity(entity); 20 | tag.applyNewViewNameIfNeeded("TestArea:TestView"); 21 | 22 | //when 23 | tag.applyNewViewNameIfNeeded(); 24 | 25 | //then 26 | assertEquals("TestView", entity.getMvcData().getViewName()); 27 | } 28 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/impl/taglib/xpm/XpmIfEnabledTagTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.taglib.xpm; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import jakarta.servlet.jsp.tagext.Tag; 6 | 7 | import static org.junit.jupiter.api.Assertions.assertEquals; 8 | import static org.mockito.Mockito.doReturn; 9 | import static org.mockito.Mockito.spy; 10 | 11 | public class XpmIfEnabledTagTest { 12 | 13 | @Test 14 | public void shouldStopTagIfNotPreview() throws Exception { 15 | //given 16 | XpmIfEnabledTag tag = spy(new XpmIfEnabledTag()); 17 | doReturn(false).when(tag).isPreview(); 18 | 19 | //when 20 | int doStartTag = tag.doStartTag(); 21 | 22 | //then 23 | assertEquals(Tag.SKIP_BODY, doStartTag); 24 | } 25 | 26 | @Test 27 | public void shouldProceedTagIfPreview() throws Exception { 28 | //given 29 | XpmIfEnabledTag tag = spy(new XpmIfEnabledTag()); 30 | doReturn(true).when(tag).isPreview(); 31 | 32 | //when 33 | int doStartTag = tag.doStartTag(); 34 | 35 | //then 36 | assertEquals(Tag.EVAL_BODY_INCLUDE, doStartTag); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/HtmlAttributeTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.hamcrest.CoreMatchers.is; 6 | import static org.hamcrest.MatcherAssert.assertThat; 7 | 8 | /** 9 | * Unit tests for {@code HtmlAttribute}. 10 | */ 11 | public class HtmlAttributeTest { 12 | 13 | @Test 14 | public void testRenderHtml() { 15 | assertThat(new HtmlAttribute("x", "y").renderHtml(), is("x=\"y\"")); 16 | assertThat(new HtmlAttribute("hello", "a \" quote").renderHtml(), is("hello=\"a " quote\"")); 17 | assertThat(new HtmlAttribute("hello", "&&").renderHtml(), is("hello=\"&&\"")); 18 | assertThat(new HtmlAttribute("hello", "<").renderHtml(), is("hello=\"<\"")); 19 | assertThat(new HtmlAttribute("test", "&\"<>&\"").renderHtml(), is("test=\"&"<>&"\"")); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/HtmlCommentNodeTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.hamcrest.CoreMatchers.is; 6 | import static org.hamcrest.MatcherAssert.assertThat; 7 | 8 | /** 9 | * Unit tests for {@code HtmlCommentNode}. 10 | */ 11 | public class HtmlCommentNodeTest { 12 | 13 | @Test 14 | public void testRenderHtmlSimple() { 15 | final HtmlCommentNode node = new HtmlCommentNode("Hello World"); 16 | assertThat(node.renderHtml(), is("")); 17 | } 18 | 19 | @Test 20 | public void testRenderHtmlWithDelimiters() { 21 | final HtmlCommentNode node = new HtmlCommentNode("Hello d"); 22 | assertThat(node.renderHtml(), is("")); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/HtmlEndTagTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.hamcrest.CoreMatchers.is; 6 | import static org.hamcrest.MatcherAssert.assertThat; 7 | 8 | /** 9 | * Unit tests for {@code HtmlEndTag}. 10 | */ 11 | public class HtmlEndTagTest { 12 | 13 | @Test 14 | public void testRenderHtml() { 15 | final HtmlEndTag tag = new HtmlEndTag("div"); 16 | assertThat(tag.renderHtml(), is("")); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/HtmlMultiNodeTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import java.util.Arrays; 6 | import java.util.Collections; 7 | 8 | import static org.hamcrest.CoreMatchers.is; 9 | import static org.hamcrest.MatcherAssert.assertThat; 10 | 11 | /** 12 | * Unit tests for {@code HtmlMultiNode}. 13 | */ 14 | public class HtmlMultiNodeTest { 15 | 16 | @Test 17 | public void testRenderHtml() { 18 | final HtmlMultiNode node = new HtmlMultiNode( 19 | new HtmlElement("h1", true, Collections.emptyList(), 20 | Arrays.asList(new HtmlTextNode("Example"))), 21 | new HtmlElement("p", true, Collections.emptyList(), 22 | Arrays.asList(new HtmlTextNode("This is a test.")))); 23 | assertThat(node.renderHtml(), is("

Example

This is a test.

")); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/HtmlStartTagTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import java.util.Arrays; 6 | import java.util.Collections; 7 | 8 | import static org.hamcrest.CoreMatchers.is; 9 | import static org.hamcrest.MatcherAssert.assertThat; 10 | 11 | /** 12 | * Unit tests for {@code HtmlStartTag}. 13 | */ 14 | public class HtmlStartTagTest { 15 | 16 | @Test 17 | public void testRenderHtmlNoAttributes() { 18 | final HtmlStartTag tag = new HtmlStartTag("div", Collections.emptyList()); 19 | assertThat(tag.renderHtml(), is("
")); 20 | } 21 | 22 | @Test 23 | public void testRenderHtmlSingleAttribute() { 24 | final HtmlStartTag tag = new HtmlStartTag("div", Arrays.asList(new HtmlAttribute("class", "header"))); 25 | assertThat(tag.renderHtml(), is("
")); 26 | } 27 | 28 | @Test 29 | public void testRenderHtmlWithAttributes() { 30 | final HtmlStartTag tag = new HtmlStartTag("div", 31 | Arrays.asList(new HtmlAttribute("class", "header"), new HtmlAttribute("id", "14785"))); 32 | assertThat(tag.renderHtml(), is("
")); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/HtmlTextNodeTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.hamcrest.CoreMatchers.is; 6 | import static org.hamcrest.MatcherAssert.assertThat; 7 | 8 | /** 9 | * Unit tests for {@code HtmlTextNode}. 10 | */ 11 | public class HtmlTextNodeTest { 12 | 13 | @Test 14 | public void testRenderHtmlWithoutEscape() { 15 | final HtmlTextNode node = new HtmlTextNode("Hello <> World & &", false); 16 | assertThat(node.renderHtml(), is("Hello <> World & &")); 17 | } 18 | 19 | @Test 20 | public void testRenderHtmlWithEscape() { 21 | final HtmlTextNode node = new HtmlTextNode("Hello <> World & &", true); 22 | assertThat(node.renderHtml(), is("Hello <> World & &amp;")); 23 | } 24 | 25 | @Test 26 | public void testRenderHtmlDefault() { 27 | final HtmlTextNode node = new HtmlTextNode("\"Nice\""); 28 | assertThat("Default should be with HTML escaping", node.renderHtml(), is(""Nice"")); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/ParsableHtmlNodeTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html; 2 | 3 | import org.jsoup.nodes.Element; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.hamcrest.CoreMatchers.is; 7 | import static org.hamcrest.MatcherAssert.assertThat; 8 | 9 | /** 10 | * ParsableHtmlNodeTest 11 | * 12 | * @author nic 13 | */ 14 | public class ParsableHtmlNodeTest { 15 | 16 | @Test 17 | public void testInjectMarkup() throws Exception { 18 | 19 | String htmlTxt = "

Hello there!!!

LINK
"; 20 | ParsableHtmlNode markup = new ParsableHtmlNode(htmlTxt); 21 | Element html = markup.getHtmlElement(); 22 | String xpmMarkup = ""; 23 | html.prepend(xpmMarkup); 24 | 25 | assertThat("XPM markup has been injected into HTML", markup.toHtml(), is("
\n \n

Hello there!!!

LINK\n
")); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/builders/AnchorElementBuilderTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html.builders; 2 | 3 | import com.sdl.webapp.common.markup.html.HtmlAttribute; 4 | import com.sdl.webapp.common.markup.html.HtmlElement; 5 | import com.sdl.webapp.common.markup.html.HtmlNode; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import java.util.Arrays; 9 | import java.util.Collections; 10 | 11 | import static org.hamcrest.CoreMatchers.is; 12 | import static org.hamcrest.MatcherAssert.assertThat; 13 | 14 | /** 15 | * Unit tests for {@code AnchorElementBuilder}. 16 | */ 17 | public class AnchorElementBuilderTest { 18 | 19 | @Test 20 | public void testBuild() { 21 | final AnchorElementBuilder builder = new AnchorElementBuilder().withHref("http://www.sdl.com").withTitle("SDL"); 22 | assertThat(builder.build(), is(new HtmlElement("a", true, 23 | Arrays.asList(new HtmlAttribute("href", "http://www.sdl.com"), new HtmlAttribute("title", "SDL")), 24 | Collections.emptyList()))); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/builders/ButtonElementBuilderTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html.builders; 2 | 3 | import com.sdl.webapp.common.markup.html.HtmlAttribute; 4 | import com.sdl.webapp.common.markup.html.HtmlElement; 5 | import com.sdl.webapp.common.markup.html.HtmlNode; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import java.util.Arrays; 9 | import java.util.Collections; 10 | 11 | import static org.hamcrest.CoreMatchers.is; 12 | import static org.hamcrest.MatcherAssert.assertThat; 13 | 14 | /** 15 | * Unit tests for {@code ButtonElementBuilder}. 16 | */ 17 | public class ButtonElementBuilderTest { 18 | 19 | @Test 20 | public void testBuild() { 21 | final ButtonElementBuilder builder = new ButtonElementBuilder().ofType("submit"); 22 | assertThat(builder.build(), is(new HtmlElement("button", true, 23 | Arrays.asList(new HtmlAttribute("type", "submit")), 24 | Collections.emptyList()))); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/markup/html/builders/ImgElementBuilderTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.markup.html.builders; 2 | 3 | import com.sdl.webapp.common.markup.html.HtmlAttribute; 4 | import com.sdl.webapp.common.markup.html.HtmlElement; 5 | import com.sdl.webapp.common.markup.html.HtmlNode; 6 | import org.junit.jupiter.api.Test; 7 | 8 | import java.util.Arrays; 9 | import java.util.Collections; 10 | 11 | import static org.hamcrest.CoreMatchers.is; 12 | import static org.hamcrest.MatcherAssert.assertThat; 13 | 14 | /** 15 | * Unit tests for {@code AnchorElementBuilder}. 16 | */ 17 | public class ImgElementBuilderTest { 18 | 19 | @Test 20 | public void testBuild() { 21 | final ImgElementBuilder builder = new ImgElementBuilder().withSrc("http://www.example.com/logo.png") 22 | .withAlt("Logo").withWidth(120).withHeight(80); 23 | assertThat(builder.build(), is(new HtmlElement("img", false, 24 | Arrays.asList( 25 | new HtmlAttribute("src", "http://www.example.com/logo.png"), 26 | new HtmlAttribute("alt", "Logo"), 27 | new HtmlAttribute("width", "120"), 28 | new HtmlAttribute("height", "80")), 29 | Collections.emptyList()))); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/Override.android.jsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RWS/dxa-web-application-java/6cb2cb81e3f6b39262d5902e5e89f325d4ed2d12/dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/Override.android.jsp -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/Override/Override.android.jsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RWS/dxa-web-application-java/6cb2cb81e3f6b39262d5902e5e89f325d4ed2d12/dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/Override/Override.android.jsp -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/Override/TestView2.jsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RWS/dxa-web-application-java/6cb2cb81e3f6b39262d5902e5e89f325d4ed2d12/dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/Override/TestView2.jsp -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/TestView.android.jsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RWS/dxa-web-application-java/6cb2cb81e3f6b39262d5902e5e89f325d4ed2d12/dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/TestView.android.jsp -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/TestView.jsp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RWS/dxa-web-application-java/6cb2cb81e3f6b39262d5902e5e89f325d4ed2d12/dxa-framework/dxa-common-api/src/test/resources/WEB-INF/Views/TestView.jsp -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.addons.device-families.properties: -------------------------------------------------------------------------------- 1 | dxa.context.deviceFamilies.file=device-families.xml -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.addons.staging.properties: -------------------------------------------------------------------------------- 1 | dxa.addons.staging=staging 2 | dxa.override.addons=addons 3 | spring.profiles.include=profile-staging -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.addons.tests.properties: -------------------------------------------------------------------------------- 1 | dxa.csrf.allowed=true -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.addons.utf8-bom.properties: -------------------------------------------------------------------------------- 1 | dxa.override.utf8bom=utf8-bom 2 | # This file is encoded with UTF-8 BOM with a property at the very first position 3 | dxa.addons.utf8-bom=utf8-bom -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.defaults.properties: -------------------------------------------------------------------------------- 1 | dxa.defaults=defaults 2 | dxa.override.defaults=defaults 3 | dxa.override.modules=defaults 4 | dxa.override.utf8bom=utf8 5 | dxa.web.views.folder=/META-INF/resources/ 6 | dxa.web.views.override.folder=Override/ 7 | dxa.web.views.prefix=/WEB-INF/Views/ 8 | dxa.web.views.suffix=.jsp 9 | spring.profiles.include=profile-default 10 | dxa.web.default.area.name=AreaName 11 | dxa.web.default.region.name=RegionName 12 | dxa.web.default.controller.name=ControllerName 13 | dxa.web.default.controller.area.name=ControllerAreaName 14 | dxa.web.default.action.name=ActionName -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.modules.cid.properties: -------------------------------------------------------------------------------- 1 | dxa.modules.cid=cid 2 | spring.profiles.include=profile-cid -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.modules.xo.properties: -------------------------------------------------------------------------------- 1 | dxa.modules.xo=xo 2 | dxa.override.modules=modules 3 | dxa.override.user=modules 4 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.properties: -------------------------------------------------------------------------------- 1 | dxa.property=dxa 2 | dxa.override.user=user 3 | dxa.override.addons=user 4 | spring.profiles.active=profile1,\ 5 | profile2 6 | spring.profiles.include=profile3,,profile4, profile5 -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/dxa.user.mimetypes.properties: -------------------------------------------------------------------------------- 1 | #DXA mimetypes. 2 | 3 | #This is a test file to test loading user defined mime types. 4 | 5 | foo=bar 6 | 7 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common-api/src/test/resources/notdxa.properties: -------------------------------------------------------------------------------- 1 | not.dxa.property=hello -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/caching/ConditionalKey.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | import lombok.Builder; 4 | import lombok.Value; 5 | 6 | /** 7 | * Key that determines if the value with this key may be cached. Used for dynamic refusal of caching. 8 | * 9 | */ 10 | @Value 11 | @Builder 12 | public class ConditionalKey { 13 | 14 | private LocalizationAwareCacheKey key; 15 | 16 | private boolean skipCaching; 17 | } 18 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/caching/LocalizationAwareCacheKey.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | import lombok.EqualsAndHashCode; 4 | import lombok.ToString; 5 | import lombok.Value; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * Combined cache key with a localization ID and key itself. 11 | * 12 | */ 13 | @Value 14 | @EqualsAndHashCode 15 | @ToString(exclude = "key") 16 | public class LocalizationAwareCacheKey implements Serializable { 17 | 18 | private String localizationId; 19 | 20 | private Serializable key; 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/caching/LocalizationAwareKeyGenerator.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cache.interceptor.KeyGenerator; 5 | import org.springframework.cache.interceptor.SimpleKey; 6 | import org.springframework.cache.interceptor.SimpleKeyGenerator; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.io.Serializable; 10 | import java.lang.reflect.Method; 11 | 12 | /** 13 | * Default implementation of localization-aware cache key generator. 14 | * 15 | */ 16 | @Component 17 | public class LocalizationAwareKeyGenerator implements KeyGenerator { 18 | 19 | @Autowired 20 | private LocalizationIdProvider localizationIdProvider; 21 | 22 | @Override 23 | public LocalizationAwareCacheKey generate(Object target, Method method, Object... params) { 24 | Object key = SimpleKeyGenerator.generateKey(params); 25 | return new LocalizationAwareCacheKey(localizationIdProvider.getId(), params.length == 1 ? new SimpleKey(key) : (Serializable) key); 26 | } 27 | 28 | public LocalizationAwareCacheKey generate(Object... params) { 29 | return generate(null, null, params); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/caching/LocalizationIdProvider.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | /** 4 | * Functional interface that can provide ID of the current localization. 5 | * 6 | */ 7 | @FunctionalInterface 8 | public interface LocalizationIdProvider { 9 | 10 | /** 11 | * Return current localization ID. By intention, is only used in caching mechanism. 12 | * If localization ID is not important for the current implementation, may return a dummy value. 13 | * Note thought that if value is not specified and there are multiple publications served by the application, 14 | * then this may lead to cache key collision. 15 | * 16 | * @return current localization ID 17 | */ 18 | String getId(); 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/caching/NeverCached.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Inherited; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * Annotates types that should never be cached. 11 | * 12 | */ 13 | @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Inherited 16 | public @interface NeverCached { 17 | 18 | /** 19 | * Qualifier of the annotated model to be used as a one-to-one identifier of the type. 20 | * 21 | * @return alias aka qualifier of the annotated model 22 | */ 23 | String qualifier() default ""; 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/caching/NoOutputCache.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Inherited; 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | import java.lang.annotation.Target; 8 | 9 | /** 10 | * Annotates types that should never be cached in the output cache. 11 | * 12 | */ 13 | @Target({ElementType.ANNOTATION_TYPE, ElementType.TYPE}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Inherited 16 | public @interface NoOutputCache { 17 | 18 | /** 19 | * Qualifier of the annotated model to be used as a one-to-one identifier of the type. 20 | * 21 | * @return alias aka qualifier of the annotated model 22 | */ 23 | String qualifier() default ""; 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/caching/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains basic interfaces and classes for DXA cache. 3 | */ 4 | package com.sdl.dxa.caching; -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/ClaimValues.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.common; 2 | 3 | import java.net.URI; 4 | 5 | public class ClaimValues { 6 | public static String ISH_MODULE_PREFIX = "taf:ish:"; 7 | 8 | public static final String ISH_CONDITIONS = ISH_MODULE_PREFIX + "userconditions"; 9 | public static final URI ISH_CONDITIONS_MERGED = URI.create(ISH_MODULE_PREFIX + "userconditions:merged"); 10 | } 11 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/dto/ClaimHolder.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.common.dto; 2 | 3 | import lombok.Data; 4 | import lombok.ToString; 5 | 6 | @Data 7 | @ToString 8 | public class ClaimHolder { 9 | private String claimType; 10 | private String uri; 11 | private String value; 12 | } 13 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/dto/ContentType.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.common.dto; 2 | 3 | /** 4 | * Way you expect the content to be. 5 | * Handy to have it in DTO to support key generation for caching even if you do not override methods, but use different names, 6 | * so that the same requests with different expected return content type won't clash on the same return type. 7 | */ 8 | public enum ContentType { 9 | RAW, MODEL 10 | } 11 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/dto/DataModelType.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.common.dto; 2 | 3 | public enum DataModelType { 4 | R2, DD4T 5 | } 6 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Common utility classes for the whole framework. 3 | */ 4 | package com.sdl.dxa.common.util; -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/modelservice/service/EntityModelService.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.modelservice.service; 2 | 3 | import com.sdl.dxa.api.datamodel.model.EntityModelData; 4 | import com.sdl.dxa.common.dto.EntityRequestDto; 5 | import com.sdl.webapp.common.api.content.ContentProviderException; 6 | import com.sdl.webapp.common.exceptions.DxaItemNotFoundException; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | @FunctionalInterface 10 | public interface EntityModelService { 11 | 12 | /** 13 | * Loads an Entity model. 14 | * 15 | * @param entityRequest entity request data 16 | * @return an entity model data, never null 17 | * @throws DxaItemNotFoundException if the component wasn't found 18 | * @throws ContentProviderException if couldn't load or parse the page content 19 | */ 20 | @NotNull 21 | EntityModelData loadEntity(EntityRequestDto entityRequest) throws ContentProviderException; 22 | } 23 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/modelservice/service/EntityModelServiceSuppressLinks.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.modelservice.service; 2 | 3 | import com.sdl.dxa.api.datamodel.model.EntityModelData; 4 | import com.sdl.dxa.common.dto.EntityRequestDto; 5 | import com.sdl.webapp.common.api.content.ContentProviderException; 6 | import com.sdl.webapp.common.exceptions.DxaItemNotFoundException; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | public interface EntityModelServiceSuppressLinks extends EntityModelService { 10 | /** 11 | * Loads an Entity model. 12 | * 13 | * @param entityRequest entity request data 14 | * @param resolveLinks should be links resolved 15 | * @return an entity model data, never null 16 | * @throws DxaItemNotFoundException if the component wasn't found 17 | * @throws ContentProviderException if couldn't load or parse the page content 18 | */ 19 | @NotNull 20 | EntityModelData loadEntity(EntityRequestDto entityRequest, boolean resolveLinks) throws ContentProviderException; 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/modelservice/service/ModelServiceProvider.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.modelservice.service; 2 | 3 | import com.sdl.dxa.api.datamodel.model.EntityModelData; 4 | import com.sdl.dxa.common.dto.PageRequestDto; 5 | import com.sdl.webapp.common.api.content.ContentProviderException; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | public interface ModelServiceProvider extends PageModelService, EntityModelService { 9 | 10 | /** 11 | * Loads a page from Content service and returns its raw representation. 12 | * 13 | * @param pageRequest page request dto 14 | * @return raw representation of page 15 | * @throws ContentProviderException 16 | */ 17 | String loadPageContent(PageRequestDto pageRequest) throws ContentProviderException; 18 | 19 | /** 20 | * Loads an Entity model from Content service by given publication id and entity id. 21 | * 22 | * @param publicationId publication id 23 | * @param entityId entity id 24 | * @return EntityModelData representation 25 | * @throws ContentProviderException 26 | */ 27 | EntityModelData loadEntity(String publicationId, @NotNull String entityId) throws ContentProviderException; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/modelservice/service/PageModelService.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.modelservice.service; 2 | 3 | import com.sdl.dxa.api.datamodel.model.PageModelData; 4 | import com.sdl.dxa.common.dto.PageRequestDto; 5 | import com.sdl.webapp.common.api.content.ContentProviderException; 6 | import org.jetbrains.annotations.NotNull; 7 | 8 | @FunctionalInterface 9 | public interface PageModelService { 10 | 11 | /** 12 | * Loads a page from CD and converts it to the {@link PageModelData} doing all the model processing. 13 | */ 14 | @NotNull 15 | PageModelData loadPageModel(PageRequestDto pageRequest) throws ContentProviderException; 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/tridion/annotations/AnnotationFetcherForValue.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.annotations; 2 | 3 | import org.springframework.beans.factory.InitializingBean; 4 | import org.springframework.stereotype.Component; 5 | 6 | @Component 7 | public interface AnnotationFetcherForValue { 8 | String fetchAllValues(InitializingBean bean) throws Exception; 9 | } 10 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/tridion/navigation/dynamic/NavigationModelProvider.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.navigation.dynamic; 2 | 3 | import com.sdl.dxa.api.datamodel.model.TaxonomyNodeModelData; 4 | import com.sdl.dxa.common.dto.SitemapRequestDto; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.Optional; 8 | 9 | /** 10 | * Navigation provider provides access to the navigation model of the publication. 11 | * Data model from {@code dxa-data-model} aka {@code R2} is used. 12 | * 13 | * @since 2.0 14 | */ 15 | @FunctionalInterface 16 | public interface NavigationModelProvider { 17 | 18 | /** 19 | * Loads full navigation model based on a request. Returns an optional in case model is not available but the request is valid. 20 | * 21 | * @param requestDto current request with mandatory localization ID 22 | * @return optional with root navigation model 23 | */ 24 | Optional getNavigationModel(@NotNull SitemapRequestDto requestDto); 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/dxa/tridion/navigation/dynamic/OnDemandNavigationModelProvider.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.navigation.dynamic; 2 | 3 | import com.sdl.dxa.api.datamodel.model.SitemapItemModelData; 4 | import com.sdl.dxa.common.dto.SitemapRequestDto; 5 | import org.jetbrains.annotations.NotNull; 6 | 7 | import java.util.Collection; 8 | import java.util.Optional; 9 | 10 | /** 11 | * On-demand navigation provider provides access to the whole tree or some particular nodes in a navigation model based on the request. 12 | * Data model from {@code dxa-data-model} aka {@code R2} is used. 13 | * 14 | * @since 2.0 15 | */ 16 | @FunctionalInterface 17 | public interface OnDemandNavigationModelProvider { 18 | 19 | /** 20 | * Returns a collection of navigation model nodes based on the request. 21 | * If there is just a single parent node for all the nodes from the request, it should merged into one. 22 | * 23 | * @param requestDto current request 24 | * @return optional collection with requested navigation nodes, 25 | * optional is not present only if the request was correct but nothing was found 26 | */ 27 | @NotNull 28 | Optional> getNavigationSubtree(@NotNull SitemapRequestDto requestDto); 29 | } 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/api/content/ContentProviderException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.content; 2 | 3 | import com.sdl.webapp.common.exceptions.DxaException; 4 | 5 | /** 6 | * Thrown when an error occurs related to a content provider. 7 | */ 8 | public class ContentProviderException extends DxaException { 9 | 10 | public ContentProviderException() { 11 | } 12 | 13 | public ContentProviderException(String message) { 14 | super(message); 15 | } 16 | 17 | public ContentProviderException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public ContentProviderException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public ContentProviderException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/api/content/StaticContentNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.content; 2 | 3 | import com.sdl.webapp.common.exceptions.DxaItemNotFoundException; 4 | 5 | /** 6 | * Thrown when a static content provider cannot find the requested static content. 7 | */ 8 | public class StaticContentNotFoundException extends DxaItemNotFoundException { 9 | 10 | public StaticContentNotFoundException() { 11 | } 12 | 13 | public StaticContentNotFoundException(String message) { 14 | super(message); 15 | } 16 | 17 | public StaticContentNotFoundException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public StaticContentNotFoundException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public StaticContentNotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/api/content/StaticContentNotLoadedException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.content; 2 | 3 | /** 4 | * Thrown when a static content provider cannot load the requested static content. 5 | */ 6 | public class StaticContentNotLoadedException extends ContentProviderException { 7 | 8 | public StaticContentNotLoadedException() { 9 | } 10 | 11 | public StaticContentNotLoadedException(String message) { 12 | super(message); 13 | } 14 | 15 | public StaticContentNotLoadedException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public StaticContentNotLoadedException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public StaticContentNotLoadedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/api/mapping/semantic/config/WithXPath.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.config; 2 | 3 | import org.jetbrains.annotations.NotNull; 4 | import org.jetbrains.annotations.Nullable; 5 | 6 | /** 7 | * Implementors of this interface can provide XPath with their current state. 8 | */ 9 | @FunctionalInterface 10 | public interface WithXPath { 11 | 12 | /** 13 | * Generates XPath for this semantic field respecting the context XPath and type of the field (metadata or content). 14 | * 15 | * @param contextXPath the current context XPath, optional, may be {@code null} 16 | * @return generated XPath 17 | */ 18 | @NotNull 19 | String getXPath(@Nullable String contextXPath); 20 | } 21 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/api/navigation/NavigationFilter.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.navigation; 2 | 3 | import lombok.Data; 4 | import lombok.EqualsAndHashCode; 5 | import lombok.ToString; 6 | import lombok.experimental.Accessors; 7 | 8 | /** 9 | * Navigation filter that holds information about the requested navigation. 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | @EqualsAndHashCode 14 | @ToString 15 | public class NavigationFilter { 16 | 17 | public static final NavigationFilter DEFAULT = new NavigationFilter(); 18 | 19 | private boolean withAncestors; 20 | 21 | private int descendantLevels = 1; 22 | } 23 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/exceptions/DxaException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.exceptions; 2 | 3 | public class DxaException extends Exception { 4 | 5 | public DxaException() { 6 | } 7 | 8 | public DxaException(String message, Throwable innerException) { 9 | super(message, innerException); 10 | 11 | } 12 | 13 | public DxaException(String message) { 14 | super(message); 15 | } 16 | 17 | public DxaException(Throwable cause) { 18 | super(cause); 19 | } 20 | 21 | public DxaException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 22 | super(message, cause, enableSuppression, writableStackTrace); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/exceptions/DxaItemNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.exceptions; 2 | 3 | import com.sdl.webapp.common.api.content.ContentProviderException; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.web.bind.annotation.ResponseStatus; 6 | 7 | @ResponseStatus(reason = "Item not found", code = HttpStatus.NOT_FOUND) 8 | public class DxaItemNotFoundException extends ContentProviderException { 9 | 10 | public DxaItemNotFoundException() { 11 | } 12 | 13 | public DxaItemNotFoundException(String message) { 14 | super(message); 15 | } 16 | 17 | public DxaItemNotFoundException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public DxaItemNotFoundException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public DxaItemNotFoundException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/exceptions/DxaRuntimeException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.exceptions; 2 | 3 | public class DxaRuntimeException extends RuntimeException { 4 | public DxaRuntimeException() { 5 | super(); 6 | } 7 | 8 | public DxaRuntimeException(String message) { 9 | super(message); 10 | } 11 | 12 | public DxaRuntimeException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public DxaRuntimeException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/exceptions/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Basic DXA exceptions. 3 | */ 4 | package com.sdl.webapp.common.exceptions; -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/impl/localization/semantics/JsonFieldSemantics.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.localization.semantics; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Setter 8 | @Getter 9 | public class JsonFieldSemantics { 10 | 11 | @JsonProperty("Prefix") 12 | private String prefix; 13 | 14 | @JsonProperty("Entity") 15 | private String entity; 16 | 17 | @JsonProperty("Property") 18 | private String property; 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/impl/localization/semantics/JsonSchema.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.localization.semantics; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | import java.util.List; 8 | 9 | @Setter 10 | @Getter 11 | public class JsonSchema { 12 | 13 | @JsonProperty("Id") 14 | private long id; 15 | 16 | @JsonProperty("RootElement") 17 | private String rootElement; 18 | 19 | @JsonProperty("Fields") 20 | private List fields; 21 | 22 | @JsonProperty("Semantics") 23 | private List semantics; 24 | } 25 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/impl/localization/semantics/JsonSchemaField.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.localization.semantics; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | import java.util.List; 8 | 9 | @Setter 10 | @Getter 11 | public class JsonSchemaField { 12 | 13 | @JsonProperty("Id") 14 | private String id; 15 | 16 | @JsonProperty("Name") 17 | private String name; 18 | 19 | @JsonProperty("Title") 20 | private String title; 21 | 22 | @JsonProperty("Path") 23 | private String path; 24 | 25 | @JsonProperty("IsMultiValue") 26 | private boolean isMultiValue; 27 | 28 | @JsonProperty("Semantics") 29 | private List semantics; 30 | 31 | @JsonProperty("Fields") 32 | private List fields; 33 | 34 | @JsonProperty("FieldType") 35 | private JsonSchemaFieldType fieldType; 36 | 37 | @JsonProperty("RootElementName") 38 | private String rootElementName; 39 | } 40 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/impl/localization/semantics/JsonSchemaFieldType.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.localization.semantics; 2 | 3 | public enum JsonSchemaFieldType { 4 | TEXT, 5 | MULTILINE_TEXT, 6 | XHTML, 7 | KEYWORD, 8 | EMBEDDED, 9 | MULTIMEDIA_LINK, 10 | COMPONENT_LINK, 11 | EXTERNAL_LINK, 12 | NUMBER, 13 | DATE 14 | } 15 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/impl/localization/semantics/JsonSchemaSemantics.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.localization.semantics; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Setter 8 | @Getter 9 | public class JsonSchemaSemantics { 10 | 11 | @JsonProperty("Prefix") 12 | private String prefix; 13 | 14 | @JsonProperty("Entity") 15 | private String entity; 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/main/java/com/sdl/webapp/common/impl/localization/semantics/JsonVocabulary.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.impl.localization.semantics; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Setter 8 | @Getter 9 | public class JsonVocabulary { 10 | 11 | @JsonProperty("Prefix") 12 | private String prefix; 13 | 14 | @JsonProperty("Vocab") 15 | private String vocab; 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/test/java/com/sdl/dxa/common/dto/StaticContentRequestDtoTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.common.dto; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertTrue; 6 | 7 | public class StaticContentRequestDtoTest { 8 | 9 | @Test 10 | public void shouldHaveSpecificUrl_AsDefault_ForBaseUrl() { 11 | //given 12 | 13 | //when 14 | StaticContentRequestDto requestDto = StaticContentRequestDto.builder("/", "42").build(); 15 | 16 | //then 17 | // ends with slash, starts with http: of https: with even number of slashes, the rest is not empty 18 | assertTrue(requestDto.getBaseUrl().matches("^https?:(//)*[^/]+/$")); 19 | } 20 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/test/java/com/sdl/dxa/common/util/MvcUtilsTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.common.util; 2 | 3 | import com.sdl.dxa.api.datamodel.model.MvcModelData; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.junit.jupiter.api.Assertions.assertEquals; 7 | 8 | public class MvcUtilsTest { 9 | 10 | @Test 11 | public void shouldParseQualifiedNames() { 12 | //when 13 | MvcModelData view = MvcUtils.parseMvcQualifiedViewName("View"); 14 | MvcModelData areaView = MvcUtils.parseMvcQualifiedViewName("Area:View"); 15 | MvcModelData full = MvcUtils.parseMvcQualifiedViewName("Area:Controller:View"); 16 | 17 | //then 18 | assertEquals("View", view.getViewName()); 19 | 20 | assertEquals("View", areaView.getViewName()); 21 | assertEquals("Area", areaView.getAreaName()); 22 | 23 | assertEquals("View", full.getViewName()); 24 | assertEquals("Area", full.getAreaName()); 25 | assertEquals("Controller", full.getControllerName()); 26 | } 27 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/test/java/com/sdl/webapp/common/api/mapping/semantic/config/FieldPathTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.common.api.mapping.semantic.config; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.*; 6 | 7 | public class FieldPathTest { 8 | 9 | @Test 10 | public void shouldDetermineMetadataOrContent() { 11 | //given 12 | FieldPath metadata1 = new FieldPath("Metadata/Test"); 13 | FieldPath metadata2 = new FieldPath("/Metadata/Test"); 14 | FieldPath test = new FieldPath("/Test/Test2"); 15 | FieldPath noTail = new FieldPath("Test2"); 16 | 17 | //then 18 | assertEquals("Metadata", metadata1.getHead()); 19 | assertEquals("Metadata", metadata2.getHead()); 20 | assertEquals("Test", test.getHead()); 21 | assertEquals("Test2", test.getTail().getHead()); 22 | assertNull(test.getTail().getTail()); 23 | assertTrue(test.hasTail()); 24 | assertFalse(test.getTail().hasTail()); 25 | 26 | assertEquals("Test2", noTail.getHead()); 27 | assertNull(noTail.getTail()); 28 | 29 | assertTrue(metadata1.isMetadata()); 30 | assertTrue(metadata2.isMetadata()); 31 | assertFalse(test.isMetadata()); 32 | } 33 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-common/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/Constants.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel; 2 | 3 | /** 4 | * Basic constants for polymorphic JSON mapping. 5 | */ 6 | public final class Constants { 7 | 8 | public static final String DOLLAR_TYPE = "$type"; 9 | 10 | public static final String DEFAULT_NAMESPACE = "tcm"; 11 | 12 | public static final String LIST_MARKER = "[]"; 13 | 14 | public static final String UNKNOWN_TYPE = "unknown_type"; 15 | 16 | private Constants() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/json/Polymorphic.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.json; 2 | 3 | import com.fasterxml.jackson.databind.ObjectMapper; 4 | import com.sdl.dxa.api.datamodel.DataModelSpringConfiguration; 5 | 6 | import java.lang.annotation.Retention; 7 | import java.lang.annotation.RetentionPolicy; 8 | 9 | /** 10 | * Annotation that marks object as polymorphic meaning that it may have subclasses. 11 | * Used by {@link ObjectMapper} to set {@link PolymorphicObjectMixin} in {@link DataModelSpringConfiguration}. 12 | * 13 | */ 14 | @Retention(RetentionPolicy.RUNTIME) 15 | public @interface Polymorphic { 16 | 17 | } 18 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/json/PolymorphicObjectMixin.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.json; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeInfo; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; 6 | import com.fasterxml.jackson.databind.annotation.JsonTypeResolver; 7 | 8 | import static com.sdl.dxa.api.datamodel.Constants.DOLLAR_TYPE; 9 | 10 | /** 11 | * Mix-in for Jackson that makes everything polymorphic. 12 | *

To be added to the configuration of {@link ObjectMapper} to make all Java objects polymorphic, 13 | * so we can handle them with custom {@link ModelDataTypeIdResolver} and {@link ModelDataTypeResolver}.

14 | */ 15 | @SuppressWarnings("unused") 16 | @JsonTypeResolver(ModelDataTypeResolver.class) 17 | @JsonTypeIdResolver(ModelDataTypeIdResolver.class) 18 | @JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, include = JsonTypeInfo.As.PROPERTY, property = DOLLAR_TYPE, visible = true) 19 | public interface PolymorphicObjectMixin { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/MvcModelData.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import lombok.Builder; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.Getter; 7 | import lombok.NoArgsConstructor; 8 | import lombok.Setter; 9 | import lombok.ToString; 10 | 11 | import java.util.Map; 12 | 13 | @JsonTypeName 14 | @ToString 15 | @NoArgsConstructor 16 | @Getter 17 | @Setter 18 | @EqualsAndHashCode 19 | public class MvcModelData { 20 | 21 | private String actionName; 22 | 23 | private String areaName; 24 | 25 | private String controllerAreaName; 26 | 27 | private String controllerName; 28 | 29 | private String viewName; 30 | 31 | private Map parameters; 32 | 33 | @Builder 34 | public MvcModelData(String actionName, String areaName, String controllerAreaName, String controllerName, String viewName, Map parameters) { 35 | this.actionName = actionName; 36 | this.areaName = areaName; 37 | this.controllerAreaName = controllerAreaName; 38 | this.controllerName = controllerName; 39 | this.viewName = viewName; 40 | this.parameters = parameters; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/PageTemplateData.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import com.sdl.dxa.api.datamodel.Constants; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | import org.joda.time.DateTime; 9 | 10 | @NoArgsConstructor 11 | @Data 12 | @Accessors(chain = true) 13 | @JsonTypeName 14 | public class PageTemplateData { 15 | 16 | private String id; 17 | 18 | private String namespace; 19 | 20 | private String title; 21 | 22 | private String fileExtension; 23 | 24 | private DateTime revisionDate; 25 | 26 | private ContentModelData metadata; 27 | 28 | public String getNamespace() { 29 | return namespace == null ? Constants.DEFAULT_NAMESPACE : namespace; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/RichTextData.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import com.sdl.dxa.api.datamodel.model.util.CanGetAndCast; 5 | import com.sdl.dxa.api.datamodel.model.util.DelegatesToList; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import lombok.ToString; 10 | import lombok.experimental.Accessors; 11 | 12 | import java.util.List; 13 | 14 | @JsonTypeName 15 | @ToString 16 | @NoArgsConstructor 17 | @Data 18 | @AllArgsConstructor 19 | @Accessors(chain = true) 20 | public class RichTextData implements DelegatesToList, CanGetAndCast { 21 | 22 | private List fragments; 23 | 24 | @Override 25 | public List getValues() { 26 | return getFragments(); 27 | } 28 | 29 | @Override 30 | public Object getElement(Integer identifier) { 31 | return getFragments().get(identifier); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/TaxonomyNodeModelData.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.annotation.JsonTypeName; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.experimental.Accessors; 8 | 9 | @EqualsAndHashCode(callSuper = true) 10 | @Data 11 | @Accessors(chain = true) 12 | @JsonTypeName 13 | public class TaxonomyNodeModelData extends SitemapItemModelData { 14 | 15 | @JsonProperty("Key") 16 | private String key; 17 | 18 | @JsonProperty("HasChildNodes") 19 | private boolean withChildren; 20 | 21 | @JsonProperty("Description") 22 | private String description; 23 | 24 | @JsonProperty("IsAbstract") 25 | private boolean taxonomyAbstract; 26 | 27 | @JsonProperty("ClassifiedItemsCount") 28 | private int classifiedItemsCount; 29 | } 30 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/unknown/UnknownModelDataSerializer.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.unknown; 2 | 3 | import com.fasterxml.jackson.core.JsonGenerator; 4 | import com.fasterxml.jackson.databind.JsonSerializer; 5 | import com.fasterxml.jackson.databind.SerializerProvider; 6 | import com.fasterxml.jackson.databind.jsontype.TypeSerializer; 7 | 8 | import java.io.IOException; 9 | 10 | public class UnknownModelDataSerializer extends JsonSerializer { 11 | 12 | @Override 13 | public void serialize(UnknownModelData value, JsonGenerator gen, SerializerProvider serializers) throws IOException { 14 | gen.writeStartObject(value); 15 | gen.writeRaw(value.getContent()); 16 | gen.writeEndObject(); 17 | } 18 | 19 | @Override 20 | public void serializeWithType(UnknownModelData value, JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException { 21 | this.serialize(value, gen, serializers); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/util/CanCopyValues.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.util; 2 | 3 | /** 4 | * Implementors of this interface can copy values from another instance to itself. 5 | */ 6 | @FunctionalInterface 7 | public interface CanCopyValues { 8 | 9 | /** 10 | * Copies values from {@code other} to self. Should return self! 11 | * 12 | * @param other instance to copy values from 13 | * @return self populated with values from the given instance 14 | */ 15 | T copyFrom(T other); 16 | } 17 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/util/CanGetAndCast.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.util; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import org.jetbrains.annotations.NotNull; 5 | 6 | import java.util.Collection; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * Functional interface to get element from a {@link Collection} and cast it. 12 | * 13 | * @param type of an identifier (e.g. key for a {@link Map}) 14 | */ 15 | @FunctionalInterface 16 | public interface CanGetAndCast { 17 | 18 | /** 19 | * Returns and element from the collection and casts it to a given class. 20 | * Basically calls {@link Map#get(Object)} or {@link List#get(int)} and casts. 21 | * Throws a {@link ClassCastException} is casting is not successful. 22 | * 23 | * @param identifier key or index of the element 24 | * @param expectedClass class to cast to 25 | * @param a required type 26 | * @return an element if any, null otherwise 27 | */ 28 | @JsonIgnore 29 | default T getAndCast(F identifier, @NotNull Class expectedClass) { 30 | return expectedClass.cast(getElement(identifier)); 31 | } 32 | 33 | @JsonIgnore 34 | Object getElement(F identifier); 35 | } 36 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/util/CanWrapContentAndMetadata.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.util; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | import com.sdl.dxa.api.datamodel.model.ContentModelData; 5 | import com.sdl.dxa.api.datamodel.model.ViewModelData; 6 | 7 | /** 8 | * Indicates that the implementor can return an instance of {@link ModelDataWrapper} to be used in data providers 9 | * as an abstraction for {@link ContentModelData} and {@link ViewModelData} that hides a real {@code content} and {@code metadata} objects. 10 | */ 11 | @FunctionalInterface 12 | public interface CanWrapContentAndMetadata { 13 | 14 | /** 15 | * Returns an instance of data wrapper for the current model. 16 | */ 17 | @JsonIgnore 18 | ModelDataWrapper getDataWrapper(); 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/util/DelegatesToList.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.util; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Delegates method calls to {@link List}, used for wrappers on top of {@link List} that cannot implement that interface directly. 9 | * Methods are named intentionally to not collapse with methods name in a {@link List}. 10 | * 11 | * @param generic type of a list 12 | */ 13 | @FunctionalInterface 14 | public interface DelegatesToList { 15 | 16 | /** 17 | * See {@link List#get(int)}. 18 | */ 19 | default T get(int index) { 20 | return getValues().get(index); 21 | } 22 | 23 | /** 24 | * Returns a wrapped list. 25 | * 26 | * @return a wrapped list 27 | */ 28 | @JsonIgnore 29 | List getValues(); 30 | 31 | /** 32 | * See {@link List#isEmpty()}. 33 | */ 34 | default boolean empty() { 35 | return getValues().isEmpty(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/main/java/com/sdl/dxa/api/datamodel/model/util/ModelDataWrapper.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.util; 2 | 3 | import com.sdl.dxa.api.datamodel.model.ContentModelData; 4 | 5 | /** 6 | * Wrapper that build an abstraction on top of what can be considered as {@code content} or {@code metadata} for the current model. 7 | * While it is basically straight-forward logic, different types of model data may have different data objects to be used as {@code content} or {@code metadata}. 8 | */ 9 | public interface ModelDataWrapper { 10 | 11 | /** 12 | * Returns what can be considered as {@code content} for the current model. 13 | */ 14 | default ContentModelData getContent() { 15 | return new ContentModelData(0); 16 | } 17 | 18 | /** 19 | * Returns what can be considered as {@code metadata} for the current model. 20 | */ 21 | ContentModelData getMetadata(); 22 | 23 | /** 24 | * Returns the wrapped model itself. 25 | */ 26 | Object getWrappedModel(); 27 | } 28 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/java/com/sdl/dxa/api/datamodel/model/RegionModelDataTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | 7 | public class RegionModelDataTest { 8 | 9 | @Test 10 | public void shouldAddRegion() throws Exception { 11 | //given 12 | RegionModelData modelData = new RegionModelData("name", "1", null, null); 13 | RegionModelData regionToAdd = new RegionModelData("name2", null, null, null); 14 | 15 | //when 16 | modelData.addRegion(regionToAdd); 17 | 18 | //then 19 | assertEquals(regionToAdd, modelData.getRegions().get(0)); 20 | } 21 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/java/com/sdl/dxa/api/datamodel/model/known/FirstChildKnownClass.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.known; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | @EqualsAndHashCode(callSuper = true) 8 | @JsonTypeName 9 | @Data 10 | public class FirstChildKnownClass extends KnownParentClass { 11 | 12 | private String id; 13 | } 14 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/java/com/sdl/dxa/api/datamodel/model/known/KnownClass.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.known; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import lombok.Data; 5 | 6 | @JsonTypeName 7 | @Data 8 | public class KnownClass { 9 | 10 | private String id; 11 | } 12 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/java/com/sdl/dxa/api/datamodel/model/known/KnownParentClass.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.known; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import com.sdl.dxa.api.datamodel.json.Polymorphic; 5 | import com.sdl.dxa.api.datamodel.model.util.HandlesHierarchyTypeInformation; 6 | 7 | @Polymorphic 8 | @JsonTypeName("KnownParentClass") 9 | public class KnownParentClass implements HandlesHierarchyTypeInformation { 10 | 11 | @Override 12 | public String getTypeId() { 13 | return KnownParentClass.class.getSimpleName(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/java/com/sdl/dxa/api/datamodel/model/known/SecondChildKnownClass.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.known; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | 7 | @EqualsAndHashCode(callSuper = true) 8 | @JsonTypeName 9 | @Data 10 | public class SecondChildKnownClass extends KnownParentClass { 11 | 12 | private String id; 13 | } 14 | -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/resources/dxa20json/unknown/DeserializerTest: -------------------------------------------------------------------------------- 1 | "$type":"UnknownParentClass[]","$values":[{"$type":"UnknownClass","KeywordModelData":{"StringValue":"1","ObjectValue":{"$type":"SecondUnknownClass","Id":"1","Id2":"2","Test":{}},"Array":["value","value2",1,2,1.0,2.0,{"Id":"2","Obj":{"Id":"2"}},{"Id":3,"Obj":{"Id":"2"}},["1","2"],["1","2"]],"Int":1,"Float":2.0,"Str":"Str"},"IntValue":1,"DoubleValue":1.0,"BoolValue":true}] -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/resources/dxa20json/unknown/UnknownClass: -------------------------------------------------------------------------------- 1 | "$type":"UnknownClass","Id":"UnknownClass" -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/resources/dxa20json/unknown/UnknownClassNoType: -------------------------------------------------------------------------------- 1 | "Id":"UnknownClassNoType" -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/resources/dxa20json/unknown/UnknownClasses: -------------------------------------------------------------------------------- 1 | "$type":"UnknownClass[]","$values":[{"$type":"UnknownClass","Id":"UnknownClass[] > UnknownClass"}] -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/resources/dxa20json/unknown/UnknownParentClasses: -------------------------------------------------------------------------------- 1 | "$type":"UnknownParentClass[]","$values":[{"$type":"UnknownClass","Id":"UnknownParentClass[] > UnknownClass"},{"$type":"SecondUnknownClass","Id":"UnknownParentClass[] > SecondUnknownClass"}] -------------------------------------------------------------------------------- /dxa-framework/dxa-data-model/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/caching/TridionNoCacheConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.caching; 2 | 3 | import org.springframework.cache.CacheManager; 4 | import org.springframework.cache.annotation.CachingConfigurerSupport; 5 | import org.springframework.cache.support.CompositeCacheManager; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.Profile; 9 | 10 | @Configuration 11 | @Profile("dxa.no-cache") 12 | public class TridionNoCacheConfiguration extends CachingConfigurerSupport { 13 | 14 | @Bean(name="compositeCacheManager") 15 | @Override 16 | public CacheManager cacheManager() { 17 | CompositeCacheManager compositeCacheManager = new CompositeCacheManager(); 18 | compositeCacheManager.setFallbackToNoOpCache(true); 19 | return compositeCacheManager; 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/exception/DxaTridionCommonException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.exception; 2 | 3 | public class DxaTridionCommonException extends RuntimeException { 4 | public DxaTridionCommonException() { 5 | super(); 6 | } 7 | 8 | public DxaTridionCommonException(String message) { 9 | super(message); 10 | } 11 | 12 | public DxaTridionCommonException(String message, Throwable cause) { 13 | super(message, cause); 14 | } 15 | 16 | public DxaTridionCommonException(Throwable cause) { 17 | super(cause); 18 | } 19 | 20 | protected DxaTridionCommonException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 21 | super(message, cause, enableSuppression, writableStackTrace); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/tridion/common/ConfigurationConstants.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.common; 2 | 3 | /** 4 | * Contains various configuration constants. 5 | */ 6 | public class ConfigurationConstants { 7 | private ConfigurationConstants() { 8 | } 9 | 10 | public static final String CONNECTION_TIMEOUT = "ConnectionTimeout"; 11 | public static final String CONTENT_SERVICE = "ContentService"; 12 | public static final String SERVICE_URI = "ServiceUri"; 13 | public static final String CONTENT_SERVICE_CONTEXT_PATH = "content.svc"; 14 | public static final String AUTHORIZATION_HEADER = "Authorization"; 15 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/tridion/content/StaticContentResolver.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.content; 2 | 3 | import com.sdl.dxa.common.dto.StaticContentRequestDto; 4 | import com.sdl.webapp.common.api.content.ContentProviderException; 5 | import com.sdl.webapp.common.api.content.StaticContentItem; 6 | import com.sdl.webapp.common.api.content.StaticContentNotFoundException; 7 | import org.jetbrains.annotations.NotNull; 8 | 9 | public interface StaticContentResolver { 10 | 11 | /** 12 | * Resolves static content with a given path in a given publication. 13 | *

Requires localization path to request the content, so resolves it using localization ID if the path is missing. 14 | * If you already know publication path, providing it in a request would give you a bit better performance.

15 | * If file is resolved, caches the file locally, so won't download it again unless it needs to be refreshed. 16 | * 17 | * @param requestDto request DTO 18 | * @return requested static file 19 | * @throws StaticContentNotFoundException if cannot resolve static file for any reason 20 | */ 21 | @NotNull StaticContentItem getStaticContent(@NotNull StaticContentRequestDto requestDto) throws ContentProviderException; 22 | } 23 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/tridion/content/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Classes and interfaces related to resolving of the static content in Tridion. 3 | */ 4 | package com.sdl.dxa.tridion.content; -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/tridion/pcaclient/ApiClientConfigurationException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.pcaclient; 2 | 3 | public class ApiClientConfigurationException extends RuntimeException { 4 | public ApiClientConfigurationException() { 5 | } 6 | 7 | public ApiClientConfigurationException(String message) { 8 | super(message); 9 | } 10 | 11 | public ApiClientConfigurationException(String message, Throwable cause) { 12 | super(message, cause); 13 | } 14 | 15 | public ApiClientConfigurationException(Throwable cause) { 16 | super(cause); 17 | } 18 | 19 | public ApiClientConfigurationException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 20 | super(message, cause, enableSuppression, writableStackTrace); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/tridion/pcaclient/ApiClientConfigurationLoader.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.pcaclient; 2 | 3 | import java.util.Properties; 4 | 5 | /** 6 | * Loads and holds public content api client configuration. 7 | */ 8 | public interface ApiClientConfigurationLoader { 9 | 10 | /** 11 | * Returns client configuration properties. 12 | * 13 | * @return 14 | */ 15 | Properties getConfiguration(); 16 | 17 | /** 18 | * Returns GraphQL service endpoint. 19 | * 20 | * @return 21 | */ 22 | String getServiceUrl(); 23 | 24 | /** 25 | * Returns true when claim forwarding is set by parameter 'dxa.graphql.claimforwarding' in dxa.properties file. 26 | * 27 | * @return 28 | */ 29 | boolean claimForwarding(); 30 | } 31 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/tridion/pcaclient/ApiClientProvider.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.pcaclient; 2 | 3 | import com.sdl.web.pca.client.ApiClient; 4 | import com.sdl.web.pca.client.GraphQLClient; 5 | import com.sdl.web.pca.client.contentmodel.generated.ClaimValue; 6 | 7 | /** 8 | * Provides instance of Api Client and GraphQL client which is works with environment configured in cd_client_conf.xml 9 | * configuration file. 10 | */ 11 | public interface ApiClientProvider { 12 | 13 | /** 14 | * Returns configured instance of ApiClient client. 15 | * 16 | * @return 17 | */ 18 | ApiClient getClient(); 19 | 20 | /** 21 | * Add a global claim to send to client. 22 | * 23 | * @param claim 24 | */ 25 | void addGlobalClaim(ClaimValue claim); 26 | 27 | /** 28 | * Remove global claim from client. 29 | * 30 | * @param claim 31 | */ 32 | void removeGlobalClaim(ClaimValue claim); 33 | } 34 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/java/com/sdl/dxa/tridion/pcaclient/GraphQLUtils.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.pcaclient; 2 | 3 | import com.sdl.web.pca.client.contentmodel.enums.ContentNamespace; 4 | 5 | public class GraphQLUtils { 6 | public static ContentNamespace convertUriToGraphQLContentNamespace(String cmUriScheme) { 7 | switch (cmUriScheme) { 8 | case "ish": 9 | return ContentNamespace.Docs; 10 | case "tcm": 11 | default: 12 | return ContentNamespace.Sites; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/main/resources/dxa.modules.tridioncommon.properties: -------------------------------------------------------------------------------- 1 | #@formatter:off 2 | #Taxonomies 3 | dxa.tridion.navigation.taxonomy.marker=[Navigation] 4 | dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup 5 | dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode 6 | dxa.tridion.navigation.taxonomy.type.page=Page 7 | 8 | # Name of cache configuration file 9 | dxa.caching.configuration=ehcache.xml 10 | # List of required caches that will be created automatically if they are missing in config, comma-separated 11 | dxa.caching.required.caches=defaultCache, failures 12 | # List of disabled caches that will be destroyed, comma-separated 13 | dxa.caching.disabled.caches=no-caches-are-disabled-by-default 14 | #@formatter:on -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/test/resources/cd_client_conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-common/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/api/datamodel/model/condition/Condition.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.condition; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import com.sdl.dxa.api.datamodel.json.Polymorphic; 5 | import com.sdl.dxa.api.datamodel.model.util.HandlesHierarchyTypeInformation; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import lombok.experimental.Accessors; 10 | 11 | @Data 12 | @Accessors(chain = true) 13 | @AllArgsConstructor 14 | @NoArgsConstructor 15 | @Polymorphic 16 | @JsonTypeName 17 | public class Condition implements HandlesHierarchyTypeInformation { 18 | 19 | private boolean negate; 20 | 21 | @Override 22 | public String getTypeId() { 23 | return Condition.class.getSimpleName(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/api/datamodel/model/condition/ConditionOperator.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.condition; 2 | 3 | import com.fasterxml.jackson.annotation.JsonCreator; 4 | import com.fasterxml.jackson.annotation.JsonValue; 5 | 6 | public enum ConditionOperator { 7 | UNKNOWN_BY_CLIENT(-2147483648), 8 | EQUALS(0), 9 | GREATER_THAN(1), 10 | LESS_THEN(2), 11 | NOT_EQUAL(3), 12 | STRING_EQUALS(4), 13 | CONTAINS(5), 14 | STARTS_WITH(6), 15 | ENDS_WITH(7); 16 | 17 | private final int index; 18 | 19 | ConditionOperator(int index) { 20 | this.index = index; 21 | } 22 | 23 | @JsonCreator 24 | public static ConditionOperator fromValue(final int typeCode) { 25 | for (ConditionOperator operator : ConditionOperator.values()) { 26 | if (operator.index == typeCode) { 27 | return operator; 28 | } 29 | } 30 | 31 | throw new IllegalArgumentException("Invalid ConditionalOperator type code: " + typeCode); 32 | } 33 | 34 | @JsonValue 35 | public int toValue() { 36 | return this.index; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/api/datamodel/model/condition/CustomerCharacteristicCondition.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.condition; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | @EqualsAndHashCode(callSuper = true) 10 | @NoArgsConstructor 11 | @Data 12 | @Accessors(chain = true) 13 | @JsonTypeName 14 | public class CustomerCharacteristicCondition extends Condition { 15 | 16 | private Object value; 17 | 18 | private String name; 19 | 20 | private ConditionOperator operator; 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/api/datamodel/model/condition/TargetGroupCondition.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.condition; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import com.sdl.dxa.api.datamodel.model.targetgroup.TargetGroup; 5 | import lombok.Data; 6 | import lombok.EqualsAndHashCode; 7 | import lombok.NoArgsConstructor; 8 | import lombok.experimental.Accessors; 9 | 10 | @EqualsAndHashCode(callSuper = true) 11 | @NoArgsConstructor 12 | @Data 13 | @Accessors(chain = true) 14 | @JsonTypeName 15 | public class TargetGroupCondition extends Condition { 16 | 17 | private TargetGroup targetGroup; 18 | } 19 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/api/datamodel/model/condition/TrackingKeyCondition.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.condition; 2 | 3 | import com.fasterxml.jackson.annotation.JsonTypeName; 4 | import lombok.Data; 5 | import lombok.EqualsAndHashCode; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | @EqualsAndHashCode(callSuper = true) 10 | @NoArgsConstructor 11 | @Data 12 | @Accessors(chain = true) 13 | @JsonTypeName 14 | public class TrackingKeyCondition extends Condition { 15 | 16 | private String trackingKeyTitle; 17 | 18 | private ConditionOperator operator; 19 | 20 | private Object value; 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/api/datamodel/model/targetgroup/TargetGroup.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.api.datamodel.model.targetgroup; 2 | 3 | import com.sdl.dxa.api.datamodel.model.condition.Condition; 4 | import lombok.Data; 5 | 6 | import java.util.List; 7 | 8 | @Data 9 | public class TargetGroup { 10 | 11 | private String id; 12 | 13 | private String title; 14 | 15 | private String description; 16 | 17 | private List conditions; 18 | } 19 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/broker/QueryProvider.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.broker; 2 | 3 | import com.sdl.web.pca.client.contentmodel.generated.Item; 4 | import com.sdl.webapp.common.api.model.query.SimpleBrokerQuery; 5 | 6 | import java.util.List; 7 | 8 | public interface QueryProvider { 9 | 10 | boolean hasMore(); 11 | 12 | String getCursor(); 13 | 14 | List executeQueryItems(SimpleBrokerQuery query); 15 | } 16 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/mapping/converter/TypeInformation.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.mapping.converter; 2 | 3 | import lombok.Builder; 4 | import lombok.Value; 5 | 6 | import java.util.Collection; 7 | 8 | @Value 9 | @Builder 10 | public class TypeInformation { 11 | 12 | private Class objectType; 13 | 14 | private Class collectionType; 15 | 16 | public boolean isCollection() { 17 | return collectionType != null; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/mapping/impl/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Default implementation of the {@linkplain com.sdl.dxa.tridion.mapping data model builders}. 3 | * 4 | */ 5 | package com.sdl.dxa.tridion.mapping.impl; -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/mapping/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes and interfaces for the data model mapping. 3 | * Model mapping is a process of the conversion of a raw loosely-typed data to a strong-typed view models. 4 | * 5 | */ 6 | package com.sdl.dxa.tridion.mapping; -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/config/TridionSpringConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.config; 2 | 3 | import com.sdl.web.api.dynamic.DynamicMappingsRetriever; 4 | import com.sdl.web.api.dynamic.DynamicMappingsRetrieverImpl; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.ComponentScan; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.context.annotation.Profile; 9 | 10 | /** 11 | * Tridion spring configuration. 12 | * 13 | * @deprecated since PCA implementation added which supports mashup scenario. 14 | */ 15 | @ComponentScan({"com.sdl.webapp.tridion", "com.sdl.dxa.tridion"}) 16 | @Configuration 17 | @Deprecated 18 | public class TridionSpringConfiguration { 19 | 20 | @Bean 21 | @Profile("cil.providers.active") 22 | public DynamicMappingsRetriever dynamicMappingsRetriever() { 23 | return new DynamicMappingsRetrieverImpl(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/PublicationMappingNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.tridion; 2 | 3 | import com.sdl.webapp.common.api.localization.LocalizationResolverException; 4 | 5 | public class PublicationMappingNotFoundException extends LocalizationResolverException { 6 | 7 | public PublicationMappingNotFoundException(String message) { 8 | super(message); 9 | } 10 | 11 | public PublicationMappingNotFoundException(String message, Throwable cause) { 12 | super(message, cause); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/fields/exceptions/TaxonomyNotFoundException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.tridion.fields.exceptions; 2 | 3 | import com.sdl.webapp.common.exceptions.DxaItemNotFoundException; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.web.bind.annotation.ResponseStatus; 6 | 7 | @ResponseStatus(HttpStatus.NOT_FOUND) 8 | public class TaxonomyNotFoundException extends DxaItemNotFoundException { 9 | public TaxonomyNotFoundException(String message) { 10 | super(message); 11 | } 12 | 13 | public TaxonomyNotFoundException(Throwable cause) { 14 | super(cause); 15 | } 16 | 17 | public TaxonomyNotFoundException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/fields/exceptions/UnsupportedTargetTypeException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.tridion.fields.exceptions; 2 | 3 | import org.springframework.core.convert.TypeDescriptor; 4 | 5 | /** 6 | * Thrown by a {@code FieldConverter} when the specified target type is not supported. 7 | */ 8 | public class UnsupportedTargetTypeException extends FieldConverterException { 9 | 10 | /** 11 | *

Constructor for UnsupportedTargetTypeException.

12 | * 13 | * @param targetType a {@link org.springframework.core.convert.TypeDescriptor} object. 14 | */ 15 | public UnsupportedTargetTypeException(TypeDescriptor targetType) { 16 | super("Unsupported target type: " + targetType); 17 | } 18 | 19 | /** 20 | *

Constructor for UnsupportedTargetTypeException.

21 | * 22 | * @param targetClass a {@link java.lang.Class} object. 23 | */ 24 | public UnsupportedTargetTypeException(Class targetClass) { 25 | super("Unsupported target class: " + targetClass.getName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/xpm/ComponentTypeImpl.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.tridion.xpm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.sdl.webapp.common.api.xpm.ComponentType; 5 | 6 | /** 7 | *

ComponentTypeImpl class.

8 | */ 9 | public class ComponentTypeImpl implements ComponentType { 10 | 11 | @JsonProperty(value = "Schema", required = true) 12 | private String schemaId; 13 | 14 | @JsonProperty(value = "Template", required = true) 15 | private String templateId; 16 | 17 | /** 18 | * {@inheritDoc} 19 | */ 20 | @Override 21 | public String getSchemaId() { 22 | return schemaId; 23 | } 24 | 25 | /** 26 | * {@inheritDoc} 27 | */ 28 | @Override 29 | public void setSchemaId(String schemaId) { 30 | this.schemaId = schemaId; 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public String getTemplateId() { 36 | return templateId; 37 | } 38 | 39 | /** {@inheritDoc} */ 40 | @Override 41 | public void setTemplateId(String templateId) { 42 | this.templateId = templateId; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/xpm/OccurrenceConstraintImpl.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.tridion.xpm; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.sdl.webapp.common.api.xpm.OccurrenceConstraint; 5 | 6 | public class OccurrenceConstraintImpl implements OccurrenceConstraint { 7 | 8 | @JsonProperty(value = "MinOccurs", required = true) 9 | private int minOccurs; 10 | 11 | @JsonProperty(value = "MaxOccurs", required = true) 12 | private int maxOccurs; 13 | 14 | /** {@inheritDoc} */ 15 | @Override 16 | public int getMinOccurs() { 17 | return minOccurs; 18 | } 19 | 20 | /** {@inheritDoc} */ 21 | @Override 22 | public void setMinOccurs(int minOccurs) { 23 | this.minOccurs = minOccurs; 24 | } 25 | 26 | /** {@inheritDoc} */ 27 | @Override 28 | public int getMaxOccurs() { 29 | return maxOccurs; 30 | } 31 | 32 | /** {@inheritDoc} */ 33 | @Override 34 | public void setMaxOccurs(int maxOccurs) { 35 | this.maxOccurs = maxOccurs; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/xpm/markup/XpmMarkupInitializer.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.tridion.xpm.markup; 2 | 3 | import com.sdl.webapp.common.api.xpm.XpmRegionConfig; 4 | import com.sdl.webapp.common.markup.MarkupDecoratorRegistry; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | 8 | import jakarta.annotation.PostConstruct; 9 | 10 | /** 11 | * XpmMarkupInitializer 12 | * 13 | * @author nic 14 | */ 15 | @Component 16 | public class XpmMarkupInitializer { 17 | 18 | @Autowired 19 | private MarkupDecoratorRegistry registry; 20 | 21 | @Autowired 22 | private XpmRegionConfig xpmRegionConfig; 23 | 24 | /** 25 | *

initializeMarkup.

26 | */ 27 | @PostConstruct 28 | public void initializeMarkup() { 29 | 30 | RegionXpmMarkup regionXpmMarkup = new RegionXpmMarkup(xpmRegionConfig); 31 | EntityXpmMarkup entityXpmMarkup = new EntityXpmMarkup(); 32 | 33 | this.registry.registerDecorator("Region", regionXpmMarkup); 34 | this.registry.registerDecorator("Regions", regionXpmMarkup); 35 | this.registry.registerDecorator("Entity", entityXpmMarkup); 36 | this.registry.registerDecorator("Entities", entityXpmMarkup); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/main/resources/dxa.modules.tridion.properties: -------------------------------------------------------------------------------- 1 | #@formatter:off 2 | dxa.tridion.navigation.modelUrl=/navigation.json 3 | 4 | #Taxonomies 5 | dxa.tridion.navigation.taxonomy.marker=[Navigation] 6 | dxa.tridion.navigation.taxonomy.type.structureGroup=StructureGroup 7 | dxa.tridion.navigation.taxonomy.type.taxonomyNode=TaxonomyNode 8 | dxa.tridion.navigation.taxonomy.type.page=Page 9 | 10 | # Controls the depth of sitemap queries to get the whole navigation tree. 11 | # Applicable if 'dynamic.navigation.provider' profile is set and 'cil.providers.active' is not set. 12 | dxa.pca.dynamic.navigation.sitemap.descendant.depth=10 13 | #@formatter:on -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/dxa/tridion/models/entity/Article.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.models.entity; 2 | 3 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticEntity; 4 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticProperty; 5 | import com.sdl.webapp.common.api.model.entity.AbstractEntityModel; 6 | import org.joda.time.DateTime; 7 | 8 | @SemanticEntity(entityName = "Article", prefix = "s",public_ = true) 9 | public class Article extends AbstractEntityModel { 10 | @SemanticProperty("s:headline") 11 | public String headline; 12 | @SemanticProperty("s:image") 13 | public Image image; 14 | @SemanticProperty("s:dateCreated") 15 | public DateTime date; 16 | @SemanticProperty("s:about") 17 | public String description; 18 | } 19 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/dxa/tridion/models/entity/Image.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.models.entity; 2 | 3 | import com.sdl.webapp.common.api.model.entity.MediaItem; 4 | import com.sdl.webapp.common.exceptions.DxaException; 5 | import com.sdl.webapp.common.markup.html.HtmlElement; 6 | 7 | public class Image extends MediaItem { 8 | 9 | public String alternateText; 10 | 11 | @Override 12 | public HtmlElement toHtmlElement(String widthFactor) throws DxaException { 13 | return null; 14 | } 15 | 16 | @Override 17 | public HtmlElement toHtmlElement(String widthFactor, double aspect, String cssClass, int containerSize) throws DxaException { 18 | return null; 19 | } 20 | 21 | @Override 22 | public HtmlElement toHtmlElement(String widthFactor, double aspect, String cssClass, int containerSize, String contextPath) throws DxaException { 23 | return null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/dxa/tridion/models/topic/SpecializedSectionTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.models.topic; 2 | 3 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticEntity; 4 | import com.sdl.webapp.common.api.mapping.semantic.annotations.SemanticProperty; 5 | import com.sdl.webapp.common.api.mapping.semantic.config.SemanticVocabulary; 6 | import com.sdl.webapp.common.api.model.RichText; 7 | import com.sdl.webapp.common.api.model.entity.AbstractEntityModel; 8 | 9 | @SemanticEntity(vocabulary = SemanticVocabulary.SDL_DITA) 10 | public class SpecializedSectionTest extends AbstractEntityModel { 11 | @SemanticProperty("_self") 12 | public RichText content; 13 | 14 | public RichText getContent() { 15 | return content; 16 | } 17 | 18 | public void setContent(RichText content) { 19 | this.content = content; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/tridion/config/ExternalFiltersWebConfigurationTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.tridion.config; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | import static org.springframework.core.Ordered.HIGHEST_PRECEDENCE; 7 | 8 | public class ExternalFiltersWebConfigurationTest { 9 | 10 | @Test 11 | public void shouldBeHighestPrecedenceBecauseOfADF() { 12 | assertEquals(HIGHEST_PRECEDENCE, new ExternalFiltersWebConfiguration().getOrder()); 13 | } 14 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/tridion/contextengine/AdfContextClaimsProviderTest.java: -------------------------------------------------------------------------------- 1 | package com.sdl.webapp.tridion.contextengine; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertNull; 6 | 7 | public class AdfContextClaimsProviderTest { 8 | 9 | @Test 10 | public void shouldReturnNullAsDeviceFamily() throws Exception { 11 | //given 12 | AdfContextClaimsProvider provider = new AdfContextClaimsProvider(); 13 | 14 | //when 15 | String deviceFamily = provider.getDeviceFamily(); 16 | 17 | //then 18 | assertNull(deviceFamily); 19 | } 20 | } -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/test/resources/cd_client_conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dxa-framework/dxa-tridion-provider/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /dxa-model-service-client/src/main/java/com/sdl/dxa/tridion/modelservice/exceptions/ItemNotFoundInModelServiceException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.modelservice.exceptions; 2 | 3 | /** 4 | * If item is not found with Model Service. 5 | */ 6 | public class ItemNotFoundInModelServiceException extends Exception { 7 | 8 | public ItemNotFoundInModelServiceException() { 9 | } 10 | 11 | public ItemNotFoundInModelServiceException(String message) { 12 | super(message); 13 | } 14 | 15 | public ItemNotFoundInModelServiceException(String message, Throwable cause) { 16 | super(message, cause); 17 | } 18 | 19 | public ItemNotFoundInModelServiceException(Throwable cause) { 20 | super(cause); 21 | } 22 | 23 | public ItemNotFoundInModelServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 24 | super(message, cause, enableSuppression, writableStackTrace); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /dxa-model-service-client/src/main/java/com/sdl/dxa/tridion/modelservice/exceptions/ModelServiceBadRequestException.java: -------------------------------------------------------------------------------- 1 | package com.sdl.dxa.tridion.modelservice.exceptions; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.web.bind.annotation.ResponseStatus; 5 | 6 | /** 7 | * Bad request to model service. 8 | */ 9 | @ResponseStatus(HttpStatus.BAD_REQUEST) 10 | public class ModelServiceBadRequestException extends RuntimeException { 11 | 12 | public ModelServiceBadRequestException() { 13 | } 14 | 15 | public ModelServiceBadRequestException(String message) { 16 | super(message); 17 | } 18 | 19 | public ModelServiceBadRequestException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | 23 | public ModelServiceBadRequestException(Throwable cause) { 24 | super(cause); 25 | } 26 | 27 | public ModelServiceBadRequestException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 28 | super(message, cause, enableSuppression, writableStackTrace); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /dxa-model-service-client/src/main/resources/dxa.modules.ms.properties: -------------------------------------------------------------------------------- 1 | dxa.model.service.key=dxa-model-service 2 | dxa.model.service.url.entity.model=/EntityModel/{uriType}/{localizationId}/{componentId}-{templateId} 3 | dxa.model.service.url.page.model=/PageModel/{uriType}/{localizationId}/{pageUrl}?includes={pageInclusion} 4 | dxa.model.service.url.api.navigation=/api/navigation/{localizationId} 5 | dxa.model.service.url.api.navigation.subtree=/api/navigation/{localizationId}/subtree/{siteMapId}?includeAncestors={includeAncestors}&descendantLevels={descendantLevels} -------------------------------------------------------------------------------- /dxa-webapp/archetype.properties: -------------------------------------------------------------------------------- 1 | groupId=org.example 2 | package=org.example 3 | archetype.artifactId=dxa-webapp-archetype 4 | archetype.groupId=com.sdl.dxa 5 | archetype.filteredExtensions=java -------------------------------------------------------------------------------- /dxa-webapp/src/main/java/org/example/SpringInitializer.java: -------------------------------------------------------------------------------- 1 | package org.example; 2 | 3 | import com.sdl.dxa.DxaSpringInitialization; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.context.annotation.Import; 7 | 8 | /** 9 | * Initializes Spring context for DXA web application. 10 | */ 11 | @Import(DxaSpringInitialization.class) 12 | @Configuration 13 | @ComponentScan("org.example") 14 | public class SpringInitializer { 15 | 16 | } 17 | -------------------------------------------------------------------------------- /dxa-webapp/src/main/java/org/example/service/AdminService.java: -------------------------------------------------------------------------------- 1 | package org.example.service; 2 | 3 | import com.sdl.webapp.common.api.WebRequestContext; 4 | import com.sdl.webapp.common.api.localization.Localization; 5 | import com.sdl.webapp.common.api.localization.LocalizationResolver; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | /** 11 | * Admin service that provides admin actions. 12 | */ 13 | @Slf4j 14 | @Service 15 | public class AdminService { 16 | 17 | @Autowired 18 | private WebRequestContext webRequestContext; 19 | 20 | @Autowired 21 | private LocalizationResolver localizationResolver; 22 | 23 | /** 24 | * Refreshes the localization and returns the index path. 25 | * 26 | * @return the index path of the localization 27 | */ 28 | public String refreshLocalization() { 29 | final Localization localization = webRequestContext.getLocalization(); 30 | 31 | log.trace("handleRefresh: localization {}", localization); 32 | 33 | localizationResolver.refreshLocalization(localization); 34 | return localization.getPath(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /dxa-webapp/src/main/resources/cd_client_conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /dxa-webapp/src/main/resources/device-families.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /dxa-webapp/src/main/webapp/WEB-INF/Views/Shared/Entity/ExceptionEntity.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | <%@ page isErrorPage="true" %> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 |
13 | -------------------------------------------------------------------------------- /dxa-webapp/src/main/webapp/WEB-INF/Views/Shared/Error/SectionError.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> 2 | <%@ page isErrorPage="true" %> 3 | <%@ taglib prefix="dxa" uri="http://www.sdl.com/tridion-dxa" %> 4 | 5 |
6 | 7 |
-------------------------------------------------------------------------------- /get-started.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo This runs default build for DXA framework for Web 8. 4 | call mvn clean install 5 | -------------------------------------------------------------------------------- /gpgwrapper.sh: -------------------------------------------------------------------------------- 1 | gpg --pinentry-mode loopback "$@" --------------------------------------------------------------------------------