This commit is contained in:
Rob Winch 2020-10-21 14:56:49 -05:00
parent 75770dd6c5
commit 435021a310
6 changed files with 37 additions and 15 deletions

View File

@ -1,3 +1,19 @@
#
# Copyright 2020 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.
#
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip

View File

@ -16,6 +16,8 @@
package example;
import javax.sql.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@ -32,9 +34,8 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.security.data.repository.query.SecurityEvaluationContextExtension;
import org.springframework.transaction.PlatformTransactionManager;
import javax.sql.DataSource;
/**
* Spring Data Configuration.
* @author Rob Winch
*/
@Configuration

View File

@ -18,9 +18,12 @@ package example;
import java.util.Calendar;
import javax.persistence.*;
import org.hibernate.validator.constraints.NotEmpty;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.validation.constraints.NotEmpty;
@Entity
public class Message {
@ -41,7 +44,7 @@ public class Message {
private User to;
public User getTo() {
return to;
return this.to;
}
public void setTo(User to) {
@ -49,7 +52,7 @@ public class Message {
}
public Long getId() {
return id;
return this.id;
}
public void setId(Long id) {
@ -57,7 +60,7 @@ public class Message {
}
public Calendar getCreated() {
return created;
return this.created;
}
public void setCreated(Calendar created) {
@ -65,7 +68,7 @@ public class Message {
}
public String getText() {
return text;
return this.text;
}
public void setText(String text) {
@ -73,7 +76,7 @@ public class Message {
}
public String getSummary() {
return summary;
return this.summary;
}
public void setSummary(String summary) {

View File

@ -20,6 +20,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* A repository for accessing {@link Message}s.
* @author Rob Winch
*/
@Repository

View File

@ -22,6 +22,7 @@ import org.springframework.stereotype.Repository;
import java.util.List;
/**
* A repository that integrates with Spring Security for accessing {@link Message}s.
* @author Rob Winch
*/
@Repository
@ -30,4 +31,4 @@ public interface SecurityMessageRepository extends MessageRepository {
@Query("select m from Message m where m.to.id = ?#{ principal?.id }")
List<Message> findAll();
}
}

View File

@ -48,7 +48,7 @@ public class User {
}
public String getFirstName() {
return firstName;
return this.firstName;
}
public void setFirstName(String firstName) {
@ -56,7 +56,7 @@ public class User {
}
public String getLastName() {
return lastName;
return this.lastName;
}
public void setLastName(String lastName) {
@ -64,7 +64,7 @@ public class User {
}
public String getEmail() {
return email;
return this.email;
}
public void setEmail(String email) {
@ -72,7 +72,7 @@ public class User {
}
public String getPassword() {
return password;
return this.password;
}
public void setPassword(String password) {