Skip to content

Commit

Permalink
Generated with JHipster 4.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Krusche committed Sep 29, 2017
1 parent dc0e042 commit d02212d
Show file tree
Hide file tree
Showing 29 changed files with 168 additions and 79 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/src/main/webapp/content/css/main.css
/build/www/**
/src/test/javascript/coverage/
/src/test/javascript/PhantomJS*/

######################
# Node
Expand Down
2 changes: 1 addition & 1 deletion .yo-rc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"generator-jhipster": {
"jhipsterVersion": "4.8.2",
"jhipsterVersion": "4.9.0",
"baseName": "ExerciseApplication",
"packageName": "de.tum.in.www1.exerciseapp",
"packageFolder": "de/tum/in/www1/exerciseapp",
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ExerciseApplication
This application was generated using JHipster 4.8.2, you can find documentation and help at [http://www.jhipster.tech/documentation-archive/v4.8.2](http://www.jhipster.tech/documentation-archive/v4.8.2).
This application was generated using JHipster 4.9.0, you can find documentation and help at [http://www.jhipster.tech/documentation-archive/v4.9.0](http://www.jhipster.tech/documentation-archive/v4.9.0).

## Development

Expand Down Expand Up @@ -97,13 +97,13 @@ For more information refer to [Using Docker and Docker-Compose][], this page als
To configure CI for your project, run the ci-cd sub-generator (`jhipster ci-cd`), this will let you generate configuration files for a number of Continuous Integration systems. Consult the [Setting up Continuous Integration][] page for more information.

[JHipster Homepage and latest documentation]: http://www.jhipster.tech
[JHipster 4.8.2 archive]: http://www.jhipster.tech/documentation-archive/v4.8.2
[JHipster 4.9.0 archive]: http://www.jhipster.tech/documentation-archive/v4.9.0

[Using JHipster in development]: http://www.jhipster.tech/documentation-archive/v4.8.2/development/
[Using Docker and Docker-Compose]: http://www.jhipster.tech/documentation-archive/v4.8.2/docker-compose
[Using JHipster in production]: http://www.jhipster.tech/documentation-archive/v4.8.2/production/
[Running tests page]: http://www.jhipster.tech/documentation-archive/v4.8.2/running-tests/
[Setting up Continuous Integration]: http://www.jhipster.tech/documentation-archive/v4.8.2/setting-up-ci/
[Using JHipster in development]: http://www.jhipster.tech/documentation-archive/v4.9.0/development/
[Using Docker and Docker-Compose]: http://www.jhipster.tech/documentation-archive/v4.9.0/docker-compose
[Using JHipster in production]: http://www.jhipster.tech/documentation-archive/v4.9.0/production/
[Running tests page]: http://www.jhipster.tech/documentation-archive/v4.9.0/running-tests/
[Setting up Continuous Integration]: http://www.jhipster.tech/documentation-archive/v4.9.0/setting-up-ci/

[Gatling]: http://gatling.io/
[Node.js]: https://nodejs.org/
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ dropwizard_metrics_version=3.2.2
logstash_logback_encoder_version=4.11
javax_transaction_version=1.2
json_path_version=0.9.1
jhipster_server_version=1.1.9
jhipster_server_version=1.1.11
hibernate_version=5.2.10.Final
hikaricp_version=2.6.0
liquibase_slf4j_version=2.0.0
liquibase_hibernate5_version=3.6
metrics_spring_version=3.1.3
node_version=6.11.1
npm_version=5.3.0
node_version=6.11.3
npm_version=5.4.2
problem_spring_web_version=0.20.0
prometheus_simpleclient_version=0.0.20
springfox_version=2.7.0
spring_boot_version=1.5.7.RELEASE
gatling_version=2.2.3
mapstruct_version=1.1.0.Final
yarn_version=0.27.5
yarn_version=1.1.0

## below are some of the gradle performance improvement settings that can be used as required, these are not enabled by default

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.2-bin.zip
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated on 2017-09-16 using generator-jhipster 4.8.2
// Generated on 2017-09-29 using generator-jhipster 4.9.0
'use strict';

var gulp = require('gulp'),
Expand Down
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"eslint-config-angular": "0.5.0",
"eslint-plugin-angular": "2.2.1",
"event-stream": "3.3.4",
"generator-jhipster": "4.8.2",
"generator-jhipster": "4.9.0",
"gulp": "3.9.1",
"gulp-angular-filesort": "1.1.1",
"gulp-angular-templatecache": "2.0.0",
Expand All @@ -37,7 +37,7 @@
"gulp-plumber": "1.1.0",
"gulp-rename": "1.2.2",
"gulp-replace": "0.5.4",
"gulp-protractor": "3.0.0",
"gulp-protractor": "4.1.0",
"gulp-util": "3.0.7",
"gulp-rev": "7.1.2",
"gulp-rev-replace": "0.4.3",
Expand All @@ -47,21 +47,20 @@
"gulp-useref": "3.1.2",
"jasmine-core": "2.5.0",
"jasmine-reporters": "2.2.0",
"karma": "1.2.0",
"karma-chrome-launcher": "2.0.0",
"karma": "1.7.1",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "1.1.1",
"karma-jasmine": "1.0.2",
"karma-junit-reporter": "1.1.0",
"karma-phantomjs-launcher": "1.0.2",
"karma-jasmine": "1.1.0",
"karma-junit-reporter": "1.2.0",
"karma-script-launcher": "1.0.0",
"lazypipe": "1.0.1",
"lodash": "4.15.0",
"main-bower-files": "2.13.1",
"map-stream": "0.0.6",
"phantomjs-prebuilt": "2.1.12",
"protractor": "4.0.4",
"protractor-jasmine2-screenshot-reporter": "0.3.2",
"protractor": "5.1.2",
"protractor-jasmine2-screenshot-reporter": "0.4.1",
"proxy-middleware": "0.15.0",
"puppeteer": "0.10.2",
"run-sequence": "1.2.2",
"yargs": "5.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public final class Constants {

public static final String SYSTEM_ACCOUNT = "system";
public static final String ANONYMOUS_USER = "anonymoususer";
public static final String DEFAULT_LANGUAGE = "en";

private Constants() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
import org.springframework.security.web.authentication.RememberMeServices;
import org.springframework.security.web.csrf.CookieCsrfTokenRepository;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.csrf.CsrfFilter;
import org.springframework.web.filter.CorsFilter;

import javax.annotation.PostConstruct;
Expand Down Expand Up @@ -106,7 +106,7 @@ protected void configure(HttpSecurity http) throws Exception {
.csrf()
.csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.and()
.addFilterBefore(corsFilter, UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(corsFilter, CsrfFilter.class)
.exceptionHandling()
.authenticationEntryPoint(http401UnauthorizedEntryPoint())
.and()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/tum/in/www1/exerciseapp/domain/Course.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Course implements Serializable {
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Exercise> exercises = new HashSet<>();

// jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
Expand Down Expand Up @@ -67,7 +67,7 @@ public Set<Exercise> getExercises() {
public void setExercises(Set<Exercise> exercises) {
this.exercises = exercises;
}
// jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

@Override
public boolean equals(Object o) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/tum/in/www1/exerciseapp/domain/Exercise.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Exercise implements Serializable {
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private Set<Participation> participations = new HashSet<>();

// jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
Expand Down Expand Up @@ -123,7 +123,7 @@ public Set<Participation> getParticipations() {
public void setParticipations(Set<Participation> participations) {
this.participations = participations;
}
// jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

@Override
public boolean equals(Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class Participation implements Serializable {
@ManyToOne
private Exercise exercise;

// jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
Expand Down Expand Up @@ -89,7 +89,7 @@ public Exercise getExercise() {
public void setExercise(Exercise exercise) {
this.exercise = exercise;
}
// jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

@Override
public boolean equals(Object o) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/tum/in/www1/exerciseapp/domain/Result.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class Result implements Serializable {
@ManyToOne
private Participation participation;

// jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
// jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
public Long getId() {
return id;
}
Expand Down Expand Up @@ -74,7 +74,7 @@ public Participation getParticipation() {
public void setParticipation(Participation participation) {
this.participation = participation;
}
// jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

@Override
public boolean equals(Object o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
import de.tum.in.www1.exerciseapp.config.audit.AuditEventConverter;
import de.tum.in.www1.exerciseapp.domain.PersistentAuditEvent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.boot.actuate.audit.AuditEventRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* An implementation of Spring Boot's AuditEventRepository.
Expand All @@ -21,10 +25,17 @@ public class CustomAuditEventRepository implements AuditEventRepository {

private static final String AUTHORIZATION_FAILURE = "AUTHORIZATION_FAILURE";

/**
* Should be the same as in Liquibase migration.
*/
protected static final int EVENT_DATA_COLUMN_MAX_LENGTH = 255;

private final PersistenceAuditEventRepository persistenceAuditEventRepository;

private final AuditEventConverter auditEventConverter;

private final Logger log = LoggerFactory.getLogger(getClass());

public CustomAuditEventRepository(PersistenceAuditEventRepository persistenceAuditEventRepository,
AuditEventConverter auditEventConverter) {

Expand Down Expand Up @@ -70,8 +81,32 @@ public void add(AuditEvent event) {
persistentAuditEvent.setPrincipal(event.getPrincipal());
persistentAuditEvent.setAuditEventType(event.getType());
persistentAuditEvent.setAuditEventDate(event.getTimestamp().toInstant());
persistentAuditEvent.setData(auditEventConverter.convertDataToStrings(event.getData()));
Map<String, String> eventData = auditEventConverter.convertDataToStrings(event.getData());
persistentAuditEvent.setData(truncate(eventData));
persistenceAuditEventRepository.save(persistentAuditEvent);
}
}

/**
* Truncate event data that might exceed column length.
*/
private Map<String, String> truncate(Map<String, String> data) {
Map<String, String> results = new HashMap<>();

if (data != null) {
for (Map.Entry<String, String> entry : data.entrySet()) {
String value = entry.getValue();
if (value != null) {
int length = value.length();
if (length > EVENT_DATA_COLUMN_MAX_LENGTH) {
value = value.substring(0, EVENT_DATA_COLUMN_MAX_LENGTH);
log.warn("Event data for {} too long ({}) has been truncated to {}. Consider increasing column width.",
entry.getKey(), length, EVENT_DATA_COLUMN_MAX_LENGTH);
}
}
results.put(entry.getKey(), value);
}
}
return results;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface UserRepository extends JpaRepository<User, Long> {

Optional<User> findOneByResetKey(String resetKey);

Optional<User> findOneByEmail(String email);
Optional<User> findOneByEmailIgnoreCase(String email);

Optional<User> findOneByLogin(String login);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public Optional<User> completePasswordReset(String newPassword, String key) {
}

public Optional<User> requestPasswordReset(String mail) {
return userRepository.findOneByEmail(mail)
return userRepository.findOneByEmailIgnoreCase(mail)
.filter(User::getActivated)
.map(user -> {
user.setResetKey(RandomUtil.generateResetKey());
Expand Down Expand Up @@ -126,7 +126,7 @@ public User createUser(UserDTO userDTO) {
user.setEmail(userDTO.getEmail());
user.setImageUrl(userDTO.getImageUrl());
if (userDTO.getLangKey() == null) {
user.setLangKey("en"); // default language
user.setLangKey(Constants.DEFAULT_LANGUAGE); // default language
} else {
user.setLangKey(userDTO.getLangKey());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public ResponseEntity registerAccount(@Valid @RequestBody ManagedUserVM managedU
}
return userRepository.findOneByLogin(managedUserVM.getLogin().toLowerCase())
.map(user -> new ResponseEntity<>("login already in use", textPlainHeaders, HttpStatus.BAD_REQUEST))
.orElseGet(() -> userRepository.findOneByEmail(managedUserVM.getEmail())
.orElseGet(() -> userRepository.findOneByEmailIgnoreCase(managedUserVM.getEmail())
.map(user -> new ResponseEntity<>("email address already in use", textPlainHeaders, HttpStatus.BAD_REQUEST))
.orElseGet(() -> {
User user = userService
Expand Down Expand Up @@ -140,7 +140,7 @@ public ResponseEntity<UserDTO> getAccount() {
@Timed
public ResponseEntity saveAccount(@Valid @RequestBody UserDTO userDTO) {
final String userLogin = SecurityUtils.getCurrentUserLogin();
Optional<User> existingUser = userRepository.findOneByEmail(userDTO.getEmail());
Optional<User> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail());
if (existingUser.isPresent() && (!existingUser.get().getLogin().equalsIgnoreCase(userLogin))) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("user-management", "emailexists", "Email already in use")).body(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public ResponseEntity createUser(@Valid @RequestBody ManagedUserVM managedUserVM
return ResponseEntity.badRequest()
.headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "userexists", "Login already in use"))
.body(null);
} else if (userRepository.findOneByEmail(managedUserVM.getEmail()).isPresent()) {
} else if (userRepository.findOneByEmailIgnoreCase(managedUserVM.getEmail()).isPresent()) {
return ResponseEntity.badRequest()
.headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "emailexists", "Email already in use"))
.body(null);
Expand All @@ -127,7 +127,7 @@ public ResponseEntity createUser(@Valid @RequestBody ManagedUserVM managedUserVM
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity<UserDTO> updateUser(@Valid @RequestBody ManagedUserVM managedUserVM) {
log.debug("REST request to update User : {}", managedUserVM);
Optional<User> existingUser = userRepository.findOneByEmail(managedUserVM.getEmail());
Optional<User> existingUser = userRepository.findOneByEmailIgnoreCase(managedUserVM.getEmail());
if (existingUser.isPresent() && (!existingUser.get().getId().equals(managedUserVM.getId()))) {
return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, "emailexists", "Email already in use")).body(null);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ jhipster:
port: 5000
queue-size: 512


# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jhipster:
port: 5000
queue-size: 512


# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
Expand Down
Loading

0 comments on commit d02212d

Please sign in to comment.