Skip to content

Commit

Permalink
Merge pull request #185 from devgateway/develop
Browse files Browse the repository at this point in the history
develop into master , 0.8.0
  • Loading branch information
mpostelnicu authored Oct 6, 2016
2 parents e553239 + 5d60207 commit 0241cc9
Show file tree
Hide file tree
Showing 251 changed files with 7,596 additions and 7,214 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ cache:
- ui/node
env:
global:
- MAVEN_OPTS="-XX:MaxMetaspaceSize=256m -Xmx4g"
- JAVA_OPTS="-XX:MaxMetaspaceSize=256m -Xmx4g"
- MAVEN_OPTS="-XX:MaxMetaspaceSize=256m -Xmx4g -Xverify:none -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -DdependencyLocationsEnabled=false"
- JAVA_OPTS="-XX:MaxMetaspaceSize=256m -Xmx4g -Xverify:none -XX:+TieredCompilation -XX:TieredStopAtLevel=1"
install: mvn install -T 64C -Dskip.frontend.build=true -DskipTests=true -Dmaven.javadoc.skip=true -B -V
script: mvn test -T 64C -Dskip.frontend.build=true -B --quiet
jdk:
Expand Down
9 changes: 5 additions & 4 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>

<suppress checks="HideUtilityClassConstructor|FinalClass"
files="PersistenceApplication\.java|MongoPersistenceApplication\.java|UIWebApplication\.java|WebApplication\.java|ReportingApplication\.java" />
<suppress checks="HideUtilityClassConstructor|FinalClass"
files="PersistenceApplication\.java|MongoPersistenceApplication\.java|UIWebApplication\.java|WebApplication\.java|ReportingApplication\.java" />

