parent
b988036706
commit
5d29a2d3fb
@ -1,21 +0,0 @@ |
||||
import java.sql.Connection; |
||||
import java.sql.DatabaseMetaData; |
||||
import java.sql.SQLException; |
||||
|
||||
import com.mysql.cj.jdbc.MysqlDataSource; |
||||
|
||||
public class Main { |
||||
|
||||
public static void main(String[] args) throws SQLException { |
||||
MysqlDataSource dataSource = new MysqlDataSource(); |
||||
dataSource.setUrl( |
||||
"jdbc:mysql://localhost:3306/clubhelper?useSSL=FALSE&useUnicode=yes&characterEncoding=utf8&serverTimezone=UTC"); |
||||
dataSource.setUser("root"); |
||||
dataSource.setPassword("07!73"); |
||||
try (Connection conn = dataSource.getConnection()) { |
||||
DatabaseMetaData meta = conn.getMetaData(); |
||||
System.out.println(meta); |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,60 @@ |
||||
package de.kreth.vaadin.clubhelper.vaadinclubhelper.business; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.List; |
||||
|
||||
import org.slf4j.Logger; |
||||
import org.slf4j.LoggerFactory; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.dao.PersonDao; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Adress; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Contact; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Person; |
||||
import de.kreth.vaadin.clubhelper.vaadinclubhelper.data.Relation; |
||||
|
||||
@Component |
||||
public class PersonBusiness { |
||||
|
||||
private final Logger log = LoggerFactory.getLogger(getClass()); |
||||
|
||||
@Autowired |
||||
private PersonDao dao; |
||||
|
||||
public void save(Person edited) { |
||||
dao.save(edited); |
||||
log.info("Saved {}", edited); |
||||
} |
||||
|
||||
public void delete(Contact c) { |
||||
dao.delete(c); |
||||
log.info("Deleted {}", c); |
||||
} |
||||
|
||||
public Collection<? extends Relation> findRelationsFor(Person person) { |
||||
log.info("Loading relations of {}", person); |
||||
return dao.findRelationsFor(person); |
||||
} |
||||
|
||||
public void delete(Adress a) { |
||||
dao.delete(a); |
||||
log.info("Deleted {}", a); |
||||
} |
||||
|
||||
public List<Person> listAll() { |
||||
log.info("Loading all Persons"); |
||||
return dao.listAll(); |
||||
} |
||||
|
||||
public void delete(Person c) { |
||||
dao.delete(c); |
||||
log.info("Deleted {}", c); |
||||
} |
||||
|
||||
public Person findLoginUser(String username, String password) { |
||||
log.info("Identifiing Login for user {}", username); |
||||
return dao.findLoginUser(username, password); |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue