Integrate push-service app

This commit is contained in:
2020-07-28 00:11:38 +02:00
parent 8cb9a8e717
commit 427c4cbf70
10 changed files with 54 additions and 7 deletions

View File

@@ -17,7 +17,7 @@
<properties> <properties>
<packaging.type>jar</packaging.type> <packaging.type>jar</packaging.type>
<activeProfiles>postgres,dev</activeProfiles> <activeProfiles>hsqldb,dev</activeProfiles>
<deploymentProfile>mk</deploymentProfile> <deploymentProfile>mk</deploymentProfile>
</properties> </properties>

View File

@@ -21,7 +21,7 @@
<activeProfiles>dev</activeProfiles> <activeProfiles>dev</activeProfiles>
<!-- Property to define the final name of the build artifact. <!-- Property to define the final name of the build artifact.
This used in combination with the build-war profile to change the .war file name This used in combination with the build-war profile to change the .war file name
to e.g. financer#00004.war so that the application is accessible via the /financer to e.g. financer##00004.war so that the application is accessible via the /financer
context path once deployed in a standalone servlet container instance. This also enables multiple context path once deployed in a standalone servlet container instance. This also enables multiple
deployments of the application in the same servlet container just with different context deployments of the application in the same servlet container just with different context
paths. Default is the artifactId, the build-war profile defines its own default. paths. Default is the artifactId, the build-war profile defines its own default.
@@ -59,6 +59,10 @@
<artifactId>mime-types</artifactId> <artifactId>mime-types</artifactId>
<version>0.1.3</version> <version>0.1.3</version>
</dependency> </dependency>
<dependency>
<groupId>de.77zzcx7.push-service</groupId>
<artifactId>push-service-client-lib</artifactId>
</dependency>
<!-- Financer dependencies --> <!-- Financer dependencies -->
<dependency> <dependency>

View File

@@ -3,12 +3,14 @@ package de.financer.config;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import java.util.Currency; import java.util.Currency;
@Configuration @Configuration
@ConfigurationProperties(prefix = "financer") @ConfigurationProperties(prefix = "financer")
@ComponentScan("de.pushservice.client")
public class FinancerConfig { public class FinancerConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(FinancerConfig.class); private static final Logger LOGGER = LoggerFactory.getLogger(FinancerConfig.class);

View File

@@ -11,6 +11,9 @@ import de.financer.template.*;
import de.financer.template.exception.FinancerRestException; import de.financer.template.exception.FinancerRestException;
import de.financer.util.ControllerUtils; import de.financer.util.ControllerUtils;
import de.financer.util.TransactionUtils; import de.financer.util.TransactionUtils;
import de.pushservice.client.dto.PayloadDto;
import de.pushservice.client.model.Urgency;
import de.pushservice.client.service.SubscriptionService;
import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -189,4 +192,30 @@ public class AccountController {
return "redirect:/accountOverview"; return "redirect:/accountOverview";
} }
// ---------------------------------------------
@Autowired
private SubscriptionService subscriptionService;
private int counter = 0;
@GetMapping("/sentTestNotification")
public String sentTestNotification() {
if (this.subscriptionService.isInitialized()) {
PayloadDto p = new PayloadDto("Hello from Financer!");
p.setTimestamp(System.currentTimeMillis());
p.setMessage("Test notification " + counter++);
p.setVibration(new int[] {100, 200, 300, 400, 500});
try {
this.subscriptionService.notify(p, "FINANCER-TEST", Urgency.NORMAL);
}
catch(Exception e) {
e.printStackTrace();
}
}
return "redirect:/accountOverview";
}
} }

View File

@@ -1 +1,2 @@
financer.serverUrl=http://localhost:8080/financer-server-mk/ financer.serverUrl=http://localhost:8080/financer-server-mk/
push-service-client.serverUrl=http://localhost:8080/push-service-server-mk/

View File

@@ -33,3 +33,6 @@ spring.messages.basename=i18n/message
# displaying. # displaying.
# Possible values are ISO-4271 currency codes. # Possible values are ISO-4271 currency codes.
financer.currencyCode=EUR financer.currencyCode=EUR
push-service-client.serverUrl=http://localhost:8077/push-service-server/
logging.level.de.pushservice=DEBUG

View File

@@ -0,0 +1 @@
window.onload = registerServiceWorker();

View File

@@ -4,8 +4,10 @@
<title th:text="#{financer.account-overview.title}"/> <title th:text="#{financer.account-overview.title}"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" th:href="@{/css/main.css}"> <link rel="stylesheet" th:href="@{/css/main.css}" />
<link rel="shortcut icon" th:href="@{/favicon.ico}" /> <link rel="shortcut icon" th:href="@{/favicon.ico}" />
<script th:src="@{/javascript/push-service-client-init.js}"></script>
<script th:src="@{/javascript/init.js}"></script>
</head> </head>
<body> <body>
<h1 th:text="#{financer.heading.account-overview}" /> <h1 th:text="#{financer.heading.account-overview}" />

View File

@@ -2,6 +2,6 @@
<hr> <hr>
<div> <div>
<span th:text="'financer v' + ${financerVersion}"/> <span th:text="'financer v' + ${financerVersion}"/>
&nbsp;(<a th:href="@{/changelog.txt}">Changelog</a>,&nbsp;<a th:href="@{/readme.txt}">Readme</a>) &nbsp;(<a th:href="@{/changelog.txt}">Changelog</a>,&nbsp;<a th:href="@{/readme.txt}">Readme</a>, <a th:href="@{/sentTestNotification}">Test</a>)
</div> </div>
</div> </div>

View File

@@ -26,7 +26,7 @@
<!-- Property to define the parallel deployment version. <!-- Property to define the parallel deployment version.
See e.g. https://tomcat.apache.org/tomcat-8.5-doc/config/context.html See e.g. https://tomcat.apache.org/tomcat-8.5-doc/config/context.html
Should be the same as the project.version but padded with zeros to six digits. --> Should be the same as the project.version but padded with zeros to six digits. -->
<parallelDeploymentVersion>000030</parallelDeploymentVersion> <parallelDeploymentVersion>000031</parallelDeploymentVersion>
</properties> </properties>
<modules> <modules>
@@ -87,6 +87,11 @@
<artifactId>financer-common</artifactId> <artifactId>financer-common</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>de.77zzcx7.push-service</groupId>
<artifactId>push-service-client-lib</artifactId>
<version>2</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>