<suppress checks="[a-zA-Z0-9]*" files="[\\/]ui[\\/]" />
</suppressions>
3 changes: 1 addition & 2 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@
</module>
<module name="Translation"/>
<module name="FileTabCharacter">
<property name="severity" value="ignore"/>
<metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
<property name="fileExtensions" value="java,xml,html,md"/>
</module>
<module name="RegexpSingleline">
<property name="severity" value="ignore"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,71 +30,71 @@
@Order(1) // this ensures the forms security comes first
public class FormsSecurityConfig extends WebSecurityConfig {

/**
* Remember me key for {@link TokenBasedRememberMeServices}
*/
private static final String UNIQUE_SECRET_REMEMBER_ME_KEY = "secret";
/**
* Remember me key for {@link TokenBasedRememberMeServices}
*/
private static final String UNIQUE_SECRET_REMEMBER_ME_KEY = "secret";

/**
* We ensure the superclass configuration is being applied Take note the
* {@link FormsSecurityConfig} extends {@link WebSecurityConfig} which has
* configuration for the dg-toolkit/web module. We then apply ant matchers
* and ignore security for css/js/images resources, and wicket mounted
* resources
*/
@Override
public void configure(final WebSecurity web) throws Exception {
super.configure(web);
web.ignoring().antMatchers("/ui/**",
"/img/**", "/css*/**", "/js*/**", "/assets*/**", "/wicket/resource/**/*.js",
"/wicket/resource/**/*.css", "/wicket/resource/**/*.png", "/wicket/resource/**/*.jpg",
"/wicket/resource/**/*.gif", "/login/**", "/forgotPassword/**",
/**
* We ensure the superclass configuration is being applied Take note the
* {@link FormsSecurityConfig} extends {@link WebSecurityConfig} which has
* configuration for the dg-toolkit/web module. We then apply ant matchers
* and ignore security for css/js/images resources, and wicket mounted
* resources
*/
@Override
public void configure(final WebSecurity web) throws Exception {
super.configure(web);
web.ignoring().antMatchers("/ui/**",
"/img/**", "/css*/**", "/js*/**", "/assets*/**", "/wicket/resource/**/*.js",
"/wicket/resource/**/*.css", "/wicket/resource/**/*.png", "/wicket/resource/**/*.jpg",
"/wicket/resource/**/*.gif", "/login/**", "/forgotPassword/**",
"/resources/**", "/resources/public/**");
}
}

/**
* This bean defines the same key in the {@link RememberMeAuthenticationProvider}
* @return
*/
@Bean
public AuthenticationProvider rememberMeAuthenticationProvider() {
return new RememberMeAuthenticationProvider(UNIQUE_SECRET_REMEMBER_ME_KEY);
}
/**
* This bean defines the same key in the {@link RememberMeAuthenticationProvider}
* @return
*/
@Bean
public AuthenticationProvider rememberMeAuthenticationProvider() {
return new RememberMeAuthenticationProvider(UNIQUE_SECRET_REMEMBER_ME_KEY);
}

/**
* This bean configures the {@link TokenBasedRememberMeServices} with
* {@link CustomJPAUserDetailsService}
*
* @return
*/
@Bean
public AbstractRememberMeServices rememberMeServices() {
TokenBasedRememberMeServices rememberMeServices = new TokenBasedRememberMeServices(
UNIQUE_SECRET_REMEMBER_ME_KEY, customJPAUserDetailsService);
rememberMeServices.setAlwaysRemember(true);
return rememberMeServices;
}
/**
* This bean configures the {@link TokenBasedRememberMeServices} with
* {@link CustomJPAUserDetailsService}
*
* @return
*/
@Bean
public AbstractRememberMeServices rememberMeServices() {
TokenBasedRememberMeServices rememberMeServices = new TokenBasedRememberMeServices(
UNIQUE_SECRET_REMEMBER_ME_KEY, customJPAUserDetailsService);
rememberMeServices.setAlwaysRemember(true);
return rememberMeServices;
}

@Override
protected void configure(final HttpSecurity http) throws Exception {
super.configure(http);
@Override
protected void configure(final HttpSecurity http) throws Exception {
super.configure(http);

// we do not allow anyonymous token. When
// enabled this basically means any guest
// user will have an annoymous default role
http.anonymous().disable().
sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER).
//we let Wicket create and manage sessions, so we disable
//session creation by spring
and().csrf().disable(); // csrf protection interferes with some wicket stuff
// we do not allow anyonymous token. When
// enabled this basically means any guest
// user will have an annoymous default role
http.anonymous().disable().
sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER).
//we let Wicket create and manage sessions, so we disable
//session creation by spring
and().csrf().disable(); // csrf protection interferes with some wicket stuff

// we enable http rememberMe cookie for autologin
// http.rememberMe().key(UNIQUE_SECRET_REMEMBER_ME_KEY);
// we enable http rememberMe cookie for autologin
// http.rememberMe().key(UNIQUE_SECRET_REMEMBER_ME_KEY);

// resolved the error Refused to display * in a frame because it set
// 'X-Frame-Options' to 'DENY'.
http.headers().contentTypeOptions().and().xssProtection().and().cacheControl().and()
.httpStrictTransportSecurity().and().frameOptions().sameOrigin();
// resolved the error Refused to display * in a frame because it set
// 'X-Frame-Options' to 'DENY'.
http.headers().contentTypeOptions().and().xssProtection().and().cacheControl().and()
.httpStrictTransportSecurity().and().frameOptions().sameOrigin();

}
}
}
38 changes: 19 additions & 19 deletions forms/src/main/java/org/devgateway/toolkit/forms/WebConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@

