Skip to content

Commit 2c0a8a5

Browse files
authored
Merge pull request #628 from devgateway/develop
merge develop into master before 1.2.0
2 parents 9973789 + a52ee7d commit 2c0a8a5

396 files changed

Lines changed: 25024 additions & 10333 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ rebel.xml
2222
/web/nbactions.xml
2323
/forms/.rebel.xml.bak
2424
/derby.log
25-
/LOG_DIR_IS_UNDEFINED/
25+
/LOG_DIR_IS_UNDEFINED/
26+
/ehcache-diskstore/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Presentation
66

7-
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.
7+
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.
88

99
## Visual Identity
1010
SVG and raster version of the logo and favicon can be found in the [`docs/images`](./docs/images/) directory.

checkstyle.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@
4747
<property name="max" value="120"/>
4848
</module>
4949
<module name="MethodLength"/>
50-
<module name="ParameterNumber"/>
50+
<module name="ParameterNumber">
51+
<property name="max" value="8"/>
52+
</module>
5153
<module name="EmptyForIteratorPad"/>
5254
<module name="GenericWhitespace"/>
5355
<module name="MethodParamPad"/>

forms/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
.project
66
/.springBeans
77
/.checkstyle
8+
/ehcache-diskstore/

forms/pom.xml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
<properties>
3030
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3131
<java.version>1.8</java.version>
32-
<wicket.version>7.7.0</wicket.version>
33-
<wicket.bootstrap.version>0.10.14</wicket.bootstrap.version>
34-
<zt.zip.version>1.11</zt.zip.version>
35-
<wicket.webjars.version>0.5.5</wicket.webjars.version>
32+
<wicket.version>7.9.0</wicket.version>
33+
<wicket.bootstrap.version>0.10.16</wicket.bootstrap.version>
34+
<zt.zip.version>1.12</zt.zip.version>
35+
<wicket.webjars.version>0.5.6</wicket.webjars.version>
3636
<closure.compiler.version>v20160822</closure.compiler.version>
3737
</properties>
3838

@@ -124,13 +124,13 @@
124124
<artifactId>cglib</artifactId>
125125
<version>3.1</version>
126126
</dependency>
127-
127+
128128
<dependency>
129-
<groupId>com.google.javascript</groupId>
130-
<artifactId>closure-compiler</artifactId>
131-
<version>${closure.compiler.version}</version>
132-
</dependency>
133-
129+
<groupId>com.google.javascript</groupId>
130+
<artifactId>closure-compiler</artifactId>
131+
<version>${closure.compiler.version}</version>
132+
</dependency>
133+
134134

135135
<dependency>
136136
<groupId>de.agilecoders.wicket.webjars</groupId>
@@ -218,14 +218,13 @@
218218
</dependency>
219219

220220
<dependency>
221-
<groupId>javax.mail</groupId>
222-
<artifactId>mail</artifactId>
223-
<version>1.4.7</version>
221+
<groupId>org.springframework.boot</groupId>
222+
<artifactId>spring-boot-starter-mail</artifactId>
224223
</dependency>
225224
<dependency>
226225
<groupId>org.apache.poi</groupId>
227226
<artifactId>poi</artifactId>
228-
<version>${pentaho.poi.version}</version>
227+
<version>${poi.version}</version>
229228
</dependency>
230229
</dependencies>
231230

