Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add server version, date created and date edited to Practitioner and Organization Resources #1047

Merged
61 changes: 28 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@

<artifactId>opensrp-server-web</artifactId>
<packaging>war</packaging>
<version>3.0.15-SNAPSHOT</version>
<version>3.1.1-SNAPSHOT</version>
<name>opensrp-server-web</name>
<description>OpenSRP Server Web Application</description>
<url>https://github.com/OpenSRP/opensrp-server-web</url>

<properties>
<jetty.port>9979</jetty.port>
<main.basedir>${project.basedir}</main.basedir>
<hibernate-entitymanager.version>5.4.12.Final</hibernate-entitymanager.version>
<hibernate-entitymanager.version>5.4.24.Final</hibernate-entitymanager.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>5.2.4.RELEASE</spring.version>
<spring.security.version>5.3.12.RELEASE</spring.security.version>
<spring.security.oauth.version>2.5.0.RELEASE</spring.security.oauth.version>
<spring.fox.swagger.version>2.9.2</spring.fox.swagger.version>
<spring.data.redis>2.2.4.RELEASE</spring.data.redis>
<redis.jedis.version>3.2.0</redis.jedis.version>
<redis.lettuce.version>5.2.2.RELEASE</redis.lettuce.version>
<spring.version>5.2.19.RELEASE</spring.version>
<spring.security.version>5.3.13.RELEASE</spring.security.version>
<spring.security.oauth.version>2.5.1.RELEASE</spring.security.oauth.version>
<spring.fox.swagger.version>3.0.0</spring.fox.swagger.version>
<spring.data.redis>2.2.13.RELEASE</spring.data.redis>
<redis.jedis.version>3.8.0</redis.jedis.version>
<redis.lettuce.version>6.1.6.RELEASE</redis.lettuce.version>
<opensrp.updatePolicy>always</opensrp.updatePolicy>
<nexus-staging-maven-plugin.version>1.5.1</nexus-staging-maven-plugin.version>
<opensrp.core.version>3.0.11-SNAPSHOT</opensrp.core.version>
<opensrp.connector.version>2.3.4-SNAPSHOT</opensrp.connector.version>
<opensrp.core.version>3.1.0-SNAPSHOT</opensrp.core.version>
<opensrp.connector.version>2.4.0-SNAPSHOT</opensrp.connector.version>
<opensrp.interface.version>2.0.1-SNAPSHOT</opensrp.interface.version>
<opensrp.common.version>2.0.3-SNAPSHOT</opensrp.common.version>
<powermock.version>2.0.5</powermock.version>
<opensrp-server-openlmis-stock-version>1.0.3-SNAPSHOT</opensrp-server-openlmis-stock-version>
<opensrp-server-openlmis-stock-version>1.1.1-SNAPSHOT</opensrp-server-openlmis-stock-version>
<lombok.version>1.18.12</lombok.version>
<log4j.version>2.17.1</log4j.version>
</properties>

<distributionManagement>
Expand Down Expand Up @@ -159,16 +159,6 @@
<artifactId>opensrp-server-connector</artifactId>
<version>${opensrp.connector.version}</version>
</dependency>
<dependency>
<groupId>org.smartregister</groupId>
<artifactId>opensrp-server-common</artifactId>
<version>${opensrp.common.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
Expand Down Expand Up @@ -249,7 +239,7 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
<version>1.15</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
Expand All @@ -274,7 +264,7 @@
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-security-adapter</artifactId>
<version>9.0.3</version>
<version>16.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand All @@ -284,7 +274,7 @@
<dependency>
<groupId>org.owasp.encoder</groupId>
<artifactId>encoder</artifactId>
<version>1.2.2</version>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
Expand Down Expand Up @@ -312,7 +302,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -354,7 +344,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.0.3</version>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>org.jeasy</groupId>
Expand All @@ -369,7 +359,7 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.4.0</version>
<version>2.6.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
Expand All @@ -392,7 +382,7 @@
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
<version>5.2.2.RELEASE</version>
<version>${redis.lettuce.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -412,17 +402,22 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.17.0</version>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.17.0</version>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.8.1</version>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0.1-jre</version>
</dependency>
</dependencies>

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/opensrp/web/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ public interface Constants {

public static final String PAGE_SIZE = "pageSize";

public static final String SERVER_VERSION = "serverVersion";

public static final String ORDER_BY_TYPE = "orderByType";

public static final String ORDER_BY_FIELD_NAME = "orderByFieldName";

public static final String DATETIME_IN_UTC_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";

String LOCATIONS = "locations";

String NULL = "null";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.binder.db.PostgreSQLDatabaseMetrics;
import io.micrometer.core.instrument.binder.jvm.DiskSpaceMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics;
import io.micrometer.core.instrument.binder.logging.Log4j2Metrics;
import io.micrometer.core.instrument.binder.system.DiskSpaceMetrics;
import io.micrometer.core.instrument.binder.system.ProcessorMetrics;
import io.micrometer.core.instrument.binder.system.UptimeMetrics;
import io.micrometer.prometheus.PrometheusConfig;
Expand Down
23 changes: 20 additions & 3 deletions src/main/java/org/opensrp/web/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package org.opensrp.web.config;

import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
Expand All @@ -18,6 +21,7 @@
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.servlet.ServletContext;
import java.util.List;

@Configuration
Expand All @@ -30,12 +34,19 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter {
private static final String BEARER = "Bearer";
private static final String HEADER = "header";

@Autowired
private ServletContext servletContext;

@Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.regex("(/rest/.*)|(/multimedia/.*)|(/security/.*)|(/user-details)"))
.paths(PathSelectors.regex(
StringUtils.replace("(basePath/rest/.*)|(basePath/multimedia/.*)|(basePath/security/.*)|(basePath/user-details)",
"basePath",
servletContext.getContextPath()
))) // To be revisited on v3.0.1
.build()
.apiInfo(getApiInfo())
.securityContexts(Lists.newArrayList(securityContext()))
Expand All @@ -54,8 +65,14 @@ public ApiInfo getApiInfo() {

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
registry.addResourceHandler("/swagger-ui/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
}

@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/swagger-ui/")
.setViewName("forward:/swagger-ui/index.html");
}

public SecurityContext securityContext() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public ServletInputStream getInputStream() throws IOException {
@Override
public BufferedReader getReader() throws IOException {
if (rawData == null) {
rawData = IOUtils.toByteArray(this.request.getReader(),StandardCharsets.UTF_8);
rawData = IOUtils.toByteArray(this.request.getReader(), StandardCharsets.UTF_8.name());
servletStream.stream = new ByteArrayInputStream(rawData);
}
updateParameters();
Expand Down
Loading