summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/imagemaster/db/DbFtpUser.java
blob: ea8a79f7784499788ae65d4f25eb56c63c8039f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package org.openslx.imagemaster.db;

import java.util.List;


public class DbFtpUser
{
	public final String username;
	public final String password;
	public final String mode;
	public final String filename;
	
	public DbFtpUser(String username, String password, String mode, String filename)
	{
		this.username = username;
		this.password = password;
		this.mode = mode;
		this.filename = filename;
	}
	
	public static List<DbFtpUser> getAllUsers()
	{
		return MySQL.findAll( DbFtpUser.class, "SELECT username, password, mode, filename from ftpUser" );
	}
	
	public static void addUser(DbFtpUser user)
	{
		MySQL.update( "INSERT INTO ftpUser username, password, mode, filename VALUES (? , ?, ?, ?)",
				user.username, user.password, user.mode, user.filename); 
	}
	
	public static DbFtpUser getUserByName(String username)
	{
		return MySQL.findUniqueOrNull( DbFtpUser.class, "SELECT username, password, mode, filename FROM ftpUser WHERE username=?", username );
	}
}