Updated Javadoc
This commit is contained in:
		| @@ -34,5 +34,6 @@ | |||||||
| 			<attribute name="maven.pomderived" value="true"/> | 			<attribute name="maven.pomderived" value="true"/> | ||||||
| 		</attributes> | 		</attributes> | ||||||
| 	</classpathentry> | 	</classpathentry> | ||||||
|  | 	<classpathentry kind="src" path="/envoy-common"/> | ||||||
| 	<classpathentry kind="output" path="target/classes"/> | 	<classpathentry kind="output" path="target/classes"/> | ||||||
| </classpath> | </classpath> | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								.project
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								.project
									
									
									
									
									
								
							| @@ -15,9 +15,15 @@ | |||||||
| 			<arguments> | 			<arguments> | ||||||
| 			</arguments> | 			</arguments> | ||||||
| 		</buildCommand> | 		</buildCommand> | ||||||
|  | 		<buildCommand> | ||||||
|  | 			<name>org.hibernate.eclipse.console.hibernateBuilder</name> | ||||||
|  | 			<arguments> | ||||||
|  | 			</arguments> | ||||||
|  | 		</buildCommand> | ||||||
| 	</buildSpec> | 	</buildSpec> | ||||||
| 	<natures> | 	<natures> | ||||||
| 		<nature>org.eclipse.jdt.core.javanature</nature> | 		<nature>org.eclipse.jdt.core.javanature</nature> | ||||||
| 		<nature>org.eclipse.m2e.core.maven2Nature</nature> | 		<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||||||
|  | 		<nature>org.hibernate.eclipse.console.hibernateNature</nature> | ||||||
| 	</natures> | 	</natures> | ||||||
| </projectDescription> | </projectDescription> | ||||||
|   | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										3
									
								
								.settings/org.hibernate.eclipse.console.prefs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.settings/org.hibernate.eclipse.console.prefs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | default.configuration=envoy-server-standalone | ||||||