@@ -355,11 +354,11 @@
355354
</dependency>
356355
<dependency>
357356
<groupId>org.hibernate</groupId>
358-
<artifactId>hibernate-entitymanager</artifactId>
357+
<artifactId>hibernate-entitymanager</artifactId>
359358
</dependency>
360359
<dependency>
361360
<groupId>org.hibernate</groupId>
362-
<artifactId>hibernate-envers</artifactId>
361+
<artifactId>hibernate-envers</artifactId>
363362
</dependency>
364363
</dependencies>
365364
</dependencyManagement>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html xmlns:wicket="http://wicket.apache.org">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>EditUserDashboardPage</title>
6+
</head>
7+
<body>
8+
<wicket:extend>
9+
<div wicket:id="firstIndicator"></div>
10+
<div wicket:id="secondIndicator"></div>
11+
<div wicket:id="color"></div>
12+
</wicket:extend>
13+
</body>
14+
</html>
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2016 Development Gateway, Inc and others.
3+
*
4+
* All rights reserved. This program and the accompanying materials
5+
* are made available under the terms of the MIT License (MIT)
6+
* which accompanies this distribution, and is available at
7+
* https://opensource.org/licenses/MIT
8+
*
9+
* Contributors:
10+
* Development Gateway - initial API and implementation
11+
*******************************************************************************/
12+
package org.devgateway.ocds.forms.wicket.page.edit;
13+
14+
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
15+
import org.apache.wicket.markup.html.form.Form;
16+
import org.apache.wicket.markup.html.form.FormComponent;
17+
import org.apache.wicket.markup.html.form.validation.AbstractFormValidator;
18+
import org.apache.wicket.model.IModel;
19+
import org.apache.wicket.request.mapper.parameter.PageParameters;
20+
import org.apache.wicket.spring.injection.annot.SpringBean;
21+
import org.devgateway.ocds.forms.wicket.page.list.ListAllColorIndicatorPage;
22+
import org.devgateway.ocds.persistence.dao.ColorIndicatorPair;
23+
import org.devgateway.ocds.persistence.mongo.flags.FlagsConstants;
24+
import org.devgateway.ocds.persistence.repository.ColorIndicatorPairRepository;
25+
import org.devgateway.toolkit.forms.wicket.components.form.ColorPickerBootstrapFormComponent;
26+
import org.devgateway.toolkit.forms.wicket.components.form.Select2ChoiceBootstrapFormComponent;
27+
import org.devgateway.toolkit.forms.wicket.page.edit.AbstractEditPage;
28+
import org.devgateway.toolkit.forms.wicket.providers.GenericChoiceProvider;
29+
import org.devgateway.toolkit.persistence.repository.PersonRepository;
30+
import org.devgateway.toolkit.web.security.SecurityConstants;
31+
import org.wicketstuff.annotation.mount.MountPath;
32+
33+
@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_ADMIN)
34+
@MountPath("/editColorIndicatorPairPage")
35+
public class EditColorIndicatorPairPage extends AbstractEditPage<ColorIndicatorPair> {
36+
37+
private static final long serialVersionUID = -6069250112046118104L;
38+
39+
@Override
40+
protected ColorIndicatorPair newInstance() {
41+
return new ColorIndicatorPair();
42+
}
43+
44+
@SpringBean
45+
private ColorIndicatorPairRepository colorIndicatorPairRepository;
46+
47+
@SpringBean
48+
private PersonRepository personRepository;
49+
50+
private Select2ChoiceBootstrapFormComponent<String> firstIndicator;
51+
52+
private Select2ChoiceBootstrapFormComponent<String> secondIndicator;
53+
54+
public EditColorIndicatorPairPage(final PageParameters parameters) {
55+
super(parameters);
56+
this.jpaRepository = colorIndicatorPairRepository;
57+
this.listPageClass = ListAllColorIndicatorPage.class;
58+
59+
}
60+
61+
62+
@Override
63+
protected void onInitialize() {
64+
super.onInitialize();
65+
66+
firstIndicator =
67+
new Select2ChoiceBootstrapFormComponent<String>("firstIndicator",
68+
new GenericChoiceProvider<String>(FlagsConstants.FLAGS_LIST));
69+
firstIndicator.required();
70+
editForm.add(firstIndicator);
71+
72+
secondIndicator =
73+
new Select2ChoiceBootstrapFormComponent<String>("secondIndicator",
74+
new GenericChoiceProvider<String>(FlagsConstants.FLAGS_LIST));
75+
secondIndicator.required();
76+
editForm.add(secondIndicator);
77+
78+
ColorPickerBootstrapFormComponent color = new ColorPickerBootstrapFormComponent("color");
79+
color.required();
80+
editForm.add(color);
81+
editForm.add(new ColorIndicatorDistinctFormValidator());
82+
editForm.add(new ColorIndicatorUniquePairFormValidator(compoundModel));
83+
84+
}
85+
86+
87+
private class ColorIndicatorDistinctFormValidator extends AbstractFormValidator {
88+
89+
@Override
90+
public FormComponent<?>[] getDependentFormComponents() {
91+
return new FormComponent[]{firstIndicator.getField(), secondIndicator.getField()};
92+
}
93+
94+
@Override
95+
public void validate(Form<?> form) {
96+
if (firstIndicator.getField().getValue() != null && secondIndicator.getField().getValue() != null
97+
&& firstIndicator.getField().getValue().equals(secondIndicator.getField().getValue())) {
98+
error(firstIndicator.getField());
99+
error(secondIndicator.getField());
100+
}
101+
}
102+
}
103+
104+
105+
private class ColorIndicatorUniquePairFormValidator extends AbstractFormValidator {
106+
107+
private final IModel<ColorIndicatorPair> masterModel;
108+
109+
ColorIndicatorUniquePairFormValidator(IModel<ColorIndicatorPair> masterModel) {
110+
this.masterModel = masterModel;
111+
}
112+
113+
@Override
114+
public FormComponent<?>[] getDependentFormComponents() {
115+
return new FormComponent[]{firstIndicator.getField(), secondIndicator.getField()};
116+
}
117+
118+
@Override
119+
public void validate(Form<?> form) {
120+
if (firstIndicator.getField().getValue() != null && secondIndicator.getField().getValue() != null) {
121+
ColorIndicatorPair indicator = colorIndicatorPairRepository.
122+
findByFirstIndicatorAndSecondIndicator(firstIndicator.getField().getValue(),
123+
secondIndicator.getField().getValue());
124+
125+
if ((masterModel.getObject().isNew() && indicator != null)
126+
|| (!masterModel.getObject().isNew() && indicator != null
127+
&& !indicator.getId().equals(masterModel.getObject().getId()))) {
128+
error(firstIndicator.getField());
129+
error(secondIndicator.getField());
130+
}
131+
}
132+
}
133+
}
134+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
###############################################################################
2+
# Copyright (c) 2015 Development Gateway, Inc and others.
3+
#
4+
# All rights reserved. This program and the accompanying materials
5+
# are made available under the terms of the MIT License (MIT)
6+
# which accompanies this distribution, and is available at
7+
# https://opensource.org/licenses/MIT
8+
#
9+
# Contributors:
10+
# Development Gateway - initial API and implementation
11+
###############################################################################
12+
page.title=Edit Color Indicator Pair
13+
firstIndicator.label=First Indicator
14+
secondIndicator.label=Second Indicator
15+
color.label=Color
16+
ColorIndicatorDistinctFormValidator=Please select two distinct indicators
17+
ColorIndicatorUniquePairFormValidator=A similar pair of indicators was already saved with a color. You can add only distinct pairs.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2016 Development Gateway, Inc and others.
3+
*
4+
* All rights reserved. This program and the accompanying materials
5+
* are made available under the terms of the MIT License (MIT)
6+
* which accompanies this distribution, and is available at
7+
* https://opensource.org/licenses/MIT
8+
*
9+
* Contributors:
10+
* Development Gateway - initial API and implementation
11+
*******************************************************************************/
12+
package org.devgateway.ocds.forms.wicket.page.list;
13+
14+
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
15+
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
16+
import org.apache.wicket.model.Model;
17+
import org.apache.wicket.request.mapper.parameter.PageParameters;
18+
import org.apache.wicket.spring.injection.annot.SpringBean;
19+
import org.devgateway.ocds.forms.wicket.page.edit.EditColorIndicatorPairPage;
20+
import org.devgateway.ocds.persistence.dao.ColorIndicatorPair;
21+
import org.devgateway.ocds.persistence.repository.ColorIndicatorPairRepository;
22+
import org.devgateway.toolkit.forms.wicket.page.lists.AbstractListPage;
23+
import org.devgateway.toolkit.web.security.SecurityConstants;
24+
import org.wicketstuff.annotation.mount.MountPath;
25+
26+
@AuthorizeInstantiation(SecurityConstants.Roles.ROLE_ADMIN)
27+
@MountPath(value = "/listColorIndicators")
28+
public class ListAllColorIndicatorPage extends AbstractListPage<ColorIndicatorPair> {
29+
30+
@SpringBean
31+
protected ColorIndicatorPairRepository colorIndicatorPairRepository;
32+
33+
34+
35+
public ListAllColorIndicatorPage(final PageParameters pageParameters) {
36+
super(pageParameters);
37+
this.jpaRepository = colorIndicatorPairRepository;
38+
this.editPageClass = EditColorIndicatorPairPage.class;
39+
columns.add(new PropertyColumn<ColorIndicatorPair, String>(new Model<String>("First Indicator"),
40+
"firstIndicator", "firstIndicator"));
41+
42+
columns.add(new PropertyColumn<ColorIndicatorPair, String>(new Model<String>("Second Indicator"),
43+
"secondIndicator", "secondIndicator"));
44+
45+
columns.add(new PropertyColumn<ColorIndicatorPair, String>(new Model<String>("Color"),
46+
"color", "color"));
47+
48+
}
49+
50+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
###############################################################################
2+
# Copyright (c) 2015 Development Gateway, Inc and others.
3+
#
4+
# All rights reserved. This program and the accompanying materials
5+
# are made available under the terms of the MIT License (MIT)
6+
# which accompanies this distribution, and is available at
7+
# https://opensource.org/licenses/MIT
8+
#
9+
# Contributors:
10+
# Development Gateway - initial API and implementation
11+
###############################################################################
12+
page.title=All Color Indicator Pairs
13+
defaultDashboardUsers=Default Dashboard For Users
14+
users=Users
15+
view=View

0 commit comments

Comments
 (0)