Skip to content

Commit

Permalink
Merge branch 'dgtkit-3.x' into #356-modal-3
Browse files Browse the repository at this point in the history
  • Loading branch information
developster committed Feb 23, 2021
2 parents d6ee01d + 6721d06 commit ba17a87
Show file tree
Hide file tree
Showing 57 changed files with 2,147 additions and 470 deletions.
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<property name="protectedAllowed" value="true"/>
</module>
<module name="ArrayTypeStyle"/>
<module name="FinalParameters"/>
<!-- <module name="FinalParameters"/> -->
<module name="TodoComment">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
Expand Down
74 changes: 31 additions & 43 deletions forms/pom.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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
-->
Expand All @@ -30,15 +30,15 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<wicket.version>8.6.1</wicket.version>
<wicketstuff.version>8.6.0</wicketstuff.version>
<wicket.bootstrap.version>2.0.10</wicket.bootstrap.version>
<wicket.version>8.10.0</wicket.version>
<wicketstuff.version>8.10.0</wicketstuff.version>
<wicket.bootstrap.version>2.0.11</wicket.bootstrap.version>
<zt.zip.version>1.13</zt.zip.version>
<wicket.webjars.version>2.0.15</wicket.webjars.version>
<closure.compiler.version>v20190528</closure.compiler.version>
<wicket.webjars.version>2.0.19</wicket.webjars.version>
<closure.compiler.version>v20200406</closure.compiler.version>
<cglib.version>3.1</cglib.version>
<yuicompressor.version>2.4.8</yuicompressor.version>
<javamelody.version>1.80.0</javamelody.version>
<javamelody.version>1.86.0</javamelody.version>
</properties>

<dependencies>
Expand All @@ -55,33 +55,39 @@
</dependency>

<dependency>
<groupId>org.devgateway.toolkit</groupId>
<artifactId>persistence-mongodb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>

<dependency>
<groupId>org.devgateway.toolkit</groupId>
<artifactId>ui</artifactId>
<artifactId>persistence-mongodb</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.devgateway.toolkit</groupId>
<artifactId>reporting</artifactId>
<artifactId>ui</artifactId>
<version>0.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>bcprov-jdk14</artifactId>
<groupId>bouncycastle</groupId>
</exclusion>
<exclusion>
<artifactId>bcprov-jdk14</artifactId>
<groupId>org.bouncycastle</groupId>
</exclusion>
</exclusions>
</dependency>

<!-- <dependency>-->
<!-- <groupId>org.devgateway.toolkit</groupId>-->
<!-- <artifactId>reporting</artifactId>-->
<!-- <version>0.0.1-SNAPSHOT</version>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <artifactId>bcprov-jdk14</artifactId>-->
<!-- <groupId>bouncycastle</groupId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <artifactId>bcprov-jdk14</artifactId>-->
<!-- <groupId>org.bouncycastle</groupId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->

<dependency>
<groupId>org.devgateway.toolkit</groupId>
<artifactId>web</artifactId>
Expand Down Expand Up @@ -120,17 +126,6 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-integration</artifactId>
<exclusions>
<exclusion>
<artifactId>xercesImpl</artifactId>
<groupId>xerces</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand All @@ -152,11 +147,6 @@
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand Down Expand Up @@ -225,6 +215,7 @@
</exclusions>
</dependency>


