andi-huber commented on code in PR #3054: URL: https://github.com/apache/causeway/pull/3054#discussion_r2248774662
########## core/config/src/main/java/org/apache/causeway/core/config/environment/CausewaySystemEnvironment.java: ########## @@ -123,6 +119,7 @@ public _IocContainer ioc() { * Must be set prior to configuration bootstrapping. * @param isUnitTesting */ + @Deprecated //TODO use autodetect instead (class-path analysis) Review Comment: I believe we already do something similar with detection integration tests. ########## core/metamodel/src/main/java/org/apache/causeway/core/metamodel/context/MmcRecord.java: ########## Review Comment: remove (dead end) ########## core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java: ########## @@ -957,194 +981,182 @@ public static class DomainEvent { * </li> * </ul> */ - private boolean postForDefault = true; + @DefaultValue("true") + boolean postForDefault) { } - } - private final ActionLayout actionLayout = new ActionLayout(); - @Data - public static class ActionLayout { + public record ActionLayout( + @DefaultValue + CssClass cssClass, + @DefaultValue + CssClassFa cssClassFa) { - private final CssClass cssClass = new CssClass(); - @Data - public static class CssClass { + public record CssClass( /** * Provides a mapping of patterns to CSS classes, where the pattern is used to match against the * name of the action method in order to determine a CSS class to use, for example on the action's * button if rendered by the Wicket viewer. * - * <p> - * Providing a default set of patterns encourages a common set of verbs to be used. - * </p> + * <p>Providing a default set of patterns encourages a common set of verbs to be used. * - * <p> - * The CSS class for individual actions can be overridden using - * {@link org.apache.causeway.applib.annotation.ActionLayout#cssClass()}. - * </p> + * <p>The CSS class for individual actions can be overridden using + * {@link org.apache.causeway.applib.annotation.ActionLayout#cssClass()}. */ - private String[] patterns = { - "add.*:btn-info", - "remove.*:btn-warning", - - "start.*:btn-info", - "play.*:btn-info", - "stop.*:btn-warning", + @DefaultValue({ + "add.*:btn-info", + "remove.*:btn-warning", - "reset.*:btn-warning", + "start.*:btn-info", + "play.*:btn-info", + "stop.*:btn-warning", - "new.*:btn-info", - "create.*:btn-info", - "delete.*:btn-danger", + "reset.*:btn-warning", - "verify.*:btn-success", - "decline.*:btn-danger", + "new.*:btn-info", + "create.*:btn-info", + "delete.*:btn-danger", - "save.*:btn-success", + "verify.*:btn-success", + "decline.*:btn-danger", - "approve.*:btn-success", - "reject.*:btn-danger", + "save.*:btn-success", - }; + "approve.*:btn-success", + "reject.*:btn-danger", - @Getter(lazy = true) - private final Map<Pattern, String> patternsAsMap = asMap(getPatterns()); + }) + String[] patterns) { + //(lazy = true) //TODO + public Map<Pattern, String> patternsAsMap() { return asMap(patterns()); } } - private final CssClassFa cssClassFa = new CssClassFa(); - @Data - public static class CssClassFa { + public record CssClassFa( /** * Provides a mapping of patterns to font-awesome CSS classes, where the pattern is used to match * against the name of the action method in order to determine a CSS class to use, for example on * the action's menu icon if rendered by the Wicket viewer. * - * <p> - * Providing a default set of patterns encourages a common set of verbs to be used. - * </p> + * <p>Providing a default set of patterns encourages a common set of verbs to be used. * - * <p> - * The font awesome class for individual actions can be overridden using - * {@link org.apache.causeway.applib.annotation.ActionLayout#cssClassFa()}. - * </p> + * <p>The font awesome class for individual actions can be overridden using + * {@link org.apache.causeway.applib.annotation.ActionLayout#cssClassFa()}. */ - private String[] patterns = { + @DefaultValue({ - "all.*:fa-solid fa-list", - "list.*:fa-solid fa-list", + "all.*:fa-solid fa-list", + "list.*:fa-solid fa-list", - "find.*:fa-search", - "lookup.*:fa-search", - "search.*:fa-search", + "find.*:fa-search", + "lookup.*:fa-search", + "search.*:fa-search", - "send.*:fa-regular fa-paper-plane", + "send.*:fa-regular fa-paper-plane", - "open.*:fa-solid fa-arrow-up-right-from-square", - "close.*:fa-solid fa-regular fa-rectangle-xmark", + "open.*:fa-solid fa-arrow-up-right-from-square", + "close.*:fa-solid fa-regular fa-rectangle-xmark", - "recent.*:fa-solid fa-clock-rotate-left", + "recent.*:fa-solid fa-clock-rotate-left", - "lock.*:fa-solid fa-lock", - "unlock.*:fa-solid fa-unlock", + "lock.*:fa-solid fa-lock", + "unlock.*:fa-solid fa-unlock", - "permit.*:fa-solid fa-unlock", - "review.*:fa-solid fa-eye", + "permit.*:fa-solid fa-unlock", + "review.*:fa-solid fa-eye", - "add.*:fa-regular fa-square-plus", - "plus.*:fa-regular fa-square-plus", - "remove.*:fa-regular fa-square-minus", - "minus.*:fa-regular fa-square-minus", + "add.*:fa-regular fa-square-plus", + "plus.*:fa-regular fa-square-plus", + "remove.*:fa-regular fa-square-minus", + "minus.*:fa-regular fa-square-minus", - "sign.*:fa-solid fa-signature", + "sign.*:fa-solid fa-signature", - "clear.*:fa-solid fa-broom", + "clear.*:fa-solid fa-broom", - "create.*:fa-regular fa-square-plus", - "new.*:fa-regular fa-square-plus", - "delete.*:fa-solid fa-trash", + "create.*:fa-regular fa-square-plus", + "new.*:fa-regular fa-square-plus", + "delete.*:fa-solid fa-trash", - "change.*:fa-regular fa-pen-to-square", - "edit.*:fa-regular fa-pen-to-square", - "maintain.*:fa-regular fa-pen-to-square", - "update.*:fa-regular fa-pen-to-square", + "change.*:fa-regular fa-pen-to-square", + "edit.*:fa-regular fa-pen-to-square", + "maintain.*:fa-regular fa-pen-to-square", + "update.*:fa-regular fa-pen-to-square", - "cut.*:fa-solid fa-scissors", - "move.*:fa-solid fa-angles-right", - "copy.*:fa-regular fa-copy", - "duplicate.*:fa-solid fa-clone", - "clone.*:fa-solid fa-clone", - "categorise.*:fa-regular fa-folder-open", + "cut.*:fa-solid fa-scissors", + "move.*:fa-solid fa-angles-right", + "copy.*:fa-regular fa-copy", + "duplicate.*:fa-solid fa-clone", + "clone.*:fa-solid fa-clone", + "categorise.*:fa-regular fa-folder-open", - "download.*:fa-solid fa-download", - "upload.*:fa-solid fa-upload", + "download.*:fa-solid fa-download", + "upload.*:fa-solid fa-upload", - "execute.*:fa-solid fa-bolt", - "run.*:fa-solid fa-bolt", - "trigger.*:fa-solid fa-bolt", + "execute.*:fa-solid fa-bolt", + "run.*:fa-solid fa-bolt", + "trigger.*:fa-solid fa-bolt", - "link.*:fa-solid fa-link", - "unlink.*:fa-solid fa-link-slash", + "link.*:fa-solid fa-link", + "unlink.*:fa-solid fa-link-slash", - "start.*:fa-solid fa-play", - "play.*:fa-solid fa-play", - "resume.*:fa-solid fa-play", - "pause.*:fa-solid fa-pause", - "suspend.*:fa-solid fa-pause", - "stop.*:fa-solid fa-stop", - "terminate.*:fa-solid fa-stop", + "start.*:fa-solid fa-play", + "play.*:fa-solid fa-play", + "resume.*:fa-solid fa-play", + "pause.*:fa-solid fa-pause", + "suspend.*:fa-solid fa-pause", + "stop.*:fa-solid fa-stop", + "terminate.*:fa-solid fa-stop", - "previous.*:fa-backward-step", - "next.*:fa-forward-step", + "previous.*:fa-backward-step", + "next.*:fa-forward-step", - "approve.*:fa-regular fa-thumbs-up", - "reject.*:fa-regular fa-thumbs-down", + "approve.*:fa-regular fa-thumbs-up", + "reject.*:fa-regular fa-thumbs-down", - "verify.*:fa-solid fa-check", - "decline.*:fa-solid fa-xmark", - "cancel.*:fa-solid fa-xmark", + "verify.*:fa-solid fa-check", + "decline.*:fa-solid fa-xmark", + "cancel.*:fa-solid fa-xmark", - "discard.*:fa-regular fa-trash-can", + "discard.*:fa-regular fa-trash-can", - "assign.*:fa-regular fa-hand-point-right", + "assign.*:fa-regular fa-hand-point-right", - "calculate.*:fa-calculator", + "calculate.*:fa-calculator", - "import.*:fa-solid fa-file-import", - "export.*:fa-solid fa-file-export", + "import.*:fa-solid fa-file-import", + "export.*:fa-solid fa-file-export", - "first.*:fa-regular fa-star", + "first.*:fa-regular fa-star", - "install.*:fa-solid fa-wrench", + "install.*:fa-solid fa-wrench", - "setup.*:fa-solid fa-gear", - "configure.*:fa-solid fa-gear", + "setup.*:fa-solid fa-gear", + "configure.*:fa-solid fa-gear", - "refresh.*:fa-sync", - "renew.*:fa-rotate-right", - "reset.*:fa-rotate-left", + "refresh.*:fa-sync", + "renew.*:fa-rotate-right", + "reset.*:fa-rotate-left", - "save.*:fa-regular fa-floppy-disk", + "save.*:fa-regular fa-floppy-disk", - "switch.*:fa-exchange", - "random.*:fa-shuffle", + "switch.*:fa-exchange", + "random.*:fa-shuffle", - "view.*:fa-regular fa-eye", + "view.*:fa-regular fa-eye", - "wizard.*:fa-solid fa-wand-magic-sparkles" + "wizard.*:fa-solid fa-wand-magic-sparkles" - }; + }) + String[] patterns) { - @Getter(lazy = true) - private final Map<Pattern, String> patternsAsMap = asMap(getPatterns()); + //(lazy = true) //TODO Review Comment: Perhaps use a `_StableValue` here, but would need an additional record component, that is not to be exposed with the default constructor as seen by Spring (`[@ConstructorBinding](https://docs.spring.io/spring-boot/4.0.0-M1/api/java/org/springframework/boot/context/properties/bind/ConstructorBinding.html)). ########## core/metamodel/src/main/java/org/apache/causeway/core/metamodel/context/MetaModelContextFactory.java: ########## @@ -41,15 +39,17 @@ public class MetaModelContextFactory { @Bean(destroyMethod = "onDestroy") public MetaModelContext metaModelContext(final CausewaySystemEnvironment systemEnvironment) { - var ioc = systemEnvironment.getIocContainer(); + var ioc = systemEnvironment.springContextHolder(); var mmc = new MetaModelContext_usingSpring(ioc); + //var mmcRecord = new MmcRecord(ioc); + //TODO potentially problematic when testing concurrently Review Comment: Is there a scenario, where a previously started test still needs its former MMC, while its replaced with a new one here? ########## core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java: ########## @@ -957,194 +981,182 @@ public static class DomainEvent { * </li> * </ul> */ - private boolean postForDefault = true; + @DefaultValue("true") + boolean postForDefault) { } - } - private final ActionLayout actionLayout = new ActionLayout(); - @Data - public static class ActionLayout { + public record ActionLayout( + @DefaultValue + CssClass cssClass, + @DefaultValue + CssClassFa cssClassFa) { - private final CssClass cssClass = new CssClass(); - @Data - public static class CssClass { + public record CssClass( /** * Provides a mapping of patterns to CSS classes, where the pattern is used to match against the * name of the action method in order to determine a CSS class to use, for example on the action's * button if rendered by the Wicket viewer. * - * <p> - * Providing a default set of patterns encourages a common set of verbs to be used. - * </p> + * <p>Providing a default set of patterns encourages a common set of verbs to be used. * - * <p> - * The CSS class for individual actions can be overridden using - * {@link org.apache.causeway.applib.annotation.ActionLayout#cssClass()}. - * </p> + * <p>The CSS class for individual actions can be overridden using + * {@link org.apache.causeway.applib.annotation.ActionLayout#cssClass()}. */ - private String[] patterns = { - "add.*:btn-info", - "remove.*:btn-warning", - - "start.*:btn-info", - "play.*:btn-info", - "stop.*:btn-warning", + @DefaultValue({ + "add.*:btn-info", + "remove.*:btn-warning", - "reset.*:btn-warning", + "start.*:btn-info", + "play.*:btn-info", + "stop.*:btn-warning", - "new.*:btn-info", - "create.*:btn-info", - "delete.*:btn-danger", + "reset.*:btn-warning", - "verify.*:btn-success", - "decline.*:btn-danger", + "new.*:btn-info", + "create.*:btn-info", + "delete.*:btn-danger", - "save.*:btn-success", + "verify.*:btn-success", + "decline.*:btn-danger", - "approve.*:btn-success", - "reject.*:btn-danger", + "save.*:btn-success", - }; + "approve.*:btn-success", + "reject.*:btn-danger", - @Getter(lazy = true) - private final Map<Pattern, String> patternsAsMap = asMap(getPatterns()); + }) + String[] patterns) { + //(lazy = true) //TODO Review Comment: Perhaps use a `_StableValue` here, but would need an additional record component, that is not to be exposed with the default constructor as seen by Spring (`[@ConstructorBinding](https://docs.spring.io/spring-boot/4.0.0-M1/api/java/org/springframework/boot/context/properties/bind/ConstructorBinding.html)). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@causeway.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org