|  | eclipse.preferences.version=1 | ||||||
|  | hibernate3.enabled=true | ||||||
| @@ -10,6 +10,11 @@ import javax.persistence.TemporalType; | |||||||
| import envoy.data.MessageBuilder; | import envoy.data.MessageBuilder; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  |  * This class serves as a way to let Hibernate communicate with the server | ||||||
|  |  * without bringing the dependency of JPA/Hibernate into the client.<br> | ||||||
|  |  * It will be referenced as "database message" to clarify between the different | ||||||
|  |  * message objects.<br> | ||||||
|  |  * <br> | ||||||
|  * Project: <strong>envoy-server-standalone</strong><br> |  * Project: <strong>envoy-server-standalone</strong><br> | ||||||
|  * File: <strong>Message.java</strong><br> |  * File: <strong>Message.java</strong><br> | ||||||
|  * Created: <strong>02.01.2020</strong><br> |  * Created: <strong>02.01.2020</strong><br> | ||||||
| @@ -33,49 +38,147 @@ public class Message { | |||||||
| 	private String								text; | 	private String								text; | ||||||
| 	private byte[]								attachment; | 	private byte[]								attachment; | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * The constructor for a database object | ||||||
|  | 	 * | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public Message() {} | 	public Message() {} | ||||||
|  |  | ||||||
| 	// TODO: everything except ID | 	// TODO: everything except ID | ||||||
| 	public Message(envoy.data.Message message) { id = message.getId(); } | 	/** | ||||||
|  | 	 * @param message the {@link envoy.data.Message} to convert into a database | ||||||
|  | 	 *                {@link Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
|  | 	public Message(envoy.data.Message message) { | ||||||
|  | 		id		= message.getId(); | ||||||
|  | 		status	= message.getStatus(); | ||||||
|  | 		text	= message.getText(); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return a database {@link Message} converted into an | ||||||
|  | 	 *         {@link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public envoy.data.Message toCommonMessage() { | 	public envoy.data.Message toCommonMessage() { | ||||||
| 		// TODO: Attachment, dates | 		// TODO: Attachment, dates | ||||||
| 		return new MessageBuilder(sender.getId(), recipient.getId()).setText(text).setDate(creationDate).setStatus(status).build(); | 		return new MessageBuilder(sender.getId(), recipient.getId()).setText(text).setDate(creationDate).setStatus(status).build(); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the id of a {link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public long getId() { return id; } | 	public long getId() { return id; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param id the id to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see Message#getId() | ||||||
|  | 	 */ | ||||||
| 	public void setId(long id) { this.id = id; } | 	public void setId(long id) { this.id = id; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the sender of a {link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public User getSender() { return sender; } | 	public User getSender() { return sender; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param sender the sender to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see Message#getSender() | ||||||
|  | 	 */ | ||||||
| 	public void setSender(User sender) { this.sender = sender; } | 	public void setSender(User sender) { this.sender = sender; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the recipient of a {link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public User getRecipient() { return recipient; } | 	public User getRecipient() { return recipient; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param recipient the recipient to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see Message#getRecipient() | ||||||
|  | 	 */ | ||||||
| 	public void setRecipient(User recipient) { this.recipient = recipient; } | 	public void setRecipient(User recipient) { this.recipient = recipient; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the date at which a {link envoy.data.Message} has been created | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public Date getCreationDate() { return creationDate; } | 	public Date getCreationDate() { return creationDate; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param creationDate the creation date to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see Message#getCreationDate() | ||||||
|  | 	 */ | ||||||
| 	public void setCreationDate(Date creationDate) { this.creationDate = creationDate; } | 	public void setCreationDate(Date creationDate) { this.creationDate = creationDate; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the date at which a {link envoy.data.Message} has been received by | ||||||
|  | 	 *         the server | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public Date getReceivedDate() { return receivedDate; } | 	public Date getReceivedDate() { return receivedDate; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param receivedDate the received date to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see Message#getReceivedDate() | ||||||
|  | 	 */ | ||||||
| 	public void setReceivedDate(Date receivedDate) { this.receivedDate = receivedDate; } | 	public void setReceivedDate(Date receivedDate) { this.receivedDate = receivedDate; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the date at which a {link envoy.data.Message} has been read | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public Date getReadDate() { return readDate; } | 	public Date getReadDate() { return readDate; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param readDate the read date to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see Message#getReadDate() | ||||||
|  | 	 */ | ||||||
| 	public void setReadDate(Date readDate) { this.readDate = readDate; } | 	public void setReadDate(Date readDate) { this.readDate = readDate; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the status of a {link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public envoy.data.Message.MessageStatus getStatus() { return status; } | 	public envoy.data.Message.MessageStatus getStatus() { return status; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param status the new status of a {link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public void setStatus(envoy.data.Message.MessageStatus status) { this.status = status; } | 	public void setStatus(envoy.data.Message.MessageStatus status) { this.status = status; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the text content of a {link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public String getText() { return text; } | 	public String getText() { return text; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param text the new text content of a {@link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public void setText(String text) { this.text = text; } | 	public void setText(String text) { this.text = text; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the attachment of a {@link envoy.data.Message} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public byte[] getAttachment() { return attachment; } | 	public byte[] getAttachment() { return attachment; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param attachment the new attachment | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public void setAttachment(byte[] attachment) { this.attachment = attachment; } | 	public void setAttachment(byte[] attachment) { this.attachment = attachment; } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -11,6 +11,11 @@ import javax.persistence.Temporal; | |||||||
| import javax.persistence.TemporalType; | import javax.persistence.TemporalType; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  |  * This class serves as a way to let Hibernate communicate with the server | ||||||
|  |  * without bringing the dependency of JPA/Hibernate into the client.<br> | ||||||
|  |  * It will be referenced as "database user" to clarify between the different | ||||||
|  |  * user objects.<br> | ||||||
|  |  * <br> | ||||||
|  * Project: <strong>envoy-server-standalone</strong><br> |  * Project: <strong>envoy-server-standalone</strong><br> | ||||||
|  * File: <strong>User.java</strong><br> |  * File: <strong>User.java</strong><br> | ||||||
|  * Created: <strong>02.01.2020</strong><br> |  * Created: <strong>02.01.2020</strong><br> | ||||||
| @@ -31,27 +36,81 @@ public class User { | |||||||
| 	private envoy.data.User.UserStatus	status; | 	private envoy.data.User.UserStatus	status; | ||||||
| 	private List<User>					contacts; | 	private List<User>					contacts; | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the id of a {link envoy.data.User} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public long getId() { return id; } | 	public long getId() { return id; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param id the id to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see User#getId | ||||||
|  | 	 */ | ||||||
| 	public void setId(long id) { this.id = id; } | 	public void setId(long id) { this.id = id; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the name of a {link envoy.data.User} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public String getName() { return name; } | 	public String getName() { return name; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param name the username to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see User#getName() | ||||||
|  | 	 */ | ||||||
| 	public void setName(String name) { this.name = name; } | 	public void setName(String name) { this.name = name; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the passwordHash of a {link envoy.data.User} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public byte[] getPasswordHash() { return passwordHash; } | 	public byte[] getPasswordHash() { return passwordHash; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param passwordHash the password hash to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see User#getPasswordHash() | ||||||
|  | 	 */ | ||||||
| 	public void setPasswordHash(byte[] passwordHash) { this.passwordHash = passwordHash; } | 	public void setPasswordHash(byte[] passwordHash) { this.passwordHash = passwordHash; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the last date an {link envoy.data.User} has been online | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public Date getLastSeen() { return lastSeen; } | 	public Date getLastSeen() { return lastSeen; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param lastSeen the latest date at which has been seen to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see User#getLastSeen() | ||||||
|  | 	 */ | ||||||
| 	public void setLastSeen(Date lastSeen) { this.lastSeen = lastSeen; } | 	public void setLastSeen(Date lastSeen) { this.lastSeen = lastSeen; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the status of a {link envoy.data.User} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public envoy.data.User.UserStatus getStatus() { return status; } | 	public envoy.data.User.UserStatus getStatus() { return status; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param status the status to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see User#getStatus() | ||||||
|  | 	 */ | ||||||
| 	public void setStatus(envoy.data.User.UserStatus status) { this.status = status; } | 	public void setStatus(envoy.data.User.UserStatus status) { this.status = status; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @return the contacts of a {link envoy.data.User} | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
| 	public List<User> getContacts() { return contacts; } | 	public List<User> getContacts() { return contacts; } | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 * @param contacts the contacts to set | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 * @see User#getContacts() | ||||||
|  | 	 */ | ||||||
| 	public void setContacts(List<User> contacts) { this.contacts = contacts; } | 	public void setContacts(List<User> contacts) { this.contacts = contacts; } | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								src/main/java/envoy/server/database/PersistenceManager.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								src/main/java/envoy/server/database/PersistenceManager.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | package envoy.server.database; | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * Project: <strong>envoy-server-standalone</strong><br> | ||||||
|  |  * File: <strong>PersistenceManager.java</strong><br> | ||||||
|  |  * Created: <strong>3 Jan 2020</strong><br> | ||||||
|  |  *  | ||||||
|  |  * @author Leon Hofmeister | ||||||
|  |  * @since Envoy Server Standalone v0.1-alpha | ||||||
|  |  */ | ||||||
|  | public class PersistenceManager { | ||||||
|  |  | ||||||
|  | 	/** | ||||||
|  | 	 *  | ||||||
|  | 	 * @since Envoy Server Standalone v0.1-alpha | ||||||
|  | 	 */ | ||||||
|  | 	public PersistenceManager() { // TODO Auto-generated constructor stub | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | } | ||||||
		Reference in New Issue
	
	Block a user
	 delvh
					delvh