This repository has been archived by the owner on May 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ✨ add setings database connection and handle
- Loading branch information
Showing
4 changed files
with
211 additions
and
7 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
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,95 @@ | ||
package fr.photonsquid.houseportal; | ||
|
||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Table; | ||
|
||
@Entity | ||
@Table(name = "devices") | ||
public class Settings implements Serializable { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private int id; | ||
|
||
private String theme, u_id; | ||
|
||
public Settings() { | ||
} | ||
|
||
public Settings(int id, String theme, String u_id) { | ||
this.id = id; | ||
this.theme = theme; | ||
this.u_id = u_id; | ||
} | ||
|
||
public int getId() { | ||
return this.id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public String getTheme() { | ||
return this.theme; | ||
} | ||
|
||
public void setTheme(String theme) { | ||
this.theme = theme; | ||
} | ||
|
||
public String getU_id() { | ||
return this.u_id; | ||
} | ||
|
||
public void setU_id(String u_id) { | ||
this.u_id = u_id; | ||
} | ||
|
||
public Settings id(int id) { | ||
setId(id); | ||
return this; | ||
} | ||
|
||
public Settings theme(String theme) { | ||
setTheme(theme); | ||
return this; | ||
} | ||
|
||
public Settings u_id(String u_id) { | ||
setU_id(u_id); | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (o == this) | ||
return true; | ||
if (!(o instanceof Settings)) { | ||
return false; | ||
} | ||
Settings settings = (Settings) o; | ||
return id == settings.id && Objects.equals(theme, settings.theme) && Objects.equals(u_id, settings.u_id); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(id, theme, u_id); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{" + | ||
" id='" + getId() + "'" + | ||
", theme='" + getTheme() + "'" + | ||
", u_id='" + getU_id() + "'" + | ||
"}"; | ||
} | ||
|
||
} |
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
67 changes: 67 additions & 0 deletions
67
src/main/java/fr/photonsquid/houseportal/controller/SettingsCredentials.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,67 @@ | ||
package fr.photonsquid.houseportal.controller; | ||
|
||
import java.util.Objects; | ||
|
||
public class SettingsCredentials { | ||
private String bearer; | ||
private String value; | ||
|
||
public SettingsCredentials() { | ||
} | ||
|
||
public SettingsCredentials(String bearer, String value) { | ||
this.bearer = bearer; | ||
this.value = value; | ||
} | ||
|
||
public String getBearer() { | ||
return this.bearer; | ||
} | ||
|
||
public void setBearer(String bearer) { | ||
this.bearer = bearer; | ||
} | ||
|
||
public String getValue() { | ||
return this.value; | ||
} | ||
|
||
public void setValue(String value) { | ||
this.value = value; | ||
} | ||
|
||
public SettingsCredentials bearer(String bearer) { | ||
setBearer(bearer); | ||
return this; | ||
} | ||
|
||
public SettingsCredentials value(String value) { | ||
setValue(value); | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (o == this) | ||
return true; | ||
if (!(o instanceof SettingsCredentials)) { | ||
return false; | ||
} | ||
SettingsCredentials settingsCredentials = (SettingsCredentials) o; | ||
return Objects.equals(bearer, settingsCredentials.bearer) && Objects.equals(value, settingsCredentials.value); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(bearer, value); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{" + | ||
" bearer='" + getBearer() + "'" + | ||
", value='" + getValue() + "'" + | ||
"}"; | ||
} | ||
|
||
} |