Project

General

Profile

« Previous | Next » 

Revision 51fe9924

Added by Cherian Mathew about 9 years ago

First commit for Status Editor
StatusEditorUI, StatusEditorView, StatusComposite, IStatusComposite, StatusPresenter : MVP classes for status editor
CdmSQLContainer, CdmSpringContextHelper : using new connection pool method
LeafNodeTaxonContainer : container for status editor
CdmStatementDelegate : sql statement delegate for cdm
AbstractAuthenticatedUI : added method for bypassing authentication (for testing)

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/container/CdmSQLContainer.java
4 4

  
5 5
import com.vaadin.data.util.sqlcontainer.SQLContainer;
6 6
import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
7
import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool;
8 7
import com.vaadin.data.util.sqlcontainer.query.QueryDelegate;
9 8
import com.vaadin.data.util.sqlcontainer.query.TableQuery;
9
import com.vaadin.data.util.sqlcontainer.query.generator.DefaultSQLGenerator;
10 10

  
11 11
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper;
12 12

  
13 13
public class CdmSQLContainer extends SQLContainer {
14
	
15
	JDBCConnectionPool pool;
16
	
17
	
18
	public CdmSQLContainer(QueryDelegate delegate) throws SQLException {
19
		super(delegate);		
20
	}
21
	
22
	public static CdmSQLContainer newInstance(String tableName, String user, String password) {
23
		// TODO Auto-generated constructor stub
24
		JDBCConnectionPool pool;
25
		try {
26
			pool = new SimpleJDBCConnectionPool(
27
			        "org.h2.Driver",
28
			        "jdbc:h2:mem:cdm;MVCC=TRUE;IGNORECASE=TRUE", user, password, 2, 5);
29
			
30
//			pool = new SimpleJDBCConnectionPool(
31
//			        "com.mysql.jdbc.Driver",
32
//			        "jdbc:mysql://127.0.0.1/local-cyprus", user, password, 2, 5);
33
			
34
			TableQuery tq = new TableQuery(tableName, pool);
35
			tq.setVersionColumn("OPTLOCK");
36
			return new CdmSQLContainer(tq);
37
		} catch (SQLException e) {
38
			// TODO Auto-generated catch block
39
			e.printStackTrace();
40
		}
41
		return null;
42
	}
14

  
15
    JDBCConnectionPool pool;
16

  
17

  
18
    public CdmSQLContainer(QueryDelegate delegate) throws SQLException {
19
        super(delegate);
20
    }
21

  
22
    public static CdmSQLContainer newInstance(String tableName) throws SQLException {
23
        // TODO : currently the sql generator is for h2, need to make this compatible for all flavours
24
        TableQuery tq = new TableQuery(tableName,CdmSpringContextHelper.getConnectionPool(), new DefaultSQLGenerator());
25
        tq.setVersionColumn("updated");
26

  
27
        return new CdmSQLContainer(tq);
28

  
29
    }
43 30

  
44 31
}

Also available in: Unified diff