├── .github └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .project ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.m2e.core.prefs ├── org.eclipse.wst.validation.prefs └── ts.eclipse.ide.core.prefs ├── .travis.yml ├── Dockerfile ├── LICENSE.md ├── README.md ├── buildDocker.sh ├── carrental-ear ├── .checkstyle ├── .gitignore ├── .maven-dockerignore ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.validation.prefs │ └── org.jboss.ide.eclipse.as.core.prefs ├── Dockerfile ├── Dockerfile-wl ├── Dockerfile-ws ├── docker │ ├── conf │ │ ├── import.sql │ │ └── server.xml │ └── lib │ │ └── h2-1.4.193.jar ├── pom.xml ├── run-docker-wl.sh ├── run-docker-ws.sh ├── run-docker.sh └── src │ └── main │ └── application │ └── META-INF │ └── carrental-ds.xml ├── carrental-ejb ├── .checkstyle ├── .classpath ├── .gitignore ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.jpt.core.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.prefs.xml │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.validation.prefs │ ├── org.hibernate.eclipse.console.prefs │ └── org.jboss.ide.eclipse.as.core.prefs ├── conf │ └── WS │ │ ├── log4j.xml │ │ └── persistence.xml ├── pom.xml └── src │ ├── main │ ├── java │ │ └── ch │ │ │ └── xxx │ │ │ └── carrental │ │ │ └── ui │ │ │ ├── config │ │ │ └── LogInjector.java │ │ │ ├── dto │ │ │ ├── BusinessException.java │ │ │ ├── CrDetail.java │ │ │ ├── CrLogMsg.java │ │ │ ├── CrMessage.java │ │ │ ├── CrPeriod.java │ │ │ ├── CrPortfolio.java │ │ │ ├── CrTableRow.java │ │ │ ├── MsgType.java │ │ │ └── UndeclaredException.java │ │ │ ├── ejb │ │ │ ├── AutoLogging.java │ │ │ ├── Converter.java │ │ │ ├── CrDetailServiceSLB.java │ │ │ ├── CrLoggingServiceSLB.java │ │ │ ├── CrServerSIB.java │ │ │ ├── CrTableServiceSLB.java │ │ │ ├── EjbNaming.java │ │ │ ├── JakartaUtils.java │ │ │ └── LoggingInterceptor.java │ │ │ ├── exception │ │ │ ├── LocalEntityNotFoundException.java │ │ │ └── LocalValidationException.java │ │ │ ├── model │ │ │ ├── CrDetailDB.java │ │ │ ├── CrMessageDB.java │ │ │ ├── CrPeriodDB.java │ │ │ ├── CrPortfolioDB.java │ │ │ └── Member.java │ │ │ └── service │ │ │ ├── CrDetailService.java │ │ │ ├── CrLoggingService.java │ │ │ └── CrTableService.java │ └── resources │ │ ├── META-INF │ │ ├── beans.xml │ │ └── persistence.xml │ │ ├── import.sql │ │ └── pdf │ │ ├── Testdocument1.pdf │ │ └── Testdocument2.pdf │ └── test │ ├── java │ └── ch │ │ └── xxx │ │ └── carrental │ │ └── test │ │ └── MemberRegistrationTest.java │ └── resources │ ├── META-INF │ └── test-persistence.xml │ ├── arquillian.xml │ └── test-ds.xml ├── carrental-web ├── .checkstyle ├── .classpath ├── .gitignore ├── .metadata │ └── src │ │ └── main │ │ └── webapp │ │ └── WEB-INF │ │ └── faces-config.pageflow ├── .project ├── .settings │ ├── org.eclipse.core.resources.prefs │ ├── org.eclipse.jdt.core.prefs │ ├── org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs │ ├── org.eclipse.ltk.core.refactoring.prefs │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.m2e.wtp.prefs │ ├── org.eclipse.wst.common.component │ ├── org.eclipse.wst.common.project.facet.core.prefs.xml │ ├── org.eclipse.wst.common.project.facet.core.xml │ ├── org.eclipse.wst.html.core.prefs │ ├── org.eclipse.wst.jsdt.ui.superType.container │ ├── org.eclipse.wst.jsdt.ui.superType.name │ ├── org.eclipse.wst.validation.prefs │ ├── org.eclipse.wst.ws.service.policy.prefs │ ├── org.eclipse.wst.xsl.core.prefs │ ├── org.hibernate.eclipse.console.prefs │ ├── org.jboss.ide.eclipse.as.core.prefs │ └── ts.eclipse.ide.core.prefs ├── pom.xml └── src │ ├── angular │ └── carrental │ │ ├── .clang-format │ │ ├── .editorconfig │ │ ├── .eslintrc.json │ │ ├── .gitignore │ │ ├── README.md │ │ ├── angular.json │ │ ├── browserslist │ │ ├── e2e │ │ ├── src │ │ │ ├── app.e2e-spec.ts │ │ │ └── app.po.ts │ │ └── tsconfig.e2e.json │ │ ├── karma.conf.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── proxy.conf.json │ │ ├── src │ │ ├── app │ │ │ ├── app-routing.module.ts │ │ │ ├── app.component.html │ │ │ ├── app.component.scss │ │ │ ├── app.component.spec.ts │ │ │ ├── app.component.ts │ │ │ ├── app.module.ts │ │ │ ├── crdate │ │ │ │ ├── crdate.component.html │ │ │ │ ├── crdate.component.scss │ │ │ │ ├── crdate.component.spec.ts │ │ │ │ └── crdate.component.ts │ │ │ ├── crdetail │ │ │ │ ├── crdetail.component.html │ │ │ │ ├── crdetail.component.scss │ │ │ │ ├── crdetail.component.spec.ts │ │ │ │ └── crdetail.component.ts │ │ │ ├── crlist │ │ │ │ ├── crlist.component.html │ │ │ │ ├── crlist.component.scss │ │ │ │ ├── crlist.component.spec.ts │ │ │ │ └── crlist.component.ts │ │ │ ├── crroot │ │ │ │ ├── crroot.component.html │ │ │ │ ├── crroot.component.scss │ │ │ │ ├── crroot.component.spec.ts │ │ │ │ └── crroot.component.ts │ │ │ ├── crupload │ │ │ │ ├── crupload.component.html │ │ │ │ ├── crupload.component.scss │ │ │ │ ├── crupload.component.spec.ts │ │ │ │ └── crupload.component.ts │ │ │ ├── crvalues │ │ │ │ ├── crvalues.component.html │ │ │ │ ├── crvalues.component.scss │ │ │ │ ├── crvalues.component.spec.ts │ │ │ │ └── crvalues.component.ts │ │ │ ├── crvaluesd │ │ │ │ ├── crvaluesd.component.html │ │ │ │ ├── crvaluesd.component.scss │ │ │ │ ├── crvaluesd.component.spec.ts │ │ │ │ └── crvaluesd.component.ts │ │ │ ├── dtos │ │ │ │ ├── crClasses.ts │ │ │ │ └── crTypes.ts │ │ │ ├── environment.ts │ │ │ ├── index.ts │ │ │ ├── services │ │ │ │ ├── base-href-interceptor.ts │ │ │ │ ├── crrest.service.spec.ts │ │ │ │ └── crrest.service.ts │ │ │ └── shared │ │ │ │ ├── crvalues.validators.ts │ │ │ │ ├── index.ts │ │ │ │ ├── my-error-handler.ts │ │ │ │ ├── number-separator.pipe.spec.ts │ │ │ │ ├── number-separator.pipe.ts │ │ │ │ ├── numberseparator.directive.spec.ts │ │ │ │ ├── numberseparator.directive.ts │ │ │ │ └── utils.ts │ │ ├── assets │ │ │ ├── .gitkeep │ │ │ └── .npmignore │ │ ├── environments │ │ │ ├── environment.prod.ts │ │ │ └── environment.ts │ │ ├── favicon.ico │ │ ├── index.html │ │ ├── locale │ │ │ └── messages.de.json │ │ ├── main.ts │ │ ├── polyfills.ts │ │ ├── styles.scss │ │ ├── test.ts │ │ └── typings.d.ts │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ └── tsconfig.spec.json │ ├── main │ ├── .gitignore │ ├── java │ │ └── ch │ │ │ └── xxx │ │ │ └── carrental │ │ │ └── ui │ │ │ ├── config │ │ │ └── ForwardingFilter.java │ │ │ ├── interceptor │ │ │ ├── DisableCaching.java │ │ │ ├── DisableCachingInterceptor.java │ │ │ └── JaxRsExceptionMapper.java │ │ │ └── rest │ │ │ ├── CrApplication.java │ │ │ └── model │ │ │ ├── CrDetailResource.java │ │ │ ├── CrLogResource.java │ │ │ └── CrTableResource.java │ └── webapp │ │ ├── WEB-INF │ │ ├── beans.xml │ │ └── urlrewrite.xml │ │ ├── index.html │ │ └── swagger │ │ ├── LICENSE │ │ ├── absolute-path.js │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── index.css │ │ ├── index.html │ │ ├── index.js │ │ ├── oauth2-redirect.html │ │ ├── swagger-initializer.js │ │ ├── swagger-ui-bundle.js │ │ ├── swagger-ui-es-bundle-core.js │ │ ├── swagger-ui-es-bundle.js │ │ ├── swagger-ui-standalone-preset.js │ │ ├── swagger-ui.css │ │ ├── swagger-ui.css.map │ │ └── swagger-ui.js │ └── test │ └── java │ └── ch │ └── xxx │ └── carrrental │ └── ui │ └── rest │ └── model │ ├── CrDetailResourceTest.java │ ├── CrTableResourceTest.java │ └── UrlTest.java ├── mvnw ├── mvnw.cmd └── pom.xml /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '44 10 * * 2' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | language: [ 'java', 'javascript' ] 32 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 33 | # Learn more: 34 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 35 | 36 | steps: 37 | - name: Checkout repository 38 | uses: actions/checkout@v2 39 | 40 | # Initializes the CodeQL tools for scanning. 41 | - name: Initialize CodeQL 42 | uses: github/codeql-action/init@v2 43 | with: 44 | languages: ${{ matrix.language }} 45 | # If you wish to specify custom queries, you can do so here or in a config file. 46 | # By default, queries listed here will override any specified in a config file. 47 | # Prefix the list here with "+" to use these queries and those in the config file. 48 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 49 | 50 | - name: Setup Java JDK 51 | uses: actions/setup-java@v2 52 | with: 53 | distribution: 'temurin' 54 | java-version: 17 55 | 56 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 57 | # If this step fails, then you should remove it and run the build manually (see below) 58 | - name: Autobuild 59 | uses: github/codeql-action/autobuild@v2 60 | 61 | # ℹ️ Command-line programs to run using the OS shell. 62 | # 📚 https://git.io/JvXDl 63 | 64 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 65 | # and modify them (or add more) to build your code if your project 66 | # uses a compiled language 67 | 68 | #- run: | 69 | # make bootstrap 70 | # make release 71 | 72 | - name: Perform CodeQL Analysis 73 | uses: github/codeql-action/analyze@v2 74 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip 2 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | carrental 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.m2e.core.maven2Builder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.m2e.core.maven2Nature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | DELEGATES_PREFERENCE=delegateValidatorList 2 | USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator; 3 | USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator; 4 | USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.800.v201904082137 5 | eclipse.preferences.version=1 6 | override=true 7 | suspend=false 8 | vals/org.eclipse.wst.html.core.HTMLValidator/groups=0107include06111contentType136org.eclipse.wst.html.core.htmlsourceT07fileext04htmlF07fileext05xhtmlF07fileext03htmF07fileext04htplF07fileext03wmlF0107exclude0204file148carrental-web/src/angular/carrental/node_modulesF0204file140carrental-web/src/angular/carrental/distF02 9 | vals/org.eclipse.wst.json.core.json/groups=0107include02111contentType136org.eclipse.wst.json.core.jsonsourceT07fileext04jsonF0107exclude0204file148carrental-web/src/angular/carrental/node_modulesF0204file140carrental-web/src/angular/carrental/distF02 10 | vf.version=3 11 | -------------------------------------------------------------------------------- /.settings/ts.eclipse.ide.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | typeScriptBuildPath={} 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | jdk: 4 | - oraclejdk11 5 | 6 | addons: 7 | chrome: beta 8 | 9 | services: 10 | - docker 11 | 12 | notifications: 13 | email: 14 | - angular2guy@gmx.ch 15 | on_success: always 16 | on_failure: always 17 | 18 | before_install: 19 | - nvm install 14.15 20 | - nvm use 14.15 21 | 22 | script: 23 | ./mvnw clean install docker:build 24 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM quay.io/wildfly/wildfly:26.1.2.Final-jdk17 2 | VOLUME /tmp 3 | ARG EAR_FILE 4 | ADD carrental-ear/target/${EAR_FILE} /opt/jboss/wildfly/standalone/deployments/ -------------------------------------------------------------------------------- /buildDocker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # the Maven build needs to be run with Jdk 17! 3 | #./mvnw clean install -Dnpm.test.script=test-chromium 4 | ./mvnw clean install -Ddocker=true 5 | docker build -t angular2guy/angular2andjavaee:latest --build-arg EAR_FILE=carrental-ear.ear --no-cache . 6 | docker run --name=mywildfly -p 8080:8080 -e WILDFLY_PASSWORD=my_password --memory="512m" --cpus=1.0 angular2guy/angular2andjavaee:latest -------------------------------------------------------------------------------- /carrental-ear/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /carrental-ear/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /carrental-ear/.maven-dockerignore: -------------------------------------------------------------------------------- 1 | target/docker/** 2 | -------------------------------------------------------------------------------- /carrental-ear/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | carrental-ear 4 | 5 | 6 | carrental-web 7 | carrental-ejb 8 | 9 | 10 | 11 | org.eclipse.wst.common.project.facet.core.builder 12 | 13 | 14 | 15 | 16 | org.eclipse.wst.validation.validationbuilder 17 | 18 | 19 | 20 | 21 | net.sf.eclipsecs.core.CheckstyleBuilder 22 | 23 | 24 | 25 | 26 | org.eclipse.m2e.core.maven2Builder 27 | 28 | 29 | 30 | 31 | 32 | org.eclipse.m2e.core.maven2Nature 33 | org.eclipse.wst.common.project.facet.core.nature 34 | org.eclipse.wst.common.modulecore.ModuleCoreNature 35 | net.sf.eclipsecs.core.CheckstyleNature 36 | 37 | 38 | -------------------------------------------------------------------------------- /carrental-ear/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /carrental-ear/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /carrental-ear/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | uses 10 | 11 | 12 | uses 13 | 14 | 15 | uses 16 | 17 | 18 | uses 19 | 20 | 21 | uses 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /carrental-ear/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /carrental-ear/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /carrental-ear/.settings/org.jboss.ide.eclipse.as.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.jboss.ide.eclipse.as.core.singledeployable.deployableList= 3 | -------------------------------------------------------------------------------- /carrental-ear/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM airhacks/wildfly-ping 2 | MAINTAINER Sven Loesekann 3 | COPY ./target/carrental-ear.ear ${DEPLOYMENT_DIR} -------------------------------------------------------------------------------- /carrental-ear/Dockerfile-wl: -------------------------------------------------------------------------------- 1 | FROM airhacks/wls-ping 2 | MAINTAINER Sven Loesekann 3 | COPY ./target/carrental-ear.ear ${DEPLOYMENT_DIR} -------------------------------------------------------------------------------- /carrental-ear/Dockerfile-ws: -------------------------------------------------------------------------------- 1 | FROM websphere-liberty:javaee7 2 | MAINTAINER Sven Loesekann 3 | COPY ./docker/conf/server.xml /config/ 4 | COPY ./docker/conf/import.sql /config/ 5 | COPY ./docker/lib/h2-1.4.193.jar /opt/ibm/wlp/usr/shared/resources/ 6 | COPY ./target/carrental-ear.ear /config/dropins/ 7 | -------------------------------------------------------------------------------- /carrental-ear/docker/conf/server.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | javaee-7.0 7 | 8 | 9 | 11 | 12 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 30 | 32 | 33 | 34 | 35 | 36 | 38 | 43 | 46 | 47 | 48 | 49 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /carrental-ear/docker/lib/h2-1.4.193.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-ear/docker/lib/h2-1.4.193.jar -------------------------------------------------------------------------------- /carrental-ear/run-docker-wl.sh: -------------------------------------------------------------------------------- 1 | docker build -t angular2guy/angular2andjavaee-wl -f Dockerfile-wl . 2 | docker run -p 8001:8001 angular2guy/angular2andjavaee-wl:latest -------------------------------------------------------------------------------- /carrental-ear/run-docker-ws.sh: -------------------------------------------------------------------------------- 1 | docker build -t angular2guy/angular2andjavaee-ws -f Dockerfile-ws . 2 | docker run -p 9080:9080 -p 9443:9443 angular2guy/angular2andjavaee-ws:latest -------------------------------------------------------------------------------- /carrental-ear/run-docker.sh: -------------------------------------------------------------------------------- 1 | docker build -t angular2guy/angular2andjavaee . 2 | docker run -p 8080:8080 angular2guy/angular2andjavaee:latest -------------------------------------------------------------------------------- /carrental-ear/src/main/application/META-INF/carrental-ds.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 15 | 18 | 20 | 22 | jdbc:h2:mem:carrental;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1 23 | h2 24 | 25 | sa 26 | sa 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /carrental-ejb/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /carrental-ejb/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 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 | -------------------------------------------------------------------------------- /carrental-ejb/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /carrental-ejb/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | carrental-ejb 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.common.project.facet.core.builder 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.validation.validationbuilder 20 | 21 | 22 | 23 | 24 | org.hibernate.eclipse.console.hibernateBuilder 25 | 26 | 27 | 28 | 29 | net.sf.eclipsecs.core.CheckstyleBuilder 30 | 31 | 32 | 33 | 34 | org.eclipse.m2e.core.maven2Builder 35 | 36 | 37 | 38 | 39 | 40 | org.eclipse.jem.workbench.JavaEMFNature 41 | org.eclipse.wst.common.modulecore.ModuleCoreNature 42 | org.eclipse.jdt.core.javanature 43 | org.eclipse.m2e.core.maven2Nature 44 | org.eclipse.wst.common.project.facet.core.nature 45 | org.hibernate.eclipse.console.hibernateNature 46 | net.sf.eclipsecs.core.CheckstyleNature 47 | 48 | 49 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 4 | org.eclipse.jdt.core.compiler.compliance=17 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 7 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 8 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 9 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 10 | org.eclipse.jdt.core.compiler.release=disabled 11 | org.eclipse.jdt.core.compiler.source=17 12 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.eclipse.jpt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jpt.core.platform=generic2_1 3 | org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true 4 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | disabled=06target 2 | eclipse.preferences.version=1 3 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration=carrental-ejb 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /carrental-ejb/.settings/org.jboss.ide.eclipse.as.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.jboss.ide.eclipse.as.core.singledeployable.deployableList= 3 | -------------------------------------------------------------------------------- /carrental-ejb/conf/WS/log4j.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /carrental-ejb/conf/WS/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 18 | 19 | 21 | 23 | datasources/carrentalDS 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/config/LogInjector.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.config; 17 | 18 | import java.util.logging.Logger; 19 | 20 | import javax.enterprise.inject.Produces; 21 | import javax.enterprise.inject.spi.InjectionPoint; 22 | 23 | 24 | public class LogInjector { 25 | @Produces 26 | public Logger injectLogger(InjectionPoint injectionPoint) { 27 | return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/dto/BusinessException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.dto; 17 | 18 | public class BusinessException extends Exception { 19 | 20 | private static final long serialVersionUID = -8728150979752233545L; 21 | 22 | public BusinessException() { 23 | super(); 24 | } 25 | 26 | public BusinessException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public BusinessException(String msg, Throwable th) { 31 | super(msg, th); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/dto/CrDetail.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.dto; 17 | 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | import javax.xml.bind.annotation.XmlAccessType; 22 | import javax.xml.bind.annotation.XmlAccessorType; 23 | import javax.xml.bind.annotation.XmlElement; 24 | import javax.xml.bind.annotation.XmlRootElement; 25 | 26 | @XmlRootElement(name="CrDetail") 27 | @XmlAccessorType(XmlAccessType.FIELD) 28 | public class CrDetail { 29 | @XmlElement(required=false) 30 | private Long id; 31 | @XmlElement(required=true) 32 | private boolean changeable; 33 | @XmlElement(required=false) 34 | private String mieteNr; 35 | @XmlElement(required=false) 36 | private String jahr; 37 | @XmlElement(required=false) 38 | private CrTableRow crTableRow; 39 | @XmlElement(required=false) 40 | private List crPeriods = new ArrayList<>(); 41 | @XmlElement(required=false) 42 | private List crMessages = new ArrayList<>(); 43 | 44 | public CrDetail() { 45 | 46 | } 47 | 48 | public CrDetail(Long id, boolean changeable, String mietNr, String jahr, CrTableRow lsdTableRow) { 49 | super(); 50 | this.id = id; 51 | this.changeable = changeable; 52 | this.mieteNr = mietNr; 53 | this.jahr = jahr; 54 | this.crTableRow = lsdTableRow; 55 | } 56 | 57 | public String getJahr() { 58 | return jahr; 59 | } 60 | public void setJahr(String jahr) { 61 | this.jahr = jahr; 62 | } 63 | 64 | public CrTableRow getCrTableRow() { 65 | return crTableRow; 66 | } 67 | 68 | public void setCrTableRow(CrTableRow crTableRow) { 69 | this.crTableRow = crTableRow; 70 | } 71 | 72 | public List getCrPeriods() { 73 | return crPeriods; 74 | } 75 | 76 | public void setCrPeriods(List crPeriods) { 77 | this.crPeriods = crPeriods; 78 | } 79 | 80 | public List getCrMessages() { 81 | return crMessages; 82 | } 83 | 84 | public void setCrMessages(List crMessages) { 85 | this.crMessages = crMessages; 86 | } 87 | 88 | public boolean isChangeable() { 89 | return changeable; 90 | } 91 | 92 | public void setChangeable(boolean changeable) { 93 | this.changeable = changeable; 94 | } 95 | 96 | public Long getId() { 97 | return id; 98 | } 99 | 100 | public void setId(Long id) { 101 | this.id = id; 102 | } 103 | 104 | public String getMieteNr() { 105 | return mieteNr; 106 | } 107 | 108 | public void setMieteNr(String mieteNr) { 109 | this.mieteNr = mieteNr; 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/dto/CrLogMsg.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.dto; 17 | 18 | import javax.xml.bind.annotation.XmlAccessType; 19 | import javax.xml.bind.annotation.XmlAccessorType; 20 | import javax.xml.bind.annotation.XmlElement; 21 | import javax.xml.bind.annotation.XmlRootElement; 22 | 23 | @XmlRootElement(name="CrLogMsg") 24 | @XmlAccessorType(XmlAccessType.FIELD) 25 | public class CrLogMsg { 26 | public enum LogLevel {INFO("Info"), WARN("Warn"), ERROR("Error"); 27 | private String level; 28 | 29 | private LogLevel(String level) { 30 | this.level = level; 31 | } 32 | 33 | public String getLevel() { 34 | return this.level; 35 | } 36 | }; 37 | 38 | @XmlElement(required=true) 39 | private String logLevel; 40 | 41 | @XmlElement(required=true) 42 | private String logMsg; 43 | 44 | public CrLogMsg() { 45 | } 46 | 47 | public CrLogMsg(String logLevel, String logMsg) { 48 | super(); 49 | this.logLevel = logLevel; 50 | this.logMsg = logMsg; 51 | } 52 | 53 | public CrLogMsg(LogLevel logLevel, String logMsg) { 54 | super(); 55 | this.logLevel = logLevel.getLevel(); 56 | this.logMsg = logMsg; 57 | } 58 | 59 | public String getLogLevel() { 60 | return logLevel; 61 | } 62 | 63 | public void setLogLevel(String logLevel) { 64 | this.logLevel = logLevel; 65 | } 66 | 67 | public String getLogMsg() { 68 | return logMsg; 69 | } 70 | 71 | public void setLogMsg(String logMsg) { 72 | this.logMsg = logMsg; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/dto/CrMessage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.dto; 17 | 18 | import javax.xml.bind.annotation.XmlAccessType; 19 | import javax.xml.bind.annotation.XmlAccessorType; 20 | import javax.xml.bind.annotation.XmlElement; 21 | import javax.xml.bind.annotation.XmlRootElement; 22 | 23 | @XmlRootElement(name="CrMessage") 24 | @XmlAccessorType(XmlAccessType.FIELD) 25 | public class CrMessage { 26 | @XmlElement(required=false) 27 | private Long id; 28 | @XmlElement(required=false) 29 | private String msgType; 30 | @XmlElement(required=false) 31 | private String msg; 32 | 33 | public CrMessage() { 34 | 35 | } 36 | 37 | public CrMessage(Long id, String type, String msg) { 38 | super(); 39 | this.id = id; 40 | this.msgType = type; 41 | this.msg = msg; 42 | } 43 | 44 | public Long getId() { 45 | return id; 46 | } 47 | public void setId(Long id) { 48 | this.id = id; 49 | } 50 | public String getMsg() { 51 | return msg; 52 | } 53 | public void setMsg(String msg) { 54 | this.msg = msg; 55 | } 56 | 57 | public String getMsgType() { 58 | return msgType; 59 | } 60 | 61 | public void setMsgType(String msgType) { 62 | this.msgType = msgType; 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/dto/CrPeriod.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.dto; 17 | 18 | import java.util.ArrayList; 19 | import java.util.Date; 20 | import java.util.List; 21 | 22 | import javax.xml.bind.annotation.XmlAccessType; 23 | import javax.xml.bind.annotation.XmlAccessorType; 24 | import javax.xml.bind.annotation.XmlElement; 25 | import javax.xml.bind.annotation.XmlRootElement; 26 | 27 | @XmlRootElement(name="CrPeriod") 28 | @XmlAccessorType(XmlAccessType.FIELD) 29 | public class CrPeriod { 30 | @XmlElement(required=false) 31 | private Long id; 32 | @XmlElement(required=false) 33 | private Date from; 34 | @XmlElement(required=false) 35 | private Date to; 36 | @XmlElement(required=false) 37 | private List crPortfolios = new ArrayList<>(); 38 | 39 | public CrPeriod() { 40 | 41 | } 42 | 43 | public CrPeriod(Long id, Date from, Date to) { 44 | super(); 45 | this.id = id; 46 | this.from = from; 47 | this.to = to; 48 | } 49 | 50 | public Long getId() { 51 | return id; 52 | } 53 | public void setId(Long id) { 54 | this.id = id; 55 | } 56 | public Date getFrom() { 57 | return from; 58 | } 59 | public void setFrom(Date from) { 60 | this.from = from; 61 | } 62 | public Date getTo() { 63 | return to; 64 | } 65 | public void setTo(Date to) { 66 | this.to = to; 67 | } 68 | 69 | public List getCrPortfolios() { 70 | return crPortfolios; 71 | } 72 | 73 | public void setCrPortfolios(List crPortfolios) { 74 | this.crPortfolios = crPortfolios; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/dto/MsgType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.dto; 17 | 18 | public enum MsgType { 19 | INFO("Info"), 20 | WARNING("Warning"), 21 | ERROR("Error"), 22 | EXEPTION("Exception"); 23 | 24 | private final String type; 25 | 26 | MsgType(String type) { 27 | this.type = type; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return this.type; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/dto/UndeclaredException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.dto; 17 | 18 | public class UndeclaredException extends Exception { 19 | 20 | private static final long serialVersionUID = -8728150979752233545L; 21 | 22 | public UndeclaredException() { 23 | super(); 24 | } 25 | 26 | public UndeclaredException(String msg) { 27 | super(msg); 28 | } 29 | 30 | public UndeclaredException(String msg, Throwable th) { 31 | super(msg, th); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/ejb/AutoLogging.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.ejb; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Inherited; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import jakarta.annotation.Priority; 25 | import jakarta.interceptor.Interceptor; 26 | import jakarta.interceptor.InterceptorBinding; 27 | 28 | 29 | @Inherited 30 | @InterceptorBinding 31 | @Retention(RetentionPolicy.RUNTIME) 32 | @Target({ElementType.TYPE,ElementType.METHOD}) 33 | @Priority(Interceptor.Priority.APPLICATION) 34 | public @interface AutoLogging { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/ejb/CrLoggingServiceSLB.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.ejb; 17 | 18 | 19 | 20 | import javax.ejb.Local; 21 | import javax.ejb.Stateless; 22 | import javax.inject.Inject; 23 | 24 | import java.util.logging.Level; 25 | import java.util.logging.Logger; 26 | import ch.xxx.carrental.ui.dto.CrLogMsg; 27 | import ch.xxx.carrental.ui.service.CrLoggingService; 28 | 29 | @Local(CrLoggingService.class) 30 | @Stateless 31 | public class CrLoggingServiceSLB implements CrLoggingService { 32 | @Inject 33 | private Logger LOG; 34 | 35 | @Override 36 | public boolean logMsg(CrLogMsg crLogMsg) { 37 | if(CrLogMsg.LogLevel.ERROR.getLevel().equals(crLogMsg.getLogLevel())) { 38 | LOG.log(Level.SEVERE, crLogMsg.getLogMsg()); 39 | } else if(CrLogMsg.LogLevel.WARN.getLevel().equals(crLogMsg.getLogLevel())) { 40 | LOG.log(Level.WARNING, crLogMsg.getLogMsg()); 41 | } else if(CrLogMsg.LogLevel.INFO.getLevel().equals(crLogMsg.getLogLevel())) { 42 | LOG.info(crLogMsg.getLogMsg()); 43 | } else { 44 | LOG.log(Level.SEVERE, "Log Level not found."); 45 | return false; 46 | } 47 | return true; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/ejb/CrTableServiceSLB.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.ejb; 17 | 18 | import java.io.InputStream; 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | import java.util.Locale; 22 | 23 | import javax.ejb.EJB; 24 | import javax.ejb.Local; 25 | import javax.ejb.Stateless; 26 | import javax.inject.Inject; 27 | import javax.persistence.EntityManager; 28 | import javax.persistence.PersistenceContext; 29 | 30 | import ch.xxx.carrental.ui.dto.CrTableRow; 31 | import ch.xxx.carrental.ui.exception.LocalEntityNotFoundException; 32 | import ch.xxx.carrental.ui.exception.LocalValidationException; 33 | import ch.xxx.carrental.ui.model.CrDetailDB; 34 | import ch.xxx.carrental.ui.service.CrTableService; 35 | 36 | @Local(CrTableService.class) 37 | @Stateless 38 | public class CrTableServiceSLB implements CrTableService { 39 | @EJB 40 | private CrServerSIB server; 41 | @PersistenceContext 42 | private EntityManager em; 43 | private Converter conv = new Converter(); 44 | @Inject 45 | private JakartaUtils myUtils; 46 | 47 | @AutoLogging 48 | @Override 49 | public List readCrRowsByMiete(String mietNr, Locale locale) { 50 | this.checkForMietNr(mietNr); 51 | if (this.myUtils.checkForWildflyorWS()) { 52 | List resultList = em 53 | .createQuery("select c from CrDetailDB c where c.mietNr=:mietNr", CrDetailDB.class) 54 | .setParameter("mietNr", mietNr).getResultList(); 55 | List rows = new ArrayList(); 56 | resultList.forEach(d -> d.getCrPeriods().forEach(per -> per.getCrPortfolios() 57 | .forEach(port -> rows.add(conv.convertTableRow(port, d.getJahr(), d.getMietNr()))))); 58 | return rows; 59 | } 60 | return server.readCrRowsByMiete(mietNr); 61 | } 62 | 63 | @AutoLogging 64 | @Override 65 | public InputStream readCrPdf(String mietNr) { 66 | this.checkForMietNr(mietNr); 67 | InputStream inputStream = this.getClass().getResourceAsStream("/pdf/Testdocument" + mietNr + ".pdf"); 68 | if(inputStream == null) { 69 | throw new LocalEntityNotFoundException("Document not found."); 70 | } 71 | return inputStream; 72 | } 73 | 74 | private void checkForMietNr(String mietNr) { 75 | if(mietNr == null) { 76 | throw new LocalValidationException("mietNr is null"); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/ejb/EjbNaming.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.ejb; 17 | 18 | public enum EjbNaming { 19 | WEBSPHERE("datasources/carrentalDS","com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource"), 20 | JBOSS("java.naming.factory.url.pkgs","org.jboss.as.naming.interfaces:org.jboss.ejb.client.naming"); 21 | 22 | private final String key; 23 | private final String value; 24 | 25 | EjbNaming(String key, String value) { 26 | this.key = key; 27 | this.value = value; 28 | } 29 | 30 | public String getKey() { 31 | return key; 32 | } 33 | 34 | public String getValue() { 35 | return value; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/ejb/JakartaUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.ejb; 17 | 18 | import java.util.logging.Level; 19 | import java.util.logging.Logger; 20 | 21 | import javax.enterprise.inject.Default; 22 | import javax.inject.Inject; 23 | import javax.inject.Named; 24 | import javax.naming.InitialContext; 25 | import javax.naming.NamingException; 26 | 27 | 28 | 29 | @Default 30 | @Named 31 | public class JakartaUtils { 32 | @Inject 33 | private Logger LOG; 34 | 35 | public boolean checkForWildflyorWS() { 36 | String namingFactoryKey = null; 37 | try { 38 | InitialContext ic = new InitialContext(); 39 | namingFactoryKey = (String) ic.getEnvironment().get(EjbNaming.JBOSS.getKey()); 40 | if(namingFactoryKey == null || !EjbNaming.JBOSS.getValue().contains(namingFactoryKey)) { 41 | Object o = ic.lookup(EjbNaming.WEBSPHERE.getKey()); 42 | namingFactoryKey = o != null ? o.getClass().getName() : "Not JBoss or Websphere"; 43 | } 44 | } catch (NamingException e) { 45 | LOG.log(Level.WARNING, "No NamingFactory found -> using singleton bean data service."); 46 | return false; 47 | } 48 | boolean result = EjbNaming.JBOSS.getValue().contains(namingFactoryKey) || EjbNaming.WEBSPHERE.getValue().equals(namingFactoryKey); 49 | LOG.info("Value: '"+namingFactoryKey+"'"+" Return: "+result); 50 | return result; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/ejb/LoggingInterceptor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.ejb; 17 | 18 | import java.lang.reflect.InvocationTargetException; 19 | import java.text.SimpleDateFormat; 20 | import java.util.Date; 21 | import java.util.logging.Level; 22 | import java.util.logging.Logger; 23 | 24 | import javax.inject.Inject; 25 | 26 | import ch.xxx.carrental.ui.dto.BusinessException; 27 | import ch.xxx.carrental.ui.exception.LocalEntityNotFoundException; 28 | import ch.xxx.carrental.ui.exception.LocalValidationException; 29 | import jakarta.annotation.Priority; 30 | import jakarta.interceptor.AroundInvoke; 31 | import jakarta.interceptor.Interceptor; 32 | import jakarta.interceptor.InvocationContext; 33 | 34 | @AutoLogging 35 | @Interceptor 36 | @Priority(Interceptor.Priority.APPLICATION) 37 | public class LoggingInterceptor { 38 | @Inject 39 | private Logger LOG; 40 | 41 | @AroundInvoke 42 | public Object interceptLogging(InvocationContext ctx) throws Exception { 43 | StringBuilder params = new StringBuilder(); 44 | for (Object param : ctx.getParameters()) { 45 | params.append(param.toString()).append(","); 46 | } 47 | String signature = ctx.getClass() + "." + ctx.getMethod() + "(" + params.substring(0, params.length() - 1) 48 | + ")"; 49 | Date now1 = new Date(System.currentTimeMillis()); 50 | SimpleDateFormat sdf = new SimpleDateFormat("hh.mm.ss dd.MM.yyyy"); 51 | LOG.info(sdf.format(now1) + " - " + signature); 52 | Object o = null; 53 | try { 54 | o = ctx.getMethod().invoke(ctx.getTarget(), ctx.getParameters()); 55 | } catch (Exception e) { 56 | if (e instanceof InvocationTargetException && ( 57 | ((InvocationTargetException) e).getTargetException() instanceof LocalValidationException 58 | || ((InvocationTargetException) e).getTargetException() instanceof LocalEntityNotFoundException)) { 59 | RuntimeException re = (RuntimeException) ((InvocationTargetException) e).getTargetException(); 60 | LOG.log(Level.WARNING, signature, re); 61 | throw re; 62 | } 63 | LOG.log(Level.SEVERE, signature, e); 64 | throw new BusinessException(signature, e); 65 | } finally { 66 | Date now2 = new Date(System.currentTimeMillis()); 67 | LOG.info(sdf.format(now2) + " - " + signature); 68 | } 69 | return o; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/exception/LocalEntityNotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.exception; 17 | 18 | public class LocalEntityNotFoundException extends RuntimeException { 19 | 20 | private static final long serialVersionUID = 8047788380084426575L; 21 | 22 | public LocalEntityNotFoundException(String message) { 23 | super(message); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/exception/LocalValidationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.exception; 17 | 18 | public class LocalValidationException extends RuntimeException { 19 | 20 | private static final long serialVersionUID = -5496037556008224068L; 21 | 22 | public LocalValidationException(String message) { 23 | super(message); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/model/CrDetailDB.java: -------------------------------------------------------------------------------- 1 | package ch.xxx.carrental.ui.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import javax.persistence.CascadeType; 7 | import javax.persistence.Entity; 8 | import javax.persistence.FetchType; 9 | import javax.persistence.GeneratedValue; 10 | import javax.persistence.Id; 11 | import javax.persistence.OneToMany; 12 | import javax.persistence.Table; 13 | 14 | @Entity 15 | @Table(name = "CrDetail") 16 | public class CrDetailDB { 17 | 18 | @Id 19 | @GeneratedValue 20 | private Long id; 21 | private String mietNr; 22 | private String jahr; 23 | @OneToMany(mappedBy="crDetail",fetch=FetchType.EAGER,cascade=CascadeType.ALL, orphanRemoval=true) 24 | private List crPeriods = new ArrayList<>(); 25 | @OneToMany(mappedBy="crDetail",fetch=FetchType.LAZY,cascade=CascadeType.ALL, orphanRemoval=true) 26 | private List crMessages = new ArrayList<>(); 27 | 28 | public String getMietNr() { 29 | return mietNr; 30 | } 31 | public void setMietNr(String mietNr) { 32 | this.mietNr = mietNr; 33 | } 34 | public String getJahr() { 35 | return jahr; 36 | } 37 | public void setJahr(String jahr) { 38 | this.jahr = jahr; 39 | } 40 | public List getCrPeriods() { 41 | return crPeriods; 42 | } 43 | public void setCrPeriods(List crPeriods) { 44 | this.crPeriods = crPeriods; 45 | } 46 | public List getCrMessages() { 47 | return crMessages; 48 | } 49 | public void setCrMessages(List crMessages) { 50 | this.crMessages = crMessages; 51 | } 52 | public Long getId() { 53 | return id; 54 | } 55 | public void setId(Long id) { 56 | this.id = id; 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/model/CrMessageDB.java: -------------------------------------------------------------------------------- 1 | package ch.xxx.carrental.ui.model; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.Id; 6 | import javax.persistence.ManyToOne; 7 | import javax.persistence.Table; 8 | 9 | @Entity 10 | @Table(name = "CrMessage") 11 | public class CrMessageDB { 12 | @Id 13 | @GeneratedValue 14 | private Long id; 15 | private String msgType; 16 | private String msg; 17 | @ManyToOne 18 | private CrDetailDB crDetail; 19 | 20 | public Long getId() { 21 | return id; 22 | } 23 | public void setId(Long id) { 24 | this.id = id; 25 | } 26 | public String getMsgType() { 27 | return msgType; 28 | } 29 | public void setMsgType(String msgType) { 30 | this.msgType = msgType; 31 | } 32 | public String getMsg() { 33 | return msg; 34 | } 35 | public void setMsg(String msg) { 36 | this.msg = msg; 37 | } 38 | public CrDetailDB getCrDetail() { 39 | return crDetail; 40 | } 41 | public void setCrDetail(CrDetailDB crDetail) { 42 | this.crDetail = crDetail; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/model/CrPeriodDB.java: -------------------------------------------------------------------------------- 1 | package ch.xxx.carrental.ui.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import javax.persistence.CascadeType; 8 | import javax.persistence.Entity; 9 | import javax.persistence.FetchType; 10 | import javax.persistence.GeneratedValue; 11 | import javax.persistence.Id; 12 | import javax.persistence.ManyToOne; 13 | import javax.persistence.OneToMany; 14 | import javax.persistence.Table; 15 | 16 | @Entity 17 | @Table(name = "CrPeriod") 18 | public class CrPeriodDB { 19 | @Id 20 | @GeneratedValue 21 | private Long id; 22 | private Date periodFrom; 23 | private Date periodTo; 24 | @OneToMany(mappedBy="crPeriod",fetch=FetchType.EAGER,cascade=CascadeType.ALL, orphanRemoval=true) 25 | private List crPortfolios = new ArrayList<>(); 26 | @ManyToOne 27 | private CrDetailDB crDetail; 28 | 29 | public Long getId() { 30 | return id; 31 | } 32 | public void setId(Long id) { 33 | this.id = id; 34 | } 35 | public Date getPeriodFrom() { 36 | return periodFrom; 37 | } 38 | public void setPeriodFrom(Date periodFrom) { 39 | this.periodFrom = periodFrom; 40 | } 41 | public Date getPeriodTo() { 42 | return periodTo; 43 | } 44 | public void setPeriodTo(Date periodTo) { 45 | this.periodTo = periodTo; 46 | } 47 | public List getCrPortfolios() { 48 | return crPortfolios; 49 | } 50 | public void setCrPortfolios(List crPortfolios) { 51 | this.crPortfolios = crPortfolios; 52 | } 53 | public CrDetailDB getCrDetail() { 54 | return crDetail; 55 | } 56 | public void setCrDetail(CrDetailDB crDetail) { 57 | this.crDetail = crDetail; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/model/CrPortfolioDB.java: -------------------------------------------------------------------------------- 1 | package ch.xxx.carrental.ui.model; 2 | 3 | import java.math.BigDecimal; 4 | 5 | import javax.persistence.Entity; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.Id; 8 | import javax.persistence.ManyToOne; 9 | import javax.persistence.Table; 10 | 11 | @Entity 12 | @Table(name = "CrPortfolio") 13 | public class CrPortfolioDB { 14 | 15 | @Id 16 | @GeneratedValue 17 | private Long id; 18 | private String bezeichnung; 19 | private String status; 20 | private String grund; 21 | private Integer anzahlPkw; 22 | private Integer anzahlLkw; 23 | private Integer anzahlTotal; 24 | private BigDecimal mieteGeplantPkw; 25 | private BigDecimal mieteGeplantLkw; 26 | private BigDecimal mieteGeplantTotal; 27 | private BigDecimal mieteAbgerechnetPkw; 28 | private BigDecimal mieteAbgerechnetLkw; 29 | private BigDecimal mieteAbgerechnetTotal; 30 | @ManyToOne 31 | private CrPeriodDB crPeriod; 32 | 33 | public Long getId() { 34 | return id; 35 | } 36 | public void setId(Long id) { 37 | this.id = id; 38 | } 39 | public String getBezeichnung() { 40 | return bezeichnung; 41 | } 42 | public void setBezeichnung(String bezeichnung) { 43 | this.bezeichnung = bezeichnung; 44 | } 45 | public Integer getAnzahlPkw() { 46 | return anzahlPkw; 47 | } 48 | public void setAnzahlPkw(Integer anzahlPkw) { 49 | this.anzahlPkw = anzahlPkw; 50 | } 51 | public Integer getAnzahlLkw() { 52 | return anzahlLkw; 53 | } 54 | public void setAnzahlLkw(Integer anzahlLkw) { 55 | this.anzahlLkw = anzahlLkw; 56 | } 57 | public Integer getAnzahlTotal() { 58 | return anzahlTotal; 59 | } 60 | public void setAnzahlTotal(Integer anzahlTotal) { 61 | this.anzahlTotal = anzahlTotal; 62 | } 63 | public BigDecimal getMieteGeplantPkw() { 64 | return mieteGeplantPkw; 65 | } 66 | public void setMieteGeplantPkw(BigDecimal mieteGeplantPkw) { 67 | this.mieteGeplantPkw = mieteGeplantPkw; 68 | } 69 | public BigDecimal getMieteGeplantLkw() { 70 | return mieteGeplantLkw; 71 | } 72 | public void setMieteGeplantLkw(BigDecimal mieteGeplantLkw) { 73 | this.mieteGeplantLkw = mieteGeplantLkw; 74 | } 75 | public BigDecimal getMieteGeplantTotal() { 76 | return mieteGeplantTotal; 77 | } 78 | public void setMieteGeplantTotal(BigDecimal mieteGeplantTotal) { 79 | this.mieteGeplantTotal = mieteGeplantTotal; 80 | } 81 | public BigDecimal getMieteAbgerechnetPkw() { 82 | return mieteAbgerechnetPkw; 83 | } 84 | public void setMieteAbgerechnetPkw(BigDecimal mieteAbgerechnetPkw) { 85 | this.mieteAbgerechnetPkw = mieteAbgerechnetPkw; 86 | } 87 | public BigDecimal getMieteAbgerechnetLkw() { 88 | return mieteAbgerechnetLkw; 89 | } 90 | public void setMieteAbgerechnetLkw(BigDecimal mieteAbgerechnetLkw) { 91 | this.mieteAbgerechnetLkw = mieteAbgerechnetLkw; 92 | } 93 | public BigDecimal getMieteAbgerechnetTotal() { 94 | return mieteAbgerechnetTotal; 95 | } 96 | public void setMieteAbgerechnetTotal(BigDecimal mieteAbgerechnetTotal) { 97 | this.mieteAbgerechnetTotal = mieteAbgerechnetTotal; 98 | } 99 | public CrPeriodDB getCrPeriod() { 100 | return crPeriod; 101 | } 102 | public void setCrPeriod(CrPeriodDB crPeriod) { 103 | this.crPeriod = crPeriod; 104 | } 105 | public String getStatus() { 106 | return status; 107 | } 108 | public void setStatus(String status) { 109 | this.status = status; 110 | } 111 | public String getGrund() { 112 | return grund; 113 | } 114 | public void setGrund(String grund) { 115 | this.grund = grund; 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/model/Member.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.model; 17 | 18 | import java.io.Serializable; 19 | 20 | import javax.persistence.Column; 21 | import javax.persistence.Entity; 22 | import javax.persistence.GeneratedValue; 23 | import javax.persistence.Id; 24 | import javax.persistence.Table; 25 | import javax.persistence.UniqueConstraint; 26 | import javax.validation.constraints.Digits; 27 | import javax.validation.constraints.NotNull; 28 | import javax.validation.constraints.Pattern; 29 | import javax.validation.constraints.Size; 30 | import javax.xml.bind.annotation.XmlRootElement; 31 | 32 | @Entity 33 | @XmlRootElement 34 | @Table(name = "Registrant", uniqueConstraints = @UniqueConstraint(columnNames = "email")) 35 | public class Member implements Serializable { 36 | /** Default value included to remove warning. Remove or modify at will. **/ 37 | private static final long serialVersionUID = 1L; 38 | 39 | @Id 40 | @GeneratedValue 41 | private Long id; 42 | 43 | @NotNull 44 | @Size(min = 1, max = 25) 45 | @Pattern(regexp = "[^0-9]*", message = "Must not contain numbers") 46 | private String name; 47 | 48 | @NotNull 49 | private String email; 50 | 51 | @NotNull 52 | @Size(min = 10, max = 12) 53 | @Digits(fraction = 0, integer = 12) 54 | @Column(name = "phone_number") 55 | private String phoneNumber; 56 | 57 | public Long getId() { 58 | return id; 59 | } 60 | 61 | public void setId(Long id) { 62 | this.id = id; 63 | } 64 | 65 | public String getName() { 66 | return name; 67 | } 68 | 69 | public void setName(String name) { 70 | this.name = name; 71 | } 72 | 73 | public String getEmail() { 74 | return email; 75 | } 76 | 77 | public void setEmail(String email) { 78 | this.email = email; 79 | } 80 | 81 | public String getPhoneNumber() { 82 | return phoneNumber; 83 | } 84 | 85 | public void setPhoneNumber(String phoneNumber) { 86 | this.phoneNumber = phoneNumber; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/service/CrDetailService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.service; 17 | 18 | import java.util.Locale; 19 | 20 | import ch.xxx.carrental.ui.dto.CrDetail; 21 | 22 | 23 | public interface CrDetailService { 24 | CrDetail readCrDetail(String mieteNr, String jahr, Locale locale); 25 | boolean createCrDetail(CrDetail lsdDetail); 26 | boolean updateCrDetail(CrDetail lsdDetail); 27 | boolean deleteCrDetail(String mieteNr, String jahr); 28 | } 29 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/service/CrLoggingService.java: -------------------------------------------------------------------------------- 1 | package ch.xxx.carrental.ui.service; 2 | 3 | import ch.xxx.carrental.ui.dto.CrLogMsg; 4 | 5 | public interface CrLoggingService { 6 | boolean logMsg(CrLogMsg crLogMsg); 7 | } 8 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/java/ch/xxx/carrental/ui/service/CrTableService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.service; 17 | 18 | import java.io.InputStream; 19 | import java.util.List; 20 | import java.util.Locale; 21 | 22 | import ch.xxx.carrental.ui.dto.CrTableRow; 23 | 24 | 25 | public interface CrTableService { 26 | List readCrRowsByMiete(String mietNr, Locale locale); 27 | 28 | InputStream readCrPdf(String mietNr); 29 | } 30 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/resources/META-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/resources/META-INF/persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 18 | 19 | 21 | 23 | java:jboss/datasources/carrentalDS 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /carrental-ejb/src/main/resources/import.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- JBoss, Home of Professional Open Source 3 | -- Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual 4 | -- contributors by the @authors tag. See the copyright.txt in the 5 | -- distribution for a full listing of individual contributors. 6 | -- 7 | -- Licensed under the Apache License, Version 2.0 (the "License"); 8 | -- you may not use this file except in compliance with the License. 9 | -- You may obtain a copy of the License at 10 | -- http://www.apache.org/licenses/LICENSE-2.0 11 | -- Unless required by applicable law or agreed to in writing, software 12 | -- distributed under the License is distributed on an "AS IS" BASIS, 13 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | -- See the License for the specific language governing permissions and 15 | -- limitations under the License. 16 | -- 17 | 18 | -- You can use this file to load seed data into the database using SQL statements 19 | insert into Registrant(id, name, email, phone_number) values (0, 'John Smith', 'john.smith@mailinator.com', '2125551212'); 20 | insert into CrDetail(id, mietNr, jahr) values (-1, '1', '2015'); 21 | insert into CrMessage(id, msgType, msg,crDetail_id) values (-1, 'Warning','This is a server warning.',-1); 22 | insert into CrPeriod(id,periodFrom,periodTo,crDetail_id) values (-1,PARSEDATETIME('01012015','ddMMyyyy'),PARSEDATETIME('31122015','ddMMyyyy'),-1); 23 | insert into CrPortfolio(id,bezeichnung,status,grund,anzahlPkw,anzahlLkw,anzahlTotal,mieteGeplantPkw,mieteGeplantLkw,mieteGeplantTotal,mieteAbgerechnetPkw,mieteAbgerechnetLkw,mieteAbgerechnetTotal,crPeriod_id) values (-1, 'Bezeichnung','Status1','Grund1',10,10,20,1000000,1000000,1000000,1000000,500000,2000000,-1); 24 | 25 | insert into CrDetail(id, mietNr, jahr) values (-2, '1', '2016'); 26 | insert into CrMessage(id, msgType, msg,crDetail_id) values (-2, 'Error','This is a server error.',-2); 27 | insert into CrPeriod(id,periodFrom,periodTo,crDetail_id) values (-2,PARSEDATETIME('01012016','ddMMyyyy'),PARSEDATETIME('31122016','ddMMyyyy'),-2); 28 | insert into CrPortfolio(id,bezeichnung,status,grund,anzahlPkw,anzahlLkw,anzahlTotal,mieteGeplantPkw,mieteGeplantLkw,mieteGeplantTotal,mieteAbgerechnetPkw,mieteAbgerechnetLkw,mieteAbgerechnetTotal,crPeriod_id) values (-2, 'Bezeichnung','Status2','Grund2',null,null,null,1000000,1000000,1000000,null,null,null,-2); -------------------------------------------------------------------------------- /carrental-ejb/src/main/resources/pdf/Testdocument1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-ejb/src/main/resources/pdf/Testdocument1.pdf -------------------------------------------------------------------------------- /carrental-ejb/src/main/resources/pdf/Testdocument2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-ejb/src/main/resources/pdf/Testdocument2.pdf -------------------------------------------------------------------------------- /carrental-ejb/src/test/java/ch/xxx/carrental/test/MemberRegistrationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual 4 | * contributors by the @authors tag. See the copyright.txt in the 5 | * distribution for a full listing of individual contributors. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package ch.xxx.carrental.test; 18 | 19 | //@RunWith(Arquillian.class) 20 | public class MemberRegistrationTest { 21 | // @Deployment 22 | // public static Archive createTestArchive() { 23 | // return ShrinkWrap.create(WebArchive.class, "test.war") 24 | // .addClasses(Member.class, MemberRegistration.class, Resources.class) 25 | // .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml") 26 | // .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml") 27 | // // Deploy our test datasource 28 | // .addAsWebInfResource("test-ds.xml", "test-ds.xml"); 29 | // return null; 30 | // } 31 | 32 | // @Inject 33 | // MemberRegistration memberRegistration; 34 | 35 | // @Inject 36 | // Logger log; 37 | 38 | // @Test 39 | public void testRegister() throws Exception { 40 | // Member newMember = new Member(); 41 | // newMember.setName("Jane Doe"); 42 | // newMember.setEmail("jane@mailinator.com"); 43 | // newMember.setPhoneNumber("2125551234"); 44 | // memberRegistration.register(newMember); 45 | // assertNotNull(newMember.getId()); 46 | // log.info(newMember.getName() + " was persisted with id " + newMember.getId()); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /carrental-ejb/src/test/resources/META-INF/test-persistence.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 18 | 19 | 22 | 24 | java:jboss/datasources/carrentalTestDS 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /carrental-ejb/src/test/resources/arquillian.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /carrental-ejb/src/test/resources/test-ds.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 15 | 18 | 20 | 23 | jdbc:h2:mem:carrental-test;DB_CLOSE_DELAY=-1 24 | h2 25 | 26 | sa 27 | sa 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /carrental-web/.checkstyle: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /carrental-web/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 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 | -------------------------------------------------------------------------------- /carrental-web/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /carrental-web/.metadata/src/main/webapp/WEB-INF/faces-config.pageflow: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /carrental-web/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | carrental-web 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.wst.common.project.facet.core.builder 15 | 16 | 17 | 18 | 19 | org.jboss.tools.jst.web.kb.kbbuilder 20 | 21 | 22 | 23 | 24 | ts.eclipse.ide.core.typeScriptBuilder 25 | 26 | 27 | 28 | 29 | org.hibernate.eclipse.console.hibernateBuilder 30 | 31 | 32 | 33 | 34 | org.jboss.tools.cdi.core.cdibuilder 35 | 36 | 37 | 38 | 39 | org.eclipse.wst.validation.validationbuilder 40 | 41 | 42 | 43 | 44 | net.sf.eclipsecs.core.CheckstyleBuilder 45 | 46 | 47 | 48 | 49 | org.eclipse.m2e.core.maven2Builder 50 | 51 | 52 | 53 | 54 | 55 | org.eclipse.jem.workbench.JavaEMFNature 56 | org.eclipse.wst.common.modulecore.ModuleCoreNature 57 | org.eclipse.jdt.core.javanature 58 | org.eclipse.m2e.core.maven2Nature 59 | org.eclipse.wst.common.project.facet.core.nature 60 | org.hibernate.eclipse.console.hibernateNature 61 | org.jboss.tools.jst.web.kb.kbnature 62 | org.jboss.tools.cdi.core.cdinature 63 | net.sf.eclipsecs.core.CheckstyleNature 64 | 65 | 66 | 67 | 0 68 | src/angular/carrental 69 | 10 70 | 71 | org.eclipse.ui.ide.multiFilter 72 | 1.0-name-matches-false-false-tmp 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/test/java=UTF-8 4 | encoding/=UTF-8 5 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=17 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 13 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 14 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 15 | org.eclipse.jdt.core.compiler.release=disabled 16 | org.eclipse.jdt.core.compiler.source=17 17 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs: -------------------------------------------------------------------------------- 1 | XDOCLETBUILDERACTIVE=true 2 | XDOCLETHOME= 3 | XDOCLETUSEGLOBAL=true 4 | XDOCLETVERSION=1.2.1 5 | eclipse.preferences.version=1 6 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.m2e.wtp.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false 3 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.html.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | use-project-settings=true 3 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.validation.prefs: -------------------------------------------------------------------------------- 1 | DELEGATES_PREFERENCE=delegateValidatorList 2 | USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator; 3 | USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator; 4 | USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.701.v201707142105 5 | disabled=06target 6 | eclipse.preferences.version=1 7 | override=true 8 | suspend=false 9 | vals/org.eclipse.jst.jsf.facelet.ui.FaceletHTMLValidator/global=FF01 10 | vals/org.eclipse.jst.jsf.ui.JSFAppConfigValidator/global=FF01 11 | vals/org.eclipse.jst.jsp.core.JSPBatchValidator/global=FF01 12 | vals/org.eclipse.jst.jsp.core.JSPContentValidator/global=FF01 13 | vals/org.eclipse.jst.jsp.core.TLDValidator/global=FF01 14 | vals/org.eclipse.wst.dtd.core.dtdDTDValidator/groups=0107include04111contentType134org.eclipse.wst.dtd.core.dtdsourceT07fileext03dtdF07fileext03entF07fileext03modF0107exclude0204file06targetF0204file139src/main/angular/carrental/node_modulesF02 15 | vals/org.eclipse.wst.html.core.HTMLValidator/groups=0107include06111contentType136org.eclipse.wst.html.core.htmlsourceT07fileext04htmlF07fileext05xhtmlF07fileext03htmF07fileext04htplF07fileext03wmlF0107exclude0204file06targetF0204file139src/main/angular/carrental/node_modulesF02 16 | vals/org.eclipse.wst.json.core.json/groups=0107include02111contentType136org.eclipse.wst.json.core.jsonsourceT07fileext04jsonF0107exclude0204file06targetF0204file139src/main/angular/carrental/node_modulesF02 17 | vals/org.eclipse.wst.wsdl.validation.wsdl/groups=0107include0107fileext04wsdlF0107exclude0204file06targetF0204file139src/main/angular/carrental/node_modulesF02 18 | vals/org.eclipse.wst.xml.core.xml/groups=0107include05111contentType128org.eclipse.core.runtime.xmlT111contentType134org.eclipse.wst.xml.core.xmlsourceT111contentType134org.eclipse.wst.xml.core.xslsourceT111contentType134org.eclipse.jst.jsp.core.tldsourceT07fileext03xmlF0107exclude07113projectNature134org.eclipse.jst.j2ee.ejb.EJBNature113projectNature130org.eclipse.jst.j2ee.EARNature04file08.projectT0104file110.classpathT0104file110.settings/T0204file06targetF0204file139src/main/angular/carrental/node_modulesF02 19 | vals/org.eclipse.wst.xsd.core.xsd/groups=0107include0107fileext03xsdF0107exclude0204file06targetF0204file139src/main/angular/carrental/node_modulesF02 20 | vals/org.eclipse.wst.xsl.core.xsl/groups=0107include0207fileext03xslF111contentType134org.eclipse.wst.xml.core.xslsourceT0107exclude0204file06targetF0204file139src/main/angular/carrental/node_modulesF02 21 | vf.version=3 22 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.ws.service.policy.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.wst.ws.service.policy.projectEnabled=false 3 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.eclipse.wst.xsl.core.prefs: -------------------------------------------------------------------------------- 1 | CHECK_CALL_TEMPLATES=2 2 | CHECK_XPATHS=2 3 | CIRCULAR_REF=2 4 | DUPLICATE_PARAMETER=2 5 | EMPTY_PARAM=1 6 | MISSING_INCLUDE=2 7 | MISSING_PARAM=1 8 | NAME_ATTRIBUTE_EMPTY=2 9 | NAME_ATTRIBUTE_MISSING=2 10 | TEMPLATE_CONFLICT=2 11 | eclipse.preferences.version=1 12 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.hibernate.eclipse.console.prefs: -------------------------------------------------------------------------------- 1 | default.configuration=carrental-web 2 | eclipse.preferences.version=1 3 | hibernate3.enabled=true 4 | -------------------------------------------------------------------------------- /carrental-web/.settings/org.jboss.ide.eclipse.as.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.jboss.ide.eclipse.as.core.singledeployable.deployableList= 3 | -------------------------------------------------------------------------------- /carrental-web/.settings/ts.eclipse.ide.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | typeScriptBuildPath={} 3 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/.clang-format: -------------------------------------------------------------------------------- 1 | Language: JavaScript 2 | BasedOnStyle: Google 3 | ColumnLimit: 100 4 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": [ 4 | "projects/**/*" 5 | ], 6 | "overrides": [ 7 | { 8 | "files": [ 9 | "*.ts" 10 | ], 11 | "parserOptions": { 12 | "project": [ 13 | "tsconfig.json", 14 | "e2e/tsconfig.json" 15 | ], 16 | "createDefaultProgram": true 17 | }, 18 | "extends": [ 19 | "plugin:@angular-eslint/recommended", 20 | "plugin:@angular-eslint/template/process-inline-templates" 21 | ], 22 | "rules": { 23 | "@angular-eslint/component-selector": [ 24 | "error", 25 | { 26 | "prefix": "app", 27 | "style": "kebab-case", 28 | "type": "element" 29 | } 30 | ] 31 | } 32 | }, 33 | { 34 | "files": [ 35 | "*.html" 36 | ], 37 | "extends": [ 38 | "plugin:@angular-eslint/template/recommended" 39 | ], 40 | "rules": {} 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist/ 5 | /tmp/ 6 | 7 | # dependencies 8 | /node_modules/ 9 | /bower_components/ 10 | 11 | # IDEs and editors 12 | /.idea/ 13 | /.vscode/ 14 | .project 15 | .classpath 16 | *.launch 17 | .settings/ 18 | 19 | # misc 20 | /.angular/cache 21 | /.sass-cache 22 | /connect.lock 23 | /coverage/* 24 | /libpeerconnection.log 25 | npm-debug.log 26 | testem.log 27 | /typings/ 28 | 29 | # e2e 30 | /e2e/*.js 31 | /e2e/*.map 32 | 33 | #System Files 34 | .DS_Store 35 | Thumbs.db 36 | /.angular/ 37 | /coverage/ 38 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/README.md: -------------------------------------------------------------------------------- 1 | # carrental 2 | 3 | This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.18. 4 | 5 | For translation ng-translate is used. 6 | 7 | For Css setup bootstrap is used. 8 | 9 | ## Development server 10 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 11 | 12 | ## Code scaffolding 13 | 14 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class`. 15 | 16 | ## Build 17 | 18 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 19 | 20 | ## Running unit tests 21 | 22 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 23 | 24 | ## Running end-to-end tests 25 | 26 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 27 | Before running the tests make sure you are serving the app via `ng serve`. 28 | 29 | ## Deploying to Github Pages 30 | 31 | Run `ng github-pages:deploy` to deploy to Github Pages. 32 | 33 | ## Further help 34 | 35 | To get more help on the `angular-cli` use `ng --help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 36 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/browserslist: -------------------------------------------------------------------------------- 1 | last 2 Chrome version 2 | last 2 Firefox version 3 | last 2 Edge major versions 4 | last 2 Safari major version 5 | last 2 iOS major versions 6 | Firefox ESR 7 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the `not` prefix on this line..<% } %> 8 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { TestprojectPage } from './app.po'; 2 | import { browser, by, element, By, $, $$, ExpectedConditions } from 'protractor'; 3 | 4 | describe('testproject App', () => { 5 | let page: TestprojectPage; 6 | 7 | beforeEach(() => { 8 | page = new TestprojectPage(); 9 | }); 10 | 11 | it('should display welcome message', done => { 12 | page.navigateTo(); 13 | page.getParagraphText() 14 | .then(msg => expect(msg).toEqual('carrental works!')) 15 | .then(done, done.fail); 16 | }); 17 | it('should display the list page', done => { 18 | page.navigateToList(); 19 | page.getParagraphTextList() 20 | .then(msg => expect(msg).toEqual('crlist works!')) 21 | .then(done, done.fail); 22 | }); 23 | // a solution for testing async tables with protractor is missing 24 | // it('should display 2 lines in the table', done => { 25 | // browser.sleep(2000); 26 | // page.getListTableLength() 27 | // .then(table => expect(table.length).toEqual(2)) 28 | // .then(done, done.fail); 29 | // }); 30 | }); 31 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element, By, $, $$, ExpectedConditions } from 'protractor'; 2 | 3 | export class TestprojectPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | 12 | navigateToList() { 13 | return element(by.id('myList')).click(); 14 | } 15 | 16 | getParagraphTextList() { 17 | return element(by.id('myListId')).getText(); 18 | } 19 | 20 | getListTableLength() { 21 | let elems = by.exactRepeater('let row of tableRows | async'); 22 | let table = element.all(elems); 23 | return table; 24 | } 25 | } -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/0.13/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage'), 13 | require('@angular-devkit/build-angular/plugins/karma'), 14 | require('karma-junit-reporter') 15 | // require('karma-phantomjs-launcher') 16 | ], 17 | client:{ 18 | clearContext: false // leave Jasmine Spec Runner output visible in browser 19 | }, 20 | coverageIstanbulReporter: { 21 | reports: [ 'html', 'lcovonly' ], 22 | fixWebpackSourcePaths: true 23 | }, 24 | angularCli: { 25 | environment: 'dev' 26 | }, 27 | // reporters: ['progress', 'kjhtml', 'junit'], 28 | reporters: ['progress', 'kjhtml'], 29 | junitReporter: { 30 | outputDir: 'reports', // results will be saved as $outputDir/$browserName.xml 31 | outputFile: 'junit.xml', // if included, results will be saved as $outputDir/$browserName/$outputFile 32 | useBrowserName: false // add browser name to report and classes names 33 | }, 34 | port: 9876, 35 | colors: true, 36 | logLevel: config.LOG_INFO, 37 | autoWatch: true, 38 | browsers: ['Chromium', 'ChromeHeadless', 'ChromiumHeadless'], 39 | customLaunchers: { 40 | ChromeHeadless: { 41 | base: 'Chrome', 42 | flags: ['--no-sandbox','--headless', '--disable-gpu', '--remote-debugging-port=9222'] 43 | }, 44 | ChromiumHeadless: { 45 | base: 'Chromium', 46 | flags: ['--no-sandbox','--headless', '--disable-gpu', '--remote-debugging-port=9222'] 47 | } 48 | }, 49 | singleRun: false 50 | }); 51 | }; 52 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "carrental", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "angular-cli": {}, 6 | "scripts": { 7 | "ng": "ng", 8 | "start": "ng serve --hmr --proxy-config proxy.conf.json", 9 | "build": "ng build --localize --configuration=production", 10 | "test": "ng test --browsers ChromeHeadless --watch=false --code-coverage=true", 11 | "test-chromium": "ng test --browsers ChromiumHeadless --watch=false --code-coverage=true", 12 | "test-local": "ng test --browsers Chromium --watch=true", 13 | "extract-i18n": "ng extract-i18n --format=json", 14 | "lint": "ng lint", 15 | "e2e": "ng e2e", 16 | "prettier": "npx prettier --write 'src/**/*.{ts,html,scss,json}'" 17 | }, 18 | "private": true, 19 | "dependencies": { 20 | "@angular/animations": "^19.0.0", 21 | "@angular/common": "^19.0.0", 22 | "@angular/compiler": "^19.0.0", 23 | "@angular/core": "^19.0.0", 24 | "@angular/forms": "^19.0.0", 25 | "@angular/localize": "^19.0.0", 26 | "@angular/platform-browser": "^19.0.0", 27 | "@angular/platform-browser-dynamic": "^19.0.0", 28 | "@angular/router": "^19.0.0", 29 | "bootstrap": "^4.5.2", 30 | "core-js": "^3.19.1", 31 | "popper.js": "^1.16.1", 32 | "rxjs": "^7.4.0", 33 | "swagger-ui-dist": "^4.14.2", 34 | "tslib": "^2.3.1", 35 | "zone.js": "~0.15.0" 36 | }, 37 | "devDependencies": { 38 | "@angular-devkit/build-angular": "^19.0.1", 39 | "@angular/cli": "^19.0.1", 40 | "@angular/compiler-cli": "^19.0.0", 41 | "@angular/language-service": "^19.0.0", 42 | "@types/jasmine": "~3.10.0", 43 | "@types/jasminewd2": "~2.0.3", 44 | "@types/node": "^18.0.0", 45 | "cpx": "^1.5.0", 46 | "jasmine-core": "~4.0.0", 47 | "jasmine-spec-reporter": "~7.0.0", 48 | "karma": "~6.3.16", 49 | "karma-chrome-launcher": "~3.1.0", 50 | "karma-coverage": "~2.0.3", 51 | "karma-jasmine": "~4.0.0", 52 | "karma-jasmine-html-reporter": "^1.5.0", 53 | "karma-junit-reporter": "~1.2.0", 54 | "jquery": "^3.5.0", 55 | "npm-run-all": "^4.1.5", 56 | "ts-node": "~10.4.0", 57 | "rimraf": "^5.0.2", 58 | "typescript": "~5.6.3", 59 | "prettier": "^3.0.0", 60 | "webpack-bundle-analyzer": "^4.5.0", 61 | "eslint": "^9.15.0", 62 | "eslint-config-prettier": "^9.0.0", 63 | "eslint-plugin-prettier": "^5.0.0", 64 | "@angular-eslint/builder": "^19.0.0-alpha.1", 65 | "@angular-eslint/eslint-plugin": "^19.0.0-alpha.1", 66 | "@angular-eslint/eslint-plugin-template": "^19.0.0-alpha.1", 67 | "@angular-eslint/schematics": "^19.0.0-alpha.1", 68 | "@angular-eslint/template-parser": "^19.0.0-alpha.1", 69 | "@typescript-eslint/eslint-plugin": "^8.15.0", 70 | "@typescript-eslint/parser": "^8.15.0" 71 | } 72 | } -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/proxy.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "/rest": { 3 | "target": "http://localhost:8080/carrental-web", 4 | "secure": false 5 | } 6 | } -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { NgModule } from "@angular/core"; 17 | import { Routes, RouterModule } from "@angular/router"; 18 | import { CrlistComponent } from "./crlist/crlist.component"; 19 | import { CrdetailComponent } from "./crdetail/crdetail.component"; 20 | import { AppComponent } from "./app.component"; 21 | import { CrrootComponent } from "./crroot/crroot.component"; 22 | 23 | const routes: Routes = [ 24 | { path: "crdetail/mietenr/:mnr/jahr/:jahr", component: CrdetailComponent }, 25 | { path: "crlist/mietenr/:mnr", component: CrlistComponent }, 26 | { path: "crroot", component: CrrootComponent }, 27 | { path: "**", redirectTo: "/crroot", pathMatch: "full" }, 28 | ]; 29 | 30 | @NgModule({ 31 | imports: [RouterModule.forRoot(routes, {})], 32 | exports: [RouterModule], 33 | providers: [], 34 | }) 35 | export class AppRoutingModule {} 36 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |

