Skip to content

Commit 8b599aa

Browse files
committed
Merge branch 'dgtkit-3.x' into feature/cache-v3
# Conflicts: # forms/pom.xml
2 parents 95bb4ba + ee94666 commit 8b599aa

File tree

54 files changed

+2128
-452
lines changed

Some content is hidden

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

54 files changed

+2128
-452
lines changed

checkstyle.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<property name="protectedAllowed" value="true"/>
9797
</module>
9898
<module name="ArrayTypeStyle"/>
99-
<module name="FinalParameters"/>
99+
<!-- <module name="FinalParameters"/> -->
100100
<module name="TodoComment">
101101
<property name="severity" value="ignore"/>
102102
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>

forms/pom.xml

+22-41
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
<properties>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3232
<java.version>1.8</java.version>
33-
<wicket.version>8.6.1</wicket.version>
34-
<wicketstuff.version>8.6.0</wicketstuff.version>
35-
<wicket.bootstrap.version>2.0.10</wicket.bootstrap.version>
33+
<wicket.version>8.8.0</wicket.version>
34+
<wicketstuff.version>8.7.0</wicketstuff.version>
35+
<wicket.bootstrap.version>2.0.11</wicket.bootstrap.version>
3636
<zt.zip.version>1.13</zt.zip.version>
37-
<wicket.webjars.version>2.0.15</wicket.webjars.version>
38-
<closure.compiler.version>v20190528</closure.compiler.version>
37+
<wicket.webjars.version>2.0.17</wicket.webjars.version>
38+
<closure.compiler.version>v20200406</closure.compiler.version>
3939
<cglib.version>3.1</cglib.version>
4040
<yuicompressor.version>2.4.8</yuicompressor.version>
41-
<javamelody.version>1.80.0</javamelody.version>
41+
<javamelody.version>1.82.0</javamelody.version>
4242
</properties>
4343

4444
<dependencies>
@@ -66,21 +66,21 @@
6666
<version>0.0.1-SNAPSHOT</version>
6767
</dependency>
6868

69-
<dependency>
70-
<groupId>org.devgateway.toolkit</groupId>
71-
<artifactId>reporting</artifactId>
72-
<version>0.0.1-SNAPSHOT</version>
73-
<exclusions>
74-
<exclusion>
75-
<artifactId>bcprov-jdk14</artifactId>
76-
<groupId>bouncycastle</groupId>
77-
</exclusion>
78-
<exclusion>
79-
<artifactId>bcprov-jdk14</artifactId>
80-
<groupId>org.bouncycastle</groupId>
81-
</exclusion>
82-
</exclusions>
83-
</dependency>
69+
<!-- <dependency>-->
70+
<!-- <groupId>org.devgateway.toolkit</groupId>-->
71+
<!-- <artifactId>reporting</artifactId>-->
72+
<!-- <version>0.0.1-SNAPSHOT</version>-->
73+
<!-- <exclusions>-->
74+
<!-- <exclusion>-->
75+
<!-- <artifactId>bcprov-jdk14</artifactId>-->
76+
<!-- <groupId>bouncycastle</groupId>-->
77+
<!-- </exclusion>-->
78+
<!-- <exclusion>-->
79+
<!-- <artifactId>bcprov-jdk14</artifactId>-->
80+
<!-- <groupId>org.bouncycastle</groupId>-->
81+
<!-- </exclusion>-->
82+
<!-- </exclusions>-->
83+
<!-- </dependency>-->
8484

8585
<dependency>
8686
<groupId>org.devgateway.toolkit</groupId>
@@ -120,17 +120,6 @@
120120
</exclusions>
121121
</dependency>
122122

123-
<dependency>
124-
<groupId>org.springframework.boot</groupId>
125-
<artifactId>spring-boot-starter-integration</artifactId>
126-
<exclusions>
127-
<exclusion>
128-
<artifactId>xercesImpl</artifactId>
129-
<groupId>xerces</groupId>
130-
</exclusion>
131-
</exclusions>
132-
</dependency>
133-
134123
<dependency>
135124
<groupId>org.springframework.boot</groupId>
136125
<artifactId>spring-boot-starter-web</artifactId>
@@ -152,11 +141,6 @@
152141
<artifactId>spring-boot-starter-security</artifactId>
153142
</dependency>
154143

