diff --git a/src/App/Database/HibernateClasses/Album.java b/src/App/Database/HibernateClasses/Album.java new file mode 100644 index 0000000000000000000000000000000000000000..31a14161930ace3e9cf299946f4ea419355ad716 --- /dev/null +++ b/src/App/Database/HibernateClasses/Album.java @@ -0,0 +1,95 @@ +package Database.HibernateClasses; + +import javax.persistence.Column; +import java.util.ArrayList; + +public class Album { + + @Column(name="id") + private int albumId; + + @Column(name="noOfPictures") + private int noOfPictures; + + @Column(name="name") + private String albumName; + + @Column(name="picture_id") + private int pictureId; + + public int getAlbumId() { + return albumId; + } + + public void setAlbumId(int albumId) { + this.albumId = albumId; + } + + public int getNoOfPictures() { + return noOfPictures; + } + + public void setNoOfPictures(int noOfPictures) { + this.noOfPictures = noOfPictures; + } + + public String getAlbumName() { + return albumName; + } + + public void setAlbumName(String albumName) { + this.albumName = albumName; + } + + public int getPictureId() { + return pictureId; + } + + public void setPictureId(int pictureId) { + this.pictureId = pictureId; + } + //Methods can be usen in abumScene later + /* public Album (String ALBUM_NAME, ArrayList <Picture> pictures){ + this.noOfPictures = 0; + this.ALBUM_NAME = ALBUM_NAME; + this.pictures = pictures; + } + + public boolean addPicture (Picture newPicture){ + if (pictures.add(newPicture)){ + noOfPictures++; + } + } + + //TODO: Unsure about the format of refrence, migth have to alter this metohod later + public void deletePicture (Picture pictureDelete){ + for(int i = 0; i < pictures.size(); i++){ + if(pictures.get(i) == (pictureDelete)){ + pictures.remove(i); + } + } + } + + public ArrayList<Picture> getPictures() { + ArrayList <Picture> picturesOut = new ArrayList<Picture>(); + for(Picture p : pictures){ + picturesOut.add(p); + } + return picturesOut; + } + + public int getNoOfPictures() { + return noOfPictures; + } + + public String getALBUM_NAME() { + return ALBUM_NAME; + } + + //unsure if this method is needed, but it will stay for now + public void setNoOfPictures(int noOfPictures) { + this.noOfPictures = noOfPictures; + }*/ + +} + diff --git a/src/App/Database/HibernateClasses/Photo.java b/src/App/Database/HibernateClasses/Photo.java deleted file mode 100644 index 586ac4fd55063c17894f2a0a57585d35c113aad9..0000000000000000000000000000000000000000 --- a/src/App/Database/HibernateClasses/Photo.java +++ /dev/null @@ -1,176 +0,0 @@ -package Database.HibernateClasses; - - -import javax.persistence.*; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -@Entity -@Table(name="PHOTOS") -public class Photo implements Serializable { - private static final long serialVersionUID = 1L; - - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name = "id", unique = true) - private int id; - - @Column(name ="title") - private String title; - - @Column(name = "url") - private String url; - - @Column(name = "latitude") - private String latitude; - - @Column(name = "longitude") - private String longitude; - - @Column(name = "width") - private int width; - - @Column(name = "height") - private int height; - - @Column(name = "file_type") - private String fileType; - - @Column(name = "file_size") - private int fileSize; - - @Column(name = "aperture") - private double aperture; - - @Column(name = "exposure_time") - private double exposureTime; - - @Column(name = "camera_model") - private String camera; - - @Column(name = "time") - private String time; - - - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getLatitude() { - return latitude; - } - - public void setLatitude(String latitude) { - this.latitude = latitude; - } - - public String getLongitude() { - return longitude; - } - - public void setLongitude(String longitude) { - this.longitude = longitude; - } - - public int getWidth() { - return width; - } - - public void setWidth(int width) { - this.width = width; - } - - public int getHeight() { - return height; - } - - public void setHeight(int height) { - this.height = height; - } - - public String getFileType() { - return fileType; - } - - public void setFileType(String fileType) { - this.fileType = fileType; - } - - public int getFileSize() { - return fileSize; - } - - public void setFileSize(int fileSize) { - this.fileSize = fileSize; - } - - public double getAperture() { - return aperture; - } - - public void setAperture(double aperture) { - this.aperture = aperture; - } - - public double getExposureTime() { - return exposureTime; - } - - public void setExposureTime(double exposureTime) { - this.exposureTime = exposureTime; - } - - public String getCamera() { - return camera; - } - - public void setCamera(String camera) { - this.camera = camera; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - - - - @Override - public String toString() { - return "Filetype: "+getFileType()+"\n"+ - "Proportions"+getWidth()+"x"+getHeight()+"\n"+ - "size: "+getFileSize()+"\n"+ - "Latitude: "+getLatitude()+"\n"+ - "Longitude: "+getLongitude()+"\n"+ - "Date: "+getTime()+"\n"+ - "Model: "+getCamera()+"\n"+ - "Aperture: "+getAperture()+"\n"+ - "Exposuretime: "+getExposureTime()+"\n"; - } -} diff --git a/src/App/Database/HibernateClasses/Picture.java b/src/App/Database/HibernateClasses/Picture.java new file mode 100644 index 0000000000000000000000000000000000000000..2931115ce42119949c93b5e07d8ddb2f38531e00 --- /dev/null +++ b/src/App/Database/HibernateClasses/Picture.java @@ -0,0 +1,124 @@ +package Database.HibernateClasses; + + +import javax.persistence.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.sql.Date; +import java.util.List; + +@Entity +@Table(name="Pictures") +public class Picture implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name = "id", unique = true) + private int id; + + @Column(name="location") + private String location; + + @Column(name="date") + private Date date; + + @Column(name = "url") + private String url; + + @Column(name = "width") + private int width; + + @Column(name = "height") + private int height; + + @Column(name = "file_type") + private String fileType; + + @Column(name = "file_size") + private int fileSize; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + + public int getWidth() { + return width; + } + + public void setWidth(int width) { + this.width = width; + } + + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } + + + public String getFileType() { + return fileType; + } + + public void setFileType(String fileType) { + this.fileType = fileType; + } + + + public int getFileSize() { + return fileSize; + } + + public void setFileSize(int fileSize) { + this.fileSize = fileSize; + } + + + + + @Override + public String toString() { + return "Date: " + getDate() + + "\nLocation: " + getLocation() + + "\nFiletype: "+getFileType()+ + "\nProportions"+getWidth()+"x"+getHeight()+ + "\nFilesize: "+getFileSize()+"\n"; + } +}