Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Initial commit
- Loading branch information
0 parents
commit d0e1540
Showing
51 changed files
with
30,816 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
HELP.md | ||
/target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
|
||
### 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/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
src/js/node/ | ||
src/js/node_modules/ | ||
src/js/build/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you 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.io.File; | ||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.nio.channels.Channels; | ||
import java.nio.channels.ReadableByteChannel; | ||
import java.util.Properties; | ||
|
||
public class MavenWrapperDownloader { | ||
|
||
/** | ||
* 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/0.4.2/maven-wrapper-0.4.2.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 direcrory '" + 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 { | ||
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# fullstack-spring-boot-and-react |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// 1. | ||
@GetMapping(path = "{studentId}/courses") | ||
public List<StudentCourse> getAllCoursesForStudent( | ||
@PathVariable("studentId") UUID studentId) { | ||
return studentService.getAllCoursesForStudent(studentId); | ||
} | ||
|
||
// 2. | ||
List<StudentCourse> getAllCoursesForStudent(UUID studentId) { | ||
return studentDataAccessService.selectAllStudentCourses(studentId); | ||
} | ||
|
||
// 3. | ||
|
||
private RowMapper<StudentCourse> mapStudentCourseFromDb() { | ||
return (resultSet, i) -> | ||
new StudentCourse( | ||
UUID.fromString(resultSet.getString("student_id")), | ||
UUID.fromString(resultSet.getString("course_id")), | ||
resultSet.getString("name"), | ||
resultSet.getString("description"), | ||
resultSet.getString("department"), | ||
resultSet.getString("teacher_name"), | ||
resultSet.getDate("start_date").toLocalDate(), | ||
resultSet.getDate("end_date").toLocalDate(), | ||
Optional.ofNullable(resultSet.getString("grade")) | ||
.map(Integer::parseInt) | ||
.orElse(null) | ||
); | ||
} | ||
|
||
List<StudentCourse> selectAllStudentCourses(UUID studentId) { | ||
String sql = "" + | ||
"SELECT " + | ||
" student.student_id, " + | ||
" course.course_id, " + | ||
" course.name, " + | ||
" course.description," + | ||
" course.department," + | ||
" course.teacher_name," + | ||
" student_course.start_date, " + | ||
" student_course.end_date, " + | ||
" student_course.grade " + | ||
"FROM student " + | ||
"JOIN student_course USING (student_id) " + | ||
"JOIN course USING (course_id) " + | ||
"WHERE student.student_id = ?"; | ||
return jdbcTemplate.query( | ||
sql, | ||
new Object[]{studentId}, | ||
mapStudentCourseFromDb() | ||
); | ||
} |
14 changes: 14 additions & 0 deletions
14
course-files/Joins and Link Tables/Insert-into-student_course.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
INSERT INTO student_course ( | ||
student_id, | ||
course_id, | ||
start_date, | ||
end_date, | ||
grade | ||
) | ||
VALUES ( | ||
'e7e40436-b931-441d-85e0-d86b6039fdfa', | ||
'7321b9a6-29f7-49e0-9330-6d079c792608', | ||
(NOW() - INTERVAL '1 YEAR')::DATE, | ||
NOW()::DATE, | ||
90 | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
1. | ||
<frontend-maven-plugin.version>1.6</frontend-maven-plugin.version> | ||
<node.version>v10.13.0</node.version> | ||
<yarn.version>v1.12.1</yarn.version> | ||
|
||
2. | ||
<profiles> | ||
<profile> | ||
<id>test</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<spring.profiles.active>dev</spring.profiles.active> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>demo</id> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-resources</id> | ||
<phase>process-classes</phase> | ||
<goals> | ||
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${basedir}/target/classes/static</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>src/js/build</directory> | ||
</resource> | ||
</resources> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.github.eirslett</groupId> | ||
<artifactId>frontend-maven-plugin</artifactId> | ||
<version>${frontend-maven-plugin.version}</version> | ||
<configuration> | ||
<workingDirectory>src/js</workingDirectory> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>install node</id> | ||
<goals> | ||
<goal>install-node-and-yarn</goal> | ||
</goals> | ||
<configuration> | ||
<nodeVersion>${node.version}</nodeVersion> | ||
<yarnVersion>${yarn.version}</yarnVersion> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>yarn install</id> | ||
<goals> | ||
<goal>yarn</goal> | ||
</goals> | ||
<phase>generate-resources</phase> | ||
</execution> | ||
<execution> | ||
<id>yarn test</id> | ||
<goals> | ||
<goal>yarn</goal> | ||
</goals> | ||
<phase>test</phase> | ||
<configuration> | ||
<arguments>test</arguments> | ||
<environmentVariables> | ||
<CI>true</CI> | ||
</environmentVariables> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>yarn build</id> | ||
<goals> | ||
<goal>yarn</goal> | ||
</goals> | ||
<phase>compile</phase> | ||
<configuration> | ||
<arguments>build</arguments> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
insert into student (student_id, first_name, last_name, email, gender) values ('e7e40436-b931-441d-85e0-d86b6039fdfa', 'Leshia', 'Aikin', 'laikin0@photobucket.com', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('13ba8584-99f5-4e7a-87b8-c2d16b39ce49', 'Idalia', 'Lentsch', 'ilentsch1@examiner.com', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('a75c1b78-0802-4888-8e8c-f8e76e34b617', 'Winny', 'Forster', 'wforster2@imgur.com', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('020bb0e0-7681-4eae-90f5-1218b649e917', 'Christel', 'Comolli', 'ccomolli3@state.gov', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('5ea017f7-b4f7-4bbd-800f-940253380b15', 'Minta', 'Autie', 'mautie4@eventbrite.com', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('953b52d8-a089-48a4-bbf8-e21008c72f0e', 'Jacqui', 'Rigate', 'jrigate5@ebay.co.uk', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('7492d4b0-1217-48af-9757-9611a9d4af55', 'Jacquelynn', 'McAnellye', 'jmcanellye6@guardian.co.uk', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('bc5bc1a9-1da7-4b1f-931a-4f5c3f7dc992', 'Perry', 'Vamplew', 'pvamplew7@uiuc.edu', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('6c20ac51-23d0-4d46-bd50-82dab6611e66', 'Rodger', 'Corradeschi', 'rcorradeschi8@europa.eu', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('eb8c6b33-8a73-4482-90d4-6f89e800b947', 'Brice', 'Farfull', 'bfarfull9@goo.ne.jp', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('ce82e722-1310-4d00-9f17-2bb0d45719f0', 'Denney', 'Chittem', 'dchittema@chron.com', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('d40668fa-432e-4649-88cc-871fa46a0396', 'Derron', 'Allix', 'dallixb@salon.com', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('5f5d877e-0649-4ec8-9991-793dfc068f75', 'Sergio', 'Stapley', 'sstapleyc@wisc.edu', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('fbdebde6-58c7-41e3-b51b-343e032b3b3b', 'Halsy', 'Obell', 'hobelld@rakuten.co.jp', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('a81ae551-6411-405b-ba89-6fe4699a7293', 'Merrick', 'Fewkes', 'mfewkese@google.com', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('fb5941db-1f2b-4eac-b9d5-f90927cb0621', 'Andee', 'Poultney', 'apoultneyf@elpais.com', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('6673241a-9e55-4cd3-b724-fff6fbe073c5', 'Saxe', 'Prettyjohns', 'sprettyjohnsg@epa.gov', 'MALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('12aca1c6-48a7-4a2e-8d0b-040556f83dc5', 'Zuzana', 'McDonagh', 'zmcdonaghh@chronoengine.com', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('583db972-bb74-4f63-94a8-7b1efa8ae4bc', 'Christin', 'Cortese', 'ccortesei@hubpages.com', 'FEMALE'); | ||
insert into student (student_id, first_name, last_name, email, gender) values ('9c42106d-04f2-4b29-a17f-28e61203b230', 'Edy', 'Shakshaft', 'eshakshaftj@jigsy.com', 'FEMALE'); |
Oops, something went wrong.