155-
<dependency>
156-
<groupId>org.springframework.data</groupId>
157-
<artifactId>spring-data-rest-hal-browser</artifactId>
158-
</dependency>
159-
160144
<dependency>
161145
<groupId>org.springframework.boot</groupId>
162146
<artifactId>spring-boot-starter-test</artifactId>
@@ -292,6 +276,7 @@
292276
<include>**/*.css</include>
293277
<include>**/*.js</include>
294278
<include>**/*.png</include>
279+
<include>**/*.svg</include>
295280
<include>**/*.gif</include>
296281
<include>**/*.html</include>
297282
<include>**/*.properties</include>
@@ -397,10 +382,6 @@
397382
<artifactId>derby</artifactId>
398383
<version>${derby.version}</version>
399384
</dependency>
400-
<dependency>
401-
<groupId>org.hibernate</groupId>
402-
<artifactId>hibernate-ehcache</artifactId>
403-
</dependency>
404385
<dependency>
405386
<groupId>org.hibernate</groupId>
406387
<artifactId>hibernate-entitymanager</artifactId>

forms/src/main/java/org/devgateway/toolkit/forms/FormsSecurityConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void configure(final WebSecurity web) throws Exception {
4848
web.ignoring().antMatchers("/img/**", "/css*/**", "/js*/**", "/assets*/**", "/wicket/resource/**/*.js",
4949
"/wicket/resource/**/*.css", "/wicket/resource/**/*.png", "/wicket/resource/**/*.jpg",
5050
"/wicket/resource/**/*.woff", "/wicket/resource/**/*.woff2", "/wicket/resource/**/*.ttf",
51-
"/favicon.ico",
51+
"/favicon.ico", "/wicket/resource/**/*.svg",
5252
"/wicket/resource/**/*.gif", "/login/**", "/forgotPassword/**", "/resources/**",
5353
"/resources/public/**");
5454
}

forms/src/main/java/org/devgateway/toolkit/forms/WebConstants.java