{{ title }}

2 | Link zu crroot 3 | Link zu crdetail 6 | Link zu crlist 7 | 8 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/angular/carrental/src/app/app.component.scss -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | /* eslint-disable @typescript-eslint/no-unused-vars */ 17 | 18 | import { TestBed, waitForAsync } from "@angular/core/testing"; 19 | import { AppComponent } from "./app.component"; 20 | import { AppRoutingModule } from "./app-routing.module"; 21 | import { CrlistComponent } from "./crlist/crlist.component"; 22 | import { CrdetailComponent } from "./crdetail/crdetail.component"; 23 | import { CrValuesComponent } from "./crvalues/crvalues.component"; 24 | import { CrvaluesdComponent } from "./crvaluesd/crvaluesd.component"; 25 | import { CrdateComponent } from "./crdate/crdate.component"; 26 | import { CrrootComponent } from "./crroot/crroot.component"; 27 | import { CruploadComponent } from "./crupload/crupload.component"; 28 | 29 | import { BrowserModule } from "@angular/platform-browser"; 30 | import { FormsModule, ReactiveFormsModule } from "@angular/forms"; 31 | import { provideHttpClient, withInterceptorsFromDi } from "@angular/common/http"; 32 | import { APP_BASE_HREF } from "@angular/common"; 33 | import { HttpTestingController } from "@angular/common/http/testing"; 34 | import { NumberSeparatorPipe } from "./shared/number-separator.pipe"; 35 | 36 | describe("AppComponent", () => { 37 | beforeEach(() => { 38 | TestBed.configureTestingModule({ 39 | declarations: [ 40 | AppComponent, 41 | CrrootComponent, 42 | CrlistComponent, 43 | CrdetailComponent, 44 | CrValuesComponent, 45 | CrvaluesdComponent, 46 | CrdateComponent, 47 | NumberSeparatorPipe, 48 | CruploadComponent, 49 | ], 50 | imports: [BrowserModule, 51 | FormsModule, 52 | ReactiveFormsModule, 53 | AppRoutingModule], 54 | providers: [{ provide: APP_BASE_HREF, useValue: "/" }, provideHttpClient(withInterceptorsFromDi())] 55 | }); 56 | TestBed.compileComponents(); 57 | }); 58 | 59 | it("should create the app", waitForAsync(() => { 60 | const fixture = TestBed.createComponent(AppComponent); 61 | const app = fixture.debugElement.componentInstance; 62 | expect(app).toBeTruthy(); 63 | })); 64 | 65 | it(`should have as title 'app works!'`, waitForAsync(() => { 66 | const fixture = TestBed.createComponent(AppComponent); 67 | const app = fixture.debugElement.componentInstance; 68 | expect(app.title).toEqual("carrental works!"); 69 | })); 70 | 71 | it("should render title in a h1 tag", waitForAsync(() => { 72 | const fixture = TestBed.createComponent(AppComponent); 73 | fixture.detectChanges(); 74 | const compiled = fixture.debugElement.nativeElement; 75 | expect(compiled.querySelector("h1").textContent).toContain( 76 | "carrental works!" 77 | ); 78 | })); 79 | }); 80 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Component } from "@angular/core"; 17 | 18 | @Component({ 19 | selector: "app-root", 20 | templateUrl: "./app.component.html", 21 | styleUrls: ["./app.component.scss"], 22 | standalone: false 23 | }) 24 | export class AppComponent { 25 | protected title = "carrental works!"; 26 | 27 | constructor() {} 28 | } 29 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { BrowserModule } from "@angular/platform-browser"; 17 | import { NgModule, ErrorHandler } from "@angular/core"; 18 | import { FormsModule, ReactiveFormsModule } from "@angular/forms"; 19 | import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from "@angular/common/http"; 20 | import { AppComponent } from "./app.component"; 21 | import { CrlistComponent } from "./crlist/crlist.component"; 22 | import { CrdetailComponent } from "./crdetail/crdetail.component"; 23 | import { CrValuesComponent } from "./crvalues/crvalues.component"; 24 | import { CrRestService } from "./services/crrest.service"; 25 | import { AppRoutingModule } from "./app-routing.module"; 26 | import { CrvaluesdComponent } from "./crvaluesd/crvaluesd.component"; 27 | import { CrdateComponent } from "./crdate/crdate.component"; 28 | import { NumberSeparatorPipe } from "./shared/number-separator.pipe"; 29 | import { NumberseparatorDirective } from "./shared/numberseparator.directive"; 30 | import { CrrootComponent } from "./crroot/crroot.component"; 31 | import { CruploadComponent } from "./crupload/crupload.component"; 32 | //import { MyErrorHandler } from './shared/my-error-handler'; 33 | import { BaseHrefInterceptor } from "./services/base-href-interceptor"; 34 | 35 | @NgModule({ declarations: [ 36 | AppComponent, 37 | CrlistComponent, 38 | CrdetailComponent, 39 | CrValuesComponent, 40 | CrvaluesdComponent, 41 | CrdateComponent, 42 | NumberSeparatorPipe, 43 | NumberseparatorDirective, 44 | CrrootComponent, 45 | CruploadComponent, 46 | ], 47 | bootstrap: [AppComponent], imports: [BrowserModule, 48 | FormsModule, 49 | ReactiveFormsModule, 50 | AppRoutingModule], providers: [ 51 | //{provide: ErrorHandler, useClass: MyErrorHandler}, 52 | { provide: HTTP_INTERCEPTORS, useClass: BaseHrefInterceptor, multi: true }, 53 | provideHttpClient(withInterceptorsFromDi()), 54 | ] }) 55 | export class AppModule {} 56 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crdate/crdate.component.html: -------------------------------------------------------------------------------- 1 |
2 | 9 | 16 |
17 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crdate/crdate.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/angular/carrental/src/app/crdate/crdate.component.scss -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crdate/crdate.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; 2 | 3 | import { CrdateComponent } from "./crdate.component"; 4 | 5 | describe("CrdateComponent", () => { 6 | let component: CrdateComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(waitForAsync(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [CrdateComponent], 12 | }).compileComponents(); 13 | })); 14 | 15 | beforeEach(() => { 16 | fixture = TestBed.createComponent(CrdateComponent); 17 | component = fixture.componentInstance; 18 | fixture.detectChanges(); 19 | }); 20 | 21 | it("should create", () => { 22 | expect(component).toBeTruthy(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crdate/crdate.component.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Component, Input, OnInit } from "@angular/core"; 17 | 18 | @Component({ 19 | selector: "app-crdate", 20 | templateUrl: "./crdate.component.html", 21 | styleUrls: ["./crdate.component.scss"], 22 | standalone: false 23 | }) 24 | export class CrdateComponent implements OnInit { 25 | constructor() {} 26 | @Input() myobject: any; 27 | @Input() myvalue: string; 28 | @Input() mytype: string; 29 | protected newDate: number; 30 | protected newString: string; 31 | 32 | ngOnInit() { 33 | if (!this.myobject) { 34 | return; 35 | } //for the tests 36 | if (!this.mytype) { 37 | this.newDate = this.myobject[this.myvalue]; 38 | } else { 39 | this.newString = this.myobject[this.myvalue]; 40 | // console.log(this.newString); 41 | } 42 | } 43 | 44 | setStr(event: any): void { 45 | this.myobject[this.myvalue] = event.target.value; 46 | //console.log(event.target.value); 47 | } 48 | 49 | convertToDate(event: any): void { 50 | const myDate = this.myobject[this.myvalue]; 51 | console.log(this.myvalue + ": " + myDate); 52 | const dateStr = event.target.value; 53 | const dtStr = dateStr.split("-"); 54 | const newStr = dtStr[1] + "/" + dtStr[2] + "/" + dtStr[0]; 55 | const newDate = new Date(newStr); 56 | //console.log(newStr); 57 | //console.log(newDate.getTime()); 58 | this.myobject[this.myvalue] = newDate.getTime(); 59 | this.newDate = newDate.getTime(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crdetail/crdetail.component.scss: -------------------------------------------------------------------------------- 1 | .wrapper { 2 | width: 100%; 3 | } 4 | .flex-container-column { 5 | display: flex; 6 | flex-wrap: nowrap; 7 | flex-direction: column; 8 | } 9 | .flex-container-row { 10 | display: flex; 11 | flex-wrap: nowrap; 12 | flex-direction: row; 13 | width: 100%; 14 | } 15 | 16 | .flex-column { 17 | flex: 1 0 100px; 18 | width: 100%; 19 | } 20 | 21 | .flex-row1 { 22 | flex: 1 0 15%; 23 | display: flex; 24 | align-items: center; 25 | flex-wrap: wrap; 26 | } 27 | .flex-row2 { 28 | flex: 1 0 85%; 29 | } 30 | .row-content { 31 | display: flex; 32 | width: 100%; 33 | height: 70%; 34 | align-items: center; 35 | } 36 | 37 | .bottom-buttons { 38 | height: 30%; 39 | width: 100%; 40 | text-align: center; 41 | } 42 | 43 | .column-text { 44 | } 45 | 46 | @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { 47 | .flex-container-column { 48 | display: block; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crdetail/crdetail.component.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | /* eslint-disable @typescript-eslint/no-unused-vars */ 17 | 18 | import { TestBed, waitForAsync } from "@angular/core/testing"; 19 | import { CrdetailComponent } from "./crdetail.component"; 20 | 21 | //describe('Component: MyComponent', () => { 22 | // it('should create an instance', () => { 23 | // let component = new LsddetailComponent(null,null,null); 24 | // expect(component).toBeTruthy(); 25 | // }); 26 | //}); 27 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crlist/crlist.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

crlist works!

5 | 8 | 11 | 14 |
15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 |
JahrStatusGrundFahrzeuge TotalMiete geplant TotalMiete abgerechnet TotalAnzahl PkwAnzahl LkwDatumMutiererMahnstop
32 | {{ row.jahr }} 36 | {{ row.status }}{{ row.grund }}{{ row.fahrzeugeTotal }}{{ row.mieteGeplantTotal }}{{ row.mieteAbgerechnetTotal }}{{ row.anzahlPkw }}{{ row.anzahlLkw }}{{ row.mutatedAt | date : "dd.MM.yyyy" }}{{ row.mutatedBy }} 47 | 48 |
51 |
52 |
53 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crlist/crlist.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/angular/carrental/src/app/crlist/crlist.component.scss -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crlist/crlist.component.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | /* eslint-disable @typescript-eslint/no-unused-vars */ 17 | 18 | import { TestBed, waitForAsync } from "@angular/core/testing"; 19 | import { Component } from "@angular/core"; 20 | import { By } from "@angular/platform-browser"; 21 | import { CrlistComponent } from "./crlist.component"; 22 | 23 | //describe('Component: MyComponent', () => { 24 | // it('should create an instance', () => { 25 | // let component = new LsddetailComponent(null,null,null); 26 | // expect(component).toBeTruthy(); 27 | // }); 28 | //}); 29 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crlist/crlist.component.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Component, OnInit, OnDestroy } from "@angular/core"; 17 | import { ActivatedRoute, Router, ParamMap } from "@angular/router"; 18 | import { Observable, of } from "rxjs"; 19 | import { CrRestService } from "../services/crrest.service"; 20 | import { CrTableRow } from "../dtos/crTypes"; 21 | import { PlatformLocation } from "@angular/common"; 22 | 23 | @Component({ 24 | selector: "app-crlist", 25 | templateUrl: "./crlist.component.html", 26 | styleUrls: ["./crlist.component.scss"], 27 | standalone: false 28 | }) 29 | export class CrlistComponent implements OnInit { 30 | protected tableRows: Observable; 31 | protected errorMsg: string; 32 | protected modalvisible = false; 33 | 34 | constructor( 35 | private route: ActivatedRoute, 36 | private router: Router, 37 | private service: CrRestService, 38 | private platformLocation: PlatformLocation 39 | ) {} 40 | 41 | ngOnInit(): void { 42 | const mnr = this.route.snapshot.paramMap.get("mnr"); 43 | this.tableRows = this.service.getCrTableRows(mnr); 44 | } 45 | 46 | showPdf(mietNr: string) { 47 | window.open( 48 | `${this.getBaseHref()}/rest/model/crTable/mietNr/${mietNr}/pdf` 49 | ); 50 | } 51 | 52 | private getBaseHref(): string { 53 | const myBaseHref = 54 | !this.platformLocation.getBaseHrefFromDOM() || 55 | this.platformLocation.getBaseHrefFromDOM().length < 2 56 | ? "//".split("/") 57 | : this.platformLocation.getBaseHrefFromDOM().split("/"); 58 | return myBaseHref[1].length > 0 ? "/" + myBaseHref[1] : ""; 59 | } 60 | 61 | showModal() { 62 | this.modalvisible = !this.modalvisible; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crroot/crroot.component.html: -------------------------------------------------------------------------------- 1 |
2 |
{{ title }}
3 |
4 |
5 | 6 |
7 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crroot/crroot.component.scss: -------------------------------------------------------------------------------- 1 | canvas { 2 | border: 2px solid black; 3 | } 4 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crroot/crroot.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; 2 | 3 | import { CrrootComponent } from "./crroot.component"; 4 | 5 | //describe('CrrootComponent', () => { 6 | // let component: CrrootComponent; 7 | // let fixture: ComponentFixture; 8 | // 9 | // beforeEach(async(() => { 10 | // TestBed.configureTestingModule({ 11 | // declarations: [ CrrootComponent ] 12 | // }) 13 | // .compileComponents(); 14 | // })); 15 | // 16 | // beforeEach(() => { 17 | // fixture = TestBed.createComponent(CrrootComponent); 18 | // component = fixture.componentInstance; 19 | // fixture.detectChanges(); 20 | // }); 21 | // 22 | // it('should create', () => { 23 | // expect(component).toBeTruthy(); 24 | // }); 25 | //}); 26 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crupload/crupload.component.html: -------------------------------------------------------------------------------- 1 | 14 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crupload/crupload.component.scss: -------------------------------------------------------------------------------- 1 | /* Modal Background */ 2 | .modal { 3 | display: none; 4 | position: fixed; 5 | z-index: 1; 6 | padding-top: 100px; 7 | left: 0; 8 | top: 0; 9 | width: 100%; 10 | height: 100%; 11 | overflow: auto; 12 | background-color: rgba(0, 0, 0, 0.4); 13 | } 14 | 15 | /* Modal Content */ 16 | .modal-content { 17 | background-color: #fefefe; 18 | margin: auto; 19 | padding: 20px; 20 | border: 1px solid #888; 21 | width: 80%; 22 | } 23 | 24 | /* The Close Button */ 25 | .close { 26 | color: #aaaaaa; 27 | float: right; 28 | font-size: 28px; 29 | font-weight: bold; 30 | } 31 | 32 | .close:hover, 33 | .close:focus { 34 | color: #000; 35 | text-decoration: none; 36 | cursor: pointer; 37 | } 38 | .myInline { 39 | display: inline; 40 | } 41 | 42 | textarea { 43 | width: 100%; 44 | } 45 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crupload/crupload.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; 2 | 3 | import { CruploadComponent } from "./crupload.component"; 4 | 5 | //describe('CruploadComponent', () => { 6 | // let component: CruploadComponent; 7 | // let fixture: ComponentFixture; 8 | // 9 | // beforeEach(async(() => { 10 | // TestBed.configureTestingModule({ 11 | // declarations: [ CruploadComponent ] 12 | // }) 13 | // .compileComponents(); 14 | // })); 15 | // 16 | // beforeEach(() => { 17 | // fixture = TestBed.createComponent(CruploadComponent); 18 | // component = fixture.componentInstance; 19 | // fixture.detectChanges(); 20 | // }); 21 | // 22 | // it('should create', () => { 23 | // expect(component).toBeTruthy(); 24 | // }); 25 | //}); 26 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crupload/crupload.component.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import { 18 | Component, 19 | OnInit, 20 | Input, 21 | OnChanges, 22 | SimpleChange, 23 | } from "@angular/core"; 24 | 25 | @Component({ 26 | selector: "app-crupload", 27 | templateUrl: "./crupload.component.html", 28 | styleUrls: ["./crupload.component.scss"], 29 | standalone: false 30 | }) 31 | export class CruploadComponent implements OnInit, OnChanges { 32 | @Input() visible: boolean; 33 | protected currentFile: File; 34 | protected filetext: string; 35 | 36 | constructor() {} 37 | 38 | filechange(fileInput: any) { 39 | this.currentFile = fileInput.target.files[0]; 40 | 41 | const reader = new FileReader(); 42 | reader.onload = () => { 43 | const textstr: string = reader.result; 44 | const textstrs = textstr.split("base64,"); 45 | this.filetext = atob(textstrs[1]); 46 | //console.log(textstr); 47 | }; 48 | reader.readAsDataURL(this.currentFile); 49 | } 50 | 51 | ngOnInit() { 52 | const modal = document.getElementById("crModal"); 53 | modal.style.display = this.visible ? "block" : "none"; 54 | } 55 | 56 | ngOnChanges(changes: { [propKey: string]: SimpleChange }): void { 57 | for (const propName in changes) { 58 | const changedProp = changes[propName]; 59 | console.log(propName + " " + changedProp.currentValue); 60 | const modal = document.getElementById("crModal"); 61 | modal.style.display = "block"; 62 | } 63 | } 64 | 65 | close() { 66 | const modal = document.getElementById("crModal"); 67 | modal.style.display = "none"; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crvalues/crvalues.component.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 22 | 27 | 37 | 38 | 39 | 40 | 41 | 50 | 55 | 65 | 66 | 67 | 68 | 69 | 72 | 77 | 82 | 83 |
Anzahl FahrzeugeMiete geplantMiete abgerechnet
Pkw 14 |
15 | 20 |
21 |
23 |
24 | {{ crvalues.mieteGeplantPkw | numberSeparator : 3 }} 25 |
26 |
28 |
29 | 35 |
36 |
Lkw 42 |
43 | 48 |
49 |
51 |
52 | {{ crvalues.mieteGeplantLkw | numberSeparator : 3 }} 53 |
54 |
56 |
57 | 63 |
64 |
Total 70 |
{{ crvalues.anzahlTotal }}
71 |
73 |
74 | {{ crvalues.mieteGeplantTotal | numberSeparator : 3 }} 75 |
76 |
78 |
79 | {{ crvalues.mieteAbgerechnetTotal | numberSeparator : 3 }} 80 |
81 |
84 |
85 | {{ form.valid }} 86 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crvalues/crvalues.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/angular/carrental/src/app/crvalues/crvalues.component.scss -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crvalues/crvalues.component.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | /* eslint-disable @typescript-eslint/no-unused-vars */ 17 | 18 | import { By } from "@angular/platform-browser"; 19 | import { DebugElement } from "@angular/core"; 20 | import { TestBed, waitForAsync } from "@angular/core/testing"; 21 | import { UntypedFormBuilder } from "@angular/forms"; 22 | import { CrValuesComponent } from "./crvalues.component"; 23 | import { CrPortfolio } from "../dtos/crTypes"; 24 | 25 | describe("Component: CrValues", () => { 26 | it("validate should return false", () => { 27 | const component = new CrValuesComponent(new UntypedFormBuilder()); 28 | const param = new CrPortfolioImplTest(null, null, null, null); 29 | component.crvalues = param; 30 | component.ngOnInit(); 31 | expect(!component.form.valid).toBeTruthy(); 32 | }); 33 | 34 | it("validate should return true", () => { 35 | const component = new CrValuesComponent(new UntypedFormBuilder()); 36 | const param = new CrPortfolioImplTest(1, 1, 1, 1); 37 | component.crvalues = param; 38 | component.ngOnInit(); 39 | expect(component.form.valid).toBeTruthy(); 40 | }); 41 | 42 | it("validate should return false", () => { 43 | const component = new CrValuesComponent(new UntypedFormBuilder()); 44 | const param = new CrPortfolioImplTest(-1, -1, -1, -1); 45 | component.crvalues = param; 46 | component.ngOnInit(); 47 | expect(!component.form.valid).toBeTruthy(); 48 | }); 49 | 50 | // it('make tests fail', () => { 51 | // expect(false).toBeTruthy(); 52 | // }) 53 | }); 54 | 55 | class CrPortfolioImplTest implements CrPortfolio { 56 | constructor( 57 | anzahlPkw: number, 58 | anzahlLkw: number, 59 | mieteAbgerechnetPkw: number, 60 | mieteAbgerechnetLkw: number 61 | ) { 62 | this.anzahlPkw = anzahlPkw; 63 | this.anzahlLkw = anzahlLkw; 64 | this.mieteAbgerechnetPkw = mieteAbgerechnetPkw; 65 | this.mieteAbgerechnetLkw = mieteAbgerechnetLkw; 66 | } 67 | 68 | id: number; 69 | bezeichnung: string; 70 | anzahlPkw: number; 71 | anzahlLkw: number; 72 | anzahlTotal: number; 73 | mieteGeplantPkw: number; 74 | mieteGeplantLkw: number; 75 | mieteGeplantTotal: number; 76 | mieteAbgerechnetPkw: number; 77 | mieteAbgerechnetLkw: number; 78 | mieteAbgerechnetTotal: number; 79 | } 80 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crvaluesd/crvaluesd.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 22 | 27 | 28 | 29 | 30 | 31 | 36 | 41 | 46 | 47 | 48 | 49 | 50 | 55 | 60 | 65 | 66 |
Anzahl FahrzeugeMiete geplantMiete abgerechnet
Pkw 13 |
14 | {{ crvalues.anzahlPkw | numberSeparator : 3 }} 15 |
16 |
18 |
19 | {{ crvalues.mieteGeplantPkw | numberSeparator : 3 }} 20 |
21 |
23 |
24 | {{ crvalues.mieteAbgerechnetPkw | numberSeparator : 3 }} 25 |
26 |
Lkw 32 |
33 | {{ crvalues.anzahlLkw | numberSeparator : 3 }} 34 |
35 |
37 |
38 | {{ crvalues.mieteGeplantPkw | numberSeparator : 3 }} 39 |
40 |
42 |
43 | {{ crvalues.mieteAbgerechnetLkw | numberSeparator : 3 }} 44 |
45 |
Total 51 |
52 | {{ crvalues.anzahlTotal | numberSeparator : 3 }} 53 |
54 |
56 |
57 | {{ crvalues.mieteGeplantTotal | numberSeparator : 3 }} 58 |
59 |
61 |
62 | {{ crvalues.mieteAbgerechnetTotal | numberSeparator : 3 }} 63 |
64 |
67 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crvaluesd/crvaluesd.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/angular/carrental/src/app/crvaluesd/crvaluesd.component.scss -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crvaluesd/crvaluesd.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; 2 | 3 | import { CrvaluesdComponent } from "./crvaluesd.component"; 4 | 5 | //describe('CrvaluesdComponent', () => { 6 | // let component: CrvaluesdComponent; 7 | // let fixture: ComponentFixture; 8 | // 9 | // beforeEach(async(() => { 10 | // TestBed.configureTestingModule({ 11 | // declarations: [ CrvaluesdComponent ] 12 | // }) 13 | // .compileComponents(); 14 | // })); 15 | // 16 | // beforeEach(() => { 17 | // fixture = TestBed.createComponent(CrvaluesdComponent); 18 | // component = fixture.componentInstance; 19 | // fixture.detectChanges(); 20 | // }); 21 | // 22 | // it('should create', () => { 23 | // expect(component).toBeTruthy(); 24 | // }); 25 | //}); 26 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/crvaluesd/crvaluesd.component.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Component, OnInit, Input } from "@angular/core"; 17 | import { CrPortfolio } from "../dtos/crTypes"; 18 | import { NumberSeparatorPipe } from "../shared/number-separator.pipe"; 19 | import { Utils } from "../shared/utils"; 20 | 21 | @Component({ 22 | selector: "app-crvaluesd", 23 | templateUrl: "./crvaluesd.component.html", 24 | styleUrls: ["./crvaluesd.component.scss"], 25 | standalone: false 26 | }) 27 | export class CrvaluesdComponent implements OnInit { 28 | @Input() crvalues: CrPortfolio; 29 | constructor() {} 30 | 31 | ngOnInit() { 32 | this.crvalues.anzahlTotal = 33 | this.crvalues.anzahlLkw + this.crvalues.anzahlPkw; 34 | const abgPkw = Utils.removeSeparators( 35 | this.crvalues.mieteAbgerechnetPkw 36 | ? this.crvalues.mieteAbgerechnetPkw.toString() 37 | : "0" 38 | ); 39 | const abgLkw = Utils.removeSeparators( 40 | this.crvalues.mieteAbgerechnetLkw 41 | ? this.crvalues.mieteAbgerechnetLkw.toString() 42 | : "0" 43 | ); 44 | this.crvalues.mieteAbgerechnetTotal = abgPkw + abgLkw; 45 | const gplPkw = Utils.removeSeparators( 46 | this.crvalues.mieteGeplantPkw 47 | ? this.crvalues.mieteGeplantPkw.toString() 48 | : "0" 49 | ); 50 | const gplLkw = Utils.removeSeparators( 51 | this.crvalues.mieteGeplantLkw 52 | ? this.crvalues.mieteGeplantLkw.toString() 53 | : "0" 54 | ); 55 | this.crvalues.mieteGeplantTotal = gplPkw + gplLkw; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/dtos/crClasses.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { 17 | CrTableRow, 18 | CrDetail, 19 | CrPeriod, 20 | CrPortfolio, 21 | CrMessage, 22 | CrLogMsg, 23 | } from "./crTypes"; 24 | 25 | export class CrTableRowImpl implements CrTableRow { 26 | constructor( 27 | public mietNr: string, 28 | public jahr: string, 29 | public status: string, 30 | public grund: string, 31 | public fahrzeugeTotal: number, 32 | public mieteGeplantTotal: number, 33 | public mieteAbgerechnetTotal: number, 34 | public anzahlPkw: number, 35 | public anzahlLkw: number, 36 | public mutatedAt: Date, 37 | public mutatedBy: string, 38 | public mahnstop: boolean 39 | ) {} 40 | } 41 | 42 | export class CrDetailImpl implements CrDetail { 43 | constructor( 44 | public id: number, 45 | public changeable: boolean, 46 | public mieteNr: string, 47 | public jahr: string, 48 | public crTableRow: CrTableRow, 49 | public crPeriods: CrPeriod[], 50 | public crMessages: CrMessage[] 51 | ) {} 52 | } 53 | 54 | export class CrPeriodImpl implements CrPeriod { 55 | constructor( 56 | public id: number, 57 | public from: Date, 58 | public to: Date, 59 | public crPortfolios: CrPortfolio[] 60 | ) {} 61 | } 62 | 63 | export class CrPortfolioImpl implements CrPortfolio { 64 | constructor( 65 | public id: number, 66 | public bezeichnung: string, 67 | public anzahlPkw: number, 68 | public anzahlLkw: number, 69 | public anzahlTotal: number, 70 | public mieteGeplantPkw: number, 71 | public mieteGeplantLkw: number, 72 | public mieteGeplantTotal: number, 73 | public mieteAbgerechnetPkw: number, 74 | public mieteAbgerechnetLkw: number, 75 | public mieteAbgerechnetTotal: number 76 | ) {} 77 | } 78 | 79 | export class CrMessageImpl implements CrMessage { 80 | constructor(public id: number, public msgType: string, public msg: string) {} 81 | } 82 | 83 | export class CrLogMsgImpl implements CrLogMsg { 84 | constructor(public logLevel: string, public logMsg: string) {} 85 | } 86 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/dtos/crTypes.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export interface CrTableRow { 17 | mietNr: string; 18 | jahr: string; 19 | status: string; 20 | grund: string; 21 | fahrzeugeTotal: number; 22 | mieteGeplantTotal: number; 23 | mieteAbgerechnetTotal: number; 24 | anzahlPkw: number; 25 | anzahlLkw: number; 26 | mutatedAt: Date; 27 | mutatedBy: string; 28 | mahnstop: boolean; 29 | } 30 | 31 | export interface CrDetail { 32 | id: number; 33 | changeable: boolean; 34 | mieteNr: string; 35 | jahr: string; 36 | crTableRow: CrTableRow; 37 | crPeriods: CrPeriod[]; 38 | crMessages: CrMessage[]; 39 | } 40 | 41 | export interface CrPeriod { 42 | id: number; 43 | from: Date; 44 | to: Date; 45 | crPortfolios: CrPortfolio[]; 46 | } 47 | 48 | export interface CrPortfolio { 49 | id: number; 50 | bezeichnung: string; 51 | anzahlPkw: number; 52 | anzahlLkw: number; 53 | anzahlTotal: number; 54 | mieteGeplantPkw: number; 55 | mieteGeplantLkw: number; 56 | mieteGeplantTotal: number; 57 | mieteAbgerechnetPkw: number; 58 | mieteAbgerechnetLkw: number; 59 | mieteAbgerechnetTotal: number; 60 | } 61 | 62 | export interface CrMessage { 63 | id: number; 64 | msgType: string; 65 | msg: string; 66 | } 67 | 68 | export interface CrLogMsg { 69 | logLevel: string; 70 | logMsg: string; 71 | } 72 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/environment.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | // The file for the current environment will overwrite this one during build 17 | // Different environments can be found in config/environment.{dev|prod}.ts 18 | // The build system defaults to the dev environment 19 | 20 | export const environment = { 21 | production: false, 22 | }; 23 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export * from "./app.component"; 17 | export * from "./app.module"; 18 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/services/base-href-interceptor.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Injectable } from "@angular/core"; 17 | import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent, HttpErrorResponse, HttpHeaders } from "@angular/common/http"; 18 | import { Observable, of } from "rxjs"; 19 | import { tap } from "rxjs/operators"; 20 | import { PlatformLocation } from "@angular/common"; 21 | import { CrRestService } from "./crrest.service"; 22 | import { CrLogMsgImpl } from "../dtos/crClasses"; 23 | 24 | @Injectable() 25 | export class BaseHrefInterceptor implements HttpInterceptor { 26 | private defaultReqHeader = new HttpHeaders().set( 27 | "Content-Type", 28 | "application/json" 29 | ); 30 | 31 | constructor( 32 | private platformLocation: PlatformLocation, 33 | private crRestService: CrRestService 34 | ) {} 35 | 36 | intercept( 37 | req: HttpRequest, 38 | next: HttpHandler 39 | ): Observable> { 40 | const myBaseHref = 41 | !this.platformLocation.getBaseHrefFromDOM() || 42 | this.platformLocation.getBaseHrefFromDOM().length < 2 43 | ? "//".split("/") 44 | : this.platformLocation.getBaseHrefFromDOM().split("/"); 45 | req = req.clone({ 46 | headers: this.defaultReqHeader, 47 | url: (myBaseHref[1].length > 0 ? "/" + myBaseHref[1] : "") + req.url, 48 | }); 49 | //console.log(myBaseHref); 50 | return next.handle(req).pipe( 51 | tap( 52 | (event) => event, 53 | (event) => this.handleError(event) 54 | ) 55 | ); 56 | } 57 | 58 | private handleError(event: HttpEvent): HttpEvent { 59 | if (event instanceof HttpErrorResponse) { 60 | const error = event; 61 | console.log(`failed: ${error.message}`); 62 | if (error.url.indexOf("crLog") < 0) { 63 | this.crRestService 64 | .putCrLogMsg(new CrLogMsgImpl("Error", error.message)) 65 | .subscribe(); 66 | } 67 | } 68 | return event; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/services/crrest.service.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { TestBed, inject, waitForAsync } from "@angular/core/testing"; 17 | import { CrRestService } from "./crrest.service"; 18 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/shared/crvalues.validators.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { FormControl } from "@angular/forms"; 17 | 18 | export class CrValuesValidators { 19 | static positiveIntValidator(control: FormControl) { 20 | const valueStr = control.value 21 | ? control.value 22 | .toString(10) 23 | .split("") 24 | .filter((c) => c != "'") 25 | .join("") 26 | : ""; 27 | const myValue = parseInt(valueStr, 20); 28 | const ret = isNaN(myValue); 29 | if (!(!ret && myValue >= 0)) { 30 | return { notPositiveIntValue: true }; 31 | } 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/shared/index.ts: -------------------------------------------------------------------------------- 1 | export * from "./crvalues.validators"; 2 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/shared/my-error-handler.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { ErrorHandler, Injectable } from "@angular/core"; 17 | import { CrRestService } from "../services/crrest.service"; 18 | import { CrLogMsgImpl } from "../dtos/crClasses"; 19 | 20 | @Injectable() 21 | export class MyErrorHandler implements ErrorHandler { 22 | constructor(private crRestService: CrRestService) {} 23 | 24 | handleError(error: any): void { 25 | console.log(error); 26 | this.crRestService 27 | .putCrLogMsg(new CrLogMsgImpl("Error", error.message)) 28 | .subscribe(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/shared/number-separator.pipe.spec.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { NumberSeparatorPipe } from "./number-separator.pipe"; 17 | 18 | describe("NumberSeparatorPipe", () => { 19 | it("create an instance", () => { 20 | const pipe = new NumberSeparatorPipe(); 21 | const result = pipe.transform("100", 3); 22 | expect(result).toBe("100"); 23 | }); 24 | it("create an instance", () => { 25 | const pipe = new NumberSeparatorPipe(); 26 | const result = pipe.transform("1000", 3); 27 | expect(result).toBe("1'000"); 28 | }); 29 | it("create an instance", () => { 30 | const pipe = new NumberSeparatorPipe(); 31 | const result = pipe.transform("10000", 3); 32 | expect(result).toBe("10'000"); 33 | }); 34 | 35 | it("create an instance", () => { 36 | const pipe = new NumberSeparatorPipe(); 37 | const result = pipe.transform("10000000", 3); 38 | expect(result).toBe("10'000'000"); 39 | }); 40 | 41 | it("create an instance", () => { 42 | const pipe = new NumberSeparatorPipe(); 43 | const result = pipe.transform("12345678", 3); 44 | expect(result).toBe("12'345'678"); 45 | }); 46 | it("create an instance", () => { 47 | const pipe = new NumberSeparatorPipe(); 48 | const result = pipe.transform("1a", 3); 49 | expect(result).toBe("1a"); 50 | }); 51 | it("create an instance", () => { 52 | const pipe = new NumberSeparatorPipe(); 53 | const result = pipe.transform("1'000'000", 3); 54 | expect(result).toBe("1'000'000"); 55 | }); 56 | it("create an instance", () => { 57 | const pipe = new NumberSeparatorPipe(); 58 | const result = pipe.transform(null, 3); 59 | expect(result).toBe("0"); 60 | }); 61 | }); 62 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/shared/number-separator.pipe.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import { Pipe, PipeTransform } from "@angular/core"; 17 | 18 | @Pipe({ 19 | name: "numberSeparator", 20 | standalone: false 21 | }) 22 | export class NumberSeparatorPipe implements PipeTransform { 23 | transform(value: string | number, args?: number): string { 24 | if (!value) { 25 | return "0"; 26 | } 27 | value = String(value).replace(/'/g, "").replace(/,/g, ""); 28 | //console.log("value: "+value); 29 | if (!isNaN(parseInt(value)) && !isNaN(args)) { 30 | const digits = args; 31 | const arr = []; 32 | let myValue = String(value); 33 | while (myValue.length > digits) { 34 | const str = myValue.slice(myValue.length - digits, myValue.length); 35 | arr.push("'" + str); 36 | myValue = myValue.slice(0, myValue.length - digits); 37 | } 38 | arr.reverse(); 39 | let result = "" + myValue + arr; 40 | result = result.replace(",", ""); 41 | // console.log("result1 "+result); 42 | return result; 43 | } 44 | // console.log("result2 "+value); 45 | return value; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/shared/numberseparator.directive.spec.ts: -------------------------------------------------------------------------------- 1 | import { NumberseparatorDirective } from "./numberseparator.directive"; 2 | 3 | //describe('NumberseparatorDirective', () => { 4 | // it('should create an instance', () => { 5 | // const directive = new NumberseparatorDirective(); 6 | // expect(directive).toBeTruthy(); 7 | // }); 8 | //}); 9 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/shared/numberseparator.directive.ts: -------------------------------------------------------------------------------- 1 | import { Directive, ElementRef, HostListener } from "@angular/core"; 2 | import { NgControl } from "@angular/forms"; 3 | import { NumberSeparatorPipe } from "./number-separator.pipe"; 4 | 5 | @Directive({ 6 | selector: "[myNumberseparator]", 7 | standalone: false 8 | }) 9 | export class NumberseparatorDirective { 10 | constructor(private el: ElementRef, private control: NgControl) {} 11 | 12 | @HostListener("input", ["onchange"]) onEvent() { 13 | let myNumber = this.el.nativeElement.value; 14 | // console.log("myNumber: "+myNumber); 15 | const pipe = new NumberSeparatorPipe(); 16 | myNumber = pipe.transform(myNumber, 3); 17 | this.control.control.setValue(myNumber); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/app/shared/utils.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | export class Utils { 17 | static removeSeparators(value: String): number { 18 | // console.log("value1 :"+value); 19 | if (!(value || parseInt(value.toString()) === 0)) { 20 | return 0; 21 | } 22 | value = value.replace(/'/g, "").replace(/,/g, ""); 23 | if (!value || isNaN(parseInt(value.toString()))) { 24 | return 0; 25 | } 26 | return parseInt(value.toString()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/angular/carrental/src/assets/.gitkeep -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/assets/.npmignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/angular/carrental/src/assets/.npmignore -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true, 3 | }; 4 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false, 8 | }; 9 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/angular/carrental/src/favicon.ico -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Carrental 6 | 7 | 8 | 9 | 10 | 11 | 12 | Loading... 13 | 14 | 15 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/locale/messages.de.json: -------------------------------------------------------------------------------- 1 | { 2 | "locale": "de", 3 | "translations": { 4 | "337960809871797088": "Link zu crroot", 5 | "1847471060124884278": "Link zu crdetail", 6 | "1051267765915501496": "Link zu crlist", 7 | "4257311468295200027": "crdetail works!", 8 | "618778231951065569": "Mietperiode", 9 | "4739373515506149638": "bis", 10 | "4046549637581574286": "Mieter", 11 | "5028777105388019087": "Details", 12 | "2963596979528181113": "Jahr", 13 | "5611592591303869712": "Status", 14 | "7531312285312665601": "Grund", 15 | "4515365200806436893": "Fahrzeuge Total", 16 | "5344961910471563923": "Miete geplant Total", 17 | "3438508045655609807": "Miete abgerechnet Total", 18 | "2856181692640859661": "Anzahl Pkw", 19 | "4063694784061210581": "Anzahl Lkw", 20 | "935267939147271845": "Datum", 21 | "8893370247668493565": "Mutierer", 22 | "8988560364088607079": "Mahnstop", 23 | "8577155686323583649": "Anzahl Fahrzeuge", 24 | "2696236920734992377": "Miete geplant", 25 | "1789889529524142520": "Miete abgerechnet", 26 | "8521633630936750492": "Pkw", 27 | "4969096573081085688": "Lkw", 28 | "3448462145758383019": "Total" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/main.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; 18 | import { enableProdMode } from "@angular/core"; 19 | import { environment } from "./environments/environment"; 20 | import { AppModule } from "./app/app.module"; 21 | 22 | if (environment.production) { 23 | enableProdMode(); 24 | } 25 | 26 | platformBrowserDynamic() 27 | .bootstrapModule(AppModule) 28 | .catch((err) => console.log(err)); 29 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /*************************************************************************************************** 2 | * Load `$localize` onto the global scope - used if i18n tags appear in Angular templates. 3 | */ 4 | import "@angular/localize/init"; 5 | /** 6 | * This file includes polyfills needed by Angular and is loaded before the app. 7 | * You can add your own extra polyfills to this file. 8 | * 9 | * This file is divided into 2 sections: 10 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 11 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 12 | * file. 13 | * 14 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 15 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 16 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 17 | * 18 | * Learn more in https://angular.io/guide/browser-support 19 | */ 20 | 21 | /*************************************************************************************************** 22 | * BROWSER POLYFILLS 23 | */ 24 | 25 | /** 26 | * By default, zone.js will patch all possible macroTask and DomEvents 27 | * user can disable parts of macroTask/DomEvents patch by setting following flags 28 | * because those flags need to be set before `zone.js` being loaded, and webpack 29 | * will put import in the top of bundle, so user need to create a separate file 30 | * in this directory (for example: zone-flags.ts), and put the following flags 31 | * into that file, and then add the following code before importing zone.js. 32 | * import './zone-flags.ts'; 33 | * 34 | * The flags allowed in zone-flags.ts are listed here. 35 | * 36 | * The following flags will work for all browsers. 37 | * 38 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 39 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 40 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 41 | * 42 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 43 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 44 | * 45 | * (window as any).__Zone_enable_cross_context_check = true; 46 | * 47 | */ 48 | 49 | /*************************************************************************************************** 50 | * Zone JS is required by default for Angular itself. 51 | */ 52 | import "zone.js"; // Included with Angular CLI. 53 | 54 | /*************************************************************************************************** 55 | * APPLICATION IMPORTS 56 | */ 57 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | /* You can add global styles to this file, and also import other style files */ 18 | //@import '/bootstrap/scss/bootstrap'; 19 | 20 | @import "bootstrap/scss/functions"; 21 | @import "bootstrap/scss/variables"; 22 | @import "bootstrap/scss/mixins"; 23 | @import "bootstrap/scss/root"; 24 | @import "bootstrap/scss/reboot"; 25 | @import "bootstrap/scss/type"; 26 | @import "bootstrap/scss/images"; 27 | @import "bootstrap/scss/code"; 28 | @import "bootstrap/scss/grid"; 29 | @import "bootstrap/scss/tables"; 30 | @import "bootstrap/scss/forms"; 31 | @import "bootstrap/scss/buttons"; 32 | @import "bootstrap/scss/transitions"; 33 | @import "bootstrap/scss/dropdown"; 34 | @import "bootstrap/scss/button-group"; 35 | @import "bootstrap/scss/input-group"; 36 | //@import "bootstrap/scss/custom-forms"; 37 | @import "bootstrap/scss/nav"; 38 | @import "bootstrap/scss/navbar"; 39 | @import "bootstrap/scss/card"; 40 | @import "bootstrap/scss/breadcrumb"; 41 | @import "bootstrap/scss/pagination"; 42 | @import "bootstrap/scss/badge"; 43 | @import "bootstrap/scss/jumbotron"; 44 | @import "bootstrap/scss/alert"; 45 | //@import "bootstrap/scss/progress"; 46 | @import "bootstrap/scss/media"; 47 | @import "bootstrap/scss/list-group"; 48 | @import "bootstrap/scss/close"; 49 | @import "bootstrap/scss/toasts"; 50 | @import "bootstrap/scss/modal"; 51 | @import "bootstrap/scss/tooltip"; 52 | @import "bootstrap/scss/popover"; 53 | @import "bootstrap/scss/carousel"; 54 | //@import "bootstrap/scss/spinners"; 55 | @import "bootstrap/scss/utilities"; 56 | @import "bootstrap/scss/print"; 57 | 58 | .borderless td, 59 | .borderless th { 60 | border: none !important; 61 | } 62 | .divboxmodel { 63 | padding: 9px !important; 64 | border-right-width: 8px !important; 65 | border-left-width: 8px !important; 66 | } 67 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import "zone.js/testing"; 4 | import { getTestBed } from "@angular/core/testing"; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting, 8 | } from "@angular/platform-browser-dynamic/testing"; 9 | 10 | // First, initialize the Angular testing environment. 11 | getTestBed().initTestEnvironment( 12 | BrowserDynamicTestingModule, 13 | platformBrowserDynamicTesting(), 14 | { 15 | teardown: { destroyAfterEach: false }, 16 | } 17 | ); 18 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | //declare let module: NodeModule; 3 | //interface NodeModule { 4 | // id: string; 5 | //} 6 | -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/app", 5 | "types": [] 6 | }, 7 | "files": [ 8 | "src/main.ts", 9 | "src/polyfills.ts" 10 | ], 11 | "include": [ 12 | "src/**/*.d.ts" 13 | ] 14 | } -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "forceConsistentCasingInFileNames": true, 7 | "esModuleInterop": true, 8 | "noImplicitReturns": true, 9 | "noFallthroughCasesInSwitch": true, 10 | "sourceMap": true, 11 | "declaration": false, 12 | "experimentalDecorators": true, 13 | "module": "esnext", 14 | "moduleResolution": "node", 15 | "importHelpers": true, 16 | "target": "ES2022", 17 | "typeRoots": [ 18 | "node_modules/@types" 19 | ], 20 | "lib": [ 21 | "es2018", 22 | "dom" 23 | ], 24 | "useDefineForClassFields": false 25 | }, 26 | "angularCompilerOptions": { 27 | "fullTemplateTypeCheck": true, 28 | "strictInjectionParameters": true 29 | } 30 | } -------------------------------------------------------------------------------- /carrental-web/src/angular/carrental/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /carrental-web/src/main/.gitignore: -------------------------------------------------------------------------------- 1 | /ignoreme/ 2 | -------------------------------------------------------------------------------- /carrental-web/src/main/java/ch/xxx/carrental/ui/config/ForwardingFilter.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.config; 17 | 18 | import java.io.IOException; 19 | import java.util.List; 20 | import java.util.Locale; 21 | import java.util.stream.StreamSupport; 22 | 23 | import javax.servlet.Filter; 24 | import javax.servlet.FilterChain; 25 | import javax.servlet.RequestDispatcher; 26 | import javax.servlet.ServletException; 27 | import javax.servlet.ServletRequest; 28 | import javax.servlet.ServletResponse; 29 | import javax.servlet.annotation.WebFilter; 30 | import javax.servlet.http.HttpServletRequest; 31 | 32 | import org.slf4j.Logger; 33 | import org.slf4j.LoggerFactory; 34 | 35 | @WebFilter("/*") 36 | public class ForwardingFilter implements Filter { 37 | private static final Logger LOGGER = LoggerFactory.getLogger(ForwardingFilter.class); 38 | private static final String REST_PATH = "/rest"; 39 | private static final List SUPPORTED_LOCALES = List.of(Locale.ENGLISH, Locale.GERMAN); 40 | public static final List LANGUAGE_PATHS = SUPPORTED_LOCALES.stream() 41 | .map(myLocale -> String.format("/%s/", myLocale.getLanguage())).toList(); 42 | 43 | @Override 44 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) 45 | throws IOException, ServletException { 46 | HttpServletRequest myRequest = (HttpServletRequest) request; 47 | if (myRequest.getServletPath().contains(REST_PATH) 48 | || LANGUAGE_PATHS.stream().anyMatch(langPath -> myRequest.getServletPath().contains(langPath)) 49 | && (myRequest.getServletPath().contains(".") && !myRequest.getServletPath().contains("?"))) { 50 | //LOGGER.info("Nothing to do: {}",myRequest.getServletPath()); 51 | chain.doFilter(myRequest, response); 52 | } else { 53 | Iterable iterable = () -> myRequest.getLocales().asIterator(); 54 | Locale userLocale = StreamSupport.stream(iterable.spliterator(), false) 55 | .filter(myLocale -> SUPPORTED_LOCALES.contains(myLocale)).findFirst().orElse(Locale.ENGLISH); 56 | String forwardPath = String.format("/%s/index.html", userLocale.getLanguage()); 57 | RequestDispatcher dispatcher = myRequest.getServletContext().getRequestDispatcher(forwardPath); 58 | //LOGGER.info("Forward path: {}", forwardPath); 59 | dispatcher.forward(myRequest, response); 60 | return; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /carrental-web/src/main/java/ch/xxx/carrental/ui/interceptor/DisableCaching.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.interceptor; 17 | 18 | import java.lang.annotation.ElementType; 19 | import java.lang.annotation.Inherited; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import jakarta.annotation.Priority; 25 | import jakarta.interceptor.Interceptor; 26 | import jakarta.interceptor.InterceptorBinding; 27 | 28 | 29 | @Inherited 30 | @InterceptorBinding 31 | @Target({ElementType.METHOD,ElementType.TYPE}) 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Priority(Interceptor.Priority.APPLICATION) 34 | public @interface DisableCaching { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /carrental-web/src/main/java/ch/xxx/carrental/ui/interceptor/DisableCachingInterceptor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.interceptor; 17 | 18 | import javax.ws.rs.core.CacheControl; 19 | import javax.ws.rs.core.Response; 20 | 21 | import jakarta.annotation.Priority; 22 | import jakarta.interceptor.AroundInvoke; 23 | import jakarta.interceptor.Interceptor; 24 | import jakarta.interceptor.InvocationContext; 25 | 26 | 27 | @DisableCaching 28 | @Interceptor 29 | @Priority(Interceptor.Priority.APPLICATION) 30 | public class DisableCachingInterceptor { 31 | 32 | @AroundInvoke 33 | public Object interceptNoCache(InvocationContext ctx) throws Exception { 34 | Object o = ctx.getMethod().invoke(ctx.getTarget(), ctx.getParameters()); 35 | if(o instanceof Response) { 36 | return Response.fromResponse((Response) o).cacheControl(createCacheControl()).build(); 37 | } 38 | return o; 39 | } 40 | 41 | private CacheControl createCacheControl() { 42 | CacheControl cacheControl = new CacheControl(); 43 | cacheControl.setNoCache(true); 44 | return cacheControl; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /carrental-web/src/main/java/ch/xxx/carrental/ui/interceptor/JaxRsExceptionMapper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.interceptor; 17 | 18 | import java.lang.reflect.InvocationTargetException; 19 | 20 | import javax.ws.rs.core.Response; 21 | import javax.ws.rs.ext.ExceptionMapper; 22 | import javax.ws.rs.ext.Provider; 23 | 24 | import ch.xxx.carrental.ui.exception.LocalEntityNotFoundException; 25 | import ch.xxx.carrental.ui.exception.LocalValidationException; 26 | 27 | @Provider 28 | public class JaxRsExceptionMapper implements ExceptionMapper { 29 | 30 | @Override 31 | public Response toResponse(InvocationTargetException exception) { 32 | if(exception.getTargetException().getCause() instanceof LocalEntityNotFoundException) { 33 | return Response.status(Response.Status.NOT_FOUND).build(); 34 | } 35 | if(exception.getTargetException().getCause() instanceof LocalValidationException) { 36 | return Response.status(Response.Status.NOT_ACCEPTABLE).build(); 37 | } 38 | return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /carrental-web/src/main/java/ch/xxx/carrental/ui/rest/CrApplication.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.rest; 17 | 18 | import java.util.HashSet; 19 | import java.util.Set; 20 | 21 | import javax.ws.rs.ApplicationPath; 22 | import javax.ws.rs.core.Application; 23 | 24 | import ch.xxx.carrental.ui.dto.CrDetail; 25 | import ch.xxx.carrental.ui.dto.CrLogMsg; 26 | import ch.xxx.carrental.ui.dto.CrMessage; 27 | import ch.xxx.carrental.ui.dto.CrPeriod; 28 | import ch.xxx.carrental.ui.dto.CrPortfolio; 29 | import ch.xxx.carrental.ui.dto.CrTableRow; 30 | import ch.xxx.carrental.ui.interceptor.JaxRsExceptionMapper; 31 | import ch.xxx.carrental.ui.rest.model.CrDetailResource; 32 | import ch.xxx.carrental.ui.rest.model.CrLogResource; 33 | import ch.xxx.carrental.ui.rest.model.CrTableResource; 34 | import io.swagger.jaxrs.config.BeanConfig; 35 | 36 | @ApplicationPath("rest") 37 | public class CrApplication extends Application { 38 | 39 | public CrApplication() { 40 | BeanConfig beanConfig = new BeanConfig(); 41 | beanConfig.setVersion("4.14.2"); 42 | beanConfig.setSchemes(new String[]{"http", "https"}); 43 | beanConfig.setBasePath("/carrental-web/rest"); 44 | beanConfig.setResourcePackage("ch.xxx.carrental.ui.rest.model"); 45 | beanConfig.setScan(true); 46 | } 47 | 48 | @Override 49 | public Set> getClasses() { 50 | Set> classes = new HashSet>(); 51 | classes.add(CrPortfolio.class); 52 | classes.add(CrDetail.class); 53 | classes.add(CrMessage.class); 54 | classes.add(CrPeriod.class); 55 | classes.add(CrTableRow.class); 56 | classes.add(CrLogMsg.class); 57 | classes.add(CrTableResource.class); 58 | classes.add(CrDetailResource.class); 59 | classes.add(CrLogResource.class); 60 | classes.add(io.swagger.jaxrs.listing.ApiListingResource.class); 61 | classes.add(io.swagger.jaxrs.listing.SwaggerSerializers.class); 62 | classes.add(JaxRsExceptionMapper.class); 63 | return classes; 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /carrental-web/src/main/java/ch/xxx/carrental/ui/rest/model/CrLogResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.rest.model; 17 | 18 | import javax.enterprise.context.RequestScoped; 19 | import javax.inject.Inject; 20 | import javax.ws.rs.Consumes; 21 | import javax.ws.rs.PUT; 22 | import javax.ws.rs.Path; 23 | import javax.ws.rs.core.Response; 24 | 25 | import ch.xxx.carrental.ui.dto.CrLogMsg; 26 | import ch.xxx.carrental.ui.interceptor.DisableCaching; 27 | import ch.xxx.carrental.ui.service.CrLoggingService; 28 | import io.swagger.annotations.Api; 29 | import io.swagger.annotations.ApiOperation; 30 | 31 | @RequestScoped 32 | @Path("/model/crLog") 33 | @Consumes({ "application/json" }) 34 | @Api(value = "/model/crLog") 35 | public class CrLogResource { 36 | @Inject 37 | private CrLoggingService service; 38 | 39 | public CrLogResource() { 40 | } 41 | 42 | @PUT 43 | @DisableCaching 44 | @ApiOperation(value = "Log Service") 45 | public Response updateDetails(CrLogMsg crLogMsg) { 46 | return Response.ok(service.logMsg(crLogMsg)).build(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /carrental-web/src/main/java/ch/xxx/carrental/ui/rest/model/CrTableResource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrental.ui.rest.model; 17 | 18 | import java.io.IOException; 19 | import java.io.InputStream; 20 | import java.util.Locale; 21 | 22 | import javax.enterprise.context.RequestScoped; 23 | import javax.inject.Inject; 24 | import javax.ws.rs.GET; 25 | import javax.ws.rs.HeaderParam; 26 | import javax.ws.rs.Path; 27 | import javax.ws.rs.PathParam; 28 | import javax.ws.rs.Produces; 29 | import javax.ws.rs.core.Response; 30 | 31 | import org.apache.commons.io.IOUtils; 32 | 33 | import ch.xxx.carrental.ui.dto.CrTableRow; 34 | import ch.xxx.carrental.ui.exception.LocalEntityNotFoundException; 35 | import ch.xxx.carrental.ui.exception.LocalValidationException; 36 | import ch.xxx.carrental.ui.interceptor.DisableCaching; 37 | import ch.xxx.carrental.ui.service.CrTableService; 38 | import io.swagger.annotations.Api; 39 | import io.swagger.annotations.ApiOperation; 40 | 41 | @RequestScoped 42 | @Path("/model/crTable") 43 | @Produces({ "application/json" }) 44 | @Api(value = "/model/crTable") 45 | public class CrTableResource { 46 | @Inject 47 | private CrTableService service; 48 | 49 | public CrTableResource() { 50 | } 51 | 52 | public CrTableResource(CrTableService service) { 53 | this.service = service; 54 | } 55 | 56 | @GET 57 | @Path("/mietNr/{mietNr}") 58 | @DisableCaching 59 | @ApiOperation(value = "gets the rows for the table", response = CrTableRow.class, responseContainer = "List") 60 | public Response getAll(@PathParam("mietNr") final String mietNr, 61 | @HeaderParam("Accept-Language") final String acceptLang) 62 | throws LocalEntityNotFoundException, LocalValidationException { 63 | String[] langs = acceptLang.split(","); 64 | Locale locale = Locale.forLanguageTag(langs[0]); 65 | return Response.ok(service.readCrRowsByMiete(mietNr, locale)).build(); 66 | } 67 | 68 | @GET 69 | @Path("/mietNr/{mietNr}/pdf") 70 | @Produces("application/pdf") 71 | @DisableCaching 72 | @ApiOperation(value = "provides the pdf files for display") 73 | public Response getPdf(@PathParam("mietNr") final String mietNr, 74 | @HeaderParam("Accept-Language") final String acceptLang) 75 | throws LocalEntityNotFoundException, LocalValidationException { 76 | byte[] array = null; 77 | InputStream inputStream = this.service.readCrPdf(mietNr); 78 | try { 79 | array = IOUtils.toByteArray(inputStream); 80 | } catch (IOException e) { 81 | throw new LocalEntityNotFoundException("Document not found."); 82 | } 83 | return Response.ok(array).build(); 84 | } 85 | 86 | } 87 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/WEB-INF/beans.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 23 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/WEB-INF/urlrewrite.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | ^\/de\/[a-zA-Z_0-9\/]+$ 15 | /de/index.html 16 | 17 | 18 | ^\/en\/[a-zA-Z_0-9\/]+$ 19 | /en/index.html 20 | 21 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/index.html: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 25 | The languages german and english are supported: 26 |
27 | German 28 | English 29 | 30 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/swagger/absolute-path.js: -------------------------------------------------------------------------------- 1 | /* 2 | * getAbsoluteFSPath 3 | * @return {string} When run in NodeJS env, returns the absolute path to the current directory 4 | * When run outside of NodeJS, will return an error message 5 | */ 6 | const getAbsoluteFSPath = function () { 7 | // detect whether we are running in a browser or nodejs 8 | if (typeof module !== "undefined" && module.exports) { 9 | return require("path").resolve(__dirname) 10 | } 11 | throw new Error('getAbsoluteFSPath can only be called within a Nodejs environment'); 12 | } 13 | 14 | module.exports = getAbsoluteFSPath 15 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/swagger/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/main/webapp/swagger/favicon-16x16.png -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/swagger/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Angular2Guy/Angular2AndJavaEE/326bdca6699d85ce1db8f19347fe704ab253243d/carrental-web/src/main/webapp/swagger/favicon-32x32.png -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/swagger/index.css: -------------------------------------------------------------------------------- 1 | html { 2 | box-sizing: border-box; 3 | overflow: -moz-scrollbars-vertical; 4 | overflow-y: scroll; 5 | } 6 | 7 | *, 8 | *:before, 9 | *:after { 10 | box-sizing: inherit; 11 | } 12 | 13 | body { 14 | margin: 0; 15 | background: #fafafa; 16 | } 17 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/swagger/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Swagger UI 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/swagger/index.js: -------------------------------------------------------------------------------- 1 | try { 2 | module.exports.SwaggerUIBundle = require("./swagger-ui-bundle.js") 3 | module.exports.SwaggerUIStandalonePreset = require("./swagger-ui-standalone-preset.js") 4 | } catch(e) { 5 | // swallow the error if there's a problem loading the assets. 6 | // allows this module to support providing the assets for browserish contexts, 7 | // without exploding in a Node context. 8 | // 9 | // see https://github.com/swagger-api/swagger-ui/issues/3291#issuecomment-311195388 10 | // for more information. 11 | } 12 | 13 | // `absolutePath` and `getAbsoluteFSPath` are both here because at one point, 14 | // we documented having one and actually implemented the other. 15 | // They were both retained so we don't break anyone's code. 16 | module.exports.absolutePath = require("./absolute-path.js") 17 | module.exports.getAbsoluteFSPath = require("./absolute-path.js") 18 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/swagger/oauth2-redirect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Swagger UI: OAuth2 Redirect 5 | 6 | 7 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /carrental-web/src/main/webapp/swagger/swagger-initializer.js: -------------------------------------------------------------------------------- 1 | window.onload = function() { 2 | // 3 | 4 | // the following lines will be replaced by docker/configurator, when it runs in a docker-container 5 | window.ui = SwaggerUIBundle({ 6 | url: `${window.location.href.split('/swagger')[0]}/rest/swagger.json`, 7 | dom_id: '#swagger-ui', 8 | deepLinking: true, 9 | presets: [ 10 | SwaggerUIBundle.presets.apis, 11 | SwaggerUIStandalonePreset 12 | ], 13 | plugins: [ 14 | SwaggerUIBundle.plugins.DownloadUrl 15 | ], 16 | layout: "StandaloneLayout" 17 | }); 18 | 19 | // 20 | }; 21 | -------------------------------------------------------------------------------- /carrental-web/src/test/java/ch/xxx/carrrental/ui/rest/model/CrDetailResourceTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrrental.ui.rest.model; 17 | 18 | public class CrDetailResourceTest { 19 | /* 20 | CrDetailService service; 21 | 22 | @Before 23 | public void init() { 24 | this.service = Mockito.mock(CrDetailService.class); 25 | Mockito.when(this.service.readCrDetail(Mockito.anyString(), Mockito.anyString(), Mockito.any(Locale.class))).thenReturn(new CrDetail()); 26 | Mockito.when(this.service.createCrDetail(Mockito.any(CrDetail.class))).thenReturn(true); 27 | Mockito.when(this.service.deleteCrDetail(Mockito.anyString(), Mockito.anyString())).thenReturn(true); 28 | Mockito.when(this.service.updateCrDetail(Mockito.any(CrDetail.class))).thenReturn(true); 29 | } 30 | 31 | @Test 32 | public void readTest() { 33 | CrDetailResource testee = new CrDetailResource(this.service); 34 | Response resp = testee.getAll("1", "2015", "en"); 35 | Assert.assertEquals(200, resp.getStatus()); 36 | } 37 | 38 | @Test 39 | public void createTest() { 40 | CrDetailResource testee = new CrDetailResource(this.service); 41 | Response resp = testee.createDetails(new CrDetail(), "1", "2015"); 42 | Assert.assertEquals(200, resp.getStatus()); 43 | } 44 | 45 | @Test 46 | public void deleteTest() { 47 | CrDetailResource testee = new CrDetailResource(this.service); 48 | Response resp = testee.deleteDetails("1", "2015"); 49 | Assert.assertEquals(200, resp.getStatus()); 50 | } 51 | 52 | @Test 53 | public void updateTest() { 54 | CrDetailResource testee = new CrDetailResource(this.service); 55 | Response resp = testee.updateDetails(new CrDetail()); 56 | Assert.assertEquals(200, resp.getStatus()); 57 | } 58 | */ 59 | } 60 | -------------------------------------------------------------------------------- /carrental-web/src/test/java/ch/xxx/carrrental/ui/rest/model/CrTableResourceTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrrental.ui.rest.model; 17 | 18 | public class CrTableResourceTest { 19 | /* 20 | CrTableService service; 21 | 22 | @Before 23 | public void init() { 24 | this.service = Mockito.mock(CrTableService.class); 25 | Mockito.when(this.service.readCrRowsByMiete(Mockito.anyString(), Mockito.any(Locale.class))).thenReturn(this.initCrTable()); 26 | } 27 | 28 | private List initCrTable() { 29 | Calendar from = Calendar.getInstance(); 30 | from.set(2015, 0, 1); 31 | Calendar to = Calendar.getInstance(); 32 | to.set(2015, 11,31); 33 | CrTableRow lsdTableRow1 = new CrTableRow("1", "2015", "Aktiv", "Geschaeflich", 20, BigDecimal.valueOf(30000), BigDecimal.valueOf(20000), 10, 12, from.getTime(), "p12345", true); 34 | CrTableRow lsdTableRow2 = new CrTableRow("1", "2016", "Passiv", "Privat", null, null, null, null, null, from.getTime(), "p12345", false); 35 | return Arrays.asList(lsdTableRow1, lsdTableRow2); 36 | } 37 | 38 | @Test 39 | public void testGetAll() { 40 | CrTableResource testee = new CrTableResource(this.service); 41 | Response resp = testee.getAll("1", "en"); 42 | Assert.assertEquals(200, resp.getStatus()); 43 | } 44 | */ 45 | } 46 | -------------------------------------------------------------------------------- /carrental-web/src/test/java/ch/xxx/carrrental/ui/rest/model/UrlTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2016 Sven Loesekann 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | package ch.xxx.carrrental.ui.rest.model; 17 | 18 | public class UrlTest { 19 | /* 20 | private String regexStr = "^\\/de\\/[a-zA-Z_0-9\\/]+$"; 21 | 22 | @Test 23 | public void url1() { 24 | String testStr = "/de/favicon.ico"; 25 | Assert.assertFalse(testStr.matches(regexStr)); 26 | } 27 | 28 | @Test 29 | public void url2() { 30 | String testStr = "/de/crlist/mietenr/1"; 31 | Assert.assertTrue(testStr.matches(regexStr)); 32 | } 33 | 34 | @Test 35 | public void url3() { 36 | String testStr = "/de/crdetail/mietenr/1/jahr/2017"; 37 | Assert.assertTrue(testStr.matches(regexStr)); 38 | } 39 | 40 | @Test 41 | public void url4() { 42 | String testStr = "/de/"; 43 | Assert.assertFalse(testStr.matches(regexStr)); 44 | } 45 | */ 46 | } 47 | --------------------------------------------------------------------------------