-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from eschremp/main
created AbstractEntity and directories for Models,Data,&Controllers
- Loading branch information
Showing
10 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
52 changes: 52 additions & 0 deletions
52
src/main/java/com/unit3project/demo/Models/AbstractEntity.java
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,52 @@ | ||
package com.unit3project.demo.Models; | ||
|
||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.MappedSuperclass; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.Size; | ||
import java.util.Objects; | ||
|
||
@MappedSuperclass | ||
public abstract class AbstractEntity { | ||
|
||
@Id | ||
@GeneratedValue | ||
private int id; | ||
|
||
@Size(min=1, max = 100, message="Please enter a valid response between 1 and 100 characters.") | ||
@NotBlank(message="Please enter a valid response between 1 and 100 characters.") | ||
private String name; | ||
|
||
@Override | ||
public String toString() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
AbstractEntity that = (AbstractEntity) o; | ||
return getId() == that.getId(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(getId()); | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
} | ||
|
||
|
10 changes: 10 additions & 0 deletions
10
src/main/java/com/unit3project/demo/Models/Data/userRepository.java
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,10 @@ | ||
package com.unit3project.demo.Models.Data; | ||
|
||
; | ||
import com.unit3project.demo.Models.User; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface userRepository extends CrudRepository <User, Integer> { | ||
} |
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,5 @@ | ||
package com.unit3project.demo.Models; | ||
|
||
public class Itinerary extends Park{ | ||
//properties, getters/setters, how many itineraries can each user have? | ||
} |
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,8 @@ | ||
package com.unit3project.demo.Models; | ||
|
||
import jakarta.persistence.Entity; | ||
|
||
@Entity | ||
public class Park extends AbstractEntity{ | ||
//needs properties, getters/setters, many-to-many w/ user, | ||
} |
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,8 @@ | ||
package com.unit3project.demo.Models; | ||
|
||
import jakarta.persistence.Entity; | ||
|
||
@Entity | ||
public class Review extends AbstractEntity{ | ||
//properties, getters/setters, many-to-many w/park, many-to-many w/ user | ||
} |
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,31 @@ | ||
package com.unit3project.demo.Models; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.validation.constraints.Email; | ||
|
||
@Entity | ||
public class User extends AbstractEntity{ | ||
|
||
private String userName; | ||
|
||
private String email; | ||
|
||
private String hashWord; | ||
|
||
public String getUserName() { | ||
return userName; | ||
} | ||
|
||
public void setUserName(String userName) { | ||
this.userName = userName; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public void setEmail(String email) { | ||
this.email = email; | ||
} | ||
} |