public final class WebConstants {

private WebConstants() {
private WebConstants() {

}
}

public static final int PAGE_SIZE = 10;
public static final int SELECT_PAGE_SIZE = 25;
public static final int PAGE_SIZE = 10;
public static final int SELECT_PAGE_SIZE = 25;

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

public static final String PARAM_ID = "id";
public static final String PARAM_REVISION_ID = "revisionId";
public static final String PARAM_ENTITY_CLASS = "class";
public static final String PARAM_ID = "id";
public static final String PARAM_REVISION_ID = "revisionId";
public static final String PARAM_ENTITY_CLASS = "class";

public static final String LANGUAGE_PARAM = "lang";
public static final String LANGUAGE_PARAM = "lang";

public static final class StringValidators {
public static final StringValidator MAXIMUM_LENGTH_VALIDATOR_ONE_LINE_TEXT = StringValidator
.maximumLength(DBConstants.MAX_DEFAULT_TEXT_LENGTH_ONE_LINE);
public static final StringValidator MAXIMUM_LENGTH_VALIDATOR_ONE_LINE_TEXTAREA = StringValidator
.maximumLength(DBConstants.MAX_DEFAULT_TEXT_AREA);
}
public static final class StringValidators {
public static final StringValidator MAXIMUM_LENGTH_VALIDATOR_ONE_LINE_TEXT =
StringValidator.maximumLength(DBConstants.MAX_DEFAULT_TEXT_LENGTH_ONE_LINE);
public static final StringValidator MAXIMUM_LENGTH_VALIDATOR_ONE_LINE_TEXTAREA =
StringValidator.maximumLength(DBConstants.MAX_DEFAULT_TEXT_AREA);
}

// add more languages here. It is pointless to make this dynamic because the
// wicket i18n is in .properties files so we need
// to change the src code anyway.
public static final List<Locale> AVAILABLE_LOCALES = Collections.unmodifiableList(Arrays.asList(new Locale("en")));
// add more languages here. It is pointless to make this dynamic because the
// wicket i18n is in .properties files so we need
// to change the src code anyway.
public static final List<Locale> AVAILABLE_LOCALES = Collections.unmodifiableList(Arrays.asList(new Locale("en")));

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
*/
public class NullEditPageClassException extends RuntimeException {

/**
*
*/
private static final long serialVersionUID = 8455626306350234992L;
/**
*
*/
private static final long serialVersionUID = 8455626306350234992L;

/**
*
*/
public NullEditPageClassException() {
super("editPageClass is null! Please set the editPageClass in your constructor");
}
/**
*
*/
public NullEditPageClassException() {
super("editPageClass is null! Please set the editPageClass in your constructor");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
*/
public class NullJpaRepositoryException extends RuntimeException {

/**
*
*/
private static final long serialVersionUID = -2779145093766288562L;
/**
*
*/
private static final long serialVersionUID = -2779145093766288562L;

/**
*
*/
public NullJpaRepositoryException() {
super("jpaRepository is null! Please set the jpaRepository in your constructor");
}
/**
*
*/
public NullJpaRepositoryException() {
super("jpaRepository is null! Please set the jpaRepository in your constructor");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
*/
public class NullListPageClassException extends RuntimeException {

/**
*
*/
private static final long serialVersionUID = 5451367480984681341L;
/**
*
*/
private static final long serialVersionUID = 5451367480984681341L;

/**
*
*/
public NullListPageClassException() {
super("listPageClass is null! Please set the listPageClass in your constructor");
}
/**
*
*/
public NullListPageClassException() {
super("listPageClass is null! Please set the listPageClass in your constructor");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,53 +18,54 @@

import nl.dries.wicket.hibernate.dozer.DozerModel;


/**
* USE THIS ONLY FOR {@link SortableJpaRepositoryDataProvider}S
* Use {@link DozerModel} for editing complex forms
* USE THIS ONLY FOR {@link SortableJpaRepositoryDataProvider}S Use
* {@link DozerModel} for editing complex forms
*
* @author mpostelnicu
*
* @param <T> the type of the entity to be accessed
* @param <T>
* the type of the entity to be accessed
*/
public class PersistableJpaRepositoryModel<T extends GenericPersistable> extends LoadableDetachableModel<T> {
private static final long serialVersionUID = -3668189792112474025L;
private Long id;
private static final long serialVersionUID = -3668189792112474025L;
private Long id;
private JpaRepository<T, Long> jpaRepository;

public PersistableJpaRepositoryModel(final Long id, final JpaRepository<T, Long> jpaRepository) {
super();
this.id = id;
this.jpaRepository = jpaRepository;
}

public PersistableJpaRepositoryModel(final T t, final JpaRepository<T, Long> jpaRepository) {
super(t);
this.id = t.getId();
this.jpaRepository = jpaRepository;
}

@Override
protected T load() {
return jpaRepository.findOne(id);
protected T load() {
return jpaRepository.findOne(id);

}

@Override
public int hashCode() {
return Long.valueOf(id).hashCode();
}

@SuppressWarnings("unchecked")
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
} else if (obj == null) {
return false;
} else if (obj instanceof PersistableJpaRepositoryModel) {
PersistableJpaRepositoryModel<T> other = (PersistableJpaRepositoryModel<T>) obj;
return other.id == id;
}
return false;
}

@Override
public int hashCode() {
return Long.valueOf(id).hashCode();
}

@SuppressWarnings("unchecked")
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
} else if (obj == null) {
return false;
} else if (obj instanceof PersistableJpaRepositoryModel) {
PersistableJpaRepositoryModel<T> other = (PersistableJpaRepositoryModel<T>) obj;
return other.id == id;
}
return false;
}
}
Loading

0 comments on commit 0241cc9

Please sign in to comment.