├── .gitattributes ├── .env ├── .mvn ├── wrapper │ ├── maven-wrapper.jar │ ├── maven-wrapper.properties │ └── MavenWrapperDownloader.java └── extensions.xml ├── src ├── main │ ├── frontend │ │ ├── themes │ │ │ └── komunumo │ │ │ │ ├── theme.json │ │ │ │ ├── styles.css │ │ │ │ └── views │ │ │ │ └── website-footer.css │ │ ├── views │ │ │ └── README │ │ └── index.html │ ├── resources │ │ ├── META-INF │ │ │ └── resources │ │ │ │ └── icons │ │ │ │ └── icon.png │ │ ├── banner.txt │ │ ├── db │ │ │ └── migration │ │ │ │ └── V1_0_0__initialization.sql │ │ └── application.properties │ └── java │ │ └── org │ │ └── komunumo │ │ ├── configuration │ │ ├── MetanetConfig.java │ │ ├── WebsiteConfig.java │ │ └── Configuration.java │ │ ├── data │ │ ├── service │ │ │ ├── getter │ │ │ │ └── DSLContextGetter.java │ │ │ ├── DatabaseService.java │ │ │ └── EventService.java │ │ ├── entity │ │ │ └── Event.java │ │ └── converter │ │ │ └── LocalTimeDurationConverter.java │ │ ├── ui │ │ └── website │ │ │ ├── WebsiteHeader.java │ │ │ ├── home │ │ │ ├── EventsPreviewContainer.java │ │ │ ├── HomeView.java │ │ │ └── EventPreview.java │ │ │ ├── WebsiteStats.java │ │ │ ├── WebsiteLayout.java │ │ │ ├── WebsiteLogo.java │ │ │ └── WebsiteFooter.java │ │ ├── util │ │ └── FormatterUtil.java │ │ ├── Application.java │ │ └── scheduler │ │ └── ImportScheduler.java └── test │ ├── resources │ ├── logback-test.xml │ └── application.properties │ └── java │ └── org │ └── komunumo │ ├── configuration │ ├── ConfigurationTest.java │ └── WebsiteConfigTest.java │ ├── ApplicationTest.java │ ├── ui │ ├── KaribuTestBase.java │ └── website │ │ ├── home │ │ └── HomeViewIT.java │ │ ├── WebsiteLayoutTest.java │ │ └── WebsiteLogoTest.java │ ├── util │ └── FormatterUtilTest.java │ └── data │ ├── converter │ └── LocalTimeDurationConverterTest.java │ ├── entity │ └── EventTest.java │ └── service │ └── EventServiceIT.java ├── .mariadb └── data │ └── README ├── Dockerfile ├── vite.config.ts ├── .gitpod.yml ├── CHANGELOG.md ├── docker-compose.yaml ├── types.d.ts ├── .gitpod.Dockerfile ├── renovate.json ├── README.md ├── DCO.md ├── tsconfig.json ├── .gitignore ├── .all-contributorsrc ├── package.json ├── mvnw.cmd ├── checkstyle.xml ├── mvnw ├── pom.xml └── .editorconfig /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bat text eol=crlf 2 | mvnw eol=lf 3 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | MARIADB_DATABASE=komunumo 2 | MARIADB_USER=komunumo 3 | MARIADB_PASSWORD=komunumo 4 | MARIADB_DATA=./.mariadb/data 5 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/friedhof/komunumo-testing/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /src/main/frontend/themes/komunumo/theme.json: -------------------------------------------------------------------------------- 1 | { 2 | "lumoImports" : [ "typography", "color", "spacing", "badge", "utility" ] 3 | } 4 | -------------------------------------------------------------------------------- /src/main/frontend/views/README: -------------------------------------------------------------------------------- 1 | Place your UI views in this directory. 2 | 3 | You can create them visually with Vaadin Designer or by hand in your IDE. -------------------------------------------------------------------------------- /src/main/resources/META-INF/resources/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/friedhof/komunumo-testing/HEAD/src/main/resources/META-INF/resources/icons/icon.png -------------------------------------------------------------------------------- /.mariadb/data/README: -------------------------------------------------------------------------------- 1 | This directory is used by the MariaDB database which can be run locally using Docker Compose. 2 | Don't delete it and don't commit it's contents. 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-temurin:21 2 | COPY target/komunumo-*.jar /usr/app/app.jar 3 | RUN useradd -m komunumo 4 | USER komunumo 5 | EXPOSE 8080 6 | CMD ["java", "-jar", "/usr/app/app.jar"] 7 | HEALTHCHECK CMD curl --fail --silent localhost:8080/actuator/health | grep UP || exit 1 8 | -------------------------------------------------------------------------------- /vite.config.ts: -------------------------------------------------------------------------------- 1 | import { UserConfigFn } from 'vite'; 2 | import { overrideVaadinConfig } from './vite.generated'; 3 | 4 | const customConfig: UserConfigFn = (env) => ({ 5 | // Here you can add custom Vite parameters 6 | // https://vitejs.dev/config/ 7 | }); 8 | 9 | export default overrideVaadinConfig(customConfig); 10 | -------------------------------------------------------------------------------- /src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | tasks: 2 | - init: mvn package -Pproduction 3 | 4 | command: mvn 5 | ports: 6 | - port: 8080 7 | onOpen: open-preview 8 | image: 9 | file: .gitpod.Dockerfile 10 | vscode: 11 | extensions: 12 | - runem.lit-plugin@1.2.1:llHUlx8TJ6tFKGa1t6dpLQ== 13 | - vscjava.vscode-java-test@0.27.0:gNh98vNbqtZC6ydHasFxAQ== 14 | - pivotal.vscode-spring-boot@1.23.0:1iLvjTfznJrV611qRUeOHg== 15 | -------------------------------------------------------------------------------- /src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | _ __ 2 | | |/ / ___ _ __ ___ _ _ _ __ _ _ _ __ ___ ___ 3 | | ' / / _ \ | '_ ` _ \ | | | || '_ \ | | | || '_ ` _ \ / _ \ 4 | | . \ | (_) || | | | | || |_| || | | || |_| || | | | | || (_) | 5 | |_|\_\ \___/ |_| |_| |_| \__,_||_| |_| \__,_||_| |_| |_| \___/ 6 | 7 | -------------------------------------------------------------------------------- /.mvn/extensions.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | com.soebes.maven.extensions 5 | maven-buildtime-profiler 6 | 0.2.0 7 | 8 | 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for *Komunumo* 2 | 3 | Please report any bugs and feature requests via our 4 | [GitHub Issue Tracker](https://github.com/McPringle/komunumo/issues). 5 | For questions and support requests, please use 6 | [GitHub Discussions](https://github.com/McPringle/komunumo/discussions). 7 | 8 | --- 9 | 10 | ## Version 1 11 | 12 | **Release date: work in progress 🚧** 13 | 14 | ### New Features 15 | 16 | ### Fixed Bugs 17 | 18 | ### Maintenance Work 19 | -------------------------------------------------------------------------------- /src/main/resources/db/migration/V1_0_0__initialization.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `event` ( 2 | `id` BIGINT NOT NULL AUTO_INCREMENT, 3 | 4 | `title` VARCHAR(255) NOT NULL, 5 | `subtitle` VARCHAR(255) NOT NULL DEFAULT '', 6 | `description` MEDIUMTEXT NOT NULL DEFAULT '', 7 | 8 | `date` DATETIME NULL, 9 | `duration` TIME NULL, 10 | 11 | `location` VARCHAR(255) NOT NULL DEFAULT '', 12 | 13 | PRIMARY KEY (`id`) 14 | ); 15 | 16 | CREATE INDEX `event_date` ON `event` (`date`); 17 | -------------------------------------------------------------------------------- /src/main/frontend/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Komunumo 7 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /docker-compose.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | 3 | db: 4 | image: mariadb:lts 5 | restart: always 6 | ports: 7 | - "3306:3306" 8 | environment: 9 | MARIADB_RANDOM_ROOT_PASSWORD: true 10 | MARIADB_DATABASE: ${MARIADB_DATABASE} 11 | MARIADB_USER: ${MARIADB_USER} 12 | MARIADB_PASSWORD: ${MARIADB_PASSWORD} 13 | volumes: 14 | - type: bind 15 | source: ${MARIADB_DATA} 16 | target: /var/lib/mysql 17 | 18 | adminer: 19 | image: adminer 20 | restart: always 21 | ports: 22 | - "4000:8080" 23 | -------------------------------------------------------------------------------- /types.d.ts: -------------------------------------------------------------------------------- 1 | // This TypeScript modules definition file is generated by vaadin-maven-plugin. 2 | // You can not directly import your different static files into TypeScript, 3 | // This is needed for TypeScript compiler to declare and export as a TypeScript module. 4 | // It is recommended to commit this file to the VCS. 5 | // You might want to change the configurations to fit your preferences 6 | declare module '*.css?inline' { 7 | import type { CSSResultGroup } from 'lit'; 8 | const content: CSSResultGroup; 9 | export default content; 10 | } 11 | 12 | // Allow any CSS Custom Properties 13 | declare module 'csstype' { 14 | interface Properties { 15 | [index: `--${string}`]: any; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full 2 | 3 | RUN sudo wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 4 | RUN sudo apt-get -q update 5 | RUN sudo apt -y install ./google-chrome-stable_current_amd64.deb 6 | RUN sudo apt-get -y install libnss3\ 7 | libnspr4\ 8 | libatk1.0-0\ 9 | libatk-bridge2.0-0\ 10 | libcups2\ 11 | libdrm2\ 12 | libxkbcommon0\ 13 | libxcomposite1\ 14 | libxdamage1\ 15 | libxfixes3\ 16 | libxrandr2\ 17 | libgbm1\ 18 | libgtk-3-0\ 19 | libatspi2.0-0\ 20 | libx11-xcb-dev 21 | RUN sudo rm -rf /var/lib/apt/lists/* 22 | 23 | RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh \ 24 | && sdk update \ 25 | && sdk install java 17.0.8-amzn \ 26 | && sdk default java 17.0.8-amzn" 27 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": [ 4 | "config:base", 5 | ":disableDependencyDashboard" 6 | ], 7 | "ignorePaths": [ 8 | "Dockerfile", 9 | "package.json", 10 | "pnpm-lock.yaml" 11 | ], 12 | "assignees": [ 13 | "McPringle" 14 | ], 15 | "reviewers": [ 16 | "McPringle" 17 | ], 18 | "packageRules": [ 19 | { 20 | "matchManagers": ["maven", "maven-wrapper", "gradle", "gradle-wrapper"], 21 | "matchUpdateTypes": ["minor", "patch", "pin", "digest"], 22 | "automerge": true, 23 | "automergeType": "branch", 24 | "commitMessagePrefix" : "⬆️ " 25 | }, 26 | { 27 | "matchDepTypes": ["devDependencies"], 28 | "automerge": true, 29 | "automergeType": "branch", 30 | "commitMessagePrefix" : "⬆️ " 31 | } 32 | ], 33 | "platformAutomerge": true 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:tc:mariadb:lts:///test?allowMultiQueries=true 2 | spring.datasource.username=test 3 | spring.datasource.password=test 4 | spring.flyway.placeholderReplacement=false 5 | 6 | # Application version 7 | komunumo.version=@project.version@ 8 | 9 | # Application specific configuration 10 | komunumo.metanet.dbUrl= 11 | komunumo.metanet.dbUser= 12 | komunumo.metanet.dbPassword= 13 | 14 | komunumo.website.aboutText=Test about text 15 | komunumo.website.association=Test Association Name 16 | komunumo.website.contactAddress=Test address 17 | komunumo.website.contactEmail=noreply@localhost 18 | komunumo.website.copyright=Test copyright text 19 | komunumo.website.logoTemplate=http://localhost:8080/icons/icon-512x512.png 20 | komunumo.website.logoMin=${WEBSITE_LOGO_MIN:0} 21 | komunumo.website.logoMax=${WEBSITE_LOGO_MAX:0} 22 | komunumo.website.url=${WEBSITE_URL:http://localhost:8080} 23 | -------------------------------------------------------------------------------- /src/main/frontend/themes/komunumo/styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | @import "views/website-footer.css"; 20 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/configuration/MetanetConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.configuration; 19 | 20 | public record MetanetConfig(String dbUrl, String dbUser, String dbPassword) { } 21 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/data/service/getter/DSLContextGetter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.data.service.getter; 19 | 20 | import org.jooq.DSLContext; 21 | 22 | public interface DSLContextGetter { 23 | 24 | DSLContext dsl(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.3.2/maven-wrapper-3.3.2.jar 19 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/configuration/WebsiteConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.configuration; 19 | 20 | public record WebsiteConfig(String aboutText, String association, String contactAddress, String contactEmail, 21 | String copyright, String logoTemplate, int logoMin, int logoMax, String url) { } 22 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=${PORT:8080} 2 | logging.level.org.atmosphere = warn 3 | 4 | spring.datasource.url=${DB_URL} 5 | spring.datasource.username=${DB_USER} 6 | spring.datasource.password=${DB_PASS} 7 | spring.flyway.placeholderReplacement=false 8 | 9 | # Launch the default browser when starting the application in development mode 10 | vaadin.launch-browser=false 11 | 12 | # Application version 13 | komunumo.version=@project.version@ 14 | 15 | # Application specific configuration 16 | komunumo.metanet.dbUrl=${METANET_DATABASE_URL:} 17 | komunumo.metanet.dbUser=${METANET_DATABASE_USER:} 18 | komunumo.metanet.dbPassword=${METANET_DATABASE_PASSWORD:} 19 | 20 | komunumo.website.aboutText=${WEBSITE_ABOUT_TEXT:CHANGEME} 21 | komunumo.website.association=${WEBSITE_ASSOCIATION:CHANGEME} 22 | komunumo.website.contactAddress=${WEBSITE_CONTACT_ADDRESS:CHANGEME} 23 | komunumo.website.contactEmail=${WEBSITE_CONTACT_EMAIL:CHANGEME} 24 | komunumo.website.copyright=${WEBSITE_COPYRIGHT:CHANGEME} 25 | komunumo.website.logoTemplate=${WEBSITE_LOGO_TEMPLATE:CHANGEME} 26 | komunumo.website.logoMin=${WEBSITE_LOGO_MIN:0} 27 | komunumo.website.logoMax=${WEBSITE_LOGO_MAX:0} 28 | komunumo.website.url=${WEBSITE_URL:http://localhost:8080} 29 | -------------------------------------------------------------------------------- /src/main/frontend/themes/komunumo/views/website-footer.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #website-footer { 20 | background-color: black; 21 | color: white; 22 | font-size: 0.8rem; 23 | padding: 20px; 24 | width: 100%; 25 | } 26 | 27 | #website-footer h2 { 28 | color: white; 29 | text-transform: uppercase; 30 | } 31 | 32 | #website-footer .contact-email a { 33 | color: #0099CB; 34 | font-size: 120%; 35 | font-weight: bold; 36 | text-transform: uppercase; 37 | } 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Komunumo 2 | 3 | > [!IMPORTANT] 4 | > **The development continues in a new repository!** 5 | > This repository was archived on December 15th 2024. The development started with a PoC (Proof of Concept) and growed rapidly. A lot of learnings have been made on the way. We are starting over in a new repository to collect all the learnings and to create a better and greater application for a lot of more people than just one specific Java user group. 6 | > _Please join us here: [https://github.com/McPringle/komunumo](https://github.com/McPringle/komunumo)_ 7 | 8 | ## Copyright and License 9 | 10 | [AGPL License](https://www.gnu.org/licenses/agpl-3.0.de.html) 11 | 12 | *Copyright (C) Marcus Fihlon and the individual contributors to **Komunumo**.* 13 | 14 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 15 | 16 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. 17 | 18 | You should have received a copy of the GNU Affero General Public License along with this program. If not, see . 19 | -------------------------------------------------------------------------------- /DCO.md: -------------------------------------------------------------------------------- 1 | # Developer Certificate of Origin 2 | **Version 1.0** 3 | 4 | Copyright (C) 2024 [Marcus Fihlon](https://github.com/McPringle) and the individual contributors to Komunumo. 5 | 6 | _Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed._ 7 | 8 | ## Developer's Certificate of Origin 1.0 9 | 10 | By making a contribution to this project, I certify that: 11 | 12 | 1. The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the [license file](LICENSE.md); or 13 | 14 | 2. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or 15 | 16 | 3. The contribution was provided directly to me by some other person who certified 1., 2. or 3. and I have not modified it. 17 | 18 | 4. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | // This TypeScript configuration file is generated by vaadin-maven-plugin. 2 | // This is needed for TypeScript compiler to compile your TypeScript code in the project. 3 | // It is recommended to commit this file to the VCS. 4 | // You might want to change the configurations to fit your preferences 5 | // For more information about the configurations, please refer to http://www.typescriptlang.org/docs/handbook/tsconfig-json.html 6 | { 7 | "_version": "9.1", 8 | "compilerOptions": { 9 | "sourceMap": true, 10 | "jsx": "react-jsx", 11 | "inlineSources": true, 12 | "module": "esNext", 13 | "target": "es2020", 14 | "moduleResolution": "bundler", 15 | "strict": true, 16 | "skipLibCheck": true, 17 | "noFallthroughCasesInSwitch": true, 18 | "noImplicitReturns": true, 19 | "noImplicitAny": true, 20 | "noImplicitThis": true, 21 | "noUnusedLocals": false, 22 | "noUnusedParameters": false, 23 | "experimentalDecorators": true, 24 | "useDefineForClassFields": false, 25 | "baseUrl": "src/main/frontend", 26 | "paths": { 27 | "@vaadin/flow-frontend": ["generated/jar-resources"], 28 | "@vaadin/flow-frontend/*": ["generated/jar-resources/*"], 29 | "Frontend/*": ["*"] 30 | } 31 | }, 32 | "include": [ 33 | "src/main/frontend/**/*", 34 | "types.d.ts" 35 | ], 36 | "exclude": [ 37 | "src/main/frontend/generated/jar-resources/**" 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/ui/website/WebsiteHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website; 19 | 20 | import com.vaadin.flow.component.html.Anchor; 21 | import com.vaadin.flow.component.html.Header; 22 | import org.jetbrains.annotations.NotNull; 23 | import org.komunumo.configuration.Configuration; 24 | 25 | public class WebsiteHeader extends Header { 26 | 27 | public WebsiteHeader(@NotNull final Configuration configuration) { 28 | setId("website-header"); 29 | 30 | add( 31 | new Anchor("/", new WebsiteLogo(configuration)), 32 | new WebsiteStats() 33 | ); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.gradle 3 | /build/ 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | !**/src/main/**/build/ 7 | !**/src/test/**/build/ 8 | 9 | # The following files are often generated by operating systems or desktop environments 10 | .DS_Store 11 | Thumbs.db 12 | 13 | # The following files are generated/updated by vaadin-maven-plugin or vaadin-gradle-plugin 14 | /node_modules/ 15 | /src/main/frontend/generated/ 16 | /pnpmfile.js 17 | /.npmrc 18 | /webpack.generated.js 19 | /vite.generated.ts 20 | 21 | # Browser drivers for local integration tests 22 | drivers/ 23 | 24 | # Error screenshots generated by TestBench for failed integration tests 25 | error-screenshots/ 26 | 27 | # Eclipse and STS 28 | /.apt_generated 29 | /.classpath 30 | /.factorypath 31 | /.project 32 | /.settings 33 | /.springBeans 34 | /.sts4-cache 35 | 36 | # IntelliJ IDEA 37 | /.idea 38 | /*.iws 39 | /*.iml 40 | /*.ipr 41 | /out/ 42 | !**/src/main/**/out/ 43 | !**/src/test/**/out/ 44 | 45 | # NetBeans 46 | /nbproject/private/ 47 | /nbbuild/ 48 | /dist/ 49 | /nbdist/ 50 | /.nb-gradle/ 51 | 52 | # VS Code 53 | /.vscode/ 54 | 55 | # The following files are auto-generated by Vaadin if missing, but they should be added to source control if customized. 56 | /tsconfig.json 57 | /types.d.ts 58 | /src/main/frontend/index.html 59 | 60 | # Files used by Docker and MariaDB tu run the database locally 61 | /.env 62 | /.mariadb/data 63 | 64 | # Temporary Codecov files 65 | codecov 66 | codecov.SHA256SUM 67 | codecov.SHA256SUM.sig 68 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/ui/website/home/EventsPreviewContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website.home; 19 | 20 | import com.vaadin.flow.component.orderedlayout.HorizontalLayout; 21 | import org.jetbrains.annotations.NotNull; 22 | import org.komunumo.data.service.DatabaseService; 23 | 24 | public class EventsPreviewContainer extends HorizontalLayout { 25 | 26 | public EventsPreviewContainer(@NotNull final DatabaseService databaseService) { 27 | addClassName("events-preview-container"); 28 | 29 | final var events = databaseService.upcomingEvents().toList(); 30 | events.stream() 31 | .map(EventPreview::new) 32 | .forEach(this::add); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/configuration/ConfigurationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.configuration; 19 | 20 | import org.junit.jupiter.api.Test; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.boot.test.context.SpringBootTest; 23 | 24 | import static org.junit.jupiter.api.Assertions.assertFalse; 25 | import static org.junit.jupiter.api.Assertions.assertNotNull; 26 | 27 | @SpringBootTest 28 | class ConfigurationTest { 29 | 30 | @Autowired 31 | private Configuration configuration; 32 | 33 | @Test 34 | void testConfiguration() { 35 | assertNotNull(configuration); 36 | assertFalse(configuration.getVersion().isBlank()); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/data/service/DatabaseService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.data.service; 19 | 20 | import org.jetbrains.annotations.NotNull; 21 | import org.jooq.DSLContext; 22 | import org.komunumo.data.service.getter.DSLContextGetter; 23 | import org.springframework.stereotype.Service; 24 | 25 | @Service 26 | public class DatabaseService implements DSLContextGetter, EventService { 27 | 28 | private final DSLContext dsl; 29 | 30 | public DatabaseService(@NotNull final DSLContext dsl) { 31 | this.dsl = dsl; 32 | } 33 | 34 | /** 35 | * Get the {@link DSLContext} to access the database. 36 | * @return the {@link DSLContext} 37 | */ 38 | @Override 39 | public DSLContext dsl() { 40 | return dsl; 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/ui/website/home/HomeView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website.home; 19 | 20 | import com.vaadin.flow.component.html.Div; 21 | import com.vaadin.flow.component.html.H2; 22 | import com.vaadin.flow.router.Route; 23 | import com.vaadin.flow.server.auth.AnonymousAllowed; 24 | import org.jetbrains.annotations.NotNull; 25 | import org.komunumo.data.service.DatabaseService; 26 | import org.komunumo.ui.website.WebsiteLayout; 27 | 28 | @Route(value = "", layout = WebsiteLayout.class) 29 | @AnonymousAllowed 30 | public class HomeView extends Div { 31 | 32 | public HomeView(@NotNull final DatabaseService databaseService) { 33 | setId("home-view"); 34 | add(new H2("Home")); 35 | add(new EventsPreviewContainer(databaseService)); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/ui/website/WebsiteStats.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website; 19 | 20 | import com.vaadin.flow.component.Text; 21 | import com.vaadin.flow.component.html.Div; 22 | import com.vaadin.flow.component.html.Span; 23 | 24 | import static org.komunumo.util.FormatterUtil.formatNumber; 25 | 26 | public class WebsiteStats extends Div { 27 | 28 | public WebsiteStats() { 29 | final var stats = new Stats(8, "bits are a byte"); 30 | final var number = new Span(new Text(formatNumber(stats.number()))); 31 | number.addClassName("number"); 32 | final var text = new Span(new Text(stats.text())); 33 | text.addClassName("text"); 34 | 35 | add(number, text); 36 | addClassName("website-stats"); 37 | } 38 | 39 | private record Stats(int number, String text) { } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/ui/website/home/EventPreview.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package org.komunumo.ui.website.home; 20 | 21 | import com.vaadin.flow.component.html.Div; 22 | import com.vaadin.flow.component.html.H3; 23 | import com.vaadin.flow.component.html.H4; 24 | import com.vaadin.flow.component.html.Paragraph; 25 | import org.jetbrains.annotations.NotNull; 26 | import org.komunumo.data.entity.Event; 27 | 28 | public class EventPreview extends Div { 29 | 30 | public EventPreview(@NotNull final Event event) { 31 | super(); 32 | addClassName("event-preview"); 33 | 34 | add(new H3(event.title())); 35 | add(new H4(event.subtitle())); 36 | add(new Paragraph(event.description())); 37 | 38 | add(new Paragraph(event.date().toString())); 39 | add(new Paragraph(event.duration().toString())); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/data/entity/Event.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.data.entity; 19 | 20 | import org.jetbrains.annotations.NotNull; 21 | import org.jetbrains.annotations.Nullable; 22 | 23 | import java.time.Duration; 24 | import java.time.LocalDateTime; 25 | 26 | public record Event(@NotNull Long id, 27 | @NotNull String title, 28 | @NotNull String subtitle, 29 | @NotNull String description, 30 | @Nullable LocalDateTime date, 31 | @Nullable Duration duration, 32 | @NotNull String location) { 33 | 34 | public boolean isUpcoming() { 35 | if (date() == null || duration() == null) { 36 | return false; 37 | } 38 | final var endDate = date().plus(duration()); 39 | return endDate.isAfter(LocalDateTime.now()); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/util/FormatterUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.util; 19 | 20 | import java.text.DecimalFormat; 21 | import java.text.NumberFormat; 22 | 23 | public final class FormatterUtil { 24 | 25 | private static final DecimalFormat LARGE_NUMBERS = createLargeNumberFormatter(); 26 | 27 | private static DecimalFormat createLargeNumberFormatter() { 28 | final var formatter = (DecimalFormat) NumberFormat.getInstance(); 29 | final var symbols = formatter.getDecimalFormatSymbols(); 30 | 31 | symbols.setGroupingSeparator('\''); 32 | formatter.setDecimalFormatSymbols(symbols); 33 | 34 | return formatter; 35 | } 36 | 37 | public static String formatNumber(final long number) { 38 | return LARGE_NUMBERS.format(number); 39 | } 40 | 41 | private FormatterUtil() { 42 | throw new IllegalStateException("Utility class"); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "komunumo", 3 | "projectOwner": "McPringle", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": [ 7 | "README.md" 8 | ], 9 | "imageSize": 100, 10 | "commit": true, 11 | "commitConvention": "gitmoji", 12 | "badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg?style=flat-square)](#contributors)", 13 | "contributors": [ 14 | { 15 | "login": "McPringle", 16 | "name": "Marcus Fihlon", 17 | "avatar_url": "https://avatars.githubusercontent.com/u/1254039?v=4", 18 | "profile": "https://github.com/McPringle", 19 | "contributions": [ 20 | "projectManagement", 21 | "ideas", 22 | "code", 23 | "design" 24 | ] 25 | }, 26 | { 27 | "login": "Interactiondesigner", 28 | "name": "Interactiondesigner", 29 | "avatar_url": "https://avatars.githubusercontent.com/u/17220369?v=4", 30 | "profile": "https://github.com/Interactiondesigner", 31 | "contributions": [ 32 | "design" 33 | ] 34 | }, 35 | { 36 | "login": "knoobie", 37 | "name": "Knoobie", 38 | "avatar_url": "https://avatars.githubusercontent.com/u/3968629?v=4", 39 | "profile": "https://github.com/knoobie", 40 | "contributions": [ 41 | "code" 42 | ] 43 | }, 44 | { 45 | "login": "shreegilliorkar", 46 | "name": "Shree Gillorkar", 47 | "avatar_url": "https://avatars.githubusercontent.com/u/70030205?v=4", 48 | "profile": "https://github.com/shreegilliorkar", 49 | "contributions": [ 50 | "code" 51 | ] 52 | } 53 | ], 54 | "contributorsPerLine": 7, 55 | "linkToUsage": false 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo; 19 | 20 | import com.vaadin.flow.component.page.AppShellConfigurator; 21 | import com.vaadin.flow.component.page.Push; 22 | import com.vaadin.flow.server.PWA; 23 | import com.vaadin.flow.theme.Theme; 24 | import org.jetbrains.annotations.NotNull; 25 | import org.springframework.boot.SpringApplication; 26 | import org.springframework.boot.autoconfigure.SpringBootApplication; 27 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 28 | import org.springframework.scheduling.annotation.EnableScheduling; 29 | 30 | /** 31 | * The entry point of the Spring Boot application. 32 | */ 33 | @Push 34 | @Theme(value = "komunumo") 35 | @PWA(name = "Komunumo - Open Source Community Manager", shortName = "Komunumo") 36 | @EnableScheduling 37 | @SpringBootApplication 38 | public class Application extends SpringBootServletInitializer implements AppShellConfigurator { 39 | 40 | public static void main(@NotNull final String... args) { 41 | SpringApplication.run(Application.class, args); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/data/converter/LocalTimeDurationConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.data.converter; 19 | 20 | import org.jetbrains.annotations.NotNull; 21 | import org.jetbrains.annotations.Nullable; 22 | import org.jooq.Converter; 23 | 24 | import java.time.Duration; 25 | import java.time.LocalTime; 26 | 27 | public final class LocalTimeDurationConverter implements Converter { 28 | @Override 29 | public Duration from(@Nullable final LocalTime databaseObject) { 30 | if (databaseObject == null) { 31 | return null; 32 | } 33 | return Duration.between(LocalTime.of(0, 0), databaseObject); 34 | } 35 | 36 | @Override 37 | public LocalTime to(@Nullable final Duration userObject) { 38 | if (userObject == null) { 39 | return null; 40 | } 41 | return LocalTime.of(0, 0).plus(userObject); 42 | } 43 | 44 | @Override 45 | public @NotNull Class fromType() { 46 | return LocalTime.class; 47 | } 48 | 49 | @Override 50 | public @NotNull Class toType() { 51 | return Duration.class; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo; 19 | 20 | import org.junit.jupiter.api.Test; 21 | import org.junit.jupiter.api.extension.ExtendWith; 22 | import org.mockito.MockedStatic; 23 | import org.mockito.junit.jupiter.MockitoExtension; 24 | import org.springframework.boot.SpringApplication; 25 | 26 | import static org.mockito.Mockito.mockStatic; 27 | import static org.mockito.Mockito.times; 28 | 29 | @ExtendWith(MockitoExtension.class) 30 | class ApplicationTest { 31 | 32 | @Test 33 | void testMainCallsSpring() { 34 | final String[] args = new String[2]; 35 | args[0] = "foo"; 36 | args[1] = "bar"; 37 | 38 | try (MockedStatic springApplication = mockStatic(SpringApplication.class)) { 39 | springApplication.when(() -> SpringApplication.run(Application.class, args)) 40 | .thenReturn(null); 41 | springApplication.verify(() -> SpringApplication.run(Application.class, args), 42 | times(0)); 43 | Application.main(args); 44 | springApplication.verify(() -> SpringApplication.run(Application.class, args), 45 | times(1)); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/configuration/WebsiteConfigTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.configuration; 19 | 20 | import org.junit.jupiter.api.Test; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.boot.test.context.SpringBootTest; 23 | 24 | import static org.junit.jupiter.api.Assertions.assertEquals; 25 | 26 | @SpringBootTest 27 | class WebsiteConfigTest { 28 | 29 | @Autowired 30 | private Configuration configuration; 31 | 32 | @Test 33 | void testWebsiteConfig() { 34 | final var websiteConfig = configuration.getWebsite(); 35 | assertEquals("Test about text", websiteConfig.aboutText()); 36 | assertEquals("Test Association Name", websiteConfig.association()); 37 | assertEquals("Test address", websiteConfig.contactAddress()); 38 | assertEquals("noreply@localhost", websiteConfig.contactEmail()); 39 | assertEquals("Test copyright text", websiteConfig.copyright()); 40 | assertEquals("http://localhost:8080/icons/icon-512x512.png", websiteConfig.logoTemplate()); 41 | assertEquals(0, websiteConfig.logoMin()); 42 | assertEquals(0, websiteConfig.logoMax()); 43 | assertEquals("http://localhost:8080", websiteConfig.url()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/ui/website/WebsiteLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website; 19 | 20 | import com.vaadin.flow.component.HasElement; 21 | import com.vaadin.flow.component.html.Div; 22 | import com.vaadin.flow.component.html.Main; 23 | import com.vaadin.flow.router.RouterLayout; 24 | import org.jetbrains.annotations.NotNull; 25 | import org.jetbrains.annotations.Nullable; 26 | import org.komunumo.configuration.Configuration; 27 | 28 | public final class WebsiteLayout extends Div implements RouterLayout { 29 | 30 | private final Main main; 31 | 32 | public WebsiteLayout(@NotNull final Configuration configuration) { 33 | setId("website-container"); 34 | main = new Main(); 35 | add(new WebsiteHeader(configuration)); 36 | add(main); 37 | add(new WebsiteFooter(configuration)); 38 | } 39 | 40 | @Override 41 | public void showRouterLayoutContent(@NotNull final HasElement content) { 42 | main.removeAll(); 43 | main.add(content.getElement().getComponent() 44 | .orElseThrow(() -> new IllegalArgumentException( 45 | "WebsiteLayout content must be a Component"))); 46 | } 47 | 48 | @Override 49 | public void removeRouterLayoutContent(@Nullable final HasElement oldContent) { 50 | main.removeAll(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/configuration/Configuration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.configuration; 19 | 20 | import org.jetbrains.annotations.NotNull; 21 | import org.springframework.boot.context.properties.ConfigurationProperties; 22 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 23 | 24 | @org.springframework.context.annotation.Configuration 25 | @ConfigurationProperties(prefix = "komunumo") 26 | @EnableConfigurationProperties 27 | @SuppressWarnings("checkstyle:DesignForExtension") // Spring configurations can be subclassed by the Spring Framework 28 | public class Configuration { 29 | 30 | private String version; 31 | private MetanetConfig metanet; 32 | private WebsiteConfig website; 33 | 34 | public String getVersion() { 35 | return version; 36 | } 37 | 38 | public void setVersion(@NotNull final String version) { 39 | this.version = version; 40 | } 41 | 42 | public MetanetConfig getMetanet() { 43 | return metanet; 44 | } 45 | 46 | public void setMetanet(@NotNull final MetanetConfig metanet) { 47 | this.metanet = metanet; 48 | } 49 | 50 | public WebsiteConfig getWebsite() { 51 | return website; 52 | } 53 | 54 | public void setWebsite(@NotNull final WebsiteConfig website) { 55 | this.website = website; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/ui/KaribuTestBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui; 19 | 20 | import com.github.mvysny.kaributesting.v10.MockVaadin; 21 | import com.github.mvysny.kaributesting.v10.Routes; 22 | import com.github.mvysny.kaributesting.v10.spring.MockSpringServlet; 23 | import com.vaadin.flow.component.UI; 24 | import kotlin.jvm.functions.Function0; 25 | import org.junit.jupiter.api.AfterEach; 26 | import org.junit.jupiter.api.BeforeAll; 27 | import org.junit.jupiter.api.BeforeEach; 28 | import org.springframework.beans.factory.annotation.Autowired; 29 | import org.springframework.boot.test.context.SpringBootTest; 30 | import org.springframework.context.ApplicationContext; 31 | import org.springframework.test.annotation.DirtiesContext; 32 | 33 | /** 34 | * An abstract class which sets up Spring, Karibu-Testing and your app. 35 | * The easiest way to use this class in your tests is having your test class to extend 36 | * this class. 37 | */ 38 | @SpringBootTest 39 | @DirtiesContext 40 | public abstract class KaribuTestBase { 41 | 42 | private static Routes routes; 43 | 44 | @BeforeAll 45 | public static void discoverRoutes() { 46 | routes = new Routes().autoDiscoverViews("org.komunumo"); 47 | } 48 | 49 | @Autowired 50 | private ApplicationContext applicationContext; 51 | 52 | /** 53 | * @see org.junit.jupiter.api.BeforeEach 54 | */ 55 | @BeforeEach 56 | public void setup() { 57 | final Function0 uiFactory = UI::new; 58 | final var servlet = new MockSpringServlet(routes, applicationContext, uiFactory); 59 | MockVaadin.setup(uiFactory, servlet); 60 | } 61 | 62 | /** 63 | * @see org.junit.jupiter.api.AfterEach 64 | */ 65 | @AfterEach 66 | public void tearDown() { 67 | MockVaadin.tearDown(); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/data/service/EventService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.data.service; 19 | 20 | import org.jetbrains.annotations.NotNull; 21 | import org.komunumo.data.db.tables.records.EventRecord; 22 | import org.komunumo.data.entity.Event; 23 | import org.komunumo.data.service.getter.DSLContextGetter; 24 | 25 | import java.time.LocalDateTime; 26 | import java.util.Optional; 27 | import java.util.stream.Stream; 28 | 29 | import static org.komunumo.data.db.tables.Event.EVENT; 30 | 31 | interface EventService extends DSLContextGetter { 32 | 33 | default void storeEvent(@NotNull Event event) { 34 | final EventRecord eventRecord; 35 | if (event.id() == 0) { 36 | eventRecord = dsl().newRecord(EVENT); 37 | } else { 38 | final var result = dsl().fetchOne(EVENT, EVENT.ID.eq(event.id())); 39 | eventRecord = result != null ? result : dsl().newRecord(EVENT); 40 | } 41 | eventRecord.from(event); 42 | eventRecord.store(); 43 | } 44 | 45 | @NotNull 46 | default Optional getEvent(@NotNull final Long id) { 47 | return dsl().selectFrom(EVENT) 48 | .where(EVENT.ID.eq(id)) 49 | .fetchOptionalInto(Event.class); 50 | } 51 | 52 | @NotNull 53 | default Stream upcomingEvents() { 54 | return dsl().selectFrom(EVENT) 55 | .where(EVENT.DATE.greaterOrEqual(LocalDateTime.now().withHour(0).withMinute(0))) 56 | .orderBy(EVENT.DATE.asc()) 57 | .fetch() 58 | .stream() 59 | .map((eventRecord -> eventRecord.into(Event.class))) 60 | .filter(Event::isUpcoming); 61 | } 62 | 63 | default boolean deleteEvent(@NotNull final Event event) { 64 | return dsl().delete(EVENT).where(EVENT.ID.eq(event.id())).execute() > 0; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/util/FormatterUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.util; 19 | 20 | import org.junit.jupiter.api.Test; 21 | 22 | import java.lang.reflect.Constructor; 23 | import java.lang.reflect.InvocationTargetException; 24 | import java.lang.reflect.Modifier; 25 | 26 | import static org.junit.jupiter.api.Assertions.assertEquals; 27 | import static org.junit.jupiter.api.Assertions.assertInstanceOf; 28 | import static org.junit.jupiter.api.Assertions.assertThrows; 29 | 30 | class FormatterUtilTest { 31 | 32 | @Test 33 | void testFormatNumber() { 34 | assertEquals("1", FormatterUtil.formatNumber(1L)); 35 | assertEquals("12", FormatterUtil.formatNumber(12L)); 36 | assertEquals("123", FormatterUtil.formatNumber(123L)); 37 | assertEquals("1'234", FormatterUtil.formatNumber(1234L)); 38 | assertEquals("12'345", FormatterUtil.formatNumber(12345L)); 39 | assertEquals("123'456", FormatterUtil.formatNumber(123456L)); 40 | assertEquals("1'234'567", FormatterUtil.formatNumber(1234567L)); 41 | assertEquals("12'345'678", FormatterUtil.formatNumber(12345678L)); 42 | assertEquals("123'456'789", FormatterUtil.formatNumber(123456789L)); 43 | } 44 | 45 | @Test 46 | @SuppressWarnings("PMD.AvoidAccessibilityAlteration") // this is exactly what we want to test 47 | void privateConstructorWithException() { 48 | final var cause = assertThrows(InvocationTargetException.class, () -> { 49 | Constructor constructor = FormatterUtil.class.getDeclaredConstructor(); 50 | if (Modifier.isPrivate(constructor.getModifiers())) { 51 | constructor.setAccessible(true); 52 | constructor.newInstance(); 53 | } 54 | }).getCause(); 55 | assertInstanceOf(IllegalStateException.class, cause); 56 | assertEquals("Utility class", cause.getMessage()); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/data/converter/LocalTimeDurationConverterTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.data.converter; 19 | 20 | import org.junit.jupiter.api.Test; 21 | 22 | import java.time.Duration; 23 | import java.time.LocalTime; 24 | 25 | import static org.junit.jupiter.api.Assertions.assertEquals; 26 | import static org.junit.jupiter.api.Assertions.assertNull; 27 | 28 | class LocalTimeDurationConverterTest { 29 | 30 | @Test 31 | void from() { 32 | final var converter = new LocalTimeDurationConverter(); 33 | assertNull(converter.from(null)); 34 | assertEquals(Duration.ofMinutes(0), converter.from(LocalTime.of(0, 0))); 35 | assertEquals(Duration.ofMinutes(1), converter.from(LocalTime.of(0, 1))); 36 | assertEquals(Duration.ofMinutes(60), converter.from(LocalTime.of(1, 0))); 37 | assertEquals(Duration.ofMinutes(61), converter.from(LocalTime.of(1, 1))); 38 | assertEquals(Duration.ofMinutes(90), converter.from(LocalTime.of(1, 30))); 39 | } 40 | 41 | @Test 42 | void to() { 43 | final var converter = new LocalTimeDurationConverter(); 44 | assertNull(converter.to(null)); 45 | assertEquals(converter.from(LocalTime.of(0, 0)), Duration.ofMinutes(0)); 46 | assertEquals(converter.from(LocalTime.of(0, 1)), Duration.ofMinutes(1)); 47 | assertEquals(converter.from(LocalTime.of(1, 0)), Duration.ofMinutes(60)); 48 | assertEquals(converter.from(LocalTime.of(1, 1)), Duration.ofMinutes(61)); 49 | assertEquals(converter.from(LocalTime.of(1, 30)), Duration.ofMinutes(90)); 50 | } 51 | 52 | @Test 53 | void fromType() { 54 | final var converter = new LocalTimeDurationConverter(); 55 | assertEquals(LocalTime.class, converter.fromType()); 56 | } 57 | 58 | @Test 59 | void toType() { 60 | final var converter = new LocalTimeDurationConverter(); 61 | assertEquals(Duration.class, converter.toType()); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/ui/website/WebsiteLogo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website; 19 | 20 | import com.vaadin.flow.component.html.Image; 21 | import com.vaadin.flow.server.InvalidApplicationConfigurationException; 22 | import org.jetbrains.annotations.NotNull; 23 | import org.komunumo.configuration.Configuration; 24 | 25 | import java.io.Serial; 26 | import java.util.Random; 27 | 28 | public class WebsiteLogo extends Image { 29 | 30 | @Serial 31 | private static final long serialVersionUID = 5073126350713287726L; 32 | private final String logoUrlTemplate; 33 | private final int minLogoNumber; 34 | private final int maxLogoNumber; 35 | private final boolean randomizeLogo; 36 | 37 | public WebsiteLogo(@NotNull final Configuration configuration) { 38 | final var websiteConfig = configuration.getWebsite(); 39 | this.logoUrlTemplate = websiteConfig.logoTemplate(); 40 | this.minLogoNumber = websiteConfig.logoMin(); 41 | this.maxLogoNumber = websiteConfig.logoMax(); 42 | this.randomizeLogo = minLogoNumber < maxLogoNumber; 43 | 44 | if (logoUrlTemplate == null || logoUrlTemplate.isBlank()) { 45 | throw new InvalidApplicationConfigurationException("Missing website logo URL template!"); 46 | } 47 | 48 | if (maxLogoNumber < minLogoNumber) { 49 | throw new InvalidApplicationConfigurationException("Max website logo number must be higher than min website logo number!"); 50 | } 51 | 52 | setAlt("Website Logo"); 53 | setSrc(getLogoUrl()); 54 | addClassName("website-logo"); 55 | } 56 | 57 | private String getLogoUrl() { 58 | return randomizeLogo ? getRandomLogoUrl() : logoUrlTemplate; 59 | } 60 | 61 | private String getRandomLogoUrl() { 62 | final var randomNumber = new Random().nextInt(maxLogoNumber - minLogoNumber) + minLogoNumber; 63 | return String.format(logoUrlTemplate, randomNumber); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/ui/website/WebsiteFooter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website; 19 | 20 | import com.vaadin.flow.component.Component; 21 | import com.vaadin.flow.component.Html; 22 | import com.vaadin.flow.component.Text; 23 | import com.vaadin.flow.component.html.Anchor; 24 | import com.vaadin.flow.component.html.Div; 25 | import com.vaadin.flow.component.html.Footer; 26 | import com.vaadin.flow.component.html.H2; 27 | import org.jetbrains.annotations.NotNull; 28 | import org.komunumo.configuration.Configuration; 29 | import org.komunumo.configuration.WebsiteConfig; 30 | 31 | public class WebsiteFooter extends Footer { 32 | 33 | private final transient WebsiteConfig websiteConfig; 34 | 35 | public WebsiteFooter(@NotNull final Configuration configuration) { 36 | this.websiteConfig = configuration.getWebsite(); 37 | setId("website-footer"); 38 | 39 | add( 40 | createAbout(), 41 | createContact() 42 | ); 43 | } 44 | 45 | private Component createAbout() { 46 | final var container = new Div(); 47 | container.setId("website-footer-about"); 48 | 49 | final var title = new Div(new H2("About")); 50 | final var about = new Html("
%s
".formatted(websiteConfig.aboutText())); 51 | container.add(new Div(title, about)); 52 | 53 | return container; 54 | } 55 | 56 | private Component createContact() { 57 | final var container = new Div(); 58 | container.setId("website-footer-contact"); 59 | 60 | final var title = new H2("Contact"); 61 | final var association = new Div(new Text(websiteConfig.association())); 62 | final var address = new Div(new Text(websiteConfig.contactAddress())); 63 | final var email = createEmail(websiteConfig.contactEmail()); 64 | final var copyright = new Div(new Text(websiteConfig.copyright())); 65 | container.add(new Div(title, new Div(association, address, email, copyright))); 66 | 67 | return container; 68 | } 69 | 70 | private Component createEmail(@NotNull final String email) { 71 | final var div = new Div(new Anchor(String.format("mailto:%s", email), email)); 72 | div.addClassName("contact-email"); 73 | return div; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/ui/website/home/HomeViewIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website.home; 19 | 20 | import com.vaadin.flow.component.UI; 21 | import com.vaadin.flow.component.html.H2; 22 | import com.vaadin.flow.component.html.H3; 23 | import org.jooq.DSLContext; 24 | import org.junit.jupiter.api.Test; 25 | import org.komunumo.data.service.DatabaseService; 26 | import org.komunumo.ui.KaribuTestBase; 27 | import org.springframework.beans.factory.annotation.Autowired; 28 | 29 | import java.time.Duration; 30 | import java.time.LocalDateTime; 31 | 32 | import static com.github.mvysny.kaributesting.v10.LocatorJ._find; 33 | import static com.github.mvysny.kaributesting.v10.LocatorJ._get; 34 | import static org.junit.jupiter.api.Assertions.assertEquals; 35 | import static org.komunumo.data.db.Tables.EVENT; 36 | 37 | class HomeViewIT extends KaribuTestBase { 38 | 39 | @Autowired 40 | private DSLContext dsl; 41 | 42 | @Autowired 43 | private DatabaseService databaseService; 44 | 45 | @Test 46 | void homeViewTest() { 47 | dsl.insertInto(EVENT, EVENT.ID, EVENT.TITLE, EVENT.SUBTITLE, EVENT.DESCRIPTION, 48 | EVENT.DATE, EVENT.DURATION, EVENT.LOCATION) 49 | .values(1L, "Foobar 1", "This is a test", "This is event number one.", 50 | LocalDateTime.of(2099, 1, 1, 18, 15), Duration.ofMinutes(90), "Terra") 51 | .values(2L, "Foobar 2", "This is a test", "This is event number two.", 52 | LocalDateTime.of(2099, 1, 1, 18, 15), null, "Terra") 53 | .values(3L, "Foobar 3", "This is a test", "This is event number three.", 54 | null, Duration.ofMinutes(90), "Terra") 55 | .values(4L, "Foobar 4", "This is a test", "This is event number four.", 56 | null, null, "Terra") 57 | .execute(); 58 | 59 | final var events = databaseService.upcomingEvents().toList(); 60 | System.out.println(events); 61 | 62 | UI.getCurrent().navigate(HomeView.class); 63 | UI.getCurrent().getPage().reload(); 64 | 65 | final var title = _get(H2.class, spec -> spec.withText("Home")).getText(); 66 | assertEquals("Home", title); 67 | 68 | final var headings = _find(H3.class); 69 | assertEquals(1, headings.size()); 70 | assertEquals("Foobar 1", headings.getFirst().getText()); 71 | 72 | assertEquals(4, dsl.deleteFrom(EVENT).where(EVENT.ID.in(1L, 2L, 3L, 4L)).execute()); 73 | } 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/data/entity/EventTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.data.entity; 19 | 20 | import org.junit.jupiter.api.Test; 21 | 22 | import java.time.Duration; 23 | import java.time.LocalDateTime; 24 | 25 | import static org.junit.jupiter.api.Assertions.assertEquals; 26 | import static org.junit.jupiter.api.Assertions.assertFalse; 27 | import static org.junit.jupiter.api.Assertions.assertTrue; 28 | 29 | class EventTest { 30 | 31 | @Test 32 | void testEvent() { 33 | final var testEvent = new Event(1L, "Foobar", "This is a test", "I am a description.", 34 | LocalDateTime.of(2024, 10, 16, 18, 15), Duration.ofHours(1), "Terra"); 35 | 36 | assertEquals(1L, testEvent.id()); 37 | assertEquals("Foobar", testEvent.title()); 38 | assertEquals("This is a test", testEvent.subtitle()); 39 | assertEquals("I am a description.", testEvent.description()); 40 | assertEquals(LocalDateTime.of(2024, 10, 16, 18, 15), testEvent.date()); 41 | assertEquals(Duration.ofHours(1), testEvent.duration()); 42 | assertEquals("Terra", testEvent.location()); 43 | } 44 | 45 | @Test 46 | void isUpcomingWithNulls() { 47 | assertFalse(new Event(1L, "Foobar", "This is a test", "I am a description.", 48 | null, null, "Terra").isUpcoming()); 49 | assertFalse(new Event(1L, "Foobar", "This is a test", "I am a description.", 50 | null, Duration.ofHours(1), "Terra").isUpcoming()); 51 | assertFalse(new Event(1L, "Foobar", "This is a test", "I am a description.", 52 | LocalDateTime.of(2099, 1, 1, 18, 15), null, "Terra").isUpcoming()); 53 | } 54 | 55 | @Test 56 | void isUpcomingFalse() { 57 | assertFalse(new Event(1L, "Foobar", "This is a test", "I am a description.", 58 | LocalDateTime.of(2000, 1, 1, 18, 15), Duration.ofHours(1), "Terra").isUpcoming()); 59 | assertFalse(new Event(1L, "Foobar", "This is a test", "I am a description.", 60 | LocalDateTime.now().minusMinutes(61), Duration.ofHours(1), "Terra").isUpcoming()); 61 | } 62 | 63 | @Test 64 | void isUpcomingTrue() { 65 | assertTrue(new Event(1L, "Foobar", "This is a test", "I am a description.", 66 | LocalDateTime.of(2099, 1, 1, 18, 15), Duration.ofHours(1), "Terra").isUpcoming()); 67 | assertTrue(new Event(1L, "Foobar", "This is a test", "I am a description.", 68 | LocalDateTime.now(), Duration.ofHours(1), "Terra").isUpcoming()); 69 | assertTrue(new Event(1L, "Foobar", "This is a test", "I am a description.", 70 | LocalDateTime.now().minusMinutes(59), Duration.ofHours(1), "Terra").isUpcoming()); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/ui/website/WebsiteLayoutTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website; 19 | 20 | import com.vaadin.flow.component.HasElement; 21 | import com.vaadin.flow.component.UI; 22 | import com.vaadin.flow.component.html.Main; 23 | import com.vaadin.flow.component.html.Paragraph; 24 | import com.vaadin.flow.dom.Element; 25 | import org.junit.jupiter.api.Test; 26 | import org.komunumo.ui.KaribuTestBase; 27 | import org.komunumo.ui.website.home.HomeView; 28 | 29 | import java.util.Optional; 30 | 31 | import static org.junit.jupiter.api.Assertions.assertEquals; 32 | import static org.junit.jupiter.api.Assertions.assertThrows; 33 | import static org.mockito.Mockito.mock; 34 | import static org.mockito.Mockito.when; 35 | 36 | class WebsiteLayoutTest extends KaribuTestBase { 37 | 38 | @Test 39 | void testRouterLayoutContent() { 40 | UI.getCurrent().navigate(HomeView.class); 41 | final var uiParent = UI.getCurrent().getCurrentView().getParent().orElseThrow() 42 | .getParent().orElseThrow(); 43 | 44 | final var websiteLayout = (WebsiteLayout) uiParent; 45 | assertEquals(3, websiteLayout.getComponentCount()); 46 | 47 | final var main = (Main) websiteLayout.getComponentAt(1); 48 | assertEquals(1, main.getElement().getChildCount()); 49 | 50 | websiteLayout.showRouterLayoutContent(new Paragraph("foo")); 51 | assertEquals(1, main.getElement().getChildCount()); 52 | assertEquals("foo", main.getElement().getChild(0).getText()); 53 | 54 | websiteLayout.showRouterLayoutContent(new Paragraph("bar")); 55 | assertEquals(1, main.getElement().getChildCount()); 56 | assertEquals("bar", main.getElement().getChild(0).getText()); 57 | 58 | websiteLayout.removeRouterLayoutContent(null); 59 | assertEquals(0, main.getElement().getChildCount()); 60 | } 61 | 62 | @Test 63 | void testRouterLayoutContentException() { 64 | UI.getCurrent().navigate(HomeView.class); 65 | final var uiParent = UI.getCurrent().getCurrentView().getParent().orElseThrow() 66 | .getParent().orElseThrow(); 67 | 68 | final var websiteLayout = (WebsiteLayout) uiParent; 69 | assertEquals(3, websiteLayout.getComponentCount()); 70 | 71 | final var content = mock(HasElement.class); 72 | final var element = mock(Element.class); 73 | when(content.getElement()).thenReturn(element); 74 | when(element.getComponent()).thenReturn(Optional.empty()); 75 | 76 | final var exception = assertThrows(IllegalArgumentException.class, 77 | () -> websiteLayout.showRouterLayoutContent(content)); 78 | assertEquals("WebsiteLayout content must be a Component", exception.getMessage()); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/data/service/EventServiceIT.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.data.service; 19 | 20 | import org.junit.jupiter.api.Test; 21 | import org.komunumo.data.entity.Event; 22 | import org.springframework.beans.factory.annotation.Autowired; 23 | import org.springframework.boot.test.context.SpringBootTest; 24 | 25 | import java.time.Duration; 26 | import java.time.LocalDateTime; 27 | 28 | import static org.junit.jupiter.api.Assertions.assertEquals; 29 | import static org.junit.jupiter.api.Assertions.assertFalse; 30 | import static org.junit.jupiter.api.Assertions.assertTrue; 31 | 32 | @SpringBootTest 33 | class EventServiceIT { 34 | 35 | @Autowired 36 | private EventService eventService; 37 | 38 | @Test 39 | void eventService() { 40 | final var previousEvent = new Event(1L, "Foobar 1", "This is a previous event", "This is event number one.", 41 | LocalDateTime.of(2020, 1, 1, 18, 15), Duration.ofMinutes(90), "Terra"); 42 | final var runningEvent = new Event(2L, "Foobar 2", "This is a running event", "This is event number two.", 43 | LocalDateTime.now().withNano(0).minusMinutes(5), Duration.ofMinutes(90), "Terra"); 44 | final var upcomingEvent = new Event(3L, "Foobar 3", "This is a upcoming event", "This is event number three.", 45 | LocalDateTime.of(2099, 1, 1, 18, 15), Duration.ofMinutes(90), "Terra"); 46 | 47 | eventService.storeEvent(previousEvent); 48 | eventService.storeEvent(runningEvent); 49 | eventService.storeEvent(upcomingEvent); 50 | 51 | assertEquals(previousEvent, eventService.getEvent(1L).orElseThrow()); 52 | assertEquals(runningEvent, eventService.getEvent(2L).orElseThrow()); 53 | assertEquals(upcomingEvent, eventService.getEvent(3L).orElseThrow()); 54 | 55 | final var upcomingEvents = eventService.upcomingEvents().toList(); 56 | assertEquals(2, upcomingEvents.size()); 57 | assertEquals(runningEvent, upcomingEvents.getFirst()); 58 | assertEquals(upcomingEvent, upcomingEvents.get(1)); 59 | 60 | assertTrue(eventService.deleteEvent(previousEvent)); 61 | assertTrue(eventService.getEvent(previousEvent.id()).isEmpty()); 62 | assertFalse(eventService.deleteEvent(previousEvent)); 63 | assertTrue(eventService.deleteEvent(runningEvent)); 64 | assertTrue(eventService.getEvent(runningEvent.id()).isEmpty()); 65 | assertFalse(eventService.deleteEvent(runningEvent)); 66 | assertTrue(eventService.deleteEvent(upcomingEvent)); 67 | assertTrue(eventService.getEvent(upcomingEvent.id()).isEmpty()); 68 | assertFalse(eventService.deleteEvent(upcomingEvent)); 69 | assertEquals(0, eventService.upcomingEvents().toList().size()); 70 | } 71 | 72 | @Test 73 | void storeEventWithId0() { 74 | final var newEvent = new Event(0L, "Test with 0", "This is a test event", "This is an event with ID set to 0.", 75 | null, null, "Terra"); 76 | 77 | eventService.storeEvent(newEvent); 78 | final var storedEvent = eventService.getEvent(1L).orElseThrow(); 79 | 80 | assertEquals(1L, storedEvent.id()); 81 | assertEquals("Test with 0", storedEvent.title()); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "no-name", 3 | "license": "UNLICENSED", 4 | "type": "module", 5 | "dependencies": { 6 | "@polymer/polymer": "3.5.2", 7 | "@vaadin/bundles": "24.5.1", 8 | "@vaadin/common-frontend": "0.0.19", 9 | "@vaadin/polymer-legacy-adapter": "24.5.1", 10 | "@vaadin/react-components": "24.5.1", 11 | "@vaadin/router": "2.0.0", 12 | "@vaadin/vaadin-development-mode-detector": "2.0.7", 13 | "@vaadin/vaadin-lumo-styles": "24.5.1", 14 | "@vaadin/vaadin-material-styles": "24.5.1", 15 | "@vaadin/vaadin-themable-mixin": "24.5.1", 16 | "@vaadin/vaadin-usage-statistics": "2.1.3", 17 | "construct-style-sheets-polyfill": "3.1.0", 18 | "date-fns": "2.29.3", 19 | "lit": "3.2.1", 20 | "react": "18.3.1", 21 | "react-dom": "18.3.1", 22 | "react-router-dom": "6.28.0" 23 | }, 24 | "devDependencies": { 25 | "@babel/preset-react": "7.26.3", 26 | "@preact/signals-react-transform": "0.4.0", 27 | "@rollup/plugin-replace": "6.0.1", 28 | "@rollup/pluginutils": "5.1.3", 29 | "@types/react": "18.3.13", 30 | "@types/react-dom": "18.3.1", 31 | "@vitejs/plugin-react": "4.3.3", 32 | "all-contributors-cli": "^6.26.1", 33 | "async": "3.2.6", 34 | "glob": "10.4.5", 35 | "rollup-plugin-brotli": "3.1.0", 36 | "rollup-plugin-visualizer": "5.12.0", 37 | "strip-css-comments": "5.0.0", 38 | "transform-ast": "2.4.4", 39 | "typescript": "5.6.3", 40 | "vite": "5.4.11", 41 | "vite-plugin-checker": "0.8.0", 42 | "workbox-build": "7.3.0", 43 | "workbox-core": "7.3.0", 44 | "workbox-precaching": "7.3.0" 45 | }, 46 | "vaadin": { 47 | "dependencies": { 48 | "@polymer/polymer": "3.5.2", 49 | "@vaadin/bundles": "24.5.1", 50 | "@vaadin/common-frontend": "0.0.19", 51 | "@vaadin/polymer-legacy-adapter": "24.5.1", 52 | "@vaadin/react-components": "24.5.1", 53 | "@vaadin/router": "2.0.0", 54 | "@vaadin/vaadin-development-mode-detector": "2.0.7", 55 | "@vaadin/vaadin-lumo-styles": "24.5.1", 56 | "@vaadin/vaadin-material-styles": "24.5.1", 57 | "@vaadin/vaadin-themable-mixin": "24.5.1", 58 | "@vaadin/vaadin-usage-statistics": "2.1.3", 59 | "construct-style-sheets-polyfill": "3.1.0", 60 | "date-fns": "2.29.3", 61 | "lit": "3.2.1", 62 | "react": "18.3.1", 63 | "react-dom": "18.3.1", 64 | "react-router-dom": "6.28.0" 65 | }, 66 | "devDependencies": { 67 | "@babel/preset-react": "7.26.3", 68 | "@preact/signals-react-transform": "0.4.0", 69 | "@rollup/plugin-replace": "6.0.1", 70 | "@rollup/pluginutils": "5.1.3", 71 | "@types/react": "18.3.13", 72 | "@types/react-dom": "18.3.1", 73 | "@vitejs/plugin-react": "4.3.3", 74 | "async": "3.2.6", 75 | "glob": "10.4.5", 76 | "rollup-plugin-brotli": "3.1.0", 77 | "rollup-plugin-visualizer": "5.12.0", 78 | "strip-css-comments": "5.0.0", 79 | "transform-ast": "2.4.4", 80 | "typescript": "5.6.3", 81 | "vite": "5.4.11", 82 | "vite-plugin-checker": "0.8.0", 83 | "workbox-build": "7.3.0", 84 | "workbox-core": "7.3.0", 85 | "workbox-precaching": "7.3.0" 86 | }, 87 | "hash": "e0be520c0acc3f6d922fa8c7e92db92345949d8cc487266e4b7307985da166d8" 88 | }, 89 | "overrides": { 90 | "@vaadin/bundles": "$@vaadin/bundles", 91 | "@vaadin/polymer-legacy-adapter": "$@vaadin/polymer-legacy-adapter", 92 | "@vaadin/vaadin-development-mode-detector": "$@vaadin/vaadin-development-mode-detector", 93 | "@vaadin/router": "$@vaadin/router", 94 | "@vaadin/vaadin-usage-statistics": "$@vaadin/vaadin-usage-statistics", 95 | "@vaadin/react-components": "$@vaadin/react-components", 96 | "@vaadin/common-frontend": "$@vaadin/common-frontend", 97 | "react-dom": "$react-dom", 98 | "construct-style-sheets-polyfill": "$construct-style-sheets-polyfill", 99 | "react-router-dom": "$react-router-dom", 100 | "lit": "$lit", 101 | "@polymer/polymer": "$@polymer/polymer", 102 | "react": "$react", 103 | "date-fns": "$date-fns", 104 | "@vaadin/vaadin-themable-mixin": "$@vaadin/vaadin-themable-mixin", 105 | "@vaadin/vaadin-lumo-styles": "$@vaadin/vaadin-lumo-styles", 106 | "@vaadin/vaadin-material-styles": "$@vaadin/vaadin-material-styles" 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /src/test/java/org/komunumo/ui/website/WebsiteLogoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.ui.website; 19 | 20 | import com.vaadin.flow.server.InvalidApplicationConfigurationException; 21 | import org.junit.jupiter.api.Test; 22 | import org.komunumo.configuration.Configuration; 23 | import org.komunumo.configuration.WebsiteConfig; 24 | 25 | import static org.junit.jupiter.api.Assertions.assertEquals; 26 | import static org.junit.jupiter.api.Assertions.assertThrows; 27 | import static org.junit.jupiter.api.Assertions.assertTrue; 28 | import static org.mockito.Mockito.mock; 29 | import static org.mockito.Mockito.when; 30 | 31 | class WebsiteLogoTest { 32 | 33 | @Test 34 | void testRandomLogo() { 35 | final var configuration = mock(Configuration.class); 36 | final var websiteConfig = mock(WebsiteConfig.class); 37 | when(configuration.getWebsite()).thenReturn(websiteConfig); 38 | when(websiteConfig.logoTemplate()).thenReturn("test_%02d.svg"); 39 | when(websiteConfig.logoMin()).thenReturn(1); 40 | when(websiteConfig.logoMax()).thenReturn(5); 41 | 42 | final var websiteLogo = new WebsiteLogo(configuration); 43 | assertEquals("website-logo", websiteLogo.getClassName()); 44 | assertEquals("Website Logo", websiteLogo.getAlt().orElseThrow()); 45 | assertTrue(websiteLogo.getSrc().matches("test_\\d{2}\\.svg")); 46 | } 47 | 48 | @Test 49 | void testStaticLogo() { 50 | final var configuration = mock(Configuration.class); 51 | final var websiteConfig = mock(WebsiteConfig.class); 52 | when(configuration.getWebsite()).thenReturn(websiteConfig); 53 | when(websiteConfig.logoTemplate()).thenReturn("test.svg"); 54 | when(websiteConfig.logoMin()).thenReturn(0); 55 | when(websiteConfig.logoMax()).thenReturn(0); 56 | 57 | final var websiteLogo = new WebsiteLogo(configuration); 58 | assertEquals("website-logo", websiteLogo.getClassName()); 59 | assertEquals("Website Logo", websiteLogo.getAlt().orElseThrow()); 60 | assertTrue(websiteLogo.getSrc().matches("test\\.svg")); 61 | } 62 | 63 | @Test 64 | void testTemplateBlank() { 65 | final var configuration = mock(Configuration.class); 66 | final var websiteConfig = mock(WebsiteConfig.class); 67 | when(configuration.getWebsite()).thenReturn(websiteConfig); 68 | when(websiteConfig.logoTemplate()).thenReturn(" "); 69 | when(websiteConfig.logoMin()).thenReturn(0); 70 | when(websiteConfig.logoMax()).thenReturn(0); 71 | 72 | final var exception = assertThrows(InvalidApplicationConfigurationException.class, 73 | () -> new WebsiteLogo(configuration)); 74 | assertEquals("Missing website logo URL template!", exception.getMessage()); 75 | } 76 | 77 | @Test 78 | void testTemplateNull() { 79 | final var configuration = mock(Configuration.class); 80 | final var websiteConfig = mock(WebsiteConfig.class); 81 | when(configuration.getWebsite()).thenReturn(websiteConfig); 82 | when(websiteConfig.logoTemplate()).thenReturn(null); 83 | when(websiteConfig.logoMin()).thenReturn(0); 84 | when(websiteConfig.logoMax()).thenReturn(0); 85 | 86 | final var exception = assertThrows(InvalidApplicationConfigurationException.class, 87 | () -> new WebsiteLogo(configuration)); 88 | assertEquals("Missing website logo URL template!", exception.getMessage()); 89 | } 90 | 91 | @Test 92 | void testMaxLogoNumberLowerThanMinLogoNumber() { 93 | final var configuration = mock(Configuration.class); 94 | final var websiteConfig = mock(WebsiteConfig.class); 95 | when(configuration.getWebsite()).thenReturn(websiteConfig); 96 | when(websiteConfig.logoTemplate()).thenReturn("test_%02d.svg"); 97 | when(websiteConfig.logoMin()).thenReturn(1); 98 | when(websiteConfig.logoMax()).thenReturn(0); 99 | 100 | final var exception = assertThrows(InvalidApplicationConfigurationException.class, 101 | () -> new WebsiteLogo(configuration)); 102 | assertEquals("Max website logo number must be higher than min website logo number!", exception.getMessage()); 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import java.net.*; 17 | import java.io.*; 18 | import java.nio.channels.*; 19 | import java.util.Properties; 20 | 21 | public class MavenWrapperDownloader { 22 | 23 | private static final String WRAPPER_VERSION = "0.5.6"; 24 | /** 25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is 26 | * provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl 33 | * property to use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = ".mvn/wrapper/maven-wrapper.properties"; 36 | 37 | /** 38 | * Path where the maven-wrapper.jar will be saved to. 39 | */ 40 | private static final String MAVEN_WRAPPER_JAR_PATH = ".mvn/wrapper/maven-wrapper.jar"; 41 | 42 | /** 43 | * Name of the property which should be used to override the default download 44 | * url for the wrapper. 45 | */ 46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 47 | 48 | public static void main(String args[]) { 49 | System.out.println("- Downloader started"); 50 | File baseDirectory = new File(args[0]); 51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 52 | 53 | // If the maven-wrapper.properties exists, read it and check if it contains a 54 | // custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* 50 | if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 124 | 125 | FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | if "%MVNW_VERBOSE%" == "true" ( 133 | echo Found %WRAPPER_JAR% 134 | ) 135 | ) else ( 136 | if not "%MVNW_REPOURL%" == "" ( 137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 138 | ) 139 | if "%MVNW_VERBOSE%" == "true" ( 140 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 141 | echo Downloading from: %DOWNLOAD_URL% 142 | ) 143 | 144 | powershell -Command "&{"^ 145 | "$webclient = new-object System.Net.WebClient;"^ 146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 148 | "}"^ 149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 150 | "}" 151 | if "%MVNW_VERBOSE%" == "true" ( 152 | echo Finished downloading %WRAPPER_JAR% 153 | ) 154 | ) 155 | @REM End of extension 156 | 157 | @REM Provide a "standardized" way to retrieve the CLI args that will 158 | @REM work with both Windows and non-Windows executions. 159 | set MAVEN_CMD_LINE_ARGS=%* 160 | 161 | %MAVEN_JAVA_EXE% ^ 162 | %JVM_CONFIG_MAVEN_PROPS% ^ 163 | %MAVEN_OPTS% ^ 164 | %MAVEN_DEBUG_OPTS% ^ 165 | -classpath %WRAPPER_JAR% ^ 166 | "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ 167 | %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 168 | if ERRORLEVEL 1 goto error 169 | goto end 170 | 171 | :error 172 | set ERROR_CODE=1 173 | 174 | :end 175 | @endlocal & set ERROR_CODE=%ERROR_CODE% 176 | 177 | if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost 178 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 179 | if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" 180 | if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" 181 | :skipRcPost 182 | 183 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 184 | if "%MAVEN_BATCH_PAUSE%"=="on" pause 185 | 186 | if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% 187 | 188 | cmd /C exit /B %ERROR_CODE% 189 | -------------------------------------------------------------------------------- /checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 15 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /src/main/java/org/komunumo/scheduler/ImportScheduler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Komunumo - Open Source Community Manager 3 | * Copyright (C) Marcus Fihlon and the individual contributors to Komunumo. 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package org.komunumo.scheduler; 19 | 20 | import org.jetbrains.annotations.NotNull; 21 | import org.jetbrains.annotations.Nullable; 22 | import org.jsoup.Jsoup; 23 | import org.komunumo.configuration.Configuration; 24 | import org.komunumo.data.entity.Event; 25 | import org.komunumo.data.service.DatabaseService; 26 | import org.slf4j.Logger; 27 | import org.slf4j.LoggerFactory; 28 | import org.springframework.scheduling.annotation.Scheduled; 29 | import org.springframework.stereotype.Service; 30 | 31 | import java.sql.Connection; 32 | import java.sql.DriverManager; 33 | import java.sql.SQLException; 34 | import java.time.Duration; 35 | import java.time.LocalDate; 36 | import java.time.LocalDateTime; 37 | import java.time.LocalTime; 38 | import java.time.format.DateTimeFormatter; 39 | import java.time.format.DateTimeParseException; 40 | import java.util.concurrent.TimeUnit; 41 | import java.util.concurrent.atomic.AtomicInteger; 42 | 43 | import static java.lang.String.format; 44 | 45 | @Service 46 | @SuppressWarnings({"java:S1192", "java:S2629", "SqlResolve"}) // this class will be deleted after go-live 47 | public final class ImportScheduler { 48 | 49 | private static final Logger LOGGER = LoggerFactory.getLogger(ImportScheduler.class); 50 | 51 | @NotNull private final DatabaseService databaseService; 52 | @NotNull private final String dbURL; 53 | @NotNull private final String dbUser; 54 | @NotNull private final String dbPass; 55 | 56 | public ImportScheduler(@NotNull final Configuration configuration, 57 | @NotNull final DatabaseService databaseService) { 58 | this.databaseService = databaseService; 59 | 60 | final var metanetConfig = configuration.getMetanet(); 61 | this.dbURL = metanetConfig.dbUrl(); 62 | this.dbUser = metanetConfig.dbUser(); 63 | this.dbPass = metanetConfig.dbPassword(); 64 | } 65 | 66 | @Scheduled(initialDelay = 10, timeUnit = TimeUnit.SECONDS) 67 | public void startImport() { 68 | if (dbURL.isBlank() || dbUser.isBlank() || dbPass.isBlank()) { 69 | LOGGER.warn("Metanet database credentials are missing. Skipping import."); 70 | return; 71 | } 72 | LOGGER.info("Starting import..."); 73 | try (var connection = DriverManager.getConnection(dbURL, dbUser, dbPass)) { 74 | connection.setReadOnly(true); 75 | importEvents(connection); 76 | } catch (final SQLException e) { 77 | LOGGER.error("Error importing data from Java User Group Switzerland: {}", e.getMessage(), e); 78 | } 79 | } 80 | 81 | private void importEvents(@NotNull final Connection connection) 82 | throws SQLException { 83 | final var counterNew = new AtomicInteger(0); 84 | final var counterUpdated = new AtomicInteger(0); 85 | final var counterEquals = new AtomicInteger(0); 86 | try (var statement = connection.createStatement()) { 87 | final var result = statement.executeQuery(""" 88 | SELECT id, ort, room, travel_instructions, datum, startzeit, zeitende, titel, untertitel, agenda, abstract, sichtbar, 89 | verantwortung, urldatei, url_webinar, video_id, anm_formular FROM events_neu 90 | WHERE sichtbar='ja' OR datum >= '2021-01-01' ORDER BY id"""); 91 | while (result.next()) { 92 | final var event = new Event( 93 | result.getLong("id"), 94 | getPlainText(getEmptyForNull(result.getString("titel"))), 95 | getPlainText(getEmptyForNull(result.getString("untertitel"))), 96 | getEmptyForNull(result.getString("abstract")), 97 | getDateTime(result.getString("datum"), result.getString("startzeit")), 98 | getDuration(result.getString("startzeit"), result.getString("zeitende")), 99 | getEmptyForNull(result.getString("ort"))); 100 | final var optionalEvent = databaseService.getEvent(result.getLong("id")); 101 | if (optionalEvent.isEmpty()) { 102 | databaseService.storeEvent(event); 103 | counterNew.incrementAndGet(); 104 | LOGGER.info("New event with ID {} imported.", event.id()); 105 | } else if (optionalEvent.get().equals(event)) { 106 | counterEquals.incrementAndGet(); 107 | } else { 108 | databaseService.storeEvent(event); 109 | counterUpdated.incrementAndGet(); 110 | LOGGER.info("Existing event with ID {} updated.", event.id()); 111 | } 112 | } 113 | } 114 | LOGGER.info("{} new events imported, {} events updated, and {} equal events skipped.", 115 | counterNew.get(), counterUpdated.get(), counterEquals.get()); 116 | } 117 | 118 | @NotNull 119 | private static String getEmptyForNull(@Nullable final String text) { 120 | return text != null ? text : ""; 121 | } 122 | 123 | @NotNull 124 | private static String getPlainText(@NotNull final String html) { 125 | return Jsoup.parse(html).text(); 126 | } 127 | 128 | @Nullable 129 | private static LocalDateTime getDateTime(@Nullable final String eventDate, @Nullable final String startTime) { 130 | if (eventDate == null || startTime == null) { 131 | return null; 132 | } 133 | try { 134 | return LocalDateTime.of( 135 | LocalDate.parse(eventDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")), 136 | LocalTime.parse(startTime, DateTimeFormatter.ofPattern("HH:mm:ss.S")) 137 | ); 138 | } catch (final DateTimeParseException e1) { 139 | try { 140 | return LocalDateTime.of( 141 | LocalDate.parse(eventDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")), 142 | LocalTime.parse(startTime, DateTimeFormatter.ofPattern("HH:mm:ss")) 143 | ); 144 | } catch (final DateTimeParseException e2) { 145 | throw new ImportException(format("Can't parse date (%s) and time(%s)", eventDate, startTime), e2); 146 | } 147 | } 148 | } 149 | 150 | @Nullable 151 | private static Duration getDuration(@NotNull final String startTime, @NotNull final String endTime) { 152 | if (startTime.equals(endTime)) { 153 | return Duration.ZERO; 154 | } 155 | 156 | final var start = LocalTime.parse(startTime, DateTimeFormatter.ofPattern("HH:mm:ss")); 157 | final var end = LocalTime.parse(endTime, DateTimeFormatter.ofPattern("HH:mm:ss")); 158 | if (start.isBefore(end)) { 159 | return Duration.between(start, end); 160 | } 161 | 162 | int startHour = Integer.parseInt(startTime.split(":")[0]); 163 | final int startMinute = Integer.parseInt(startTime.split(":")[1]); 164 | final int startSecond = Integer.parseInt(startTime.split(":")[2]); 165 | 166 | int endHour = Integer.parseInt(endTime.split(":")[0]); 167 | final int endMinute = Integer.parseInt(endTime.split(":")[1]); 168 | final int endSecond = Integer.parseInt(endTime.split(":")[2]); 169 | 170 | if (endHour == 0) { 171 | endHour = 24; 172 | } 173 | 174 | if (endHour > startHour) { 175 | endHour = endHour - startHour; 176 | startHour = 0; 177 | } 178 | 179 | if (endHour > startHour && endHour < 24) { 180 | final var newStart = LocalTime.of(startHour, startMinute, startSecond); 181 | final var newEnd = LocalTime.of(endHour, endMinute, endSecond); 182 | return Duration.between(newStart, newEnd); 183 | } 184 | 185 | throw new IllegalArgumentException(format("Invalid combination of time values (start='%s', end='%s'", startTime, endTime)); 186 | } 187 | 188 | static class ImportException extends RuntimeException { 189 | ImportException(@NotNull final String message, @NotNull final Throwable cause) { 190 | super(message, cause); 191 | } 192 | } 193 | 194 | } 195 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /usr/local/etc/mavenrc ] ; then 40 | . /usr/local/etc/mavenrc 41 | fi 42 | 43 | if [ -f /etc/mavenrc ] ; then 44 | . /etc/mavenrc 45 | fi 46 | 47 | if [ -f "$HOME/.mavenrc" ] ; then 48 | . "$HOME/.mavenrc" 49 | fi 50 | 51 | fi 52 | 53 | # OS specific support. $var _must_ be set to either true or false. 54 | cygwin=false; 55 | darwin=false; 56 | mingw=false 57 | case "`uname`" in 58 | CYGWIN*) cygwin=true ;; 59 | MINGW*) mingw=true;; 60 | Darwin*) darwin=true 61 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 62 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 63 | if [ -z "$JAVA_HOME" ]; then 64 | if [ -x "/usr/libexec/java_home" ]; then 65 | export JAVA_HOME="`/usr/libexec/java_home`" 66 | else 67 | export JAVA_HOME="/Library/Java/Home" 68 | fi 69 | fi 70 | ;; 71 | esac 72 | 73 | if [ -z "$JAVA_HOME" ] ; then 74 | if [ -r /etc/gentoo-release ] ; then 75 | JAVA_HOME=`java-config --jre-home` 76 | fi 77 | fi 78 | 79 | if [ -z "$M2_HOME" ] ; then 80 | ## resolve links - $0 may be a link to maven's home 81 | PRG="$0" 82 | 83 | # need this for relative symlinks 84 | while [ -h "$PRG" ] ; do 85 | ls=`ls -ld "$PRG"` 86 | link=`expr "$ls" : '.*-> \(.*\)$'` 87 | if expr "$link" : '/.*' > /dev/null; then 88 | PRG="$link" 89 | else 90 | PRG="`dirname "$PRG"`/$link" 91 | fi 92 | done 93 | 94 | saveddir=`pwd` 95 | 96 | M2_HOME=`dirname "$PRG"`/.. 97 | 98 | # make it fully qualified 99 | M2_HOME=`cd "$M2_HOME" && pwd` 100 | 101 | cd "$saveddir" 102 | # echo Using m2 at $M2_HOME 103 | fi 104 | 105 | # For Cygwin, ensure paths are in UNIX format before anything is touched 106 | if $cygwin ; then 107 | [ -n "$M2_HOME" ] && 108 | M2_HOME=`cygpath --unix "$M2_HOME"` 109 | [ -n "$JAVA_HOME" ] && 110 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 111 | [ -n "$CLASSPATH" ] && 112 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 113 | fi 114 | 115 | # For Mingw, ensure paths are in UNIX format before anything is touched 116 | if $mingw ; then 117 | [ -n "$M2_HOME" ] && 118 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 119 | [ -n "$JAVA_HOME" ] && 120 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 121 | fi 122 | 123 | if [ -z "$JAVA_HOME" ]; then 124 | javaExecutable="`which javac`" 125 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 126 | # readlink(1) is not available as standard on Solaris 10. 127 | readLink=`which readlink` 128 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 129 | if $darwin ; then 130 | javaHome="`dirname \"$javaExecutable\"`" 131 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 132 | else 133 | javaExecutable="`readlink -f \"$javaExecutable\"`" 134 | fi 135 | javaHome="`dirname \"$javaExecutable\"`" 136 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 137 | JAVA_HOME="$javaHome" 138 | export JAVA_HOME 139 | fi 140 | fi 141 | fi 142 | 143 | if [ -z "$JAVACMD" ] ; then 144 | if [ -n "$JAVA_HOME" ] ; then 145 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 146 | # IBM's JDK on AIX uses strange locations for the executables 147 | JAVACMD="$JAVA_HOME/jre/sh/java" 148 | else 149 | JAVACMD="$JAVA_HOME/bin/java" 150 | fi 151 | else 152 | JAVACMD="`\\unset -f command; \\command -v java`" 153 | fi 154 | fi 155 | 156 | if [ ! -x "$JAVACMD" ] ; then 157 | echo "Error: JAVA_HOME is not defined correctly." >&2 158 | echo " We cannot execute $JAVACMD" >&2 159 | exit 1 160 | fi 161 | 162 | if [ -z "$JAVA_HOME" ] ; then 163 | echo "Warning: JAVA_HOME environment variable is not set." 164 | fi 165 | 166 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 167 | 168 | # traverses directory structure from process work directory to filesystem root 169 | # first directory with .mvn subdirectory is considered project base directory 170 | find_maven_basedir() { 171 | 172 | if [ -z "$1" ] 173 | then 174 | echo "Path not specified to find_maven_basedir" 175 | return 1 176 | fi 177 | 178 | basedir="$1" 179 | wdir="$1" 180 | while [ "$wdir" != '/' ] ; do 181 | if [ -d "$wdir"/.mvn ] ; then 182 | basedir=$wdir 183 | break 184 | fi 185 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 186 | if [ -d "${wdir}" ]; then 187 | wdir=`cd "$wdir/.."; pwd` 188 | fi 189 | # end of workaround 190 | done 191 | echo "${basedir}" 192 | } 193 | 194 | # concatenates all lines of a file 195 | concat_lines() { 196 | if [ -f "$1" ]; then 197 | echo "$(tr -s '\n' ' ' < "$1")" 198 | fi 199 | } 200 | 201 | BASE_DIR=`find_maven_basedir "$(pwd)"` 202 | if [ -z "$BASE_DIR" ]; then 203 | exit 1; 204 | fi 205 | 206 | ########################################################################################## 207 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 208 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 209 | ########################################################################################## 210 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Found .mvn/wrapper/maven-wrapper.jar" 213 | fi 214 | else 215 | if [ "$MVNW_VERBOSE" = true ]; then 216 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 217 | fi 218 | if [ -n "$MVNW_REPOURL" ]; then 219 | jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 220 | else 221 | jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" 222 | fi 223 | while IFS="=" read key value; do 224 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 225 | esac 226 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 227 | if [ "$MVNW_VERBOSE" = true ]; then 228 | echo "Downloading from: $jarUrl" 229 | fi 230 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 231 | if $cygwin; then 232 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 233 | fi 234 | 235 | if command -v wget > /dev/null; then 236 | if [ "$MVNW_VERBOSE" = true ]; then 237 | echo "Found wget ... using wget" 238 | fi 239 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 240 | wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 241 | else 242 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" 243 | fi 244 | elif command -v curl > /dev/null; then 245 | if [ "$MVNW_VERBOSE" = true ]; then 246 | echo "Found curl ... using curl" 247 | fi 248 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 249 | curl -o "$wrapperJarPath" "$jarUrl" -f 250 | else 251 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 252 | fi 253 | 254 | else 255 | if [ "$MVNW_VERBOSE" = true ]; then 256 | echo "Falling back to using Java to download" 257 | fi 258 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 259 | # For Cygwin, switch paths to Windows format before running javac 260 | if $cygwin; then 261 | javaClass=`cygpath --path --windows "$javaClass"` 262 | fi 263 | if [ -e "$javaClass" ]; then 264 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 265 | if [ "$MVNW_VERBOSE" = true ]; then 266 | echo " - Compiling MavenWrapperDownloader.java ..." 267 | fi 268 | # Compiling the Java class 269 | ("$JAVA_HOME/bin/javac" "$javaClass") 270 | fi 271 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 272 | # Running the downloader 273 | if [ "$MVNW_VERBOSE" = true ]; then 274 | echo " - Running MavenWrapperDownloader.java ..." 275 | fi 276 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 277 | fi 278 | fi 279 | fi 280 | fi 281 | ########################################################################################## 282 | # End of extension 283 | ########################################################################################## 284 | 285 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 286 | if [ "$MVNW_VERBOSE" = true ]; then 287 | echo $MAVEN_PROJECTBASEDIR 288 | fi 289 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 290 | 291 | # For Cygwin, switch paths to Windows format before running java 292 | if $cygwin; then 293 | [ -n "$M2_HOME" ] && 294 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 295 | [ -n "$JAVA_HOME" ] && 296 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 297 | [ -n "$CLASSPATH" ] && 298 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 299 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 300 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 301 | fi 302 | 303 | # Provide a "standardized" way to retrieve the CLI args that will 304 | # work with both Windows and non-Windows executions. 305 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" 306 | export MAVEN_CMD_LINE_ARGS 307 | 308 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 309 | 310 | exec "$JAVACMD" \ 311 | $MAVEN_OPTS \ 312 | $MAVEN_DEBUG_OPTS \ 313 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 314 | "-Dmaven.home=${M2_HOME}" \ 315 | "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 316 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 317 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | org.komunumo 6 | komunumo 7 | Komunumo 8 | 1.0-SNAPSHOT 9 | jar 10 | the open source community management 11 | https://komunumo.org/ 12 | 2021 13 | 14 | 15 | 16 | GNU Affero General Public License v3.0 only 17 | https://github.com/McPringle/komunumo/blob/main/LICENSE.md 18 | manual 19 | A FSF Free/Libre and OSI approved license 20 | 21 | 22 | 23 | 24 | 25 | McPringle 26 | Marcus Fihlon 27 | marcus@fihlon.swiss 28 | https://fihlon.swiss/ 29 | 30 | maintainer 31 | architect 32 | developer 33 | 34 | Europe/Zurich 35 | 36 | https://gravatar.com/avatar/b7fd700b1ed81ebff879cdd72ed4a2a4?s=400 37 | 38 | 39 | 40 | 41 | 42 | 43 | Gunnar Donis 44 | mr.funky@gmx.de 45 | 46 | designer 47 | 48 | Europe/Zurich 49 | 50 | 51 | Simon Martinelli 52 | simon@martinelli.ch 53 | 72 Services, LLC 54 | https://72.services/ 55 | 56 | reviewer 57 | 58 | Europe/Zurich 59 | 60 | https://gravatar.com/avatar/1bcf3bbacd5621ca38af8ea26c333b51?s=400 61 | 62 | 63 | 64 | 65 | 66 | GitHub 67 | https://github.com/McPringle/komunumo/issues 68 | 69 | 70 | 71 | scm:git:https://github.com/McPringle/komunumo.git 72 | scm:git:https://github.com/McPringle/komunumo.git 73 | HEAD 74 | https://github.com/McPringle/komunumo 75 | 76 | 77 | 78 | 21 79 | 3.19.16 80 | 3.9.9 81 | 5.14.2 82 | 24.5.8 83 | 84 | 85 | 86 | org.springframework.boot 87 | spring-boot-starter-parent 88 | 3.4.0 89 | 90 | 91 | 92 | 93 | Vaadin Directory 94 | https://maven.vaadin.com/vaadin-addons 95 | 96 | false 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | com.vaadin 105 | vaadin-bom 106 | ${vaadin.version} 107 | pom 108 | import 109 | 110 | 111 | 112 | 113 | 114 | 115 | com.vaadin 116 | 117 | 118 | vaadin-core 119 | 120 | 121 | com.vaadin 122 | vaadin-spring-boot-starter 123 | 124 | 125 | org.springframework.boot 126 | spring-boot-starter-validation 127 | 128 | 129 | org.springframework.boot 130 | spring-boot-devtools 131 | true 132 | 133 | 134 | org.jetbrains 135 | annotations 136 | 26.0.1 137 | provided 138 | 139 | 140 | com.github.spotbugs 141 | spotbugs-annotations 142 | 4.8.6 143 | true 144 | 145 | 146 | org.flywaydb 147 | flyway-core 148 | 149 | 150 | org.flywaydb 151 | flyway-mysql 152 | 153 | 154 | org.mariadb.jdbc 155 | mariadb-java-client 156 | 157 | 158 | org.jooq 159 | jooq 160 | ${jooq.version} 161 | 162 | 163 | org.springframework.boot 164 | spring-boot-starter-jooq 165 | 166 | 167 | org.springframework.boot 168 | spring-boot-starter-test 169 | test 170 | 171 | 172 | com.vaadin 173 | vaadin-testbench-junit5 174 | test 175 | 176 | 177 | com.github.mvysny.kaributesting 178 | karibu-testing-v10-spring 179 | 2.2.0 180 | test 181 | 182 | 183 | org.testcontainers 184 | junit-jupiter 185 | 1.20.4 186 | test 187 | 188 | 189 | org.mockito 190 | mockito-core 191 | ${mockito.version} 192 | test 193 | 194 | 195 | org.mockito 196 | mockito-junit-jupiter 197 | ${mockito.version} 198 | test 199 | 200 | 201 | org.testcontainers 202 | mariadb 203 | 1.20.4 204 | 205 | 206 | 207 | 208 | spring-boot:run 209 | 210 | 211 | 212 | 213 | org.apache.maven.plugins 214 | maven-clean-plugin 215 | 3.4.0 216 | 217 | 218 | org.apache.maven.plugins 219 | maven-compiler-plugin 220 | 3.13.0 221 | 222 | 223 | org.apache.maven.plugins 224 | maven-deploy-plugin 225 | 3.1.3 226 | 227 | 228 | org.apache.maven.plugins 229 | maven-install-plugin 230 | 3.1.3 231 | 232 | 233 | org.apache.maven.plugins 234 | maven-jar-plugin 235 | 3.4.2 236 | 237 | 238 | org.apache.maven.plugins 239 | maven-resources-plugin 240 | 3.3.1 241 | 242 | 243 | org.apache.maven.plugins 244 | maven-site-plugin 245 | 3.21.0 246 | 247 | 248 | org.apache.maven.plugins 249 | maven-surefire-plugin 250 | 3.5.2 251 | 252 | 253 | org.apache.maven.plugins 254 | maven-failsafe-plugin 255 | 3.5.2 256 | 257 | 258 | org.simplify4u.plugins 259 | pgpverify-maven-plugin 260 | 1.18.2 261 | 262 | 263 | 264 | 265 | 266 | 267 | org.apache.maven.plugins 268 | maven-enforcer-plugin 269 | 3.5.0 270 | 271 | 272 | enforce-versions 273 | 274 | enforce 275 | 276 | 277 | 278 | 279 | ${maven.version} 280 | 281 | 282 | ${java.version} 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | org.simplify4u.plugins 292 | pgpverify-maven-plugin 293 | 294 | 295 | 296 | check 297 | 298 | 299 | 300 | 301 | 302 | 303 | org.springframework.boot 304 | spring-boot-maven-plugin 305 | 306 | 307 | 308 | com.vaadin 309 | vaadin-maven-plugin 310 | ${vaadin.version} 311 | 312 | 313 | 314 | prepare-frontend 315 | 316 | 317 | 318 | 319 | 320 | 321 | org.apache.maven.plugins 322 | maven-failsafe-plugin 323 | 324 | 325 | 326 | integration-test 327 | verify 328 | 329 | 330 | 331 | 332 | false 333 | true 334 | 335 | 336 | 337 | 338 | org.apache.maven.plugins 339 | maven-checkstyle-plugin 340 | 3.6.0 341 | 342 | 343 | com.puppycrawl.tools 344 | checkstyle 345 | 10.21.0 346 | 347 | 348 | 349 | ${basedir}/checkstyle.xml 350 | 351 | 352 | 353 | validate 354 | validate 355 | 356 | check 357 | 358 | 359 | 360 | 361 | 362 | 363 | org.jacoco 364 | jacoco-maven-plugin 365 | 0.8.12 366 | 367 | 368 | org/komunumo/data/db/** 369 | org/komunumo/scheduler/Import*.class 370 | 371 | 372 | 373 | 374 | prepare-agent 375 | 376 | prepare-agent 377 | 378 | 379 | ${project.build.directory}/jacoco-ut.exec 380 | 381 | 382 | 383 | prepare-agent-integration 384 | 385 | prepare-agent-integration 386 | 387 | 388 | ${project.build.directory}/jacoco-it.exec 389 | 390 | 391 | 392 | jacoco-merge 393 | verify 394 | 395 | merge 396 | 397 | 398 | 399 | 400 | ${project.build.directory} 401 | 402 | jacoco-ut.exec 403 | jacoco-it.exec 404 | 405 | 406 | 407 | ${project.build.directory}/jacoco.exec 408 | 409 | 410 | 411 | report 412 | verify 413 | 414 | report 415 | 416 | 417 | 418 | jacoco-check 419 | 420 | check 421 | 422 | 423 | 424 | 425 | BUNDLE 426 | 427 | 428 | CLASS 429 | COVEREDRATIO 430 | 100% 431 | 432 | 433 | CLASS 434 | MISSEDCOUNT 435 | 0 436 | 437 | 438 | METHOD 439 | COVEREDRATIO 440 | 100% 441 | 442 | 443 | METHOD 444 | MISSEDCOUNT 445 | 0 446 | 447 | 448 | LINE 449 | COVEREDRATIO 450 | 100% 451 | 452 | 453 | LINE 454 | MISSEDCOUNT 455 | 0 456 | 457 | 458 | BRANCH 459 | COVEREDRATIO 460 | 100% 461 | 462 | 463 | BRANCH 464 | MISSEDCOUNT 465 | 0 466 | 467 | 468 | INSTRUCTION 469 | COVEREDRATIO 470 | 100% 471 | 472 | 473 | INSTRUCTION 474 | MISSEDCOUNT 475 | 0 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | org.spdx 487 | spdx-maven-plugin 488 | 0.7.4 489 | 490 | 491 | build-spdx 492 | package 493 | 494 | createSPDX 495 | 496 | 497 | 498 | 499 | 500 | 501 | com.giovds 502 | outdated-maven-plugin 503 | 1.4.0 504 | 505 | 1 506 | true 507 | 508 | 509 | 510 | 511 | org.jooq 512 | jooq-codegen-maven 513 | 514 | 515 | jooq-codegen 516 | generate-sources 517 | 518 | generate 519 | 520 | 521 | 522 | 523 | 524 | org.testcontainers.jdbc.ContainerDatabaseDriver 525 | jdbc:tc:mariadb:lts:///ignored?allowMultiQueries=true&TC_TMPFS=/testtmpfs:rw&TC_INITSCRIPT=file:${basedir}/src/main/resources/db/migration/V1_0_0__initialization.sql 526 | test 527 | test 528 | 529 | 530 | 531 | org.jooq.meta.mariadb.MariaDBDatabase 532 | test 533 | true 534 | 535 | 536 | BOOLEAN 537 | (?i:TINYINT\(1\)) 538 | 539 | 540 | java.time.Duration 541 | org.komunumo.data.converter.LocalTimeDurationConverter 542 | false 543 | .*\.DURATION.* 544 | 545 | 546 | 547 | 548 | sort 549 | semantic 550 | 551 | 552 | 553 | 554 | true 555 | true 556 | 557 | 558 | org.komunumo.data.db 559 | target/generated-sources/jooq 560 | 561 | 562 | 563 | 564 | 565 | org.jooq 566 | jooq-meta-extensions 567 | ${jooq.version} 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | production 578 | 579 | 580 | 581 | com.vaadin 582 | vaadin-core 583 | 584 | 585 | com.vaadin 586 | vaadin-dev 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | com.vaadin 595 | vaadin-maven-plugin 596 | ${vaadin.version} 597 | 598 | 599 | 600 | build-frontend 601 | 602 | compile 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | max_line_length = 150 10 | tab_width = 4 11 | ij_continuation_indent_size = 8 12 | ij_formatter_off_tag = @formatter:off 13 | ij_formatter_on_tag = @formatter:on 14 | ij_formatter_tags_enabled = false 15 | ij_smart_tabs = false 16 | ij_wrap_on_typing = false 17 | 18 | [*.css] 19 | ij_css_align_closing_brace_with_properties = false 20 | ij_css_blank_lines_around_nested_selector = 1 21 | ij_css_blank_lines_between_blocks = 1 22 | ij_css_brace_placement = end_of_line 23 | ij_css_enforce_quotes_on_format = false 24 | ij_css_hex_color_long_format = false 25 | ij_css_hex_color_lower_case = false 26 | ij_css_hex_color_short_format = false 27 | ij_css_hex_color_upper_case = false 28 | ij_css_keep_blank_lines_in_code = 2 29 | ij_css_keep_indents_on_empty_lines = false 30 | ij_css_keep_single_line_blocks = false 31 | ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow 32 | ij_css_space_after_colon = true 33 | ij_css_space_before_opening_brace = true 34 | ij_css_use_double_quotes = true 35 | ij_css_value_alignment = do_not_align 36 | 37 | [*.java] 38 | ij_java_align_consecutive_assignments = false 39 | ij_java_align_consecutive_variable_declarations = false 40 | ij_java_align_group_field_declarations = false 41 | ij_java_align_multiline_annotation_parameters = false 42 | ij_java_align_multiline_array_initializer_expression = false 43 | ij_java_align_multiline_assignment = false 44 | ij_java_align_multiline_binary_operation = false 45 | ij_java_align_multiline_chained_methods = false 46 | ij_java_align_multiline_extends_list = false 47 | ij_java_align_multiline_for = true 48 | ij_java_align_multiline_method_parentheses = false 49 | ij_java_align_multiline_parameters = true 50 | ij_java_align_multiline_parameters_in_calls = false 51 | ij_java_align_multiline_parenthesized_expression = false 52 | ij_java_align_multiline_resources = true 53 | ij_java_align_multiline_ternary_operation = false 54 | ij_java_align_multiline_text_blocks = false 55 | ij_java_align_multiline_throws_list = false 56 | ij_java_align_subsequent_simple_methods = false 57 | ij_java_align_throws_keyword = false 58 | ij_java_annotation_parameter_wrap = off 59 | ij_java_array_initializer_new_line_after_left_brace = false 60 | ij_java_array_initializer_right_brace_on_new_line = false 61 | ij_java_array_initializer_wrap = off 62 | ij_java_assert_statement_colon_on_next_line = false 63 | ij_java_assert_statement_wrap = off 64 | ij_java_assignment_wrap = off 65 | ij_java_binary_operation_sign_on_next_line = false 66 | ij_java_binary_operation_wrap = off 67 | ij_java_blank_lines_after_anonymous_class_header = 0 68 | ij_java_blank_lines_after_class_header = 0 69 | ij_java_blank_lines_after_imports = 1 70 | ij_java_blank_lines_after_package = 1 71 | ij_java_blank_lines_around_class = 1 72 | ij_java_blank_lines_around_field = 0 73 | ij_java_blank_lines_around_field_in_interface = 0 74 | ij_java_blank_lines_around_initializer = 1 75 | ij_java_blank_lines_around_method = 1 76 | ij_java_blank_lines_around_method_in_interface = 1 77 | ij_java_blank_lines_before_class_end = 0 78 | ij_java_blank_lines_before_imports = 1 79 | ij_java_blank_lines_before_method_body = 0 80 | ij_java_blank_lines_before_package = 0 81 | ij_java_block_brace_style = end_of_line 82 | ij_java_block_comment_at_first_column = true 83 | ij_java_call_parameters_new_line_after_left_paren = false 84 | ij_java_call_parameters_right_paren_on_new_line = false 85 | ij_java_call_parameters_wrap = off 86 | ij_java_case_statement_on_separate_line = true 87 | ij_java_catch_on_new_line = false 88 | ij_java_class_annotation_wrap = split_into_lines 89 | ij_java_class_brace_style = end_of_line 90 | ij_java_class_count_to_use_import_on_demand = 2147483647 91 | ij_java_class_names_in_javadoc = 1 92 | ij_java_do_not_indent_top_level_class_members = false 93 | ij_java_do_not_wrap_after_single_annotation = false 94 | ij_java_do_while_brace_force = never 95 | ij_java_doc_add_blank_line_after_description = true 96 | ij_java_doc_add_blank_line_after_param_comments = false 97 | ij_java_doc_add_blank_line_after_return = false 98 | ij_java_doc_add_p_tag_on_empty_lines = true 99 | ij_java_doc_align_exception_comments = true 100 | ij_java_doc_align_param_comments = true 101 | ij_java_doc_do_not_wrap_if_one_line = false 102 | ij_java_doc_enable_formatting = true 103 | ij_java_doc_enable_leading_asterisks = true 104 | ij_java_doc_indent_on_continuation = false 105 | ij_java_doc_keep_empty_lines = true 106 | ij_java_doc_keep_empty_parameter_tag = true 107 | ij_java_doc_keep_empty_return_tag = true 108 | ij_java_doc_keep_empty_throws_tag = true 109 | ij_java_doc_keep_invalid_tags = true 110 | ij_java_doc_param_description_on_new_line = false 111 | ij_java_doc_preserve_line_breaks = false 112 | ij_java_doc_use_throws_not_exception_tag = true 113 | ij_java_else_on_new_line = false 114 | ij_java_entity_dd_suffix = EJB 115 | ij_java_entity_eb_suffix = Bean 116 | ij_java_entity_hi_suffix = Home 117 | ij_java_entity_lhi_prefix = Local 118 | ij_java_entity_lhi_suffix = Home 119 | ij_java_entity_li_prefix = Local 120 | ij_java_entity_pk_class = java.lang.String 121 | ij_java_entity_vo_suffix = VO 122 | ij_java_enum_constants_wrap = off 123 | ij_java_extends_keyword_wrap = off 124 | ij_java_extends_list_wrap = off 125 | ij_java_field_annotation_wrap = split_into_lines 126 | ij_java_finally_on_new_line = false 127 | ij_java_for_brace_force = never 128 | ij_java_for_statement_new_line_after_left_paren = false 129 | ij_java_for_statement_right_paren_on_new_line = false 130 | ij_java_for_statement_wrap = off 131 | ij_java_generate_final_locals = false 132 | ij_java_generate_final_parameters = false 133 | ij_java_if_brace_force = never 134 | ij_java_imports_layout = *,|,javax.**,java.**,|,$* 135 | ij_java_indent_case_from_switch = true 136 | ij_java_insert_inner_class_imports = false 137 | ij_java_insert_override_annotation = true 138 | ij_java_keep_blank_lines_before_right_brace = 2 139 | ij_java_keep_blank_lines_between_package_declaration_and_header = 2 140 | ij_java_keep_blank_lines_in_code = 2 141 | ij_java_keep_blank_lines_in_declarations = 2 142 | ij_java_keep_control_statement_in_one_line = true 143 | ij_java_keep_first_column_comment = true 144 | ij_java_keep_indents_on_empty_lines = false 145 | ij_java_keep_line_breaks = true 146 | ij_java_keep_multiple_expressions_in_one_line = false 147 | ij_java_keep_simple_blocks_in_one_line = false 148 | ij_java_keep_simple_classes_in_one_line = false 149 | ij_java_keep_simple_lambdas_in_one_line = false 150 | ij_java_keep_simple_methods_in_one_line = false 151 | ij_java_label_indent_absolute = false 152 | ij_java_label_indent_size = 0 153 | ij_java_lambda_brace_style = end_of_line 154 | ij_java_layout_static_imports_separately = true 155 | ij_java_line_comment_add_space = false 156 | ij_java_line_comment_at_first_column = true 157 | ij_java_message_dd_suffix = EJB 158 | ij_java_message_eb_suffix = Bean 159 | ij_java_method_annotation_wrap = split_into_lines 160 | ij_java_method_brace_style = end_of_line 161 | ij_java_method_call_chain_wrap = off 162 | ij_java_method_parameters_new_line_after_left_paren = false 163 | ij_java_method_parameters_right_paren_on_new_line = false 164 | ij_java_method_parameters_wrap = off 165 | ij_java_modifier_list_wrap = false 166 | ij_java_names_count_to_use_import_on_demand = 2147483647 167 | ij_java_parameter_annotation_wrap = off 168 | ij_java_parentheses_expression_new_line_after_left_paren = false 169 | ij_java_parentheses_expression_right_paren_on_new_line = false 170 | ij_java_place_assignment_sign_on_next_line = false 171 | ij_java_prefer_longer_names = true 172 | ij_java_prefer_parameters_wrap = false 173 | ij_java_repeat_synchronized = true 174 | ij_java_replace_instanceof_and_cast = false 175 | ij_java_replace_null_check = true 176 | ij_java_replace_sum_lambda_with_method_ref = true 177 | ij_java_resource_list_new_line_after_left_paren = false 178 | ij_java_resource_list_right_paren_on_new_line = false 179 | ij_java_resource_list_wrap = off 180 | ij_java_session_dd_suffix = EJB 181 | ij_java_session_eb_suffix = Bean 182 | ij_java_session_hi_suffix = Home 183 | ij_java_session_lhi_prefix = Local 184 | ij_java_session_lhi_suffix = Home 185 | ij_java_session_li_prefix = Local 186 | ij_java_session_si_suffix = Service 187 | ij_java_space_after_closing_angle_bracket_in_type_argument = false 188 | ij_java_space_after_colon = true 189 | ij_java_space_after_comma = true 190 | ij_java_space_after_comma_in_type_arguments = true 191 | ij_java_space_after_for_semicolon = true 192 | ij_java_space_after_quest = true 193 | ij_java_space_after_type_cast = true 194 | ij_java_space_before_annotation_array_initializer_left_brace = false 195 | ij_java_space_before_annotation_parameter_list = false 196 | ij_java_space_before_array_initializer_left_brace = false 197 | ij_java_space_before_catch_keyword = true 198 | ij_java_space_before_catch_left_brace = true 199 | ij_java_space_before_catch_parentheses = true 200 | ij_java_space_before_class_left_brace = true 201 | ij_java_space_before_colon = true 202 | ij_java_space_before_colon_in_foreach = true 203 | ij_java_space_before_comma = false 204 | ij_java_space_before_do_left_brace = true 205 | ij_java_space_before_else_keyword = true 206 | ij_java_space_before_else_left_brace = true 207 | ij_java_space_before_finally_keyword = true 208 | ij_java_space_before_finally_left_brace = true 209 | ij_java_space_before_for_left_brace = true 210 | ij_java_space_before_for_parentheses = true 211 | ij_java_space_before_for_semicolon = false 212 | ij_java_space_before_if_left_brace = true 213 | ij_java_space_before_if_parentheses = true 214 | ij_java_space_before_method_call_parentheses = false 215 | ij_java_space_before_method_left_brace = true 216 | ij_java_space_before_method_parentheses = false 217 | ij_java_space_before_opening_angle_bracket_in_type_parameter = false 218 | ij_java_space_before_quest = true 219 | ij_java_space_before_switch_left_brace = true 220 | ij_java_space_before_switch_parentheses = true 221 | ij_java_space_before_synchronized_left_brace = true 222 | ij_java_space_before_synchronized_parentheses = true 223 | ij_java_space_before_try_left_brace = true 224 | ij_java_space_before_try_parentheses = true 225 | ij_java_space_before_type_parameter_list = false 226 | ij_java_space_before_while_keyword = true 227 | ij_java_space_before_while_left_brace = true 228 | ij_java_space_before_while_parentheses = true 229 | ij_java_space_inside_one_line_enum_braces = false 230 | ij_java_space_within_empty_array_initializer_braces = false 231 | ij_java_space_within_empty_method_call_parentheses = false 232 | ij_java_space_within_empty_method_parentheses = false 233 | ij_java_spaces_around_additive_operators = true 234 | ij_java_spaces_around_assignment_operators = true 235 | ij_java_spaces_around_bitwise_operators = true 236 | ij_java_spaces_around_equality_operators = true 237 | ij_java_spaces_around_lambda_arrow = true 238 | ij_java_spaces_around_logical_operators = true 239 | ij_java_spaces_around_method_ref_dbl_colon = false 240 | ij_java_spaces_around_multiplicative_operators = true 241 | ij_java_spaces_around_relational_operators = true 242 | ij_java_spaces_around_shift_operators = true 243 | ij_java_spaces_around_type_bounds_in_type_parameters = true 244 | ij_java_spaces_around_unary_operator = false 245 | ij_java_spaces_within_angle_brackets = false 246 | ij_java_spaces_within_annotation_parentheses = false 247 | ij_java_spaces_within_array_initializer_braces = false 248 | ij_java_spaces_within_braces = false 249 | ij_java_spaces_within_brackets = false 250 | ij_java_spaces_within_cast_parentheses = false 251 | ij_java_spaces_within_catch_parentheses = false 252 | ij_java_spaces_within_for_parentheses = false 253 | ij_java_spaces_within_if_parentheses = false 254 | ij_java_spaces_within_method_call_parentheses = false 255 | ij_java_spaces_within_method_parentheses = false 256 | ij_java_spaces_within_parentheses = false 257 | ij_java_spaces_within_switch_parentheses = false 258 | ij_java_spaces_within_synchronized_parentheses = false 259 | ij_java_spaces_within_try_parentheses = false 260 | ij_java_spaces_within_while_parentheses = false 261 | ij_java_special_else_if_treatment = true 262 | ij_java_subclass_name_suffix = Impl 263 | ij_java_ternary_operation_signs_on_next_line = false 264 | ij_java_ternary_operation_wrap = off 265 | ij_java_test_name_suffix = Test 266 | ij_java_throws_keyword_wrap = off 267 | ij_java_throws_list_wrap = off 268 | ij_java_use_external_annotations = false 269 | ij_java_use_fq_class_names = false 270 | ij_java_use_relative_indents = false 271 | ij_java_use_single_class_imports = true 272 | ij_java_variable_annotation_wrap = off 273 | ij_java_visibility = public 274 | ij_java_while_brace_force = never 275 | ij_java_while_on_new_line = false 276 | ij_java_wrap_comments = false 277 | ij_java_wrap_first_method_in_call_chain = false 278 | ij_java_wrap_long_lines = false 279 | 280 | [.editorconfig] 281 | ij_editorconfig_align_group_field_declarations = false 282 | ij_editorconfig_space_after_colon = false 283 | ij_editorconfig_space_after_comma = true 284 | ij_editorconfig_space_before_colon = false 285 | ij_editorconfig_space_before_comma = false 286 | ij_editorconfig_spaces_around_assignment_operators = true 287 | 288 | [{*.bash,*.zsh,*.sh}] 289 | indent_size = 2 290 | tab_width = 2 291 | ij_shell_binary_ops_start_line = false 292 | ij_shell_keep_column_alignment_padding = false 293 | ij_shell_minify_program = false 294 | ij_shell_redirect_followed_by_space = false 295 | ij_shell_switch_cases_indented = false 296 | 297 | [{*.cjs,*.js}] 298 | ij_continuation_indent_size = 4 299 | ij_javascript_align_imports = false 300 | ij_javascript_align_multiline_array_initializer_expression = false 301 | ij_javascript_align_multiline_binary_operation = false 302 | ij_javascript_align_multiline_chained_methods = false 303 | ij_javascript_align_multiline_extends_list = false 304 | ij_javascript_align_multiline_for = true 305 | ij_javascript_align_multiline_parameters = true 306 | ij_javascript_align_multiline_parameters_in_calls = false 307 | ij_javascript_align_multiline_ternary_operation = false 308 | ij_javascript_align_object_properties = 0 309 | ij_javascript_align_union_types = false 310 | ij_javascript_align_var_statements = 0 311 | ij_javascript_array_initializer_new_line_after_left_brace = false 312 | ij_javascript_array_initializer_right_brace_on_new_line = false 313 | ij_javascript_array_initializer_wrap = off 314 | ij_javascript_assignment_wrap = off 315 | ij_javascript_binary_operation_sign_on_next_line = false 316 | ij_javascript_binary_operation_wrap = off 317 | ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**/*,@angular/material,@angular/material/typings/** 318 | ij_javascript_blank_lines_after_imports = 1 319 | ij_javascript_blank_lines_around_class = 1 320 | ij_javascript_blank_lines_around_field = 0 321 | ij_javascript_blank_lines_around_function = 1 322 | ij_javascript_blank_lines_around_method = 1 323 | ij_javascript_block_brace_style = end_of_line 324 | ij_javascript_call_parameters_new_line_after_left_paren = false 325 | ij_javascript_call_parameters_right_paren_on_new_line = false 326 | ij_javascript_call_parameters_wrap = off 327 | ij_javascript_catch_on_new_line = false 328 | ij_javascript_chained_call_dot_on_new_line = true 329 | ij_javascript_class_brace_style = end_of_line 330 | ij_javascript_comma_on_new_line = false 331 | ij_javascript_do_while_brace_force = never 332 | ij_javascript_else_on_new_line = false 333 | ij_javascript_enforce_trailing_comma = keep 334 | ij_javascript_extends_keyword_wrap = off 335 | ij_javascript_extends_list_wrap = off 336 | ij_javascript_field_prefix = _ 337 | ij_javascript_file_name_style = relaxed 338 | ij_javascript_finally_on_new_line = false 339 | ij_javascript_for_brace_force = never 340 | ij_javascript_for_statement_new_line_after_left_paren = false 341 | ij_javascript_for_statement_right_paren_on_new_line = false 342 | ij_javascript_for_statement_wrap = off 343 | ij_javascript_force_quote_style = false 344 | ij_javascript_force_semicolon_style = false 345 | ij_javascript_function_expression_brace_style = end_of_line 346 | ij_javascript_if_brace_force = never 347 | ij_javascript_import_merge_members = global 348 | ij_javascript_import_prefer_absolute_path = global 349 | ij_javascript_import_sort_members = true 350 | ij_javascript_import_sort_module_name = false 351 | ij_javascript_import_use_node_resolution = true 352 | ij_javascript_imports_wrap = on_every_item 353 | ij_javascript_indent_case_from_switch = true 354 | ij_javascript_indent_chained_calls = true 355 | ij_javascript_indent_package_children = 0 356 | ij_javascript_jsx_attribute_value = braces 357 | ij_javascript_keep_blank_lines_in_code = 2 358 | ij_javascript_keep_first_column_comment = true 359 | ij_javascript_keep_indents_on_empty_lines = false 360 | ij_javascript_keep_line_breaks = true 361 | ij_javascript_keep_simple_blocks_in_one_line = false 362 | ij_javascript_keep_simple_methods_in_one_line = false 363 | ij_javascript_line_comment_add_space = true 364 | ij_javascript_line_comment_at_first_column = false 365 | ij_javascript_method_brace_style = end_of_line 366 | ij_javascript_method_call_chain_wrap = off 367 | ij_javascript_method_parameters_new_line_after_left_paren = false 368 | ij_javascript_method_parameters_right_paren_on_new_line = false 369 | ij_javascript_method_parameters_wrap = off 370 | ij_javascript_object_literal_wrap = on_every_item 371 | ij_javascript_parentheses_expression_new_line_after_left_paren = false 372 | ij_javascript_parentheses_expression_right_paren_on_new_line = false 373 | ij_javascript_place_assignment_sign_on_next_line = false 374 | ij_javascript_prefer_as_type_cast = false 375 | ij_javascript_prefer_parameters_wrap = false 376 | ij_javascript_reformat_c_style_comments = false 377 | ij_javascript_space_after_colon = true 378 | ij_javascript_space_after_comma = true 379 | ij_javascript_space_after_dots_in_rest_parameter = false 380 | ij_javascript_space_after_generator_mult = true 381 | ij_javascript_space_after_property_colon = true 382 | ij_javascript_space_after_quest = true 383 | ij_javascript_space_after_type_colon = true 384 | ij_javascript_space_after_unary_not = false 385 | ij_javascript_space_before_async_arrow_lparen = true 386 | ij_javascript_space_before_catch_keyword = true 387 | ij_javascript_space_before_catch_left_brace = true 388 | ij_javascript_space_before_catch_parentheses = true 389 | ij_javascript_space_before_class_lbrace = true 390 | ij_javascript_space_before_class_left_brace = true 391 | ij_javascript_space_before_colon = true 392 | ij_javascript_space_before_comma = false 393 | ij_javascript_space_before_do_left_brace = true 394 | ij_javascript_space_before_else_keyword = true 395 | ij_javascript_space_before_else_left_brace = true 396 | ij_javascript_space_before_finally_keyword = true 397 | ij_javascript_space_before_finally_left_brace = true 398 | ij_javascript_space_before_for_left_brace = true 399 | ij_javascript_space_before_for_parentheses = true 400 | ij_javascript_space_before_for_semicolon = false 401 | ij_javascript_space_before_function_left_parenth = true 402 | ij_javascript_space_before_generator_mult = false 403 | ij_javascript_space_before_if_left_brace = true 404 | ij_javascript_space_before_if_parentheses = true 405 | ij_javascript_space_before_method_call_parentheses = false 406 | ij_javascript_space_before_method_left_brace = true 407 | ij_javascript_space_before_method_parentheses = false 408 | ij_javascript_space_before_property_colon = false 409 | ij_javascript_space_before_quest = true 410 | ij_javascript_space_before_switch_left_brace = true 411 | ij_javascript_space_before_switch_parentheses = true 412 | ij_javascript_space_before_try_left_brace = true 413 | ij_javascript_space_before_type_colon = false 414 | ij_javascript_space_before_unary_not = false 415 | ij_javascript_space_before_while_keyword = true 416 | ij_javascript_space_before_while_left_brace = true 417 | ij_javascript_space_before_while_parentheses = true 418 | ij_javascript_spaces_around_additive_operators = true 419 | ij_javascript_spaces_around_arrow_function_operator = true 420 | ij_javascript_spaces_around_assignment_operators = true 421 | ij_javascript_spaces_around_bitwise_operators = true 422 | ij_javascript_spaces_around_equality_operators = true 423 | ij_javascript_spaces_around_logical_operators = true 424 | ij_javascript_spaces_around_multiplicative_operators = true 425 | ij_javascript_spaces_around_relational_operators = true 426 | ij_javascript_spaces_around_shift_operators = true 427 | ij_javascript_spaces_around_unary_operator = false 428 | ij_javascript_spaces_within_array_initializer_brackets = false 429 | ij_javascript_spaces_within_brackets = false 430 | ij_javascript_spaces_within_catch_parentheses = false 431 | ij_javascript_spaces_within_for_parentheses = false 432 | ij_javascript_spaces_within_if_parentheses = false 433 | ij_javascript_spaces_within_imports = false 434 | ij_javascript_spaces_within_interpolation_expressions = false 435 | ij_javascript_spaces_within_method_call_parentheses = false 436 | ij_javascript_spaces_within_method_parentheses = false 437 | ij_javascript_spaces_within_object_literal_braces = false 438 | ij_javascript_spaces_within_object_type_braces = true 439 | ij_javascript_spaces_within_parentheses = false 440 | ij_javascript_spaces_within_switch_parentheses = false 441 | ij_javascript_spaces_within_type_assertion = false 442 | ij_javascript_spaces_within_union_types = true 443 | ij_javascript_spaces_within_while_parentheses = false 444 | ij_javascript_special_else_if_treatment = true 445 | ij_javascript_ternary_operation_signs_on_next_line = false 446 | ij_javascript_ternary_operation_wrap = off 447 | ij_javascript_union_types_wrap = on_every_item 448 | ij_javascript_use_chained_calls_group_indents = false 449 | ij_javascript_use_double_quotes = true 450 | ij_javascript_use_explicit_js_extension = global 451 | ij_javascript_use_path_mapping = always 452 | ij_javascript_use_public_modifier = false 453 | ij_javascript_use_semicolon_after_statement = true 454 | ij_javascript_var_declaration_wrap = normal 455 | ij_javascript_while_brace_force = never 456 | ij_javascript_while_on_new_line = false 457 | ij_javascript_wrap_comments = false 458 | 459 | [{*.jhm,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.wadl,*.tld,*.fxml,*.jrxml,*.xml,*.jnlp,*.wsdl,*.wsdd,*.pom,*.xjb}] 460 | ij_xml_block_comment_at_first_column = true 461 | ij_xml_keep_indents_on_empty_lines = false 462 | ij_xml_line_comment_at_first_column = true 463 | 464 | [{*.kt,*.kts}] 465 | ij_kotlin_align_in_columns_case_branch = false 466 | ij_kotlin_align_multiline_binary_operation = false 467 | ij_kotlin_align_multiline_extends_list = false 468 | ij_kotlin_align_multiline_method_parentheses = false 469 | ij_kotlin_align_multiline_parameters = true 470 | ij_kotlin_align_multiline_parameters_in_calls = false 471 | ij_kotlin_assignment_wrap = off 472 | ij_kotlin_blank_lines_after_class_header = 0 473 | ij_kotlin_blank_lines_around_block_when_branches = 0 474 | ij_kotlin_block_comment_at_first_column = true 475 | ij_kotlin_call_parameters_new_line_after_left_paren = false 476 | ij_kotlin_call_parameters_right_paren_on_new_line = false 477 | ij_kotlin_call_parameters_wrap = off 478 | ij_kotlin_catch_on_new_line = false 479 | ij_kotlin_class_annotation_wrap = split_into_lines 480 | ij_kotlin_continuation_indent_for_chained_calls = true 481 | ij_kotlin_continuation_indent_for_expression_bodies = true 482 | ij_kotlin_continuation_indent_in_argument_lists = true 483 | ij_kotlin_continuation_indent_in_elvis = true 484 | ij_kotlin_continuation_indent_in_if_conditions = true 485 | ij_kotlin_continuation_indent_in_parameter_lists = true 486 | ij_kotlin_continuation_indent_in_supertype_lists = true 487 | ij_kotlin_else_on_new_line = false 488 | ij_kotlin_enum_constants_wrap = off 489 | ij_kotlin_extends_list_wrap = off 490 | ij_kotlin_field_annotation_wrap = split_into_lines 491 | ij_kotlin_finally_on_new_line = false 492 | ij_kotlin_if_rparen_on_new_line = false 493 | ij_kotlin_import_nested_classes = false 494 | ij_kotlin_insert_whitespaces_in_simple_one_line_method = true 495 | ij_kotlin_keep_blank_lines_before_right_brace = 2 496 | ij_kotlin_keep_blank_lines_in_code = 2 497 | ij_kotlin_keep_blank_lines_in_declarations = 2 498 | ij_kotlin_keep_first_column_comment = true 499 | ij_kotlin_keep_indents_on_empty_lines = false 500 | ij_kotlin_keep_line_breaks = true 501 | ij_kotlin_lbrace_on_next_line = false 502 | ij_kotlin_line_comment_add_space = false 503 | ij_kotlin_line_comment_at_first_column = true 504 | ij_kotlin_method_annotation_wrap = split_into_lines 505 | ij_kotlin_method_call_chain_wrap = off 506 | ij_kotlin_method_parameters_new_line_after_left_paren = false 507 | ij_kotlin_method_parameters_right_paren_on_new_line = false 508 | ij_kotlin_method_parameters_wrap = off 509 | ij_kotlin_name_count_to_use_star_import = 2147483647 510 | ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 511 | ij_kotlin_parameter_annotation_wrap = off 512 | ij_kotlin_space_after_comma = true 513 | ij_kotlin_space_after_extend_colon = true 514 | ij_kotlin_space_after_type_colon = true 515 | ij_kotlin_space_before_catch_parentheses = true 516 | ij_kotlin_space_before_comma = false 517 | ij_kotlin_space_before_extend_colon = true 518 | ij_kotlin_space_before_for_parentheses = true 519 | ij_kotlin_space_before_if_parentheses = true 520 | ij_kotlin_space_before_lambda_arrow = true 521 | ij_kotlin_space_before_type_colon = false 522 | ij_kotlin_space_before_when_parentheses = true 523 | ij_kotlin_space_before_while_parentheses = true 524 | ij_kotlin_spaces_around_additive_operators = true 525 | ij_kotlin_spaces_around_assignment_operators = true 526 | ij_kotlin_spaces_around_equality_operators = true 527 | ij_kotlin_spaces_around_function_type_arrow = true 528 | ij_kotlin_spaces_around_logical_operators = true 529 | ij_kotlin_spaces_around_multiplicative_operators = true 530 | ij_kotlin_spaces_around_range = false 531 | ij_kotlin_spaces_around_relational_operators = true 532 | ij_kotlin_spaces_around_unary_operator = false 533 | ij_kotlin_spaces_around_when_arrow = true 534 | ij_kotlin_variable_annotation_wrap = off 535 | ij_kotlin_while_on_new_line = false 536 | ij_kotlin_wrap_elvis_expressions = 1 537 | ij_kotlin_wrap_expression_body_functions = 0 538 | ij_kotlin_wrap_first_method_in_call_chain = false 539 | 540 | [{*.ng,*.html,*.shtm,*.sht,*.shtml,*.htm}] 541 | ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 542 | ij_html_align_attributes = true 543 | ij_html_align_text = false 544 | ij_html_attribute_wrap = normal 545 | ij_html_block_comment_at_first_column = true 546 | ij_html_do_not_align_children_of_min_lines = 0 547 | ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p 548 | ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot 549 | ij_html_enforce_quotes = false 550 | ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var 551 | ij_html_keep_blank_lines = 2 552 | ij_html_keep_indents_on_empty_lines = false 553 | ij_html_keep_line_breaks = true 554 | ij_html_keep_line_breaks_in_text = true 555 | ij_html_keep_whitespaces = false 556 | ij_html_keep_whitespaces_inside = span,pre,textarea 557 | ij_html_line_comment_at_first_column = true 558 | ij_html_new_line_after_last_attribute = never 559 | ij_html_new_line_before_first_attribute = never 560 | ij_html_quote_style = double 561 | ij_html_remove_new_line_before_tags = br 562 | ij_html_space_after_tag_name = false 563 | ij_html_space_around_equality_in_attribute = false 564 | ij_html_space_inside_empty_tag = false 565 | ij_html_text_wrap = normal 566 | 567 | [{*.yml,*.yaml}] 568 | indent_size = 2 569 | ij_yaml_keep_indents_on_empty_lines = false 570 | ij_yaml_keep_line_breaks = true 571 | 572 | [{.asciidoctorconfig,*.adoc,*.asciidoc,*.ad}] 573 | ij_asciidoc_formatting_enabled = true 574 | ij_asciidoc_one_sentence_per_line = true 575 | 576 | [{.eslintrc,.stylelintrc,jest.config,.babelrc,bowerrc,*.json,*.jsb3,*.jsb2}] 577 | indent_size = 2 578 | ij_json_keep_blank_lines_in_code = 0 579 | ij_json_keep_indents_on_empty_lines = false 580 | ij_json_keep_line_breaks = true 581 | ij_json_space_after_colon = true 582 | ij_json_space_after_comma = true 583 | ij_json_space_before_colon = true 584 | ij_json_space_before_comma = false 585 | ij_json_spaces_within_braces = false 586 | ij_json_spaces_within_brackets = false 587 | ij_json_wrap_long_lines = false 588 | 589 | [{spring.handlers,spring.schemas,*.properties}] 590 | ij_properties_align_group_field_declarations = false 591 | --------------------------------------------------------------------------------