Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
2a2de2c
finished module 1
batetolast1 Sep 22, 2020
d336756
added description to code written in module 1
batetolast1 Sep 23, 2020
21d0021
created User entity class
batetolast1 Sep 23, 2020
6f120a0
updated User entity class using Lombok
batetolast1 Sep 23, 2020
f2f0f38
added Registration Controller class
batetolast1 Sep 23, 2020
f48c113
added Spring Security Taglibs dependency
batetolast1 Sep 23, 2020
5ab1923
created registration form jsp page and connected it with controller
batetolast1 Sep 23, 2020
35afc3b
added description to <sec:csrfInput/> tag
batetolast1 Sep 23, 2020
9d4886d
added @Builder Lombok annotation to User class
batetolast1 Sep 23, 2020
ba470d2
created User Repository interface
batetolast1 Sep 23, 2020
fb33a2b
injected UserRepository interface object to controller, implemented s…
batetolast1 Sep 24, 2020
3e0e144
added Lombok @Log4j2 logger
batetolast1 Sep 24, 2020
28121d1
added logger level to Spring config
batetolast1 Sep 24, 2020
6796842
added custom security config for register process
batetolast1 Sep 24, 2020
6bb1dc9
added password encryption using DelegatingPasswordEncoder class with …
batetolast1 Sep 24, 2020
867709a
added logging feature using user credentials stored in data source (M…
batetolast1 Sep 24, 2020
7f3d138
registered user is now active by default and can log in to app
batetolast1 Sep 24, 2020
6c4c7c0
small fix
batetolast1 Sep 24, 2020
ca71979
added jsp login page
batetolast1 Sep 24, 2020
533c976
Created login controller
batetolast1 Sep 24, 2020
b3c8d49
implemented login feature using custom Spring Security config
batetolast1 Sep 24, 2020
8c32426
set @EqualsAndHashCode to use only ID
batetolast1 Sep 24, 2020
119edef
created Advert entity
batetolast1 Sep 24, 2020
babc7c7
added TODO in User entity
batetolast1 Sep 24, 2020
bb78bbc
added repository to operate Advert entity
batetolast1 Sep 24, 2020
cb4d577
created controller for home page
batetolast1 Sep 24, 2020
9381e5b
added method to fetch all Adverts sorted by date descending
batetolast1 Sep 24, 2020
75564d5
created GET mapping for home page
batetolast1 Sep 24, 2020
655afb9
added jsp page template
batetolast1 Sep 24, 2020
741e5f5
added home page displaying list of all adverts
batetolast1 Sep 24, 2020
b38cc36
configured security for home page (available to both anonymous and lo…
batetolast1 Sep 24, 2020
0ff2cb0
added Spring Boot Devtools
batetolast1 Sep 26, 2020
de15fd5
added form to create new advert
batetolast1 Sep 26, 2020
6cc5773
added custom methods to find users by username
batetolast1 Sep 26, 2020
c5a7cea
created AdvertController, added processing for adding new advert
batetolast1 Sep 26, 2020
32af08a
added some new description
batetolast1 Sep 26, 2020
74bdbe4
created site navigation
batetolast1 Sep 26, 2020
034998b
added navigation to all sites
batetolast1 Sep 26, 2020
076ea76
added feature: display adverts added by user
batetolast1 Sep 26, 2020
226327c
main menu fixes
batetolast1 Sep 26, 2020
6668391
added feature: finding all user's adverts from homepage by direct link
batetolast1 Sep 26, 2020
504dcf9
limited number of adverts displaying to non-logged user
batetolast1 Sep 27, 2020
722281e
added feature: deleting adverts
batetolast1 Sep 27, 2020
63a9cb9
added feature: editing adverts
batetolast1 Sep 27, 2020
f9cdd58
disabled showing Hibernate SQL queries
batetolast1 Sep 27, 2020
d0ca6b2
added feature: show observed adverts
batetolast1 Sep 27, 2020
6f5edd3
reverted changes with @ManyToOne column
batetolast1 Sep 27, 2020
02d34eb
added feature: observe and unobserve adverts added by other users
batetolast1 Sep 27, 2020
dcc5a22
Major code cleanup (deleted descriptions, added loggers...)
batetolast1 Sep 27, 2020
4043748
fixed displaying edit and delete options for adverts
batetolast1 Sep 27, 2020
e3357c2
added ViewResolver custom config
batetolast1 Sep 28, 2020
1287109
simplified @ManyToOne in Advert class
batetolast1 Sep 28, 2020
645a846
added DTO classes to process data retrieved from all forms
batetolast1 Sep 28, 2020
5603189
added DTO classes to process deleting, observing and unobserving adverts
batetolast1 Sep 28, 2020
44c97dc
added DTO classes to display adverts in views - homepage, user adverts
batetolast1 Sep 28, 2020
2c7f0ca
added missing DTO classes; necessary fixes in views, switched to find…
batetolast1 Sep 29, 2020
a764d6e
added feature: advert categories
batetolast1 Sep 29, 2020
69cb3ab
added feature: AbstractEntity base class
batetolast1 Sep 30, 2020
5a1001d
added feature: service layer for registering new user
batetolast1 Sep 30, 2020
302b78d
added feature: service layer for preparing homepage and creating new …
batetolast1 Oct 1, 2020
e063e8a
added feature: interface and facade to get authenticated user details
batetolast1 Oct 6, 2020
d8594b5
used Authentication Facade in controllers
batetolast1 Oct 6, 2020
99fe6b4
finished implementing service layer
batetolast1 Oct 7, 2020
ed0507f
added Enum to mark active/deleted Adverts and Categories
batetolast1 Oct 12, 2020
3672de3
implemented user roles
batetolast1 Oct 12, 2020
1a8e743
implemented managing categories for users with role ADMIN
batetolast1 Oct 12, 2020
418e733
added ModelMapper for user registration
batetolast1 Oct 12, 2020
f0fc66b
added validation for registering new user
batetolast1 Oct 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions projects/batetolast1/demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
117 changes: 117 additions & 0 deletions projects/batetolast1/demo/.mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
Loading