Skip to content
Permalink
Browse files
added first report
  • Loading branch information
mgeiss committed Jul 6, 2017
1 parent bf26ed8 commit dc8dc1f2522d106a86a804e296af1802ed285587
Show file tree
Hide file tree
Showing 11 changed files with 327 additions and 47 deletions.
@@ -17,6 +17,5 @@

@SuppressWarnings("unused")
public interface PermittableGroupIds {
String SAMPLE_MANAGEMENT = "reporting__v1__samples";
String SELF_MANAGEMENT = "reporting__v1__self";
String REPORT_MANAGEMENT = "reporting__v1__general";
}
@@ -18,12 +18,15 @@
import io.mifos.core.api.annotation.ThrowsException;
import io.mifos.core.api.annotation.ThrowsExceptions;
import io.mifos.core.api.util.CustomFeignClientsConfiguration;
import io.mifos.core.lang.ServiceException;
import io.mifos.reporting.api.v1.PermittableGroupIds;
import io.mifos.reporting.api.v1.domain.ReportDefinition;
import io.mifos.reporting.api.v1.domain.ReportPage;
import io.mifos.reporting.api.v1.domain.ReportRequest;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -69,4 +72,15 @@ ReportPage generateReport(@PathVariable("category") final String category,
@RequestBody final ReportRequest reportRequest,
@RequestParam(value = "pageIndex", required = false) final Integer pageIndex,
@RequestParam(value = "size", required = false) final Integer size);

@RequestMapping(
value = "categories/{category}/definitions/{identifier}",
method = RequestMethod.GET,
produces = MediaType.ALL_VALUE,
consumes = MediaType.APPLICATION_JSON_VALUE)
@ThrowsExceptions({
@ThrowsException(status = HttpStatus.NOT_FOUND, exception = ReportNotFoundException.class)
})
ReportDefinition findReportDefinition(@PathVariable("category") final String category,
@PathVariable("identifier") final String identifier);
}
@@ -26,8 +26,7 @@ public class ReportPage {
private Header header;
private List<Row> rows;
private Footer footer;
private Integer totalPages;
private Long totalElements;
private boolean hasMore;

public ReportPage() {
super();
@@ -89,19 +88,11 @@ public void setFooter(final Footer footer) {
this.footer = footer;
}

public Integer getTotalPages() {
return this.totalPages;
public void setHasMore(final boolean hasMore) {
this.hasMore = hasMore;
}

public void setTotalPages(final Integer totalPages) {
this.totalPages = totalPages;
}

public Long getTotalElements() {
return this.totalElements;
}

public void setTotalElements(final Long totalElements) {
this.totalElements = totalElements;
public boolean isHasMore() {
return hasMore;
}
}
@@ -17,19 +17,19 @@

public class Value {

private String value;
private String[] values;
private Type type;

public Value() {
super();
}

public String getValue() {
return this.value;
public String[] getValues() {
return this.values;
}

public void setValue(final String value) {
this.value = value;
public void setValues(final String[] values) {
this.values = values;
}

public Type getType() {
@@ -38,7 +38,8 @@ dependencies {
[group: 'io.mifos.core', name: 'cassandra', version: versions.frameworkcassandra],
[group: 'io.mifos.core', name: 'mariadb', version: versions.frameworkmariadb],
[group: 'io.mifos.core', name: 'command', version: versions.frameworkcommand],
[group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator]
[group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator],
[group: 'org.owasp.esapi', name: 'esapi', version: '2.1.0.1']
)
}

@@ -27,7 +27,6 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@@ -42,11 +41,7 @@
@EnableServiceException
@ComponentScan({
"io.mifos.reporting.service.rest",
"io.mifos.reporting.service.internal",
"io.mifos.reporting.service.repository"
})
@EnableJpaRepositories({
"io.mifos.reporting.service.repository"
"io.mifos.reporting.service.internal"
})
public class ReportingConfiguration extends WebMvcConfigurerAdapter {

@@ -92,4 +92,16 @@ private void initialize() {
private String buildKeyForSpecificationCache(final String category, final String identifier) {
return category + "~" + identifier;
}

public Optional<ReportDefinition> findReportDefinition(final String category, final String identifier) {
final List<ReportDefinition> reportDefinitions = this.reportCategoryCache.get(category);
if (reportDefinitions != null) {
return reportDefinitions
.stream()
.filter(reportDefinition -> reportDefinition.getIdentifier().equals(identifier))
.findAny();
} else {
return Optional.empty();
}
}
}

0 comments on commit dc8dc1f

Please sign in to comment.