Skip to content

Commit

Permalink
Merge pull request #628 from devgateway/develop
Browse files Browse the repository at this point in the history
merge develop into master before 1.2.0
  • Loading branch information
mpostelnicu authored May 14, 2018
2 parents 9973789 + a52ee7d commit 2c0a8a5
Show file tree
Hide file tree
Showing 396 changed files with 25,024 additions and 10,333 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ rebel.xml
/web/nbactions.xml
/forms/.rebel.xml.bak
/derby.log
/LOG_DIR_IS_UNDEFINED/
/LOG_DIR_IS_UNDEFINED/
/ehcache-diskstore/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Presentation

OCE is a project that allows importing the Vietnam public procurement data, available in the common MS Excel format, into a native [Open Contracting Data Standard (OCDS)](http://standard.open-contracting.org/) NoSQL storage, and then run visual data analytics (display a *live* dashboard with charts, maps and data tables as well as custom comparison charts). Since the data is natively stored in the OCDS format, it can be readily exported in this format without any transformation required, and with great throughput.
OCE is a project that allows importing the public procurement data, available in the common MS Excel format, into a native [Open Contracting Data Standard (OCDS)](http://standard.open-contracting.org/) NoSQL storage, and then run visual data analytics (display a *live* dashboard with charts, maps and data tables as well as custom comparison charts). Since the data is natively stored in the OCDS format, it can be readily exported in this format without any transformation required, and with great throughput.

## Visual Identity
SVG and raster version of the logo and favicon can be found in the [`docs/images`](./docs/images/) directory.
Expand Down
4 changes: 3 additions & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
<property name="max" value="120"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<module name="ParameterNumber">
<property name="max" value="8"/>
</module>
<module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
Expand Down
1 change: 1 addition & 0 deletions forms/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
.project
/.springBeans
/.checkstyle
/ehcache-diskstore/
31 changes: 15 additions & 16 deletions forms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<wicket.version>7.7.0</wicket.version>
<wicket.bootstrap.version>0.10.14</wicket.bootstrap.version>
<zt.zip.version>1.11</zt.zip.version>
<wicket.webjars.version>0.5.5</wicket.webjars.version>
<wicket.version>7.9.0</wicket.version>
<wicket.bootstrap.version>0.10.16</wicket.bootstrap.version>
<zt.zip.version>1.12</zt.zip.version>
<wicket.webjars.version>0.5.6</wicket.webjars.version>
<closure.compiler.version>v20160822</closure.compiler.version>
</properties>

Expand Down Expand Up @@ -124,13 +124,13 @@
<artifactId>cglib</artifactId>
<version>3.1</version>
</dependency>

<dependency>
<groupId>com.google.javascript</groupId>
<artifactId>closure-compiler</artifactId>
<version>${closure.compiler.version}</version>
</dependency>
<groupId>com.google.javascript</groupId>
<artifactId>closure-compiler</artifactId>
<version>${closure.compiler.version}</version>
</dependency>


<dependency>
<groupId>de.agilecoders.wicket.webjars</groupId>
Expand Down Expand Up @@ -218,14 +218,13 @@
</dependency>

<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${pentaho.poi.version}</version>
<version>${poi.version}</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -355,11 +354,11 @@
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-envers</artifactId>
<artifactId>hibernate-envers</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<head>
<meta charset="utf-8">
<title>EditUserDashboardPage</title>
</head>
<body>
<wicket:extend>
<div wicket:id="firstIndicator"></div>
<div wicket:id="secondIndicator"></div>
<div wicket:id="color"></div>
</wicket:extend>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
/*******************************************************************************
* Copyright (c) 2016 Development Gateway, Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License (MIT)
* which accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*
* Contributors:
* Development Gateway - initial API and implementation
*******************************************************************************/
package org.devgateway.ocds.forms.wicket.page.edit;

import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.validation.AbstractFormValidator;
import org.apache.wicket.model.IModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.devgateway.ocds.forms.wicket.page.list.ListAllColorIndicatorPage;
import org.devgateway.ocds.persistence.dao.ColorIndicatorPair;
import org.devgateway.ocds.persistence.mongo.flags.FlagsConstants;
import org.devgateway.ocds.persistence.repository.ColorIndicatorPairRepository;
import org.devgateway.toolkit.forms.wicket.components.form.ColorPickerBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.components.form.Select2ChoiceBootstrapFormComponent;
import org.devgateway.toolkit.forms.wicket.page.edit.AbstractEditPage;
import org.devgateway.toolkit.forms.wicket.providers.GenericChoiceProvider;
import org.devgateway.toolkit.persistence.repository.PersonRepository;
import org.devgateway.toolkit.web.security.SecurityConstants;
import org.wicketstuff.annotation.mount.MountPath;

@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_ADMIN)
@MountPath("/editColorIndicatorPairPage")
public class EditColorIndicatorPairPage extends AbstractEditPage<ColorIndicatorPair> {

private static final long serialVersionUID = -6069250112046118104L;

@Override
protected ColorIndicatorPair newInstance() {
return new ColorIndicatorPair();
}

@SpringBean
private ColorIndicatorPairRepository colorIndicatorPairRepository;

@SpringBean
private PersonRepository personRepository;

private Select2ChoiceBootstrapFormComponent<String> firstIndicator;

private Select2ChoiceBootstrapFormComponent<String> secondIndicator;

public EditColorIndicatorPairPage(final PageParameters parameters) {
super(parameters);
this.jpaRepository = colorIndicatorPairRepository;
this.listPageClass = ListAllColorIndicatorPage.class;

}


@Override
protected void onInitialize() {
super.onInitialize();

firstIndicator =
new Select2ChoiceBootstrapFormComponent<String>("firstIndicator",
new GenericChoiceProvider<String>(FlagsConstants.FLAGS_LIST));
firstIndicator.required();
editForm.add(firstIndicator);

secondIndicator =
new Select2ChoiceBootstrapFormComponent<String>("secondIndicator",
new GenericChoiceProvider<String>(FlagsConstants.FLAGS_LIST));
secondIndicator.required();
editForm.add(secondIndicator);

ColorPickerBootstrapFormComponent color = new ColorPickerBootstrapFormComponent("color");
color.required();
editForm.add(color);
editForm.add(new ColorIndicatorDistinctFormValidator());
editForm.add(new ColorIndicatorUniquePairFormValidator(compoundModel));

}


private class ColorIndicatorDistinctFormValidator extends AbstractFormValidator {

@Override
public FormComponent<?>[] getDependentFormComponents() {
return new FormComponent[]{firstIndicator.getField(), secondIndicator.getField()};
}

@Override
public void validate(Form<?> form) {
if (firstIndicator.getField().getValue() != null && secondIndicator.getField().getValue() != null
&& firstIndicator.getField().getValue().equals(secondIndicator.getField().getValue())) {
error(firstIndicator.getField());
error(secondIndicator.getField());
}
}
}


private class ColorIndicatorUniquePairFormValidator extends AbstractFormValidator {

private final IModel<ColorIndicatorPair> masterModel;

ColorIndicatorUniquePairFormValidator(IModel<ColorIndicatorPair> masterModel) {
this.masterModel = masterModel;
}

@Override
public FormComponent<?>[] getDependentFormComponents() {
return new FormComponent[]{firstIndicator.getField(), secondIndicator.getField()};
}

@Override
public void validate(Form<?> form) {
if (firstIndicator.getField().getValue() != null && secondIndicator.getField().getValue() != null) {
ColorIndicatorPair indicator = colorIndicatorPairRepository.
findByFirstIndicatorAndSecondIndicator(firstIndicator.getField().getValue(),
secondIndicator.getField().getValue());

if ((masterModel.getObject().isNew() && indicator != null)
|| (!masterModel.getObject().isNew() && indicator != null
&& !indicator.getId().equals(masterModel.getObject().getId()))) {
error(firstIndicator.getField());
error(secondIndicator.getField());
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
###############################################################################
# Copyright (c) 2015 Development Gateway, Inc and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the MIT License (MIT)
# which accompanies this distribution, and is available at
# https://opensource.org/licenses/MIT
#
# Contributors:
# Development Gateway - initial API and implementation
###############################################################################
page.title=Edit Color Indicator Pair
firstIndicator.label=First Indicator
secondIndicator.label=Second Indicator
color.label=Color
ColorIndicatorDistinctFormValidator=Please select two distinct indicators
ColorIndicatorUniquePairFormValidator=A similar pair of indicators was already saved with a color. You can add only distinct pairs.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright (c) 2016 Development Gateway, Inc and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the MIT License (MIT)
* which accompanies this distribution, and is available at
* https://opensource.org/licenses/MIT
*
* Contributors:
* Development Gateway - initial API and implementation
*******************************************************************************/
package org.devgateway.ocds.forms.wicket.page.list;

import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.model.Model;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.devgateway.ocds.forms.wicket.page.edit.EditColorIndicatorPairPage;
import org.devgateway.ocds.persistence.dao.ColorIndicatorPair;
import org.devgateway.ocds.persistence.repository.ColorIndicatorPairRepository;
import org.devgateway.toolkit.forms.wicket.page.lists.AbstractListPage;
import org.devgateway.toolkit.web.security.SecurityConstants;
import org.wicketstuff.annotation.mount.MountPath;

@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_ADMIN)
@MountPath(value = "/listColorIndicators")
public class ListAllColorIndicatorPage extends AbstractListPage<ColorIndicatorPair> {

@SpringBean
protected ColorIndicatorPairRepository colorIndicatorPairRepository;



public ListAllColorIndicatorPage(final PageParameters pageParameters) {
super(pageParameters);
this.jpaRepository = colorIndicatorPairRepository;
this.editPageClass = EditColorIndicatorPairPage.class;
columns.add(new PropertyColumn<ColorIndicatorPair, String>(new Model<String>("First Indicator"),
"firstIndicator", "firstIndicator"));

columns.add(new PropertyColumn<ColorIndicatorPair, String>(new Model<String>("Second Indicator"),
"secondIndicator", "secondIndicator"));

columns.add(new PropertyColumn<ColorIndicatorPair, String>(new Model<String>("Color"),
"color", "color"));

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
###############################################################################
# Copyright (c) 2015 Development Gateway, Inc and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the MIT License (MIT)
# which accompanies this distribution, and is available at
# https://opensource.org/licenses/MIT
#
# Contributors:
# Development Gateway - initial API and implementation
###############################################################################
page.title=All Color Indicator Pairs
defaultDashboardUsers=Default Dashboard For Users
users=Users
view=View
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ public void clearReportsApiCache() {
if (cache != null) {
cache.removeAll();
}

// get the reports cache "excelExportCache", declared in ehcache.xml
Cache excelExportCache = cm.getCache("excelExportCache");

if (excelExportCache != null) {
excelExportCache.removeAll();
}
}

private String createCacheKey(final String outputType, final String reportName, final String parameters) {
Expand Down
Loading

0 comments on commit 2c0a8a5

Please sign in to comment.