Files
qbit-cms/src/main/java/com/kingsrook/qbits/cms/CmsFeature.java
T
James MaesandClaude Sonnet 5.5 3fb67aac99
QRun-IO/ci-policy: ci / fork-guard (pull_request) Skipped
Shared Java Maven CI / secrets (push) Successful in 33s
QRun-IO/ci-policy: native / fork-deny (pull_request) Skipped
QRun-IO/ci-policy: native / dotnet-0 (pull_request) Skipped
QRun-IO/ci-policy: ci / Scoped workflow [workflow f1d46718955078331817c6206b822a94bc7d769f] (pull_request) Successful in 12s
QRun-IO/ci-policy: ci / head-profile (pull_request) Skipped
QRun-IO/ci-policy: ci / repository-policy (pull_request) Skipped
QRun-IO/ci-policy: native / native-result (pull_request) Successful in 9s
QRun-IO/ci-policy: ci / application-template-0 (pull_request) Skipped
QRun-IO/ci-policy: ci / gradle-1 (pull_request) Skipped
QRun-IO/ci-policy: ci / java-core-2-head (pull_request) Skipped
QRun-IO/ci-policy: ci / java-docker-3 (pull_request) Skipped
QRun-IO/ci-policy: ci / java-docker-3-head (pull_request) Skipped
QRun-IO/ci-policy: ci / java-docker-4 (pull_request) Skipped
QRun-IO/ci-policy: ci / java-frontend-browser-5 (pull_request) Skipped
QRun-IO/ci-policy: ci / java-maven-6-head (pull_request) Skipped
QRun-IO/ci-policy: ci / java-maven-7 (pull_request) Skipped
QRun-IO/ci-policy: ci / java-maven-7-head (pull_request) Skipped
QRun-IO/ci-policy: ci / node-8 (pull_request) Skipped
QRun-IO/ci-policy: ci / node-9 (pull_request) Skipped
QRun-IO/ci-policy: ci / node-10 (pull_request) Skipped
QRun-IO/ci-policy: ci / node-playwright-11 (pull_request) Skipped
QRun-IO/ci-policy: ci / repository-policy-12 (pull_request) Skipped
QRun-IO/ci-policy: ci / source-config-13 (pull_request) Skipped
QRun-IO/ci-policy: ci / source-config-14 (pull_request) Skipped
QRun-IO/ci-policy: ci / android-0 (pull_request) Skipped
QRun-IO/ci-policy: ci / original-business (pull_request) Skipped
QRun-IO/ci-policy: ci / original-mcp (pull_request) Skipped
QRun-IO/ci-policy: ci / original-voyage (pull_request) Skipped
QRun-IO/ci-policy: ci / original-cli (pull_request) Skipped
QRun-IO/ci-policy: ci / not-enrolled (pull_request) Skipped
QRun-IO/ci-policy: ci / shared-pipeline (pull_request) Skipped
QRun-IO/ci-policy: Shared Java Maven CI / secrets (pull_request) Successful in 30s
Shared Java Maven CI / verify (push) Successful in 1m31s
Shared Java Maven CI / gate (push) Successful in 20s
qrun-release / release (push) Successful in 56m59s
qrun-release / postpublish (push) Skipped
QRun-IO/ci-policy: Shared Java Maven CI / verify (pull_request) Successful in 1m33s
QRun-IO/ci-policy: Shared Java Maven CI / gate (pull_request) Successful in 26s
QRun-IO/ci-policy: ci / java-maven-6 (pull_request) Successful in 58m32s
QRun-IO/ci-policy: ci / ci-result (pull_request) Successful in 10s
Release candidate / release-rc (pull_request) Skipped
feat(cms): implement the CMS CORE feature on QQQ 4.1
Implement the CORE feature area as standard QQQ tables: site, domain,
redirect, redirect type, page, page type, page section, page section type,
snippet, menu and menu item. Add the CMS app with Sites, Pages and
Navigation homes, CmsFeature flags with dependency validation, per-table
permissions with CmsRole bundles and openReads, a startup schema check
(FAIL_FAST, DEGRADED, SKIP), a prefix-parameterized Liquibase changelog and
the Postgres DDL.

Add unit tests, Postgres-backed Testcontainers install and runtime-identity
tests, and a local demo server used to produce the docs screenshots.

Build against the published QQQ 4.1 BOM (4.1.0-RC.21), add the test-scope
Postgres, Javalin, frontend-next and Testcontainers dependencies, and
enforce checkstyle at validate.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 05:28:20 -06:00

155 lines
5.0 KiB
Java

/*
* Copyright 2026 Kingsrook, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.kingsrook.qbits.cms;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
/*******************************************************************************
** The feature areas of the CMS (spec section 2.3). A host turns features on
** and off in CmsQBitConfig.features; a feature that is off produces no meta
** data, and its changesets are skipped by the cms.features changelog
** property.
**
** CORE is always on. A feature that is not built yet (available = false) is
** rejected by validation, so a host never believes it installed something
** that is not there.
*******************************************************************************/
public enum CmsFeature
{
/** Sites, domains, redirects, pages, page sections, snippets, menus. */
CORE(true),
/** The media library, media types and the storage SPI. */
MEDIA(false),
/** Blogs, posts, tags, authors, post media and versions. */
BLOG(false, MEDIA),
/** Projects, project categories and project updates. */
PROJECTS(false, MEDIA),
/** Photo albums, folders, photos and photo tags. */
PHOTOS(false, MEDIA),
/** Publishing processes, publications and receipts. */
PUBLISHING(false),
/** The public content stream across content kinds. */
STREAM(false, BLOG),
/** CMS Data Health rules, for hosts with a Data Health framework (D10). */
DATA_HEALTH_RULES(false);
private final boolean available;
private final List<CmsFeature> requires;
/*******************************************************************************
** Constructor.
**
** @param available whether this version of the qbit implements the feature
** @param requires features this one needs
*******************************************************************************/
CmsFeature(boolean available, CmsFeature... requires)
{
this.available = available;
this.requires = List.of(requires);
}
/*******************************************************************************
** Whether this version of the qbit implements the feature.
*******************************************************************************/
public boolean isAvailable()
{
return (available);
}
/*******************************************************************************
** The features this one needs (beyond CORE, which is always on).
*******************************************************************************/
public List<CmsFeature> getRequires()
{
return (requires);
}
/*******************************************************************************
** Every feature this version implements: the default feature set.
*******************************************************************************/
public static Set<CmsFeature> allAvailable()
{
EnumSet<CmsFeature> rs = EnumSet.noneOf(CmsFeature.class);
for(CmsFeature feature : values())
{
if(feature.available)
{
rs.add(feature);
}
}
return (rs);
}
/*******************************************************************************
** Validation messages for a feature set: unknown-in-this-version features,
** missing dependencies, and PUBLISHING without BLOG or PROJECTS.
**
** @param features the requested features
** @return the problems (empty when valid)
*******************************************************************************/
public static List<String> validate(Set<CmsFeature> features)
{
List<String> errors = new ArrayList<>();
if(features == null || !features.contains(CORE))
{
errors.add("features must include CORE");
return (errors);
}
for(CmsFeature feature : features)
{
if(!feature.available)
{
errors.add("feature " + feature + " is not available in this version of qbit-cms");
}
for(CmsFeature required : feature.requires)
{
if(!features.contains(required))
{
errors.add("feature " + feature + " requires " + required);
}
}
}
if(features.contains(PUBLISHING) && !features.contains(BLOG) && !features.contains(PROJECTS))
{
errors.add("feature PUBLISHING requires BLOG or PROJECTS");
}
return (errors);
}
}