+7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@ private WebConstants() {
3030

3131
public static final String PARAM_VIEW_MODE = "viewMode";
3232

33+
public static final String DISABLE_FORM_LEAVING_JS
34+
= "if(typeof disableFormLeavingConfirmation === 'function') disableFormLeavingConfirmation();";
35+
36+
public static final String PARAM_PRINT = "print";
37+
3338
public static final String PARAM_ID = "id";
39+
public static final String V_POSITION = "vPosition";
40+
public static final String MAX_HEIGHT = "maxPosition";
3441
public static final String PARAM_REVISION_ID = "revisionId";
3542
public static final String PARAM_ENTITY_CLASS = "class";
3643

forms/src/main/java/org/devgateway/toolkit/forms/security/SecurityConstants.java

+6
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,11 @@ public final class SecurityConstants {
2323
public static final class Roles {
2424
public static final String ROLE_ADMIN = "ROLE_ADMIN";
2525
public static final String ROLE_USER = "ROLE_USER";
26+
public static final String ROLE_VALIDATOR = "ROLE_VALIDATOR";
27+
}
28+
29+
public static final class Action {
30+
public static final String EDIT = "EDIT";
31+
public static final String VIEW = "VIEW";
2632
}
2733
}

forms/src/main/java/org/devgateway/toolkit/forms/util/MarkupCacheService.java

+16-15
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
*******************************************************************************/
1212
package org.devgateway.toolkit.forms.util;
1313

14-
import net.sf.ehcache.Cache;
15-
import net.sf.ehcache.CacheManager;
16-
import net.sf.ehcache.Element;
14+
1715
import org.apache.wicket.markup.Markup;
1816
import org.apache.wicket.markup.MarkupCache;
17+
import org.springframework.beans.factory.annotation.Autowired;
1918
import org.springframework.stereotype.Component;
2019

20+
import javax.cache.Cache;
21+
import javax.cache.CacheManager;
2122
import java.util.Collection;
2223

2324
/**
@@ -30,6 +31,10 @@
3031
*/
3132
@Component
3233
public class MarkupCacheService {
34+
35+
@Autowired
36+
private CacheManager cm;
37+
3338
/**
3439
* start-key used to identify the reports markup
3540
*/
@@ -61,12 +66,11 @@ public final void flushMarkupCache() {
6166
*/
6267
public void addPentahoReportToCache(final String outputType, final String reportName, final String parameters,
6368
final byte[] buffer) {
64-
final CacheManager cm = CacheManager.getInstance();
6569

6670
// get the reports cache "reportsCache", declared in ehcache.xml
67-
final Cache cache = cm.getCache("reportsCache");
71+
final Cache<String, byte[]> cache = cm.getCache("reportsCache", String.class, byte[].class);
6872

69-
cache.put(new Element(createCacheKey(outputType, reportName, parameters), buffer));
73+
cache.put(createCacheKey(outputType, reportName, parameters), buffer);
7074
}
7175

7276
/**
@@ -78,15 +82,14 @@ public void addPentahoReportToCache(final String outputType, final String report
7882
* @return
7983
*/
8084
public byte[] getPentahoReportFromCache(final String outputType, final String reportName, final String parameters) {
81-
final CacheManager cm = CacheManager.getInstance();
8285

8386
// get the reports cache "reportsCache", declared in ehcache.xml
84-
final Cache cache = cm.getCache("reportsCache");
87+
final Cache<String, byte[]> cache = cm.getCache("reportsCache", String.class, byte[].class);
8588

8689
final String key = createCacheKey(outputType, reportName, parameters);
8790

88-
if (cache.isKeyInCache(key)) {
89-
return (byte[]) cache.get(key).getObjectValue();
91+
if (cache.containsKey(key)) {
92+
return cache.get(key);
9093
}
9194

9295
return null;
@@ -96,10 +99,9 @@ public byte[] getPentahoReportFromCache(final String outputType, final String re
9699
* Remove from cache all reports content
97100
*/
98101
public void clearPentahoReportsCache() {
99-
final CacheManager cm = CacheManager.getInstance();
100102

101103
// get the reports cache "reportsCache", declared in ehcache.xml
102-
final Cache cache = cm.getCache("reportsCache");
104+
final Cache<Object, Object> cache = cm.getCache("reportsCache");
103105

104106
if (cache != null) {
105107
cache.removeAll();
@@ -110,16 +112,15 @@ public void clearPentahoReportsCache() {
110112
* Remove from cache all APIs/Services content.
111113
*/
112114
public void clearAllCaches() {
113-
final CacheManager cm = CacheManager.getInstance();
114115

115116
// get the reports cache "reportsApiCache", declared in ehcache.xml
116-
final Cache cache = cm.getCache("reportsApiCache");
117+
final Cache<Object, Object> cache = cm.getCache("reportsApiCache");
117118
if (cache != null) {
118119
cache.removeAll();
119120
}
120121

121122
// get the reports cache "excelExportCache", declared in ehcache.xml
122-
final Cache excelExportCache = cm.getCache("excelExportCache");
123+
final Cache<Object, Object> excelExportCache = cm.getCache("excelExportCache");
123124
if (excelExportCache != null) {
124125
excelExportCache.removeAll();
125126
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* Copyright (c) 2015 Development Gateway, Inc and others.
3+
* <p>
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+
* <p>
9+
* Contributors:
10+
* Development Gateway - initial API and implementation
11+
*/
12+
/**
13+
*
14+
*/
15+
package org.devgateway.toolkit.forms.wicket.components.form;
16+
17+
import org.apache.wicket.markup.html.form.TextArea;
18+
import org.apache.wicket.model.IModel;
19+
import org.apache.wicket.validation.validator.StringValidator;
20+
import org.devgateway.toolkit.forms.WebConstants;
21+
22+
/**
23+
* @author mpostelnicu
24+
*
25+
* A {@link TextAreaFieldBootstrapFormComponent} that has TextArea{@link #isRequired()} exposed
26+
*
27+
*/
28+
public abstract class OptionallyRequiredTextAreaFieldComponent<TYPE> extends TextAreaFieldBootstrapFormComponent<TYPE> {
29+
private StringValidator validator = WebConstants.StringValidators.MAXIMUM_LENGTH_VALIDATOR_ONE_LINE_TEXTAREA;
30+
31+
private static final long serialVersionUID = 1L;
32+
33+
public OptionallyRequiredTextAreaFieldComponent(final String id, final IModel<String> labelModel,
34+
final IModel<TYPE> model) {
35+
super(id, labelModel, model);
36+
}
37+
38+
public OptionallyRequiredTextAreaFieldComponent(final String id, final IModel<String> labelModel) {
39+
super(id, labelModel, null);
40+
}
41+
42+
/**
43+
* @param id
44+
*/
45+
public OptionallyRequiredTextAreaFieldComponent(final String id) {
46+
super(id);
47+
}
48+
49+
public boolean isRequired() {
50+
return false;
51+
}
52+
53+
@Override
54+
protected TextArea<TYPE> inputField(final String id, final IModel<TYPE> model) {
55+
TextArea<TYPE> textArea = new TextArea<TYPE>(id, initFieldModel()) {
56+
@Override
57+
public boolean isRequired() {
58+
return OptionallyRequiredTextAreaFieldComponent.this.isRequired();
59+
}
60+
};
61+
return textArea;
62+
}
63+
64+
}

0 commit comments

Comments
 (0)