<dependency>
<groupId>de.agilecoders.wicket</groupId>
<artifactId>wicket-bootstrap-extensions</artifactId>
Expand Down Expand Up @@ -292,6 +283,7 @@
<include>**/*.css</include>
<include>**/*.js</include>
<include>**/*.png</include>
<include>**/*.svg</include>
<include>**/*.gif</include>
<include>**/*.html</include>
<include>**/*.properties</include>
Expand Down Expand Up @@ -397,10 +389,6 @@
<artifactId>derby</artifactId>
<version>${derby.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void configure(final WebSecurity web) throws Exception {
web.ignoring().antMatchers("/img/**", "/css*/**", "/js*/**", "/assets*/**", "/wicket/resource/**/*.js",
"/wicket/resource/**/*.css", "/wicket/resource/**/*.png", "/wicket/resource/**/*.jpg",
"/wicket/resource/**/*.woff", "/wicket/resource/**/*.woff2", "/wicket/resource/**/*.ttf",
"/favicon.ico",
"/favicon.ico", "/wicket/resource/**/*.svg",
"/wicket/resource/**/*.gif", "/login/**", "/forgotPassword/**", "/resources/**",
"/resources/public/**");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ private WebConstants() {

public static final String PARAM_VIEW_MODE = "viewMode";

public static final String DISABLE_FORM_LEAVING_JS
= "if(typeof disableFormLeavingConfirmation === 'function') disableFormLeavingConfirmation();";

public static final String PARAM_PRINT = "print";

public static final String PARAM_ID = "id";
public static final String V_POSITION = "vPosition";
public static final String MAX_HEIGHT = "maxPosition";
public static final String PARAM_REVISION_ID = "revisionId";
public static final String PARAM_ENTITY_CLASS = "class";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ public final class SecurityConstants {
public static final class Roles {
public static final String ROLE_ADMIN = "ROLE_ADMIN";
public static final String ROLE_USER = "ROLE_USER";
public static final String ROLE_VALIDATOR = "ROLE_VALIDATOR";
}

public static final class Action {
public static final String EDIT = "EDIT";
public static final String VIEW = "VIEW";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
*******************************************************************************/
package org.devgateway.toolkit.forms.util;

import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;

import org.apache.wicket.markup.Markup;
import org.apache.wicket.markup.MarkupCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.cache.Cache;
import javax.cache.CacheManager;
import java.util.Collection;

/**
Expand All @@ -30,6 +31,10 @@
*/
@Component
public class MarkupCacheService {

@Autowired
private CacheManager cm;

/**
* start-key used to identify the reports markup
*/
Expand Down Expand Up @@ -61,12 +66,11 @@ public final void flushMarkupCache() {
*/
public void addPentahoReportToCache(final String outputType, final String reportName, final String parameters,
final byte[] buffer) {
final CacheManager cm = CacheManager.getInstance();

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

cache.put(new Element(createCacheKey(outputType, reportName, parameters), buffer));
cache.put(createCacheKey(outputType, reportName, parameters), buffer);
}

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

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

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

if (cache.isKeyInCache(key)) {
return (byte[]) cache.get(key).getObjectValue();
if (cache.containsKey(key)) {
return cache.get(key);
}

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

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

if (cache != null) {
cache.removeAll();
Expand All @@ -110,16 +112,15 @@ public void clearPentahoReportsCache() {
* Remove from cache all APIs/Services content.
*/
public void clearAllCaches() {
final CacheManager cm = CacheManager.getInstance();

// get the reports cache "reportsApiCache", declared in ehcache.xml
final Cache cache = cm.getCache("reportsApiCache");
final Cache<Object, Object> cache = cm.getCache("reportsApiCache");
if (cache != null) {
cache.removeAll();
}

// get the reports cache "excelExportCache", declared in ehcache.xml
final Cache excelExportCache = cm.getCache("excelExportCache");
final Cache<Object, Object> excelExportCache = cm.getCache("excelExportCache");
if (excelExportCache != null) {
excelExportCache.removeAll();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright (c) 2015 Development Gateway, Inc and others.
* <p>
* 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
* <p>
* Contributors:
* Development Gateway - initial API and implementation
*/
/**
*
*/
package org.devgateway.toolkit.forms.wicket.components.form;

import org.apache.wicket.markup.html.form.TextArea;
import org.apache.wicket.model.IModel;
import org.apache.wicket.validation.validator.StringValidator;
import org.devgateway.toolkit.forms.WebConstants;

/**
* @author mpostelnicu
*
* A {@link TextAreaFieldBootstrapFormComponent} that has TextArea{@link #isRequired()} exposed
*
*/
public abstract class OptionallyRequiredTextAreaFieldComponent<TYPE> extends TextAreaFieldBootstrapFormComponent<TYPE> {
private StringValidator validator = WebConstants.StringValidators.MAXIMUM_LENGTH_VALIDATOR_ONE_LINE_TEXTAREA;

private static final long serialVersionUID = 1L;

public OptionallyRequiredTextAreaFieldComponent(final String id, final IModel<String> labelModel,
final IModel<TYPE> model) {
super(id, labelModel, model);
}

public OptionallyRequiredTextAreaFieldComponent(final String id, final IModel<String> labelModel) {
super(id, labelModel, null);
}

/**
* @param id
*/
public OptionallyRequiredTextAreaFieldComponent(final String id) {
super(id);
}

public boolean isRequired() {
return false;
}

@Override
protected TextArea<TYPE> inputField(final String id, final IModel<TYPE> model) {
TextArea<TYPE> textArea = new TextArea<TYPE>(id, initFieldModel()) {
@Override
public boolean isRequired() {
return OptionallyRequiredTextAreaFieldComponent.this.isRequired();
}
};
return textArea;
}

}
Loading

0 comments on commit ba17a87

Please sign in to comment.