├── macro └── .gitignore ├── docker ├── fakes3 │ ├── run.sh │ └── Dockerfile ├── mariadb │ ├── run.sh │ ├── connectToCF.sh │ ├── scripts │ │ ├── m1_schema.sql │ │ ├── m2_schema.sql │ │ ├── normal_run.sh │ │ ├── start.sh │ │ ├── first_run.sh │ │ └── sql │ │ │ └── db_schema.sql │ ├── exportXMLSchema.sh │ ├── cleanAllDockerImages.sh │ └── Dockerfile └── docker-fake-smtp │ └── run.sh ├── project ├── build.properties ├── GenerateParametersTrait.scala ├── plugins.sbt ├── GenerateParametersMapping.scala └── GenerateTuples.scala ├── src ├── main │ ├── resources │ │ ├── envvars.conf │ │ ├── vorlagen │ │ │ ├── esr.png │ │ │ ├── Mahnung.odt │ │ │ ├── Depotbrief.odt │ │ │ ├── Rechnung.odt │ │ │ ├── Auslieferung.odt │ │ │ ├── Korbdetails.odt │ │ │ ├── Kundenbrief.odt │ │ │ ├── Arbeitsangebote.odt │ │ │ ├── Arbeitseinsatz.odt │ │ │ ├── Korbuebersicht.odt │ │ │ ├── Lieferplanung.odt │ │ │ ├── RechnungQrCode.odt │ │ │ ├── DepotLieferschein.odt │ │ │ ├── PostLieferschein.odt │ │ │ ├── Produzentenbrief.odt │ │ │ ├── TourLieferschein.odt │ │ │ ├── DepotLieferetiketten.odt │ │ │ ├── PostLieferetiketten.odt │ │ │ ├── TourLieferetiketten.odt │ │ │ └── Produzentenabrechnung.odt │ │ ├── import_data_dev.ods │ │ ├── reporting │ │ │ └── SimpleReportTemplate.odt │ │ ├── openolitor-server-test-logback-sunu.xml │ │ ├── openolitor-server-testprod-sunu-logback.xml │ │ ├── openolitor-server-test-logback.xml │ │ ├── openolitor-server-int-logback.xml │ │ ├── openolitor-server-prod-logback.xml │ │ └── openolitor-server-testprod-logback.xml │ └── scala │ │ └── ch │ │ └── openolitor │ │ ├── core │ │ ├── repositories │ │ │ ├── BaseParameter.scala │ │ │ ├── BaseUpdateRepositoryComponent.scala │ │ │ ├── BaseWriteRepositoryComponent.scala │ │ │ └── CoreReadRepositoryComponent.scala │ │ ├── filestore │ │ │ ├── FileStoreReference.scala │ │ │ ├── FileStoreJsonProtocol.scala │ │ │ └── FileStoreComponent.scala │ │ ├── domain │ │ │ └── DefaultMessages.scala │ │ ├── exceptions │ │ │ └── InvalidStateException.scala │ │ ├── models │ │ │ ├── Defaults.scala │ │ │ └── ModificationFlags.scala │ │ ├── FileStoreReference.scala │ │ ├── security │ │ │ ├── TokenCache.scala │ │ │ └── RoleBasedAuthorization.scala │ │ ├── DateFormats.scala │ │ ├── ExecutionContextAware.scala │ │ ├── db │ │ │ ├── DbNameFixer.scala │ │ │ ├── evolution │ │ │ │ └── scripts │ │ │ │ │ ├── v1 │ │ │ │ │ ├── OO382_DBScripts.scala │ │ │ │ │ ├── OO618_DBScripts.scala │ │ │ │ │ ├── OO337_DBScripts.scala │ │ │ │ │ ├── OO433_DBScripts.scala │ │ │ │ │ ├── OO468_DBScripts.scala │ │ │ │ │ ├── OO499_DBScripts.scala │ │ │ │ │ ├── OO564_DBScripts.scala │ │ │ │ │ ├── OO476_DBScripts.scala │ │ │ │ │ ├── OO311_DBScripts.scala │ │ │ │ │ └── OO506_DBScripts.scala │ │ │ │ │ ├── Scripts.scala │ │ │ │ │ └── v2 │ │ │ │ │ └── OOBetrieb2_recalculate_aktive_inaktive_accounts.scala │ │ │ ├── ConnectionPoolContextAware.scala │ │ │ └── AsyncConnectionPoolContextAware.scala │ │ ├── mailservice │ │ │ └── MailJsonProtocol.scala │ │ ├── system │ │ │ ├── StatusJsonProtocol.scala │ │ │ └── SystemJsonProtocol.scala │ │ ├── scalax │ │ │ └── CustomTuple.scala │ │ ├── eventsourcing │ │ │ ├── PersistenceJsonProtocol.scala │ │ │ └── CoreEventStoreSerializer.scala │ │ ├── reporting │ │ │ └── models │ │ │ │ └── ReportModels.scala │ │ └── ws │ │ │ └── ExportFormat.scala │ │ ├── util │ │ ├── parsing │ │ │ ├── UriQueryFilterParserAST.scala │ │ │ ├── UriQueryParamGeschaeftsjahrParserAST.scala │ │ │ ├── UriQueryFilterParser.scala │ │ │ └── UriQueryParamGeschaeftsjahrParser.scala │ │ ├── IdUtil.scala │ │ ├── IteratorUtil.scala │ │ ├── InputStreamUtil.scala │ │ ├── ByteStringUtil.scala │ │ ├── ZipBuilderWithFile.scala │ │ └── StringUtil.scala │ │ ├── kundenportal │ │ ├── models │ │ │ └── BelongingTo.scala │ │ └── repositories │ │ │ ├── KundenportalReadRepositoryAsyncComponent.scala │ │ │ └── KundenportalInsertRepository.scala │ │ ├── helloworld │ │ └── HelloWorldJsonProtocol.scala │ │ ├── buchhaltung │ │ ├── zahlungsimport │ │ │ └── esr │ │ │ │ └── ZahlungsImportEsrRecords.scala │ │ └── repositories │ │ │ ├── BuchhaltungReadRepositoryAsyncComponent.scala │ │ │ ├── BuchhaltungDeleteRepository.scala │ │ │ └── BuchhaltungInsertRepository.scala │ │ ├── reports │ │ └── repositories │ │ │ ├── ReportsReadRepositoryAsyncComponent.scala │ │ │ ├── ReportsDeleteRepository.scala │ │ │ ├── ReportsInsertRepository.scala │ │ │ └── ReportsUpdateRepository.scala │ │ ├── stammdaten │ │ ├── LieferungDurchschnittspreisHandler.scala │ │ ├── MailCommandForwarderComponent.scala │ │ └── repositories │ │ │ ├── StammdatenReadRepositoryAsyncComponent.scala │ │ │ └── StammdatenInsertRepository.scala │ │ ├── arbeitseinsatz │ │ └── repositories │ │ │ ├── ArbeitseinsatzReadRepositoryAsyncComponent.scala │ │ │ ├── ArbeitseinsatzDeleteRepository.scala │ │ │ └── ArbeitseinsatzInsertRepository.scala │ │ └── mailtemplates │ │ └── repositories │ │ └── MailTemplateWriteRepository.scala ├── test │ ├── resources │ │ ├── VorlageKorbUebersichtGnu.odt │ │ ├── mock_db_dump.sh │ │ ├── mock_db_schema_init.sh │ │ ├── mock_db_pump.sh │ │ ├── esrimport_with_blank_lines.esr │ │ └── camt_054_Beispiel_ZA1_ESR_ZE.xml │ └── scala │ │ └── ch │ │ └── openolitor │ │ ├── stammdaten │ │ ├── repositories │ │ │ └── MockStammdatenReadRepositoryComponent.scala │ │ ├── MockStammdatenRoutes.scala │ │ └── StammdatenRoutesProjektSpec.scala │ │ ├── buchhaltung │ │ ├── repositories │ │ │ └── MockBuchhaltungReadRepositoryComponent.scala │ │ └── MockBuchhaltungRoutes.scala │ │ ├── core │ │ ├── config │ │ │ └── ModifyingSystemConfigReference.scala │ │ ├── db │ │ │ ├── MockDB.scala │ │ │ ├── WithWriteRepositories.scala │ │ │ └── TestDB.scala │ │ ├── filestore │ │ │ ├── MockFileStoreComponent.scala │ │ │ └── WithInMemoryFileStore.scala │ │ ├── util │ │ │ └── WithInMemoryPdfGenerator.scala │ │ ├── MockActorReferences.scala │ │ ├── ws │ │ │ └── MockClientMessagesRouteService.scala │ │ ├── MockInMemoryActorReferences.scala │ │ ├── WsInteractionsForReports.scala │ │ ├── SpecSubjects.scala │ │ └── mailservice │ │ │ └── MailServiceMock.scala │ │ ├── kundenportal │ │ └── MockKundenportalRoutes.scala │ │ └── arbeitseinsatz │ │ └── MockArbeitseinsatzRoutes.scala └── universal │ └── conf │ └── application.ini ├── check_system.sh ├── .sbtopts ├── import_data.sh ├── .scala-steward.conf ├── .github └── workflows │ ├── dependency-graph.yml │ ├── sbt-docker-publish.yml │ ├── sbt-docker-prepublish.yml │ └── sbt-test.yml ├── .gitignore ├── .run ├── Openolitor.run.xml ├── ReportDocumentProcessorApp - Tourlieferung.run.xml └── ReportDocumentProcessorApp.run.xml └── README.md /macro/.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | -------------------------------------------------------------------------------- /docker/fakes3/run.sh: -------------------------------------------------------------------------------- 1 | docker run -p 4569:4569 $@ 2 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version=1.11.3 2 | 3 | -------------------------------------------------------------------------------- /docker/mariadb/run.sh: -------------------------------------------------------------------------------- 1 | docker run -p 3307:3306 -e PASS=openolitor $@ 2 | -------------------------------------------------------------------------------- /src/main/resources/envvars.conf: -------------------------------------------------------------------------------- 1 | environment-config-list=["VCAP_SERVICES", "OO_SERVICES"] 2 | -------------------------------------------------------------------------------- /check_system.sh: -------------------------------------------------------------------------------- 1 | curl -v -u admin@openolitor.ch:admin http://localhost:9003/m1/admin/status 2 | -------------------------------------------------------------------------------- /docker/mariadb/connectToCF.sh: -------------------------------------------------------------------------------- 1 | cf ssh -L 13000:galera-service.service.consul:3306 openolitor-server-test 2 | -------------------------------------------------------------------------------- /docker/mariadb/scripts/m1_schema.sql: -------------------------------------------------------------------------------- 1 | create database m1; 2 | use m1; 3 | 4 | source /scripts/sql/db_schema.sql 5 | -------------------------------------------------------------------------------- /docker/mariadb/scripts/m2_schema.sql: -------------------------------------------------------------------------------- 1 | create database m2; 2 | use m2; 3 | 4 | source /scripts/sql/db_schema.sql 5 | -------------------------------------------------------------------------------- /.sbtopts: -------------------------------------------------------------------------------- 1 | -J-Xmx6g 2 | -J-XX:+UseCodeCacheFlushing 3 | -J-XX:ReservedCodeCacheSize=128m 4 | -J-XX:MaxMetaspaceSize=512M 5 | -------------------------------------------------------------------------------- /docker/docker-fake-smtp/run.sh: -------------------------------------------------------------------------------- 1 | docker run -d --name fakesmtp -p 1025:25 -v /tmp/fakemail:/var/mail digiplant/fake-smtp 2 | -------------------------------------------------------------------------------- /docker/mariadb/exportXMLSchema.sh: -------------------------------------------------------------------------------- 1 | mysqldump --xml --no-data -u super -popenolitor -P 3307 -h 127.0.0.1 m1 > oo_schema.xml 2 | -------------------------------------------------------------------------------- /src/main/resources/vorlagen/esr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/esr.png -------------------------------------------------------------------------------- /docker/fakes3/Dockerfile: -------------------------------------------------------------------------------- 1 | #Fake-s3 (https://hub.docker.com/r/lphoward/fake-s3/) 2 | 3 | FROM lphoward/fake-s3 4 | MAINTAINER me 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/import_data_dev.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/import_data_dev.ods -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Mahnung.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Mahnung.odt -------------------------------------------------------------------------------- /docker/mariadb/cleanAllDockerImages.sh: -------------------------------------------------------------------------------- 1 | docker rm -v $(docker ps -a -q -f status=exited) 2 | docker rmi $(docker images -f "dangling=true" -q) 3 | -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Depotbrief.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Depotbrief.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Rechnung.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Rechnung.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Auslieferung.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Auslieferung.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Korbdetails.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Korbdetails.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Kundenbrief.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Kundenbrief.odt -------------------------------------------------------------------------------- /import_data.sh: -------------------------------------------------------------------------------- 1 | curl -v -u admin@openolitor.ch:admin -Ffile=@src/main/resources/import_data_dev.ods -F clear=true http://localhost:9003/m1/admin/import 2 | -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Arbeitsangebote.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Arbeitsangebote.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Arbeitseinsatz.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Arbeitseinsatz.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Korbuebersicht.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Korbuebersicht.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Lieferplanung.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Lieferplanung.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/RechnungQrCode.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/RechnungQrCode.odt -------------------------------------------------------------------------------- /src/test/resources/VorlageKorbUebersichtGnu.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/test/resources/VorlageKorbUebersichtGnu.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/DepotLieferschein.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/DepotLieferschein.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/PostLieferschein.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/PostLieferschein.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Produzentenbrief.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Produzentenbrief.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/TourLieferschein.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/TourLieferschein.odt -------------------------------------------------------------------------------- /src/test/resources/mock_db_dump.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # shellcheck disable=SC2046,SC2086,SC2116 3 | mysqldump --opt -u tegonal -ptegonal replace_me > dump.sql -------------------------------------------------------------------------------- /src/main/resources/vorlagen/DepotLieferetiketten.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/DepotLieferetiketten.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/PostLieferetiketten.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/PostLieferetiketten.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/TourLieferetiketten.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/TourLieferetiketten.odt -------------------------------------------------------------------------------- /src/main/resources/reporting/SimpleReportTemplate.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/reporting/SimpleReportTemplate.odt -------------------------------------------------------------------------------- /src/main/resources/vorlagen/Produzentenabrechnung.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenOlitor/openolitor-server/HEAD/src/main/resources/vorlagen/Produzentenabrechnung.odt -------------------------------------------------------------------------------- /src/test/resources/mock_db_schema_init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # shellcheck disable=SC2046,SC2086,SC2116 3 | mysql -u tegonal -ptegonal -A -D replace_me < db_schema.sql -------------------------------------------------------------------------------- /.scala-steward.conf: -------------------------------------------------------------------------------- 1 | dependencyOverrides = [{ 2 | pullRequests = { frequency = "30 days" }, 3 | dependency = { groupId = "com.amazonaws", artifactId = "aws-java-sdk-s3" } 4 | }] 5 | -------------------------------------------------------------------------------- /docker/mariadb/scripts/normal_run.sh: -------------------------------------------------------------------------------- 1 | pre_start_action() { 2 | # Cleanup previous sockets 3 | rm -f /run/mysqld/mysqld.sock 4 | } 5 | 6 | post_start_action() { 7 | : # No-op 8 | } 9 | -------------------------------------------------------------------------------- /src/universal/conf/application.ini: -------------------------------------------------------------------------------- 1 | -J-Xmx6G 2 | -J-Xms512m 3 | -J-XX:+UseShenandoahGC 4 | -J-XX:+ExitOnOutOfMemoryError 5 | -Dconfig.file=/etc/openolitor-server/application.conf 6 | -Dlogback.configurationFile=/etc/openolitor-server/logback.xml 7 | -------------------------------------------------------------------------------- /project/GenerateParametersTrait.scala: -------------------------------------------------------------------------------- 1 | object GenerateParametersTrait { 2 | def apply(n: Int): String = { 3 | s""" 4 | package ch.openolitor.core.repositories 5 | 6 | trait Parameters extends ${(1 to n) map (i => s"Parameters$i") mkString (" with ")}""" 7 | } 8 | } -------------------------------------------------------------------------------- /.github/workflows/dependency-graph.yml: -------------------------------------------------------------------------------- 1 | name: Update Dependency Graph 2 | on: 3 | push: 4 | branches: 5 | - prod 6 | jobs: 7 | dependency-graph: 8 | name: Update Dependency Graph 9 | runs-on: ubuntu-22.04 10 | steps: 11 | - uses: actions/checkout@v4 12 | - uses: scalacenter/sbt-dependency-submission@v2 13 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/stammdaten/repositories/MockStammdatenReadRepositoryComponent.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.stammdaten.repositories 2 | 3 | import org.specs2.mock.Mockito 4 | 5 | trait MockStammdatenReadRepositoryComponent extends StammdatenReadRepositoryAsyncComponent with Mockito { 6 | override val stammdatenReadRepository: StammdatenReadRepositoryAsync = mock[StammdatenReadRepositoryAsync] 7 | } 8 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/buchhaltung/repositories/MockBuchhaltungReadRepositoryComponent.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.buchhaltung.repositories 2 | 3 | import org.specs2.mock.Mockito 4 | 5 | trait MockBuchhaltungReadRepositoryComponent extends BuchhaltungReadRepositoryAsyncComponent with Mockito { 6 | override val buchhaltungReadRepository: BuchhaltungReadRepositoryAsync = mock[BuchhaltungReadRepositoryAsync] 7 | } 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.log 3 | 4 | # sbt specific 5 | .cache 6 | .cache-* 7 | .history 8 | .lib/ 9 | .sbt 10 | dist/* 11 | target/ 12 | lib_managed/ 13 | src_managed/ 14 | project/boot/ 15 | project/plugins/project/ 16 | 17 | # Scala-IDE specific 18 | .scala_dependencies 19 | .worksheet 20 | .classpath 21 | .project 22 | .settings 23 | /bin/ 24 | .idea 25 | .bsp 26 | 27 | # ensime 28 | .ensime 29 | .ensime_cache 30 | ensime.sbt 31 | 32 | # ctags 33 | tags 34 | 35 | # vim 36 | *~ 37 | 38 | # Intellij Idea specifics 39 | .idea/* 40 | -------------------------------------------------------------------------------- /.run/Openolitor.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.11.1") 2 | 3 | addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3") 4 | addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") 5 | 6 | addSbtPlugin("org.scalaxb" % "sbt-scalaxb" % "1.12.2") 7 | 8 | addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.1") 9 | //addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.10") 10 | 11 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.1") 12 | 13 | dependencyOverrides += "org.scala-lang.modules" %% "scala-xml" % "2.4.0" 14 | -------------------------------------------------------------------------------- /src/test/resources/mock_db_pump.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # shellcheck disable=SC2046,SC2086,SC2116 6 | mysql -u root -ptegonal -e "DROP DATABASE IF EXISTS $1;" 7 | mysql -u root -ptegonal -e "CREATE DATABASE $1;" 8 | mysql -u root -ptegonal -e "GRANT ALL PRIVILEGES ON $1.* TO 'tegonal'@'%';" 9 | mysql -u root -ptegonal -e "FLUSH PRIVILEGES;" 10 | mysql -u tegonal -ptegonal -A -D"$1" < dump.sql 11 | mysql -u root -ptegonal -e "SHOW DATABASES;" 12 | mysql -u root -ptegonal -Dreplace_me -e "SHOW TABLES;" 13 | mysql -u tegonal -ptegonal -D"$1" -e "SHOW TABLES;" -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/config/ModifyingSystemConfigReference.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core.config 2 | 3 | import ch.openolitor.core.{ MandantConfiguration, SystemConfig, SystemConfigReference } 4 | import com.tegonal.CFEnvConfigLoader.ConfigLoader 5 | 6 | trait ModifyingSystemConfigReference extends SystemConfigReference { 7 | override lazy val config = modifyConfig() 8 | override lazy val sysConfig = SystemConfig(MandantConfiguration("test", "test", "", 0, 0, Map(), config.getConfig("openolitor.test")), null, null) 9 | 10 | protected def modifyConfig() = ConfigLoader.loadConfig 11 | } 12 | -------------------------------------------------------------------------------- /docker/mariadb/scripts/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Starts up MariaDB within the container. 3 | 4 | # Stop on error 5 | set -e 6 | 7 | DATA_DIR=/data 8 | 9 | if [[ -e /firstrun ]]; then 10 | source /scripts/first_run.sh 11 | else 12 | source /scripts/normal_run.sh 13 | fi 14 | 15 | wait_for_mysql_and_run_post_start_action() { 16 | # Wait for mysql to finish starting up first. 17 | while [[ ! -e /run/mysqld/mysqld.sock ]] ; do 18 | inotifywait -q -e create /run/mysqld/ >> /dev/null 19 | done 20 | 21 | post_start_action 22 | } 23 | 24 | pre_start_action 25 | 26 | wait_for_mysql_and_run_post_start_action & 27 | 28 | # Start MariaDB 29 | echo "Starting MariaDB..." 30 | exec /usr/bin/mysqld_safe 31 | -------------------------------------------------------------------------------- /src/test/resources/esrimport_with_blank_lines.esr: -------------------------------------------------------------------------------- 1 | 0020000000000000003078431000700030001000000038400110522483513110413110513110500668965100000000000000 2 | 3 | 1020000000000000003078431000700030715000000024000112831273513112713112813112800047024800000000000000 4 | 0020000000000000003078431000700032003000000024000112831273513112713112813112800333047500000000000000 5 | 6 | 7 | 0020000000000000003078431000700031530000000024000112831273513112713112813112800338084700000000000000 8 | 999000000000999999999999999999999999999000005721600000000000224140126000000000000000000 9 | 10 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/db/MockDB.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core.db 2 | 3 | import ch.openolitor.core.SystemConfigReference 4 | import scalikejdbc.ConnectionPool 5 | 6 | trait MockDBComponent extends SystemConfigReference with ConnectionPoolContextAware with AsyncConnectionPoolContextAware { 7 | def initializeConnectionPool(): Unit = { 8 | ConnectionPool.singleton(sysConfig.mandantConfiguration.config.getString("db.default.url"), "tegonal", "tegonal") 9 | } 10 | 11 | override implicit def connectionPoolContext = MandantDBs(sysConfig.mandantConfiguration).connectionPoolContext() 12 | 13 | override implicit def asyncConnectionPoolContext = AsyncMandantDBs(sysConfig.mandantConfiguration).connectionPoolContext() 14 | } 15 | -------------------------------------------------------------------------------- /.run/ReportDocumentProcessorApp - Tourlieferung.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /project/GenerateParametersMapping.scala: -------------------------------------------------------------------------------- 1 | object GenerateParametersMapping { 2 | def apply(n: Int): String = { 3 | s""" 4 | package ch.openolitor.core.repositories 5 | 6 | import scalikejdbc._ 7 | ${if (n > 22) "import ch.openolitor.core.scalax.Tuple"+n else ""} 8 | 9 | trait Parameters$n extends BaseParameter { 10 | def parameters[${(1 to n) map (i => s"T$i") mkString (",")}](params: Tuple$n[${(1 to n) map (i => s"T$i") mkString (",")}])( 11 | implicit 12 | ${(1 to n) map{ i => 13 | s"binder$i: Binders[T$i]" 14 | } mkString (",")} 15 | ): Seq[ParameterBinder] = { 16 | Seq( 17 | ${(1 to n) map{ i => 18 | s"binder$i(params._$i)" 19 | } mkString (",")} 20 | ) 21 | } 22 | } 23 | """ 24 | } 25 | } -------------------------------------------------------------------------------- /.run/ReportDocumentProcessorApp.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/filestore/MockFileStoreComponent.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core.filestore 2 | 3 | import akka.actor.ActorSystem 4 | import ch.openolitor.core.MandantConfiguration 5 | 6 | import scala.collection.concurrent.TrieMap 7 | 8 | trait MockFileStoreComponent extends FileStoreComponent { 9 | override lazy val fileStore = MockFileStoreComponent.MockFileStore(sysConfig.mandantConfiguration, system) 10 | } 11 | 12 | object MockFileStoreComponent { 13 | private val s3UrlToFileStore = TrieMap.empty[String, S3FileStore] 14 | 15 | def MockFileStore(mandantConfiguration: MandantConfiguration, actorSystem: ActorSystem) = { 16 | s3UrlToFileStore.getOrElseUpdate(mandantConfiguration.config.getString("s3.aws-access-key-id"), S3FileStore(mandantConfiguration, actorSystem)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/kundenportal/MockKundenportalRoutes.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.kundenportal 2 | 3 | import akka.actor.ActorSystem 4 | import ch.openolitor.core.{ MockInMemoryActorReferences, SystemConfig } 5 | import ch.openolitor.core.db.MockDBComponent 6 | import ch.openolitor.core.filestore.MockFileStoreComponent 7 | import ch.openolitor.kundenportal.repositories.DefaultKundenportalReadRepositoryAsyncComponent 8 | 9 | import scala.concurrent.ExecutionContext 10 | 11 | class MockKundenportalRoutes(override val sysConfig: SystemConfig, override val system: ActorSystem)(override implicit protected val executionContext: ExecutionContext) extends KundenportalRoutes 12 | with DefaultKundenportalReadRepositoryAsyncComponent 13 | with MockFileStoreComponent 14 | with MockInMemoryActorReferences 15 | with MockDBComponent { 16 | } 17 | -------------------------------------------------------------------------------- /.github/workflows/sbt-docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: Build and Publish Docker Image 2 | 3 | on: 4 | release: 5 | types: [released] 6 | 7 | jobs: 8 | docker: 9 | 10 | runs-on: ubuntu-22.04 11 | 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Install locales 15 | run: sudo apt-get -y install locales 16 | - name: Fix up git URLs 17 | run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig 18 | - name: Set up JDK 19 | uses: actions/setup-java@v4 20 | with: 21 | java-version: 21 22 | distribution: temurin 23 | - name: Docker Login 24 | run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin 25 | - name: Build and Publish Docker Image 26 | run: sbt docker:publish 27 | env: 28 | DOCKER_UPDATE_LATEST: true 29 | -------------------------------------------------------------------------------- /.github/workflows/sbt-docker-prepublish.yml: -------------------------------------------------------------------------------- 1 | name: Build and Publish Docker Image 2 | 3 | on: 4 | release: 5 | types: [prereleased] 6 | 7 | jobs: 8 | docker: 9 | 10 | runs-on: ubuntu-22.04 11 | 12 | steps: 13 | - uses: actions/checkout@v4 14 | - name: Install locales 15 | run: sudo apt-get -y install locales 16 | - name: Fix up git URLs 17 | run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig 18 | - name: Set up JDK 19 | uses: actions/setup-java@v4 20 | with: 21 | java-version: 21 22 | distribution: temurin 23 | - name: Docker Login 24 | run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin 25 | - name: Build and Publish Docker Image 26 | run: sbt docker:publish 27 | env: 28 | DOCKER_UPDATE_LATEST: false 29 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/stammdaten/MockStammdatenRoutes.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.stammdaten 2 | 3 | import akka.actor.ActorSystem 4 | import ch.openolitor.buchhaltung.repositories.DefaultBuchhaltungReadRepositoryAsyncComponent 5 | import ch.openolitor.core.{ MockInMemoryActorReferences, SystemConfig } 6 | import ch.openolitor.core.db.MockDBComponent 7 | import ch.openolitor.core.filestore.MockFileStoreComponent 8 | import ch.openolitor.stammdaten.repositories.DefaultStammdatenReadRepositoryAsyncComponent 9 | 10 | import scala.concurrent.ExecutionContext 11 | 12 | class MockStammdatenRoutes(override val sysConfig: SystemConfig, override val system: ActorSystem)(override implicit protected val executionContext: ExecutionContext) extends StammdatenRoutes 13 | with DefaultStammdatenReadRepositoryAsyncComponent 14 | with DefaultBuchhaltungReadRepositoryAsyncComponent 15 | with MockFileStoreComponent 16 | with MockInMemoryActorReferences 17 | with MockDBComponent { 18 | } 19 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/buchhaltung/MockBuchhaltungRoutes.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.buchhaltung 2 | 3 | import akka.actor.ActorSystem 4 | import ch.openolitor.buchhaltung.repositories.DefaultBuchhaltungReadRepositoryAsyncComponent 5 | import ch.openolitor.core.{ MockInMemoryActorReferences, SystemConfig } 6 | import ch.openolitor.core.db.MockDBComponent 7 | import ch.openolitor.core.filestore.MockFileStoreComponent 8 | import ch.openolitor.stammdaten.repositories.DefaultStammdatenReadRepositoryAsyncComponent 9 | 10 | import scala.concurrent.ExecutionContext 11 | 12 | class MockBuchhaltungRoutes(override val sysConfig: SystemConfig, override val system: ActorSystem)(override implicit protected val executionContext: ExecutionContext) extends BuchhaltungRoutes 13 | with DefaultStammdatenReadRepositoryAsyncComponent 14 | with DefaultBuchhaltungReadRepositoryAsyncComponent 15 | with MockFileStoreComponent 16 | with MockInMemoryActorReferences 17 | with MockDBComponent { 18 | } 19 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/arbeitseinsatz/MockArbeitseinsatzRoutes.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.arbeitseinsatz 2 | 3 | import akka.actor.ActorSystem 4 | import ch.openolitor.arbeitseinsatz.repositories.DefaultArbeitseinsatzReadRepositoryAsyncComponent 5 | import ch.openolitor.core.{ MockInMemoryActorReferences, SystemConfig } 6 | import ch.openolitor.core.db.MockDBComponent 7 | import ch.openolitor.core.filestore.MockFileStoreComponent 8 | import ch.openolitor.stammdaten.repositories.DefaultStammdatenReadRepositoryAsyncComponent 9 | 10 | import scala.concurrent.ExecutionContext 11 | 12 | class MockArbeitseinsatzRoutes(override val sysConfig: SystemConfig, override val system: ActorSystem)(override implicit protected val executionContext: ExecutionContext) extends ArbeitseinsatzRoutes 13 | with DefaultStammdatenReadRepositoryAsyncComponent 14 | with DefaultArbeitseinsatzReadRepositoryAsyncComponent 15 | with MockFileStoreComponent 16 | with MockInMemoryActorReferences 17 | with MockDBComponent { 18 | } -------------------------------------------------------------------------------- /project/GenerateTuples.scala: -------------------------------------------------------------------------------- 1 | object GenerateTuples { 2 | def apply(n: Int): String = { 3 | val types = (1 to n) map (i => s"T$i") mkString (",") 4 | val plusTypes = (1 to n) map (i => s"+T$i") mkString (",") 5 | 6 | s""" 7 | package ch.openolitor.core.scalax 8 | 9 | object Product$n { 10 | def unapply[$types](x: Product$n[$types]): Option[Product$n[$types]] = 11 | Some(x) 12 | } 13 | 14 | trait Product$n[$plusTypes] extends Product { 15 | 16 | override def productArity = $n 17 | 18 | @throws(classOf[IndexOutOfBoundsException]) 19 | override def productElement(n: Int) = n match { 20 | ${(1 to n) map (i => s"case ${i-1} => _$i") mkString ("\n")} 21 | case _ => throw new IndexOutOfBoundsException(n.toString()) 22 | } 23 | 24 | ${(1 to n) map (i => s"def _$i: T$i") mkString ("\n")} 25 | } 26 | 27 | case class Tuple$n[$plusTypes](${(1 to n) map (i => s"val _$i: T$i") mkString (",")}) extends Product$n[$types] with CustomTuple { 28 | override def canEqual(other: Any) = other.isInstanceOf[Tuple$n[${(1 to n) map (i => s"_") mkString (",")}]] 29 | } 30 | """ 31 | } 32 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.com/OpenOlitor/openolitor-server.svg?branch=prod)](https://travis-ci.com/OpenOlitor/openolitor-server) 2 | # openolitor-server 3 | Server Backend der OpenOlitor Administrationsplattform 4 | 5 | ## Issues 6 | Please report issues to the [main project](https://github.com/OpenOlitor/OpenOlitor/issues). 7 | 8 | ## Entwicklungs-Setup 9 | https://github.com/OpenOlitor/OpenOlitor/wiki/Doku-Technisch_Server_Ent-Setup 10 | 11 | ## Dokumentation 12 | Die gesamte Dokumentation befindet sich auf dem OpenOlitor-Projekt-Wiki 13 | https://github.com/OpenOlitor/OpenOlitor/wiki/ 14 | 15 | Release Notes stehen projektübergreifend zur Verfügung: 16 | https://github.com/OpenOlitor/OpenOlitor/wiki/Release-Notes 17 | 18 | ## Lizenz / License 19 | Code bis April 2018 wurde unter [GPL v3](LICENSE_legacy) publiziert. Ab April 2018 wird OpenOlitor unter [AGPL v3](LICENSE) veröffentlicht. 20 | 21 | ## bumpversion.sh 22 | Mittels `./bumpversion.sh` (`./bumpversion.sh -v 1.0.x`) wird die Version in `project/Build.scala` erhöht. 23 | Mit dem Flag -c/--commit wird ein git commit und ein git tag mit entsprechender Nachricht gemacht. 24 | Anderseits werden die nötigen git Befehle ausgegeben. 25 | 26 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/util/WithInMemoryPdfGenerator.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core.util 2 | 3 | import ch.openolitor.core.config.ModifyingSystemConfigReference 4 | import com.typesafe.config.{ Config, ConfigValueFactory } 5 | import org.specs2.mutable.Specification 6 | import org.testcontainers.containers.GenericContainer 7 | 8 | class PdfGeneratorContainer(dockerImageName: String) extends GenericContainer[PdfGeneratorContainer](dockerImageName) 9 | 10 | trait WithInMemoryPdfGenerator extends ModifyingSystemConfigReference { 11 | self: Specification => 12 | 13 | protected lazy val pdfGenerator = WithInMemoryPdfGenerator.initPdfGenerator 14 | 15 | override protected def modifyConfig(): Config = 16 | super 17 | .modifyConfig() 18 | .withValue("openolitor.test.converttopdf.endpoint", ConfigValueFactory.fromAnyRef(s"http://localhost:${pdfGenerator.getMappedPort(8080)}/lool/convert-to/pdf")) 19 | } 20 | 21 | object WithInMemoryPdfGenerator { 22 | protected lazy val initPdfGenerator = { 23 | val pdfGenerator = new PdfGeneratorContainer("eugenmayer/jodconverter:rest") 24 | .withExposedPorts(8080) 25 | 26 | pdfGenerator.start() 27 | 28 | pdfGenerator 29 | } 30 | } -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/db/WithWriteRepositories.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core.db 2 | 3 | import ch.openolitor.arbeitseinsatz.ArbeitseinsatzDBMappings 4 | import ch.openolitor.buchhaltung.BuchhaltungDBMappings 5 | import ch.openolitor.core.models.{ BaseEntity, BaseId, PersonId } 6 | import ch.openolitor.core.repositories.BaseEntitySQLSyntaxSupport 7 | import ch.openolitor.stammdaten.repositories.DefaultStammdatenWriteRepositoryComponent 8 | import ch.openolitor.stammdaten.StammdatenDBMappings 9 | import scalikejdbc.{ Binders, DB } 10 | import ch.openolitor.core.repositories.EventPublishingImplicits._ 11 | 12 | trait WithWriteRepositories extends MockDBComponent with StammdatenDBMappings with BuchhaltungDBMappings with ArbeitseinsatzDBMappings with DefaultStammdatenWriteRepositoryComponent { 13 | 14 | implicit lazy val stammdatenRepositoryImplicit = stammdatenWriteRepository 15 | 16 | def insertEntity[E <: BaseEntity[I], I <: BaseId](entity: E)(implicit user: PersonId, syntaxSupport: BaseEntitySQLSyntaxSupport[E], binder: Binders[I]): Option[E] = { 17 | DB autoCommitSinglePublish { implicit session => implicit publisher => 18 | stammdatenWriteRepository.insertEntity[E, I](entity) 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/MockActorReferences.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core 2 | 3 | import akka.actor.ActorRef 4 | import akka.testkit.TestProbe 5 | 6 | trait MockActorReferences extends ActorReferences with SystemConfigReference with ActorSystemReference { 7 | private lazy val mailServiceProbe = TestProbe()(system) 8 | override lazy val mailService: ActorRef = mailServiceProbe.ref 9 | 10 | private lazy val dbEvolutionActorProbe = TestProbe()(system) 11 | override lazy val dbEvolutionActor: ActorRef = dbEvolutionActorProbe.ref 12 | 13 | private lazy val airbrakeNotifierProbe = TestProbe()(system) 14 | override lazy val airbrakeNotifier: ActorRef = airbrakeNotifierProbe.ref 15 | 16 | private lazy val entityStoreProbe = TestProbe()(system) 17 | override lazy val entityStore: ActorRef = entityStoreProbe.ref 18 | 19 | private lazy val eventStoreProbe = TestProbe()(system) 20 | override lazy val eventStore: ActorRef = eventStoreProbe.ref 21 | 22 | private lazy val jobQueueServiceProbe = TestProbe()(system) 23 | override lazy val jobQueueService: ActorRef = jobQueueServiceProbe.ref 24 | 25 | private lazy val reportSystemProbe = TestProbe()(system) 26 | override lazy val reportSystem: ActorRef = reportSystemProbe.ref 27 | } 28 | -------------------------------------------------------------------------------- /.github/workflows/sbt-test.yml: -------------------------------------------------------------------------------- 1 | name: sbt test 2 | 3 | on: [push, pull_request,pull_request_target] 4 | 5 | permissions: 6 | pull-requests: write 7 | contents: write 8 | issues: write 9 | 10 | jobs: 11 | test: 12 | runs-on: ubuntu-22.04 13 | permissions: 14 | pull-requests: write 15 | issues: write 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - name: Install locales 20 | run: sudo apt-get -y install locales 21 | - name: Fix up git URLs 22 | run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig 23 | - name: Set up JDK 24 | uses: actions/setup-java@v4 25 | with: 26 | java-version: 21 27 | distribution: temurin 28 | - name: Run Tests 29 | run: sbt "coverage; test; coverageReport; coverageAggregate;" 30 | - name: Coverage Report 31 | uses: irongut/CodeCoverageSummary@v1.3.0 32 | with: 33 | filename: target/scala-2.13/coverage-report/cobertura.xml 34 | badge: true 35 | format: "markdown" 36 | indicators: false 37 | hide_complexity: true 38 | output: "both" 39 | - name: Coverage Report Pull Request Comment 40 | uses: marocchino/sticky-pull-request-comment@v2 41 | if: github.event_name == 'pull_request' 42 | with: 43 | recreate: true 44 | path: code-coverage-results.md 45 | - name: Coverage Summary 46 | run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY 47 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/filestore/WithInMemoryFileStore.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core.filestore 2 | 3 | import akka.actor.ActorSystem 4 | import ch.openolitor.core.config.ModifyingSystemConfigReference 5 | import com.typesafe.config.{ Config, ConfigValueFactory } 6 | import io.findify.s3mock.S3Mock 7 | import org.specs2.mutable.Specification 8 | import org.specs2.specification.BeforeAfterAll 9 | 10 | import java.util.concurrent.atomic.AtomicInteger 11 | 12 | trait WithInMemoryFileStore extends ModifyingSystemConfigReference with BeforeAfterAll { 13 | self: Specification => 14 | 15 | implicit protected val system: ActorSystem 16 | protected lazy val randomPort = WithInMemoryFileStore.getNextPort() 17 | protected lazy val api = S3Mock(port = randomPort) 18 | 19 | override protected def modifyConfig(): Config = 20 | super 21 | .modifyConfig() 22 | .withValue("openolitor.test.s3.aws-endpoint", ConfigValueFactory.fromAnyRef(s"http://localhost:$randomPort")) 23 | .withValue("openolitor.test.s3.aws-access-key-id", ConfigValueFactory.fromAnyRef("accessKey1")) 24 | .withValue("openolitor.test.s3.aws-secret-access-key", ConfigValueFactory.fromAnyRef("verySecretKey1")) 25 | 26 | def initializeInMemoryFileStore(): Unit = { 27 | api.start 28 | } 29 | 30 | override def beforeAll(): Unit = { 31 | initializeInMemoryFileStore() 32 | } 33 | } 34 | 35 | object WithInMemoryFileStore { 36 | val currentPort = new AtomicInteger(9051) 37 | 38 | def getNextPort() = { 39 | currentPort.incrementAndGet() 40 | } 41 | } -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/ws/MockClientMessagesRouteService.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core.ws 2 | 3 | import akka.actor.ActorSystem 4 | import ch.openolitor.buchhaltung.repositories.DefaultBuchhaltungReadRepositoryAsyncComponent 5 | import ch.openolitor.core.{ MockInMemoryActorReferences, SpecSubjects, SystemConfig } 6 | import ch.openolitor.core.db.MockDBComponent 7 | import ch.openolitor.core.filestore.MockFileStoreComponent 8 | import ch.openolitor.stammdaten.repositories.DefaultStammdatenReadRepositoryAsyncComponent 9 | 10 | import scala.concurrent.{ ExecutionContext, Future } 11 | import scala.concurrent.duration.DurationInt 12 | 13 | class MockClientMessagesRouteService(override val sysConfig: SystemConfig, override val system: ActorSystem)(override implicit protected val executionContext: ExecutionContext) extends ClientMessagesRouteService 14 | with DefaultStammdatenReadRepositoryAsyncComponent 15 | with DefaultBuchhaltungReadRepositoryAsyncComponent 16 | with MockFileStoreComponent 17 | with MockInMemoryActorReferences 18 | with MockDBComponent 19 | with SpecSubjects { 20 | 21 | override lazy val loginTokenCache = MockInMemoryActorReferences.MockStartedServices(sysConfig).loginTokenCache 22 | override lazy val clientMessagesService = new DefaultClientMessagesService(system, loginTokenCache, { 23 | MockInMemoryActorReferences.MockStartedServices(sysConfig).loginTokenCache.put(adminSubjectToken, Future.successful(adminSubject)) 24 | MockInMemoryActorReferences.MockStartedServices(sysConfig).streamsByUser 25 | }) 26 | override val maxRequestDelay = Some(20 seconds) 27 | } 28 | -------------------------------------------------------------------------------- /docker/mariadb/Dockerfile: -------------------------------------------------------------------------------- 1 | #MariaDB (https://mariadb.org/) 2 | 3 | FROM phusion/baseimage:0.9.18 4 | MAINTAINER me 5 | 6 | # Ensure UTF-8 7 | RUN locale-gen en_US.UTF-8 8 | 9 | # Disable SSH (Not using it at the moment). 10 | RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh 11 | 12 | # Install MariaDB from repository. 13 | RUN echo "deb http://ftp.osuosl.org/pub/mariadb/repo/10.1/ubuntu trusty main" > /etc/apt/sources.list.d/mariadb.list && \ 14 | apt-get update && \ 15 | DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes mariadb-server mariadb-server-10.1 16 | 17 | # Install other tools. 18 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pwgen inotify-tools 19 | 20 | # Clean up APT when done. 21 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 22 | 23 | # Configure the database to use our data dir. 24 | RUN sed -i -e 's/^datadir\s*=.*/datadir = \/data/' /etc/mysql/my.cnf 25 | 26 | # Configure MariaDB to listen on any address. 27 | RUN sed -i -e 's/^bind-address/#bind-address/' /etc/mysql/my.cnf 28 | 29 | # Change the innodb-buffer-pool-size to 128M (default is 256M). 30 | # This should make it friendlier to run on low memory servers. 31 | RUN sed -i -e 's/^innodb_buffer_pool_size\s*=.*/innodb_buffer_pool_size = 128M/' /etc/mysql/my.cnf 32 | 33 | EXPOSE 3306 34 | ADD scripts /scripts 35 | RUN chmod +x /scripts/start.sh 36 | RUN touch /firstrun 37 | 38 | # Expose our data, log, and configuration directories. 39 | VOLUME ["/data", "/var/log/mysql", "/etc/mysql"] 40 | 41 | # Use baseimage-docker's init system. 42 | CMD ["/sbin/my_init", "--", "/scripts/start.sh"] 43 | -------------------------------------------------------------------------------- /src/main/resources/openolitor-server-test-logback-sunu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.out 5 | 6 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 7 | 8 | 9 | 10 | 11 | ./akka.log 12 | 13 | ./akka.log.%d{yyyy-MM-dd-HH} 14 | 15 | 16 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/openolitor-server-testprod-sunu-logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.out 5 | 6 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 7 | 8 | 9 | 10 | 11 | ./akka.log 12 | 13 | ./akka.log.%d{yyyy-MM-dd-HH} 14 | 15 | 16 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/main/resources/openolitor-server-test-logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.out 5 | 6 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 7 | 8 | 9 | 10 | 11 | ./akka.log 12 | 13 | ./akka.log.%d{yyyy-MM-dd-HH} 14 | 15 | 16 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/openolitor-server-int-logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.out 5 | 6 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 7 | 8 | 9 | 10 | 11 | ./akka.log 12 | 13 | ./akka.log.%d{yyyy-MM-dd-HH} 14 | 15 | 16 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/openolitor-server-prod-logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.out 5 | 6 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 7 | 8 | 9 | 10 | 11 | ./akka.log 12 | 13 | ./akka.log.%d{yyyy-MM-dd-HH} 14 | 15 | 16 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/openolitor-server-testprod-logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | System.out 5 | 6 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 7 | 8 | 9 | 10 | 11 | ./akka.log 12 | 13 | ./akka.log.%d{yyyy-MM-dd-HH} 14 | 15 | 16 | %X{akkaTimestamp} %-5level %logger{36} %X{sourceThread} - %msg%n 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/stammdaten/StammdatenRoutesProjektSpec.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.stammdaten 2 | 3 | import akka.http.scaladsl.model.StatusCodes 4 | import ch.openolitor.core.{ BaseRoutesWithDBSpec, SpecSubjects } 5 | import ch.openolitor.core.security.Subject 6 | import ch.openolitor.stammdaten.models.{ Projekt, ProjektModify } 7 | import ch.openolitor.core.Macros._ 8 | import ch.openolitor.core.models.EntityModified 9 | 10 | import scala.concurrent.Await 11 | 12 | class StammdatenRoutesProjektSpec extends BaseRoutesWithDBSpec with SpecSubjects with StammdatenJsonProtocol { 13 | sequential 14 | 15 | protected val stammdatenRouteService = new MockStammdatenRoutes(sysConfig, system) 16 | implicit val subject: Subject = adminSubject 17 | 18 | "StammdatenRoutes for Projekt" should { 19 | "return Projekt" in { 20 | Get("/projekt") ~> stammdatenRouteService.stammdatenRoute ~> check { 21 | val response = responseAs[Option[Projekt]] 22 | status === StatusCodes.OK 23 | response.headOption.map { head => 24 | head.bezeichnung === "Demo Projekt" 25 | } 26 | response must beSome 27 | } 28 | } 29 | 30 | "update Projekt" in { 31 | val projekt = Await.result(stammdatenRouteService.stammdatenReadRepository.getProjekt, defaultTimeout).get 32 | val update = copyTo[Projekt, ProjektModify](projekt).copy(bezeichnung = "Updated") 33 | 34 | Post(s"/projekt/${projekt.id.id}", update) ~> stammdatenRouteService.stammdatenRoute ~> check { 35 | status === StatusCodes.Accepted 36 | 37 | dbEventProbe.expectMsgType[EntityModified[Projekt]] 38 | 39 | val updated = Await.result(stammdatenRouteService.stammdatenReadRepository.getProjekt, defaultTimeout).get 40 | updated.bezeichnung === "Updated" 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /docker/mariadb/scripts/first_run.sh: -------------------------------------------------------------------------------- 1 | USER=${USER:-super} 2 | PASS=${PASS:-$(pwgen -s -1 16)} 3 | 4 | pre_start_action() { 5 | # Echo out info to later obtain by running `docker logs container_name` 6 | echo "MARIADB_USER=$USER" 7 | echo "MARIADB_PASS=$PASS" 8 | echo "MARIADB_DATA_DIR=$DATA_DIR" 9 | 10 | # test if DATA_DIR has content 11 | if [[ ! "$(ls -A $DATA_DIR)" ]]; then 12 | echo "Initializing MariaDB at $DATA_DIR" 13 | # Copy the data that we generated within the container to the empty DATA_DIR. 14 | cp -R /var/lib/mysql/* $DATA_DIR 15 | fi 16 | 17 | # Ensure mysql owns the DATA_DIR 18 | chown -R mysql $DATA_DIR 19 | chown root $DATA_DIR/debian*.flag 20 | } 21 | 22 | post_start_action() { 23 | # The password for 'debian-sys-maint'@'localhost' is auto generated. 24 | # The database inside of DATA_DIR may not have been generated with this password. 25 | # So, we need to set this for our database to be portable. 26 | DB_MAINT_PASS=$(cat /etc/mysql/debian.cnf | grep -m 1 "password\s*=\s*"| sed 's/^password\s*=\s*//') 27 | mysql -u root -e \ 28 | "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '$DB_MAINT_PASS';" 29 | 30 | # Create the superuser. 31 | mysql -u root <<-EOF 32 | DELETE FROM mysql.user WHERE user = '$USER'; 33 | FLUSH PRIVILEGES; 34 | CREATE USER '$USER'@'localhost' IDENTIFIED BY '$PASS'; 35 | GRANT ALL PRIVILEGES ON *.* TO '$USER'@'localhost' WITH GRANT OPTION; 36 | CREATE USER '$USER'@'%' IDENTIFIED BY '$PASS'; 37 | GRANT ALL PRIVILEGES ON *.* TO '$USER'@'%' WITH GRANT OPTION; 38 | EOF 39 | 40 | # create the default database from the ADDed file. 41 | echo "Initializing Mandant1..." 42 | mysql -u root < /scripts/m1_schema.sql 43 | echo "Initializing Mandant2..." 44 | mysql -u root < /scripts/m2_schema.sql 45 | 46 | 47 | rm /firstrun 48 | } 49 | -------------------------------------------------------------------------------- /docker/mariadb/scripts/sql/db_schema.sql: -------------------------------------------------------------------------------- 1 | ALTER DATABASE CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci'; 2 | 3 | CREATE TABLE IF NOT EXISTS persistence_metadata ( 4 | persistence_key BIGINT NOT NULL AUTO_INCREMENT, 5 | persistence_id VARCHAR(255) NOT NULL, 6 | sequence_nr BIGINT NOT NULL, 7 | PRIMARY KEY (persistence_key), 8 | UNIQUE (persistence_id) 9 | ) CHARACTER SET utf8 COLLATE = 'utf8mb4_unicode_ci'; 10 | 11 | CREATE TABLE IF NOT EXISTS persistence_journal ( 12 | persistence_key BIGINT NOT NULL, 13 | sequence_nr BIGINT NOT NULL, 14 | message MEDIUMBLOB NOT NULL, 15 | PRIMARY KEY (persistence_key, sequence_nr), 16 | FOREIGN KEY (persistence_key) REFERENCES persistence_metadata (persistence_key) 17 | ) CHARACTER SET utf8 COLLATE = 'utf8mb4_unicode_ci'; 18 | 19 | CREATE TABLE IF NOT EXISTS persistence_snapshot ( 20 | persistence_key BIGINT NOT NULL, 21 | sequence_nr BIGINT NOT NULL, 22 | created_at BIGINT NOT NULL, 23 | snapshot MEDIUMBLOB NOT NULL, 24 | PRIMARY KEY (persistence_key, sequence_nr), 25 | FOREIGN KEY (persistence_key) REFERENCES persistence_metadata (persistence_key) 26 | ) CHARACTER SET utf8 COLLATE = 'utf8mb4_unicode_ci'; 27 | 28 | CREATE TABLE IF NOT EXISTS DBSchema ( 29 | id BIGINT NOT NULL, 30 | revision BIGINT NOT NULL, 31 | status varchar(50) NOT NULL, 32 | erstelldat DATETIME NOT NULL, 33 | ersteller BIGINT NOT NULL, 34 | modifidat DATETIME NOT NULL, 35 | modifikator BIGINT NOT NULL, 36 | PRIMARY KEY (id) 37 | ) CHARACTER SET utf8 COLLATE = 'utf8mb4_unicode_ci'; 38 | 39 | CREATE TABLE IF NOT EXISTS PersistenceEventState ( 40 | id BIGINT not null, 41 | persistence_id varchar(100) not null, 42 | last_transaction_nr BIGINT default 0, 43 | last_sequence_nr BIGINT default 0, 44 | erstelldat datetime not null, 45 | ersteller BIGINT not null, 46 | modifidat datetime not null, 47 | modifikator BIGINT not null 48 | ) CHARACTER SET utf8 COLLATE = 'utf8mb4_unicode_ci'; 49 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/repositories/BaseParameter.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.repositories 24 | 25 | trait BaseParameter { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/parsing/UriQueryFilterParserAST.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util.parsing 24 | 25 | case class QueryFilter(query: String) 26 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/filestore/FileStoreReference.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.filestore 24 | 25 | trait FileStoreReference { 26 | val fileStore: FileStore 27 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/repositories/BaseUpdateRepositoryComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.repositories 24 | 25 | trait BaseUpdateRepositoryComponent { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/domain/DefaultMessages.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.domain 24 | 25 | object DefaultMessages { 26 | case object Startup 27 | case object Started 28 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/exceptions/InvalidStateException.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.exceptions 24 | 25 | class InvalidStateException(val message: String) extends Exception(message) -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/models/Defaults.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.models 24 | 25 | trait Defaults { 26 | val FALSE = false 27 | val TRUE = true 28 | 29 | val ZERO = 0 30 | } -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/MockInMemoryActorReferences.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core 2 | 3 | import akka.actor.ActorRef 4 | import ch.openolitor.core.MockInMemoryActorReferences.MockStartedServices 5 | import ch.openolitor.core.batch.BatchJobs.InitializeBatchJob 6 | import ch.openolitor.core.domain.SystemEvents.SystemStarted 7 | import com.typesafe.config.Config 8 | import org.joda.time.DateTime 9 | 10 | import scala.collection.concurrent.TrieMap 11 | 12 | trait MockInMemoryActorReferences extends MockActorReferences { 13 | override lazy val mailService: ActorRef = MockStartedServices(sysConfig).mailService 14 | 15 | override lazy val dbEvolutionActor: ActorRef = MockStartedServices(sysConfig).dbEvolutionActor 16 | 17 | override lazy val airbrakeNotifier: ActorRef = MockStartedServices(sysConfig).airbrakeNotifier 18 | 19 | override lazy val entityStore: ActorRef = MockStartedServices(sysConfig).entityStore 20 | 21 | override lazy val eventStore: ActorRef = MockStartedServices(sysConfig).eventStore 22 | 23 | override lazy val jobQueueService: ActorRef = MockStartedServices(sysConfig).jobQueueService 24 | 25 | override lazy val reportSystem: ActorRef = MockStartedServices(sysConfig).reportSystem 26 | } 27 | 28 | object MockInMemoryActorReferences extends StartingServices { 29 | private val jdbcUrlToServices = TrieMap.empty[String, StartedServices] 30 | 31 | def MockStartedServices(systemConfig: SystemConfig) = { 32 | jdbcUrlToServices(systemConfig.mandantConfiguration.config.getString("db.default.url")) 33 | } 34 | 35 | def initialize(baseConfig: Config, systemConfig: SystemConfig) = { 36 | val services = startServicesForConfiguration(baseConfig, systemConfig.mandantConfiguration) 37 | 38 | services.batchJobs ! InitializeBatchJob 39 | 40 | // persist timestamp of system startup 41 | services.eventStore ! SystemStarted(DateTime.now) 42 | 43 | jdbcUrlToServices.getOrElseUpdate(systemConfig.mandantConfiguration.config.getString("db.default.url"), services) 44 | } 45 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/repositories/BaseWriteRepositoryComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.repositories 24 | 25 | trait BaseWriteRepositoryComponent extends BaseUpdateRepositoryComponent { 26 | } 27 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/parsing/UriQueryParamGeschaeftsjahrParserAST.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util.parsing 24 | 25 | import org.joda.time.DateTime 26 | 27 | case class GeschaeftsjahrFilter(inGeschaeftsjahr: Int) 28 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/FileStoreReference.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core 24 | 25 | import ch.openolitor.core.filestore.FileStore 26 | 27 | trait FileStoreReference { 28 | protected val fileStore: FileStore 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/security/TokenCache.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.security 24 | 25 | import akka.http.caching.scaladsl.Cache 26 | 27 | trait TokenCache { 28 | val loginTokenCache: Cache[String, Subject] 29 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/kundenportal/models/BelongingTo.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.kundenportal.models 24 | 25 | import ch.openolitor.stammdaten.models.KundeId 26 | 27 | trait BelongsToKunde { 28 | def kundeId: KundeId 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/DateFormats.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core 24 | 25 | import org.joda.time.format.DateTimeFormat 26 | 27 | trait DateFormats { 28 | val filenameDateFormat = DateTimeFormat.forPattern("yyyyMMddssS") 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/ExecutionContextAware.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core 24 | 25 | import scala.concurrent.ExecutionContext 26 | 27 | trait ExecutionContextAware { 28 | implicit protected val executionContext: ExecutionContext 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/DbNameFixer.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db 24 | 25 | trait DbNameFixer { 26 | def fixDbName(url: String): String = { 27 | if (url.indexOf('?') > 0) url.substring(0, url.indexOf('?')) else url 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/mailservice/MailJsonProtocol.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.mailservice 24 | 25 | import ch.openolitor.core.BaseJsonProtocol 26 | 27 | trait MailJsonProtocol extends BaseJsonProtocol { 28 | implicit val mailFormat = jsonFormat8(Mail) 29 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/system/StatusJsonProtocol.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.system 24 | 25 | import spray.json.DefaultJsonProtocol 26 | 27 | trait StatusJsonProtocol extends DefaultJsonProtocol { 28 | implicit val statusFormat = jsonFormat2(Status) 29 | } 30 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/WsInteractionsForReports.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core 2 | 3 | import akka.http.scaladsl.testkit.WSProbe 4 | import akka.testkit.TestProbe 5 | import ch.openolitor.core.jobs.JobQueueService.{ FetchJobResult, FileResultPayload, JobResult } 6 | import ch.openolitor.core.reporting.AsyncReportServiceResult 7 | import ch.openolitor.core.ws.MockClientMessagesRouteService 8 | import org.specs2.matcher.MatchResult 9 | 10 | import java.io.File 11 | 12 | trait WsInteractionsForReports extends BaseRoutesSpec with SpecSubjects { 13 | 14 | protected lazy val clientMessagesService = new MockClientMessagesRouteService(sysConfig, system) 15 | 16 | protected def withWsProbeFakeLogin(wsClient: WSProbe)(block: WSProbe => MatchResult[_]) = { 17 | WS("/", wsClient.flow) ~> clientMessagesService.routes ~> check { 18 | isWebSocketUpgrade === true 19 | 20 | // logging in manually via ws to attach our wsClient 21 | wsClient.sendMessage(s"""{"type":"Login","token":"${adminSubjectToken}"}""") 22 | val loginOkMessage = wsClient.expectMessage() 23 | loginOkMessage.asTextMessage.getStrictText must contain("LoggedIn") 24 | 25 | block(wsClient) 26 | } 27 | } 28 | 29 | protected def awaitFileViaWebsocket(wsClient: WSProbe, reportServiceResult: AsyncReportServiceResult): File = { 30 | // receive progress update 31 | val progressMessage = wsClient.expectMessage() 32 | progressMessage.asTextMessage.getStrictText must contain(""""numberOfTasksInProgress":1""") 33 | 34 | // receive task completion 35 | val completionMessage = wsClient.expectMessage() 36 | completionMessage.asTextMessage.getStrictText must contain(""""progresses":[]""") 37 | 38 | // fetch the result directly from jobQueueService 39 | val probe = TestProbe() 40 | probe.send(jobQueueService, FetchJobResult(adminSubject.personId, reportServiceResult.jobId.id)) 41 | 42 | val message = probe.expectMsgType[JobResult] 43 | 44 | message.payload must beSome 45 | 46 | message.payload.get.asInstanceOf[FileResultPayload].file 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/helloworld/HelloWorldJsonProtocol.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.helloworld 24 | 25 | import spray.json.DefaultJsonProtocol 26 | 27 | object HelloWorldJsonProtocol extends DefaultJsonProtocol { 28 | implicit val helloWorldFormat = jsonFormat1(HelloWorld) 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/filestore/FileStoreJsonProtocol.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.filestore 24 | 25 | import ch.openolitor.core.BaseJsonProtocol 26 | 27 | trait FileStoreJsonProtocol extends BaseJsonProtocol { 28 | implicit val fileTypeFormat = enumFormat(FileType.apply) 29 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/models/ModificationFlags.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.models 24 | 25 | import org.joda.time.DateTime 26 | 27 | case class ModificationFlags( 28 | erstelldat: DateTime, 29 | ersteller: PersonId, 30 | modifidat: DateTime, 31 | modifikator: PersonId 32 | ) -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/IdUtil.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util 24 | 25 | import scala.util.Random 26 | 27 | object IdUtil { 28 | 29 | /** 30 | * @return next Int as Long (avoid problem on client side limitation of 53bit number). 31 | */ 32 | def positiveRandomId: Long = Random.nextInt() >>> 1 33 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO382_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalulateLieferungCounter 26 | 27 | object OO382_DBScripts { 28 | val scripts = Seq(RecalulateLieferungCounter.scripts) 29 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO618_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalulateLieferungCounter 26 | 27 | object OO618_DBScripts { 28 | val scripts = Seq(RecalulateLieferungCounter.scripts) 29 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/security/RoleBasedAuthorization.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.security 24 | 25 | import ch.openolitor.stammdaten.models.Rolle 26 | 27 | trait RoleBasedAuthorization { 28 | 29 | def hasRole(rolle: Rolle)(implicit subject: Subject): Boolean = { 30 | subject.rolle == Some(rolle) 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/IteratorUtil.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util 24 | 25 | object IteratorUtil { 26 | implicit class Extension[A](i: Iterator[A]) { 27 | def takeWhileInclusive(p: A => Boolean) = { 28 | val (a, b) = i.span(p) 29 | a ++ (if (b.hasNext) Some(b.next()) else None) 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/db/TestDB.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db 24 | 25 | import scalikejdbc._ 26 | 27 | trait TestDB { 28 | val url = "jdbc:h2:mem:test" 29 | 30 | ConnectionPool.singleton(url, "", "") 31 | implicit val ctx = MultipleConnectionPoolContext(ConnectionPool.DEFAULT_NAME -> ConnectionPool()) 32 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/ConnectionPoolContextAware.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db 24 | 25 | import scalikejdbc._ 26 | import ch.openolitor.core._ 27 | 28 | trait ConnectionPoolContextAware { 29 | val sysConfig: SystemConfig 30 | 31 | implicit def connectionPoolContext: ConnectionPoolContext = sysConfig.cpContext 32 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO337_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlAbwesenheiten 26 | 27 | object OO337_DBScripts { 28 | val scripts = Seq(RecalculateAnzahlAbwesenheiten.scripts) 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO433_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlAbwesenheiten 26 | 27 | object OO433_DBScripts { 28 | val scripts = Seq(RecalculateAnzahlAbwesenheiten.scripts) 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO468_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlAktiveAbosCounter 26 | 27 | object OO468_DBScripts { 28 | val scripts = Seq(RecalculateAnzahlAktiveAbosCounter.scripts) 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO499_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlGeliefertLieferung 26 | 27 | object OO499_DBScripts { 28 | val scripts = Seq(RecalculateAnzahlGeliefertLieferung.scripts) 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO564_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlAktiveAbosCounter 26 | 27 | object OO564_DBScripts { 28 | val scripts = Seq(RecalculateAnzahlAktiveAbosCounter.scripts) 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO476_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlAbwesenheitenLieferung 26 | 27 | object OO476_DBScripts { 28 | val scripts = Seq(RecalculateAnzahlAbwesenheitenLieferung.scripts) 29 | } 30 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/AsyncConnectionPoolContextAware.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db 24 | 25 | import ch.openolitor.core._ 26 | 27 | trait AsyncConnectionPoolContextAware extends ConnectionPoolContextAware { 28 | val sysConfig: SystemConfig 29 | 30 | implicit def asyncConnectionPoolContext: MultipleAsyncConnectionPoolContext = sysConfig.asyncCpContext 31 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/system/SystemJsonProtocol.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.system 24 | 25 | import ch.openolitor.core.data.DataImportService.ImportResult 26 | import ch.openolitor.core.eventsourcing.PersistenceJsonProtocol 27 | 28 | trait SystemJsonProtocol extends PersistenceJsonProtocol { 29 | implicit val importResultFormat = jsonFormat2(ImportResult) 30 | } 31 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/InputStreamUtil.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util 24 | 25 | import java.io.InputStream 26 | import scala.util.Try 27 | 28 | object InputStreamUtil { 29 | implicit class ExtInputStream(self: InputStream) { 30 | def toByteArray: Try[Array[Byte]] = 31 | Try(LazyList.continually(self.read).takeWhile(_ != -1).map(_.toByte).toArray) 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/ByteStringUtil.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util 24 | 25 | import java.io.InputStream 26 | import scala.util.Try 27 | import akka.util.ByteString 28 | 29 | object ByteStringUtil { 30 | def readFromInputStream(is: InputStream): Try[ByteString] = { 31 | Try(ByteString(LazyList.continually(is.read).takeWhile(_ != -1).map(_.toByte).toArray)) 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/scalax/CustomTuple.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.scalax 24 | 25 | import scala.runtime.ScalaRunTime 26 | 27 | trait CustomTuple { 28 | this: Product => 29 | 30 | override def toString() = "(" + this.productIterator.mkString(", ") + ")" 31 | 32 | override def hashCode(): Int = ScalaRunTime._hashCode(this) 33 | 34 | override def equals(other: Any): Boolean 35 | 36 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/parsing/UriQueryFilterParser.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util.parsing 24 | 25 | import com.typesafe.scalalogging.LazyLogging 26 | 27 | object UriQueryFilterParser extends LazyLogging { 28 | 29 | def parse(input: String): Option[QueryFilter] = { 30 | if (input.length > 0) { 31 | Some(QueryFilter(input)) 32 | } else { 33 | None 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/buchhaltung/zahlungsimport/esr/ZahlungsImportEsrRecords.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.buchhaltung.zahlungsimport.esr 24 | 25 | import org.joda.time.format.DateTimeFormat 26 | 27 | sealed trait EsrTyp 28 | case object Esr extends EsrTyp 29 | case object EsrPlus extends EsrTyp 30 | 31 | object ZahlungsImportEsrRecord { 32 | val Scale = 2 33 | val Format = DateTimeFormat.forPattern("yyMMdd") 34 | } 35 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/SpecSubjects.scala: -------------------------------------------------------------------------------- 1 | package ch.openolitor.core 2 | 3 | import ch.openolitor.core.models.PersonId 4 | import ch.openolitor.core.security.Subject 5 | import ch.openolitor.stammdaten.models._ 6 | import ch.openolitor.util.OtpUtil 7 | import org.apache.commons.codec.binary.Base32 8 | import org.joda.time.DateTime 9 | import org.mindrot.jbcrypt.BCrypt 10 | 11 | import java.nio.charset.StandardCharsets 12 | import java.util.Locale 13 | import javax.crypto.spec.SecretKeySpec 14 | 15 | trait SpecSubjects { 16 | val email = "info@test.com" 17 | val pwd = "pwd" 18 | val pwdHashed = BCrypt.hashpw(pwd, BCrypt.gensalt()) 19 | val personId = PersonId(1) 20 | val otpSecret = OtpUtil.generateOtpSecretString 21 | val otpSecretKey = 22 | new SecretKeySpec( 23 | new Base32().decode(otpSecret.getBytes(StandardCharsets.US_ASCII)), 24 | OtpUtil.Totp.getAlgorithm 25 | ) 26 | val personKundeActive = Person(personId, KundeId(1), None, "Test", "Test", Some(email), None, None, None, None, 1, true, Some(pwdHashed.toCharArray), None, 27 | false, Some(KundenZugang), Set.empty, None, otpSecret, false, false, DateTime.now, PersonId(1), DateTime.now, PersonId(1)) 28 | val personAdminActive = Person(personId, KundeId(1), None, "Test", "Test", Some(email), None, None, None, None, 1, true, Some(pwdHashed.toCharArray), None, 29 | false, Some(AdministratorZugang), Set.empty, None, otpSecret, false, false, DateTime.now, PersonId(1), DateTime.now, PersonId(1)) 30 | val personAdminInactive = Person(personId, KundeId(1), None, "Test", "Test", Some(email), None, None, None, None, 1, false, Some(pwdHashed.toCharArray), None, 31 | false, Some(AdministratorZugang), Set.empty, None, otpSecret, false, false, DateTime.now, PersonId(1), DateTime.now, PersonId(1)) 32 | val projekt = Projekt(ProjektId(1), "Test", None, None, None, None, None, true, true, true, CHF, 1, 1, Map(AdministratorZugang -> true, KundenZugang -> false), EmailSecondFactorType, Locale.GERMAN, None, None, None, false, false, EinsatzEinheit("Tage"), 1, false, false, DateTime.now, PersonId(1), DateTime.now, PersonId(1)) 33 | val adminSubjectToken = "someToken" 34 | val adminSubject = Subject(adminSubjectToken, personId, KundeId(1), None, None) 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO311_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalulateKorbStatus 26 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalulateLieferungCounter 27 | 28 | object OO311_DBScripts { 29 | val scripts = Seq(RecalulateKorbStatus.scripts, RecalulateLieferungCounter.scripts) 30 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/Scripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts 24 | 25 | import ch.openolitor.core.db.evolution.scripts.v1._ 26 | import ch.openolitor.core.db.evolution.scripts.v2._ 27 | import akka.actor.ActorSystem 28 | 29 | object Scripts { 30 | def current(system: ActorSystem) = 31 | V1Scripts.scripts ++ 32 | V1SRScripts.scripts ++ 33 | V2Scripts.scripts(system) 34 | } 35 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/ZipBuilderWithFile.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util 24 | 25 | import scala.util.Try 26 | import java.io.File 27 | import java.io.FileOutputStream 28 | 29 | class ZipBuilderWithFile(file: File = File.createTempFile("report", ".zip")) extends ZipBuilder(new FileOutputStream(file)) { 30 | file.deleteOnExit() 31 | 32 | override def close(): Option[File] = { 33 | super.close() 34 | Try(file).toOption 35 | } 36 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/reports/repositories/ReportsReadRepositoryAsyncComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.reports.repositories 24 | 25 | trait ReportsReadRepositoryAsyncComponent { 26 | val reportsReadRepository: ReportsReadRepositoryAsync 27 | } 28 | 29 | trait DefaultReportsReadRepositoryAsyncComponent extends ReportsReadRepositoryAsyncComponent { 30 | override val reportsReadRepository: ReportsReadRepositoryAsync = new ReportsReadRepositoryAsyncImpl 31 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/parsing/UriQueryParamGeschaeftsjahrParser.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util.parsing 24 | 25 | import com.typesafe.scalalogging.LazyLogging 26 | 27 | object UriQueryParamGeschaeftsjahrParser extends LazyLogging { 28 | 29 | def parse(input: String): Option[GeschaeftsjahrFilter] = { 30 | if (input.length == 4) { 31 | Some(GeschaeftsjahrFilter(input.toInt)) 32 | } else { 33 | None 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/test/scala/ch/openolitor/core/mailservice/MailServiceMock.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.mailservice 24 | 25 | import akka.actor._ 26 | import MailService.SendMailEvent 27 | import MailService.SendMailCommand 28 | import org.joda.time.DateTime 29 | 30 | class MailServiceMock extends Actor { 31 | def receive = { 32 | case SendMailCommand(personId, mail, duration) => 33 | sender() ! SendMailEvent(null, "uid", mail, DateTime.now(), None) 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/stammdaten/LieferungDurchschnittspreisHandler.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.stammdaten 24 | 25 | trait LieferungDurchschnittspreisHandler { 26 | def calcDurchschnittspreis(durchschnittspreis: BigDecimal, anzahlLieferungen: Int, neuerPreis: BigDecimal): BigDecimal = 27 | if (anzahlLieferungen == 0) { 28 | 0 29 | } else { 30 | ((durchschnittspreis * (anzahlLieferungen - 1)) + neuerPreis) / anzahlLieferungen 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/eventsourcing/PersistenceJsonProtocol.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.eventsourcing 24 | 25 | import ch.openolitor.core.BaseJsonProtocol 26 | import ch.openolitor.core.models.{ PersistedMessage, PersistenceJournalView } 27 | 28 | trait PersistenceJsonProtocol extends BaseJsonProtocol { 29 | implicit val PersistedMessageFormat = jsonFormat1(PersistedMessage) 30 | implicit val persistenceJournalFormat = jsonFormat4(PersistenceJournalView) 31 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/util/StringUtil.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.util 24 | 25 | object StringUtil { 26 | implicit class OOString(self: String) { 27 | def toUnderscore: String = 28 | (self replaceAll ("([A-Z]+)([A-Z][a-z])", "$1_$2") replaceAll ("([a-z\\d])([A-Z])", "$1_$2")).toLowerCase 29 | 30 | /** 31 | * Turn first letter of string into lower case 32 | */ 33 | def decapitalize: String = s"${self.head.toLower}${self.tail}" 34 | } 35 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/stammdaten/MailCommandForwarderComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.stammdaten 24 | 25 | import ch.openolitor.core.MailServiceReference 26 | 27 | trait MailCommandForwarderComponent { 28 | val mailCommandForwarder: MailCommandForwarder 29 | } 30 | 31 | trait DefaultMailCommandForwarderComponent extends MailCommandForwarderComponent with MailServiceReference { 32 | override lazy val mailCommandForwarder = MailCommandForwarder(mailService) 33 | } 34 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/reporting/models/ReportModels.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.reporting.models 24 | 25 | import ch.openolitor.core.models._ 26 | import ch.openolitor.core.JSONSerializable 27 | import ch.openolitor.stammdaten.models.ProjektReport 28 | 29 | case class MultiReportId(id: Long) extends BaseId 30 | 31 | case class MultiReport[T <: JSONSerializable]( 32 | id: MultiReportId, 33 | entries: Seq[T], 34 | projekt: ProjektReport 35 | ) extends JSONSerializable 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/repositories/CoreReadRepositoryComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.repositories 24 | 25 | import ch.openolitor.core.ActorSystemReference 26 | 27 | trait CoreReadRepositoryComponent { 28 | val coreReadRepository: CoreReadRepository 29 | } 30 | 31 | trait DefaultCoreReadRepositoryComponent extends CoreReadRepositoryComponent with ActorSystemReference { 32 | override val coreReadRepository: CoreReadRepository = new CoreReadRepositoryImpl(system) 33 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/stammdaten/repositories/StammdatenReadRepositoryAsyncComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.stammdaten.repositories 24 | 25 | trait StammdatenReadRepositoryAsyncComponent { 26 | val stammdatenReadRepository: StammdatenReadRepositoryAsync 27 | } 28 | 29 | trait DefaultStammdatenReadRepositoryAsyncComponent extends StammdatenReadRepositoryAsyncComponent { 30 | override val stammdatenReadRepository: StammdatenReadRepositoryAsync = new StammdatenReadRepositoryAsyncImpl 31 | } -------------------------------------------------------------------------------- /src/test/resources/camt_054_Beispiel_ZA1_ESR_ZE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MSGID-C053.01.00.10-110725163809-01 6 | 2015-01-15T09:30:47Z 7 | 8 | 1 9 | true 10 | 11 | 12 | 13 | C054.01.00.10-110725163809-01 14 | 2015-01-15T09:30:47Z 15 | 16 | 17 | CH160077401231234567 18 | 19 | 20 | 21 | 010391391 22 | 3949.75 23 | CRDT 24 | BOOK 25 | 26 |
2015-01-07
27 |
28 | 29 |
2015-01-07
30 |
31 | 32 | 33 | PMNT 34 | 35 | RCDT 36 | VCOM 37 | 38 | 39 | 40 | 41 | 42 | 1 43 | 44 | 45 | 46 | ENDTOENDID-001 47 | 48 | 3949.75 49 | CRDT 50 | 51 | 52 | 3949.75 53 | 54 | 55 | 56 | Pia Rutschmann 57 | 58 | Marktgasse 59 | 28 60 | 9400 61 | Rorschach 62 | 63 | 64 | 65 | 66 | 67 | 68 | 210000000003139471430009017 69 | 70 | 71 | 72 | 73 | 74 |
75 |
76 |
77 |
78 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/reports/repositories/ReportsDeleteRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.reports.repositories 24 | 25 | import ch.openolitor.core.repositories._ 26 | import com.typesafe.scalalogging.LazyLogging 27 | import ch.openolitor.core.EventStream 28 | 29 | trait ReportsDeleteRepository extends BaseDeleteRepository 30 | with ReportsReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait ReportsDeleteRepositoryImpl extends ReportsDeleteRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/reports/repositories/ReportsInsertRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.reports.repositories 24 | 25 | import ch.openolitor.core.repositories._ 26 | import com.typesafe.scalalogging.LazyLogging 27 | import ch.openolitor.core.EventStream 28 | 29 | trait ReportsInsertRepository extends BaseInsertRepository 30 | with ReportsReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait ReportsInsertRepositoryImpl extends ReportsInsertRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/buchhaltung/repositories/BuchhaltungReadRepositoryAsyncComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.buchhaltung.repositories 24 | 25 | trait BuchhaltungReadRepositoryAsyncComponent { 26 | val buchhaltungReadRepository: BuchhaltungReadRepositoryAsync 27 | } 28 | 29 | trait DefaultBuchhaltungReadRepositoryAsyncComponent extends BuchhaltungReadRepositoryAsyncComponent { 30 | override val buchhaltungReadRepository: BuchhaltungReadRepositoryAsync = new BuchhaltungReadRepositoryAsyncImpl 31 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/kundenportal/repositories/KundenportalReadRepositoryAsyncComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.kundenportal.repositories 24 | 25 | trait KundenportalReadRepositoryAsyncComponent { 26 | val kundenportalReadRepository: KundenportalReadRepositoryAsync 27 | } 28 | 29 | trait DefaultKundenportalReadRepositoryAsyncComponent extends KundenportalReadRepositoryAsyncComponent { 30 | override val kundenportalReadRepository: KundenportalReadRepositoryAsync = new KundenportalReadRepositoryAsyncImpl 31 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/eventsourcing/CoreEventStoreSerializer.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.eventsourcing 24 | 25 | import stamina.json._ 26 | import ch.openolitor.core.models._ 27 | import ch.openolitor.core.BaseJsonProtocol 28 | import ch.openolitor.core.domain.EntityStoreJsonProtocol 29 | 30 | trait CoreEventStoreSerializer extends BaseJsonProtocol with EntityStoreJsonProtocol { 31 | implicit val personIdPersister = persister[PersonId]("person-id") 32 | 33 | val corePersisters = List(personIdPersister) 34 | } -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/stammdaten/repositories/StammdatenInsertRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.stammdaten.repositories 24 | 25 | import ch.openolitor.core.repositories._ 26 | import com.typesafe.scalalogging.LazyLogging 27 | import ch.openolitor.core.EventStream 28 | 29 | trait StammdatenInsertRepository extends BaseInsertRepository 30 | with StammdatenReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait StammdatenInsertRepositoryImpl extends StammdatenInsertRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v1/OO506_DBScripts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v1 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlAbwesenheitenLieferung 26 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlGeliefertLieferung 27 | 28 | object OO506_DBScripts { 29 | val scripts = Seq( 30 | RecalculateAnzahlAbwesenheitenLieferung.scripts, 31 | RecalculateAnzahlGeliefertLieferung.scripts 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/buchhaltung/repositories/BuchhaltungDeleteRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.buchhaltung.repositories 24 | 25 | import ch.openolitor.core.repositories._ 26 | import com.typesafe.scalalogging.LazyLogging 27 | import ch.openolitor.core.EventStream 28 | 29 | trait BuchhaltungDeleteRepository extends BaseDeleteRepository 30 | with BuchhaltungReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait BuchhaltungDeleteRepositoryImpl extends BuchhaltungDeleteRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/buchhaltung/repositories/BuchhaltungInsertRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.buchhaltung.repositories 24 | 25 | import ch.openolitor.core.repositories._ 26 | import com.typesafe.scalalogging.LazyLogging 27 | import ch.openolitor.core.EventStream 28 | 29 | trait BuchhaltungInsertRepository extends BaseInsertRepository 30 | with BuchhaltungReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait BuchhaltungInsertRepositoryImpl extends BuchhaltungInsertRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/kundenportal/repositories/KundenportalInsertRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.kundenportal.repositories 24 | 25 | import ch.openolitor.core.repositories._ 26 | import com.typesafe.scalalogging.LazyLogging 27 | import ch.openolitor.core.EventStream 28 | 29 | trait KundenportalInsertRepository extends BaseInsertRepository 30 | with KundenportalReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait KundenportalInsertRepositoryImpl extends KundenportalInsertRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/reports/repositories/ReportsUpdateRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.reports.repositories 24 | 25 | import ch.openolitor.core.repositories._ 26 | import com.typesafe.scalalogging.LazyLogging 27 | import ch.openolitor.core.EventStream 28 | 29 | trait ReportsUpdateRepository extends BaseUpdateRepository 30 | with ReportsReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait ReportsUpdateRepositoryImpl extends ReportsReadRepositorySyncImpl with ReportsUpdateRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/arbeitseinsatz/repositories/ArbeitseinsatzReadRepositoryAsyncComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.arbeitseinsatz.repositories 24 | 25 | trait ArbeitseinsatzReadRepositoryAsyncComponent { 26 | val arbeitseinsatzReadRepository: ArbeitseinsatzReadRepositoryAsync 27 | } 28 | 29 | trait DefaultArbeitseinsatzReadRepositoryAsyncComponent extends ArbeitseinsatzReadRepositoryAsyncComponent { 30 | override val arbeitseinsatzReadRepository: ArbeitseinsatzReadRepositoryAsync = new ArbeitseinsatzReadRepositoryAsyncImpl 31 | } 32 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/arbeitseinsatz/repositories/ArbeitseinsatzDeleteRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.arbeitseinsatz.repositories 24 | 25 | import ch.openolitor.core.EventStream 26 | import ch.openolitor.core.repositories._ 27 | import com.typesafe.scalalogging.LazyLogging 28 | 29 | trait ArbeitseinsatzDeleteRepository extends BaseDeleteRepository 30 | with ArbeitseinsatzReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait ArbeitseinsatzDeleteRepositoryImpl extends ArbeitseinsatzDeleteRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/arbeitseinsatz/repositories/ArbeitseinsatzInsertRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.arbeitseinsatz.repositories 24 | 25 | import ch.openolitor.core.EventStream 26 | import ch.openolitor.core.repositories._ 27 | import com.typesafe.scalalogging.LazyLogging 28 | 29 | trait ArbeitseinsatzInsertRepository extends BaseInsertRepository 30 | with ArbeitseinsatzReadRepositorySync 31 | with EventStream { 32 | } 33 | 34 | trait ArbeitseinsatzInsertRepositoryImpl extends ArbeitseinsatzInsertRepository with LazyLogging { 35 | } 36 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/filestore/FileStoreComponent.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.filestore 24 | 25 | import ch.openolitor.core.{ ActorSystemReference, SystemConfigReference } 26 | import com.typesafe.scalalogging.LazyLogging 27 | 28 | trait FileStoreComponent extends SystemConfigReference with ActorSystemReference { 29 | val fileStore: FileStore 30 | } 31 | 32 | trait DefaultFileStoreComponent extends FileStoreComponent with LazyLogging { 33 | override lazy val fileStore = S3FileStore(sysConfig.mandantConfiguration, system) 34 | } 35 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/mailtemplates/repositories/MailTemplateWriteRepository.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.mailtemplates.repositories 24 | 25 | import ch.openolitor.core.repositories.BaseWriteRepository 26 | import ch.openolitor.core.EventStream 27 | 28 | trait MailTemplateWriteRepository extends BaseWriteRepository with MailTemplateReadRepositorySync with EventStream { 29 | 30 | } 31 | 32 | trait MailTemplateWriteRepositoryImpl extends MailTemplateWriteRepository with MailTemplateRepositoryQueries with MailTemplateReadRepositorySyncImpl 33 | with EventStream -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/db/evolution/scripts/v2/OOBetrieb2_recalculate_aktive_inaktive_accounts.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.db.evolution.scripts.v2 24 | 25 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlAbosCounter 26 | import ch.openolitor.core.db.evolution.scripts.recalculations.RecalculateAnzahlAktiveAbosCounter 27 | 28 | object OOBetrieb2_recalculate_aktive_inaktive_accounts { 29 | val scripts = Seq( 30 | RecalculateAnzahlAbosCounter.scripts, 31 | RecalculateAnzahlAktiveAbosCounter.scripts 32 | ) 33 | } 34 | -------------------------------------------------------------------------------- /src/main/scala/ch/openolitor/core/ws/ExportFormat.scala: -------------------------------------------------------------------------------- 1 | /* *\ 2 | * ____ ____ ___ __ * 3 | * / __ \____ ___ ____ / __ \/ (_) /_____ _____ * 4 | * / / / / __ \/ _ \/ __ \/ / / / / / __/ __ \/ ___/ OpenOlitor * 5 | * / /_/ / /_/ / __/ / / / /_/ / / / /_/ /_/ / / contributed by tegonal * 6 | * \____/ .___/\___/_/ /_/\____/_/_/\__/\____/_/ http://openolitor.ch * 7 | * /_/ * 8 | * * 9 | * This program is free software: you can redistribute it and/or modify it * 10 | * under the terms of the GNU General Public License as published by * 11 | * the Free Software Foundation, either version 3 of the License, * 12 | * or (at your option) any later version. * 13 | * * 14 | * This program is distributed in the hope that it will be useful, but * 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * 16 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * 17 | * more details. * 18 | * * 19 | * You should have received a copy of the GNU General Public License along * 20 | * with this program. If not, see http://www.gnu.org/licenses/ * 21 | * * 22 | \* */ 23 | package ch.openolitor.core.ws 24 | 25 | import com.typesafe.scalalogging.LazyLogging 26 | 27 | trait ExportFormat 28 | 29 | case object Json extends ExportFormat 30 | case object ODS extends ExportFormat 31 | 32 | object ExportFormat extends LazyLogging { 33 | val AlleExportFormat = List( 34 | Json, 35 | ODS 36 | ) 37 | 38 | def apply(value: String): ExportFormat = { 39 | AlleExportFormat.find(_.toString.toLowerCase == value.toLowerCase.replaceFirst(".", "")).getOrElse(Json) 40 | } 41 | } 42 | --------------------------------------------------------------------------------