Project

General

Profile

« Previous | Next » 

Revision dce0fa4c

Added by Markus Döring over 16 years ago

Initial import.

View differences:

.gitattributes
243 243
cdmlibrary/src/test/resources/applicationContext-test.xml -text
244 244
docs/layers.graffle -text
245 245
docs/layers.png -text
246
musiclib-hibernatetest/listAnnotatedClasses.py -text
247
musiclib-hibernatetest/pom.xml -text
248
musiclib-hibernatetest/src/main/java/org/bgbm/model/Address.java -text
249
musiclib-hibernatetest/src/main/java/org/bgbm/model/AnnotatableEntity.java -text
250
musiclib-hibernatetest/src/main/java/org/bgbm/model/Annotation.java -text
251
musiclib-hibernatetest/src/main/java/org/bgbm/model/Contact.java -text
252
musiclib-hibernatetest/src/main/java/org/bgbm/model/Person.java -text
253
musiclib-hibernatetest/src/main/java/org/bgbm/model/package-info.java -text
254
musiclib-hibernatetest/src/main/java/org/bgbm/persistence/dao/AgentDaoHibernateImpl.java -text
255
musiclib-hibernatetest/src/main/java/org/bgbm/persistence/dao/DaoBase.java -text
256
musiclib-hibernatetest/src/main/java/org/bgbm/persistence/dao/IAgentDao.java -text
257
musiclib-hibernatetest/src/main/java/org/bgbm/persistence/dao/IDao.java -text
258
musiclib-hibernatetest/src/main/resources/applicationContext.xml -text
259
musiclib-hibernatetest/src/main/resources/log4j.properties -text
260
musiclib-hibernatetest/src/main/resources/sessionfactory.xml -text
261
musiclib-hibernatetest/src/site/site.xml -text
246 262
updateSite/.project -text
247 263
updateSite/features/eu.etaxonomy.cdmLibrary_0.2.5.jar -text
248 264
updateSite/index.html -text
musiclib-hibernatetest/listAnnotatedClasses.py
1
#!/usr/bin/python
2
import os, sys
3

  
4
modelDir="src/main/java/eu/etaxonomy/cdm/model"
5
modelPackage="eu.etaxonomy.cdm.model"
6

  
7
print"<list>"
8
for path,dirs,files in os.walk(modelDir):
9
    if path <> modelDir:
10
        package = "%s.%s"%(modelPackage, path[len(modelDir)+1:])
11
    else:
12
        package = modelPackage
13
    for f in files: 
14
        if f.endswith(".java") and f <> "package-info.java":
15
            print "<value>%s.%s</value>" %(package, f[:-5])
16
print"</list>"
17

  
musiclib-hibernatetest/pom.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<project xmlns="http://maven.apache.org/POM/4.0.0" 
3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
5
    >
6
  <parent>
7
    <artifactId>cdmParent</artifactId>
8
    <groupId>eu.etaxonomy</groupId>
9
    <version>0.1</version>
10
    <relativePath>../cdmParent/pom.xml</relativePath>
11
  </parent>
12
  <modelVersion>4.0.0</modelVersion>
13
  <artifactId>musiclib</artifactId>
14
  <name>Markus Music Test</name>
15
  <version>0.1.0</version>
16
  <description>EDIT cdm library</description>
17
  <scm>
18
    <connection>scm:svn:http://ww2.biocase.org/svn/edit/trunk/cdmlib/musiclib/</connection>
19
    <developerConnection>scm:svn:https://ww2.biocase.org/svn/edit/trunk/cdmlib/musiclib/</developerConnection>
20
    <url>http://ww2.biocase.org/svn/edit/trunk/cdmlib/musiclib/</url>
21
  </scm>
22
  <build>
23
    <plugins>
24
      <plugin>
25
        <artifactId>maven-compiler-plugin</artifactId>
26
        <configuration>
27
          <source>1.5</source>
28
          <target>1.5</target>
29
        </configuration>
30
      </plugin>
31
      <plugin>
32
        <artifactId>maven-surefire-plugin</artifactId>
33
        <configuration>
34
          <includes>
35
            <include>**/*Test.java</include>
36
          </includes>
37
        </configuration>
38
      </plugin>
39
    </plugins>
40
  </build>
41
  <dependencies>
42
    <dependency>
43
      <groupId>javax.persistence</groupId>
44
      <artifactId>ejb</artifactId>
45
      <version>3</version>
46
    </dependency>
47
    <dependency>
48
      <groupId>javax.xml</groupId>
49
      <artifactId>jaxrpc-api</artifactId>
50
      <version>1.1</version>
51
    </dependency>
52
    <dependency>
53
      <groupId>javax.xml.bind</groupId>
54
      <artifactId>jaxb-api</artifactId>
55
      <version>2.0</version>
56
    </dependency>
57
    <dependency>
58
      <groupId>mysql</groupId>
59
      <artifactId>mysql-connector-java</artifactId>
60
      <version>5.0.5</version>
61
    </dependency>
62
    <dependency>
63
      <groupId>org.hibernate</groupId>
64
      <artifactId>hibernate-commons-annotations</artifactId>
65
      <version>3.3.0.ga</version>
66
    </dependency>
67
    <dependency>
68
      <groupId>org.hibernate</groupId>
69
      <artifactId>hibernate-annotations</artifactId>
70
      <version>3.3.0.ga</version>
71
    </dependency>
72
    <dependency>
73
      <groupId>org.hibernate</groupId>
74
      <artifactId>hibernate</artifactId>
75
      <version>3.2.5.ga</version>
76
    </dependency>
77
    
78
    <dependency>
79
      <groupId>org.springframework</groupId>
80
      <artifactId>spring</artifactId>
81
      <version>2.5</version>
82
    </dependency>
83
    <dependency>
84
      <groupId>org.springframework</groupId>
85
      <artifactId>spring-beans</artifactId>
86
      <version>2.5</version>
87
    </dependency>
88
    <dependency>
89
      <groupId>org.springframework</groupId>
90
      <artifactId>spring-orm</artifactId>
91
      <version>2.5</version>
92
    </dependency>
93
    <dependency>
94
      <groupId>org.springframework</groupId>
95
      <artifactId>spring-jdbc</artifactId>
96
      <version>2.5</version>
97
    </dependency>    
98
    <dependency>
99
      <groupId>org.springframework</groupId>
100
      <artifactId>spring-test</artifactId>
101
      <version>2.5</version>
102
    </dependency>
103
  </dependencies>
104
</project>
105

  
musiclib-hibernatetest/src/main/java/org/bgbm/model/Address.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.model.agent;
11

  
12

  
13
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
14
import eu.etaxonomy.cdm.model.location.Point;
15
import eu.etaxonomy.cdm.model.common.VersionableEntity;
16
import org.apache.log4j.Logger;
17
import eu.etaxonomy.cdm.model.Description;
18
import java.util.*;
19
import javax.persistence.*;
20

  
21
/**
22
 * taken from TDWG & VCard  http://rs.tdwg.
23
 * org/ontology/voc/ContactDetails#Address
24
 * @author m.doering
25
 * @version 1.0
26
 * @created 08-Nov-2007 13:06:09
27
 */
28
@Entity
29
public class Address extends VersionableEntity {
30
	static Logger logger = Logger.getLogger(Address.class);
31
	//Post Office Box
32
	private String pobox;
33
	//including number
34
	private String street;
35
	private String postcode;
36
	//town,locality,suburb
37
	private String locality;
38
	//Region/State
39
	private String region;
40
	private WaterbodyOrCountry country;
41
	private Point location;
42
	public WaterbodyOrCountry getCountry(){
43
		return this.country;
44
	}
45

  
46
	/**
47
	 * 
48
	 * @param country    country
49
	 */
50
	public void setCountry(WaterbodyOrCountry country){
51
		this.country = country;
52
	}
53

  
54
	public Point getLocation(){
55
		return this.location;
56
	}
57

  
58
	/**
59
	 * 
60
	 * @param location    location
61
	 */
62
	public void setLocation(Point location){
63
		this.location = location;
64
	}
65

  
66
	public String getPobox(){
67
		return this.pobox;
68
	}
69

  
70
	/**
71
	 * 
72
	 * @param pobox    pobox
73
	 */
74
	public void setPobox(String pobox){
75
		this.pobox = pobox;
76
	}
77

  
78
	public String getStreet(){
79
		return this.street;
80
	}
81

  
82
	/**
83
	 * 
84
	 * @param street    street
85
	 */
86
	public void setStreet(String street){
87
		this.street = street;
88
	}
89

  
90
	public String getPostcode(){
91
		return this.postcode;
92
	}
93

  
94
	/**
95
	 * 
96
	 * @param postcode    postcode
97
	 */
98
	public void setPostcode(String postcode){
99
		this.postcode = postcode;
100
	}
101

  
102
	public String getLocality(){
103
		return this.locality;
104
	}
105

  
106
	/**
107
	 * 
108
	 * @param locality    locality
109
	 */
110
	public void setLocality(String locality){
111
		this.locality = locality;
112
	}
113

  
114
	public String getRegion(){
115
		return this.region;
116
	}
117

  
118
	/**
119
	 * 
120
	 * @param region    region
121
	 */
122
	public void setRegion(String region){
123
		this.region = region;
124
	}
125

  
126
}
musiclib-hibernatetest/src/main/java/org/bgbm/model/AnnotatableEntity.java
1
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        /**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.model.common;
11

  
12

  
13
import org.apache.log4j.Logger;
14
import eu.etaxonomy.cdm.model.Description;
15
import java.util.*;
16

  
17
import javax.persistence.*;
18

  
19
/**
20
 * @author m.doering
21
 * @version 1.0
22
 * @created 08-Nov-2007 13:06:10
23
 */
24
@MappedSuperclass
25
public abstract class AnnotatableEntity extends VersionableEntity {
26
	public AnnotatableEntity() {
27
		super();
28
		// TODO Auto-generated constructor stub
29
	}
30

  
31
	static Logger logger = Logger.getLogger(AnnotatableEntity.class);
32
	private Set<Marker> markers = new HashSet();
33
	private Set<Annotation> annotations = new HashSet();
34
	
35
	
36
	@OneToMany
37
	public Set<Marker> getMarkers(){
38
		return this.markers;
39
	}
40

  
41
	/**
42
	 * 
43
	 * @param marker    marker
44
	 */
45
	public void addMarker(Marker marker){
46

  
47
	}
48

  
49
	/**
50
	 * 
51
	 * @param marker    marker
52
	 */
53
	public void removeMarker(Marker marker){
54

  
55
	}
56

  
57
	@OneToMany
58
	public Set<Annotation> getAnnotations(){
59
		return this.annotations;
60
	}
61

  
62
	/**
63
	 * @param annotations
64
	 * 
65
	 * @param annotation
66
	 */
67
	public void addAnnotations(Annotation annotation){
68

  
69
	}
70

  
71
	/**
72
	 * 
73
	 * @param annotation
74
	 */
75
	public void removeAnnotations(Annotation annotation){
76

  
77
	}
78

  
79
	public void setMarkers(Set<Marker> markers) {
80
		this.markers = markers;
81
	}
82

  
83
	public void setAnnotations(Set<Annotation> annotations) {
84
		this.annotations = annotations;
85
	}
86

  
87
}
musiclib-hibernatetest/src/main/java/org/bgbm/model/Annotation.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.model.common;
11

  
12

  
13
import eu.etaxonomy.cdm.model.agent.Person;
14
import org.apache.log4j.Logger;
15
import eu.etaxonomy.cdm.model.Description;
16
import java.util.*;
17
import javax.persistence.*;
18

  
19
/**
20
 * @author m.doering
21
 * @version 1.0
22
 * @created 08-Nov-2007 13:06:10
23
 */
24
@Entity
25
public class Annotation extends LanguageString {
26
	public Annotation(String text, Language lang) {
27
		super(text, lang);
28
	}
29

  
30
	static Logger logger = Logger.getLogger(Annotation.class);
31
	//Human annotation
32
	private Person commentator;
33

  
34
	public Person getCommentator(){
35
		return this.commentator;
36
	}
37

  
38
	/**
39
	 * 
40
	 * @param commentator    commentator
41
	 */
42
	public void setCommentator(Person commentator){
43
		this.commentator = commentator;
44
	}
45

  
46
}
musiclib-hibernatetest/src/main/java/org/bgbm/model/Contact.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.model.agent;
11

  
12

  
13
import eu.etaxonomy.cdm.model.common.VersionableEntity;
14
import org.apache.log4j.Logger;
15
import eu.etaxonomy.cdm.model.Description;
16
import java.util.*;
17
import javax.persistence.*;
18

  
19
/**
20
 * http://rs.tdwg.org/ontology/voc/ContactDetails#ContactDetails
21
 * @author m.doering
22
 * @version 1.0
23
 * @created 08-Nov-2007 13:06:18
24
 */
25
@Entity
26
public class Contact extends VersionableEntity {
27
	public Contact() {
28
		super();
29
		// TODO Auto-generated constructor stub
30
	}
31

  
32
	static Logger logger = Logger.getLogger(Contact.class);
33
	private String email;
34
	private String url;
35
	private String phone;
36
	private String fax;
37
	private Set<Address> addresses;
38
	
39
	
40
	@OneToMany
41
	public Set<Address> getAddresses(){
42
		return this.addresses;
43
	}
44

  
45
	/**
46
	 * 
47
	 * @param addresses    addresses
48
	 */
49
	public void setAddresses(Set<Address> addresses){
50
		this.addresses = addresses;
51
	}
52
	public void addAddress(Address address){
53
		this.addresses.add(address);
54
	}
55
	public void removeAddress(Address address){
56
		this.addresses.remove(address);
57
	}
58

  
59
	public String getEmail(){
60
		return this.email;
61
	}
62

  
63
	/**
64
	 * 
65
	 * @param email    email
66
	 */
67
	public void setEmail(String email){
68
		this.email = email;
69
	}
70

  
71
	public String getUrl(){
72
		return this.url;
73
	}
74

  
75
	/**
76
	 * 
77
	 * @param url    url
78
	 */
79
	public void setUrl(String url){
80
		this.url = url;
81
	}
82

  
83
	public String getPhone(){
84
		return this.phone;
85
	}
86

  
87
	/**
88
	 * 
89
	 * @param phone    phone
90
	 */
91
	public void setPhone(String phone){
92
		this.phone = phone;
93
	}
94

  
95
	public String getFax(){
96
		return this.fax;
97
	}
98

  
99
	/**
100
	 * 
101
	 * @param fax    fax
102
	 */
103
	public void setFax(String fax){
104
		this.fax = fax;
105
	}
106

  
107
}
musiclib-hibernatetest/src/main/java/org/bgbm/model/Person.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.model.agent;
11

  
12

  
13
import eu.etaxonomy.cdm.model.common.TimePeriod;
14
import eu.etaxonomy.cdm.model.common.Keyword;
15
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
16
import org.apache.log4j.Logger;
17
import eu.etaxonomy.cdm.model.Description;
18
import java.util.*;
19
import javax.persistence.*;
20

  
21
/**
22
 * http://rs.tdwg.org/ontology/voc/Person.rdf
23
 * @author m.doering
24
 * @version 1.0
25
 * @created 08-Nov-2007 13:06:42
26
 */
27
@Entity
28
public class Person extends Agent {
29
	public Person() {
30
		super();
31
		// TODO Auto-generated constructor stub
32
	}
33
	
34
	static Logger logger = Logger.getLogger(Person.class);
35
	//e.g. the title
36
	private String prefix;
37
	//All other names not included in the surname. May be just initials, all forenames in full or a combination of expanded
38
	//names and initials.
39
	private String firstname;
40
	//A hereditary name common to all members of a family, as distinct from a given name or forename
41
	private String lastname;
42
	//e.g. junior
43
	private String suffix;
44
	//The period for which this person was alive represented as a TimePeriod datatype, i.e. start - end date. Alternative
45
	//suggestion as a flexible String. the form birthdate - deathdate (XXXX - YYYY; XXXX - or - YYYY as appropriate) is
46
	//prefered, or as simple flourished date (fl. XXXX) may be given where that is all that is known
47
	private TimePeriod lifespan;
48
	private Set<InstitutionalMembership> institutionalMemberships;
49
	private Contact contact;
50
	private Set<Keyword> keywords;
51

  
52
	@OneToMany
53
	public Set<InstitutionalMembership> getInstitutionalMemberships(){
54
		return this.institutionalMemberships;
55
	}
56

  
57
	/**
58
	 * 
59
	 * @param institutionalMemberships    institutionalMemberships
60
	 */
61
	public void setInstitutionalMemberships(Set<InstitutionalMembership> institutionalMemberships){
62
		this.institutionalMemberships = institutionalMemberships;
63
	}
64

  
65

  
66
	@OneToMany
67
	public Set<Keyword> getKeywords(){
68
		return this.keywords;
69
	}
70
	public void setKeywords(Set<Keyword> keywords){
71
		this.keywords = keywords;
72
	}
73
	public void addKeyword(Keyword keyword){
74
		this.keywords.add(keyword);
75
	}
76
	public void removeKeyword(Keyword keyword){
77
		this.keywords.remove(keyword);
78
	}
79

  
80

  
81

  
82
	public Contact getContact(){
83
		return this.contact;
84
	}
85

  
86
	/**
87
	 * 
88
	 * @param contact    contact
89
	 */
90
	public void setContact(Contact contact){
91
		this.contact = contact;
92
	}
93

  
94
	public String getPrefix(){
95
		return this.prefix;
96
	}
97

  
98
	/**
99
	 * 
100
	 * @param prefix    prefix
101
	 */
102
	public void setPrefix(String prefix){
103
		this.prefix = prefix;
104
	}
105

  
106
	public String getFirstname(){
107
		return this.firstname;
108
	}
109

  
110
	/**
111
	 * 
112
	 * @param firstname    firstname
113
	 */
114
	public void setFirstname(String firstname){
115
		this.firstname = firstname;
116
	}
117

  
118
	public String getLastname(){
119
		return this.lastname;
120
	}
121

  
122
	/**
123
	 * 
124
	 * @param lastname    lastname
125
	 */
126
	public void setLastname(String lastname){
127
		this.lastname = lastname;
128
	}
129

  
130
	public String getSuffix(){
131
		return this.suffix;
132
	}
133

  
134
	/**
135
	 * 
136
	 * @param suffix    suffix
137
	 */
138
	public void setSuffix(String suffix){
139
		this.suffix = suffix;
140
	}
141

  
142
	public TimePeriod getLifespan(){
143
		return this.lifespan;
144
	}
145

  
146
	/**
147
	 * 
148
	 * @param lifespan    lifespan
149
	 */
150
	public void setLifespan(TimePeriod lifespan){
151
		this.lifespan = lifespan;
152
	}
153

  
154
	@Override
155
	public String generateTitle(){
156
		return "";
157
	}
158

  
159
}
musiclib-hibernatetest/src/main/java/org/bgbm/model/package-info.java
1
/* Package Annotations*/
2

  
3
@GenericGenerator(
4
		name="system-increment", 
5
		strategy = "increment"
6
)
7
package eu.etaxonomy.cdm.model.common;
8

  
9
import org.hibernate.annotations.GenericGenerator;	
musiclib-hibernatetest/src/main/java/org/bgbm/persistence/dao/AgentDaoHibernateImpl.java
1
package eu.etaxonomy.cdm.persistence.dao;
2

  
3
import java.util.List;
4

  
5
import org.apache.log4j.Logger;
6
import org.springframework.stereotype.Repository;
7

  
8
import eu.etaxonomy.cdm.model.agent.Agent;
9

  
10

  
11
@Repository
12
public class AgentDaoHibernateImpl extends DaoBase<Agent, Integer> implements IAgentDao{
13
	private static final Logger logger = Logger.getLogger(AgentDaoHibernateImpl.class);
14

  
15
	public AgentDaoHibernateImpl() {
16
		super(Agent.class); 
17
	}
18

  
19

  
20
	@Override
21
	public List<Agent> find(String queryString) {
22
		// TODO Auto-generated method stub
23
		return null;
24
	}
25
}
musiclib-hibernatetest/src/main/java/org/bgbm/persistence/dao/DaoBase.java
1
/**
2
 * 
3
 */
4
package eu.etaxonomy.cdm.persistence.dao;
5

  
6
import java.io.Serializable;
7
import java.util.List;
8

  
9
import org.apache.log4j.Logger;
10
import org.hibernate.Session;
11
import org.hibernate.SessionFactory;
12
import org.springframework.beans.factory.annotation.Autowired;
13
import org.springframework.dao.DataAccessException;
14

  
15
import eu.etaxonomy.cdm.model.common.CdmBase;
16

  
17

  
18
/**
19
 * @author a.mueller
20
 *
21
 */
22
public abstract class DaoBase<T extends CdmBase, ID extends Serializable> implements IDao<T, ID> {
23

  
24
	static Logger logger = Logger.getLogger(DaoBase.class);
25

  
26
	@Autowired
27
	private SessionFactory factory;
28
	protected Class<T> type;
29
	
30
	public DaoBase(Class<T> type){
31
		this.type = type;
32
		logger.debug("Creating DAO of type [" + type.getSimpleName() + "]");
33
	}
34
	
35
	protected Session getSession(){
36
		return factory.getCurrentSession();
37
	}
38
	
39
	
40
	public void saveOrUpdate(T transientObject) throws DataAccessException  {
41
		getSession().saveOrUpdate(transientObject);
42
	}
43

  
44
	public Serializable save(T newInstance) throws DataAccessException {
45
		return getSession().save(newInstance);
46
	}
47
	
48
	public void update(T transientObject) throws DataAccessException {
49
		getSession().update(transientObject);
50
	}
51
	
52
	public void delete(T persistentObject) throws DataAccessException {
53
		getSession().delete(persistentObject);
54
	}
55

  
56
	public T findById(Integer id) throws DataAccessException {
57
		return (T) getSession().get(type, id);
58
	}
59

  
60

  
61
	
62
	public Boolean exists(ID id) {
63
		if (findById(id)==null){
64
			return false;
65
		}
66
		return true;
67
	}
68

  
69

  
70
	public List<T> list(Integer limit) {
71
		// TODO Auto-generated method stub
72
		return null;
73
	}
74

  
75

  
76
	/* (non-Javadoc)
77
	 * @see eu.etaxonomy.cdm.persistence.dao.IDao#find(java.lang.String)
78
	 */
79
	public abstract List<T> find(String queryString);
80
}
musiclib-hibernatetest/src/main/java/org/bgbm/persistence/dao/IAgentDao.java
1
package eu.etaxonomy.cdm.persistence.dao;
2

  
3
import eu.etaxonomy.cdm.model.agent.Agent;
4

  
5
public interface IAgentDao extends IDao<Agent,Integer> {
6
	
7
}
musiclib-hibernatetest/src/main/java/org/bgbm/persistence/dao/IDao.java
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

  
10
package eu.etaxonomy.cdm.persistence.dao;
11

  
12

  
13
import java.io.Serializable;
14
import java.util.List;
15

  
16
import org.apache.log4j.Logger;
17
import org.springframework.dao.DataAccessException;
18
import org.springframework.orm.hibernate3.HibernateTemplate;
19

  
20
import eu.etaxonomy.cdm.model.Description;
21
import eu.etaxonomy.cdm.model.common.CdmBase;
22
import eu.etaxonomy.cdm.model.common.Enumeration;
23

  
24
/**
25
 * an data access interface that all data access classes implement
26
 * @author m.doering
27
 * @version 1.0
28
 * @created 02-Nov-2007 19:36:10
29
 */
30
public interface IDao<T extends CdmBase, ID extends Serializable> {
31
	public void saveOrUpdate(T transientObject) throws DataAccessException;
32
	
33
	/* (non-Javadoc)
34
	 * @see eu.etaxonomy.cdm.persistence.dao.IDAO#save(java.lang.Object)
35
	 */
36
	public Serializable save(T newOrManagedObject) throws DataAccessException;
37
	
38
	/* (non-Javadoc)
39
	 * @see eu.etaxonomy.cdm.persistence.dao.IDAO#update(java.lang.Object)
40
	 */
41
	public void update(T transientObject) throws DataAccessException;
42
	
43
	/* (non-Javadoc)
44
	 * @see eu.etaxonomy.cdm.persistence.dao.IDAO#delete(java.lang.Object)
45
	 */
46
	public void delete(T persistentObject) throws DataAccessException;
47
	
48
	/* (non-Javadoc)
49
	 * @see eu.etaxonomy.cdm.persistence.dao.IDAO#findById(java.io.Serializable)
50
	 */
51
	public T findById(ID id) throws DataAccessException;
52

  
53
//********************************************//	
54
	
55
	
56
	/**
57
	 * @param queryString
58
	 * @return List<T extends CdmBase>
59
	 * list object by searching on their title/lable.
60
	 * common.Identifyable.getTitleCache if existing
61
	 */
62
	public List<T> find(String queryString);
63

  
64
	public Boolean exists(ID id);
65

  
66
	public List<T> list(Integer limit);
67

  
68
}
musiclib-hibernatetest/src/main/resources/applicationContext.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xmlns:context="http://www.springframework.org/schema/context"
5
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
6
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
7
    http://www.springframework.org/schema/context
8
    http://www.springframework.org/schema/context/spring-context-2.5.xsd">
9
        
10
    <import resource="sessionfactory.xml"/>
11
    
12
    <bean id="mysqlDataSource" 
13
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
14
        <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
15
        <property name="url" value="jdbc:mysql://192.168.2.10/cdm_test"/>
16
        <property name="username" value="edit"/>
17
        <property name="password" value="wp5"/>
18
    </bean>
19
        
20
</beans>
21

  
musiclib-hibernatetest/src/main/resources/log4j.properties
1
### ************ APPENDER ***********************************###
2

  
3
### direct log messages to stdout ###
4
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
5
log4j.appender.stdout.Target=System.out
6
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
7
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
8

  
9
### direct messages to file hibernate.log ###
10
log4j.appender.file=org.apache.log4j.FileAppender
11
log4j.appender.file.File=hibernate.log
12
log4j.appender.file.layout=org.apache.log4j.PatternLayout
13
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
14

  
15

  
16
### ************* LOG LEVELS *********************************###
17

  
18
### set log levels - for more verbose logging change 'info' to 'debug' ###
19

  
20
log4j.rootLogger=info, stdout
21

  
22
	### *** CDM *** ###
23

  
24
log4j.logger.eu.etaxonomy.cdm = debug 
25

  
26
	### ***HIBERNATE ************ ###
27

  
28
log4j.logger.org.hibernate=warn
29

  
30
### log HQL query parser activity
31
#log4j.logger.org.hibernate.hql.ast.AST=debug
32

  
33
### log just the SQL
34
#log4j.logger.org.hibernate.SQL=debug
35

  
36
### log JDBC bind parameters ###
37
log4j.logger.org.hibernate.type=info
38

  
39
### log schema export/update ###
40
log4j.logger.org.hibernate.tool.hbm2ddl=warn
41

  
42
### log HQL parse trees
43
#log4j.logger.org.hibernate.hql=debug
44

  
45
### log cache activity ###
46
#log4j.logger.org.hibernate.cache=debug
47

  
48
### log transaction activity
49
#log4j.logger.org.hibernate.transaction=debug
50

  
51
### log JDBC resource acquisition
52
log4j.logger.org.hibernate.jdbc=info
53

  
54
### enable the following line if you want to track down connection ###
55
### leakages when using DriverManagerConnectionProvider ###
56
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
musiclib-hibernatetest/src/main/resources/sessionfactory.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<beans xmlns="http://www.springframework.org/schema/beans"
3
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
    xmlns:context="http://www.springframework.org/schema/context"
5
    xmlns:tx="http://www.springframework.org/schema/tx"
6
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
7
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
8
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
9
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
10
    ">
11
    
12
    <context:component-scan base-package="eu.etaxonomy.cdm"/>
13

  
14
    <!-- enable the configuration of transactional behavior based on annotations -->
15
    <tx:annotation-driven transaction-manager="transactionManager"/>    
16

  
17
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
18
        <property name="sessionFactory" ref="sessionFactory" />
19
    </bean>
20
    
21
<bean id="sessionFactory" 
22
    class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
23
    <property name="dataSource" ref="mysqlDataSource"/>
24
    <property name="annotatedPackages">
25
        <list>
26
            <value>eu.etaxonomy.cdm.model.common</value>
27
        </list>
28
    </property>
29
    
30
    <property name="annotatedClasses">
31
        <list>
32
            <value>eu.etaxonomy.cdm.model.Description</value>
33
            <value>eu.etaxonomy.cdm.model.agent.Address</value>
34
            <value>eu.etaxonomy.cdm.model.agent.Contact</value>
35
            <value>eu.etaxonomy.cdm.model.agent.Institution</value>
36
            <value>eu.etaxonomy.cdm.model.agent.InstitutionalMembership</value>
37
            <value>eu.etaxonomy.cdm.model.agent.InstitutionType</value>
38
            <value>eu.etaxonomy.cdm.model.agent.Person</value>
39
            <value>eu.etaxonomy.cdm.model.agent.Team</value>
40
            <value>eu.etaxonomy.cdm.model.common.AnnotatableEntity</value>
41
            <value>eu.etaxonomy.cdm.model.common.Annotation</value>
42
            <value>eu.etaxonomy.cdm.model.common.AudioFile</value>
43
            <value>eu.etaxonomy.cdm.model.common.CdmBase</value>
44
            <value>eu.etaxonomy.cdm.model.common.DefinedTermBase</value>
45
            <value>eu.etaxonomy.cdm.model.common.EnumeratedTermBase</value>
46
            <value>eu.etaxonomy.cdm.model.common.Enumeration</value>
47
            <value>eu.etaxonomy.cdm.model.common.Extension</value>
48
            <value>eu.etaxonomy.cdm.model.common.ExtensionType</value>
49
            <value>eu.etaxonomy.cdm.model.common.Figure</value>
50
            <value>eu.etaxonomy.cdm.model.common.IdentifiableEntity</value>
51
            <value>eu.etaxonomy.cdm.model.common.ImageFile</value>
52
            <value>eu.etaxonomy.cdm.model.common.IOriginalSource</value>
53
            <value>eu.etaxonomy.cdm.model.common.IReferencedEntity</value>
54
            <value>eu.etaxonomy.cdm.model.common.Keyword</value>
55
            <value>eu.etaxonomy.cdm.model.common.Language</value>
56
            <value>eu.etaxonomy.cdm.model.common.LanguageString</value>
57
            <value>eu.etaxonomy.cdm.model.common.Marker</value>
58
            <value>eu.etaxonomy.cdm.model.common.MarkerType</value>
59
            <value>eu.etaxonomy.cdm.model.common.Media</value>
60
            <value>eu.etaxonomy.cdm.model.common.MediaInstance</value>
61
            <value>eu.etaxonomy.cdm.model.common.MovieFile</value>
62
            <value>eu.etaxonomy.cdm.model.common.MultilanguageSet</value>
63
            <value>eu.etaxonomy.cdm.model.common.OriginalSource</value>
64
            <value>eu.etaxonomy.cdm.model.common.package-info</value>
65
            <value>eu.etaxonomy.cdm.model.common.ReferencedEntityBase</value>
66
            <value>eu.etaxonomy.cdm.model.common.ReferencedMedia</value>
67
            <value>eu.etaxonomy.cdm.model.common.Representation</value>
68
            <value>eu.etaxonomy.cdm.model.common.Rights</value>
69
            <value>eu.etaxonomy.cdm.model.common.RightsTerm</value>
70
            <value>eu.etaxonomy.cdm.model.common.TimePeriod</value>
71
            <value>eu.etaxonomy.cdm.model.common.VersionableEntity</value>
72
            <value>eu.etaxonomy.cdm.model.description.AbsenceTerm</value>
73
            <value>eu.etaxonomy.cdm.model.description.CategoricalData</value>
74
            <value>eu.etaxonomy.cdm.model.description.CharacterTree</value>
75
            <value>eu.etaxonomy.cdm.model.description.CommonTaxonName</value>
76
            <value>eu.etaxonomy.cdm.model.description.Description</value>
77
            <value>eu.etaxonomy.cdm.model.description.Distribution</value>
78
            <value>eu.etaxonomy.cdm.model.description.FeatureBase</value>
79
            <value>eu.etaxonomy.cdm.model.description.FeatureType</value>
80
            <value>eu.etaxonomy.cdm.model.description.IdentificationKey</value>
81
            <value>eu.etaxonomy.cdm.model.description.IndividualsAssociation</value>
82
            <value>eu.etaxonomy.cdm.model.description.MeasurementUnit</value>
83
            <value>eu.etaxonomy.cdm.model.description.Modifier</value>
84
            <value>eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase</value>
85
            <value>eu.etaxonomy.cdm.model.description.PresenceTerm</value>
86
            <value>eu.etaxonomy.cdm.model.description.QuantitativeData</value>
87
            <value>eu.etaxonomy.cdm.model.description.Scope</value>
88
            <value>eu.etaxonomy.cdm.model.description.Sex</value>
89
            <value>eu.etaxonomy.cdm.model.description.Stage</value>
90
            <value>eu.etaxonomy.cdm.model.description.State</value>
91
            <value>eu.etaxonomy.cdm.model.description.StateData</value>
92
            <value>eu.etaxonomy.cdm.model.description.StatisticalMeasure</value>
93
            <value>eu.etaxonomy.cdm.model.description.StatisticalMeasurementValue</value>
94
            <value>eu.etaxonomy.cdm.model.description.TaxonInteraction</value>
95
            <value>eu.etaxonomy.cdm.model.description.TextData</value>
96
            <value>eu.etaxonomy.cdm.model.description.TextFormat</value>
97
            <value>eu.etaxonomy.cdm.model.location.Continent</value>
98
            <value>eu.etaxonomy.cdm.model.location.NamedArea</value>
99
            <value>eu.etaxonomy.cdm.model.location.NamedAreaLevel</value>
100
            <value>eu.etaxonomy.cdm.model.location.NamedAreaType</value>
101
            <value>eu.etaxonomy.cdm.model.location.Point</value>
102
            <value>eu.etaxonomy.cdm.model.location.ReferenceSystem</value>
103
            <value>eu.etaxonomy.cdm.model.location.WaterbodyOrCountry</value>
104
            <value>eu.etaxonomy.cdm.model.molecular.DnaSample</value>
105
            <value>eu.etaxonomy.cdm.model.molecular.GenBankAccession</value>
106
            <value>eu.etaxonomy.cdm.model.molecular.Locus</value>
107
            <value>eu.etaxonomy.cdm.model.molecular.PhylogeneticTree</value>
108
            <value>eu.etaxonomy.cdm.model.molecular.Sequence</value>
109
            <value>eu.etaxonomy.cdm.model.molecular.TissueSample</value>
110
            <value>eu.etaxonomy.cdm.model.name.BacterialName</value>
111
            <value>eu.etaxonomy.cdm.model.name.BotanicalName</value>
112
            <value>eu.etaxonomy.cdm.model.name.CultivarPlantName</value>
113
            <value>eu.etaxonomy.cdm.model.name.HybridRelationship</value>
114
            <value>eu.etaxonomy.cdm.model.name.HybridRelationshipType</value>
115
            <value>eu.etaxonomy.cdm.model.name.TypeDesignationBase</value>
116
            <value>eu.etaxonomy.cdm.model.name.NameRelationship</value>
117
            <value>eu.etaxonomy.cdm.model.name.NameRelationshipType</value>
118
            <value>eu.etaxonomy.cdm.model.name.NameTypeDesignation</value>
119
            <value>eu.etaxonomy.cdm.model.name.NomenclaturalStatus</value>
120
            <value>eu.etaxonomy.cdm.model.name.NomenclaturalStatusType</value>
121
            <value>eu.etaxonomy.cdm.model.name.NonViralName</value>
122
            <value>eu.etaxonomy.cdm.model.name.Rank</value>
123
            <value>eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation</value>
124
            <value>eu.etaxonomy.cdm.model.name.TaxonNameBase</value>
125
            <value>eu.etaxonomy.cdm.model.name.TypeDesignationStatus</value>
126
            <value>eu.etaxonomy.cdm.model.name.ViralName</value>
127
            <value>eu.etaxonomy.cdm.model.name.ZoologicalName</value>
128
            <value>eu.etaxonomy.cdm.model.occurrence.Collection</value>
129
            <value>eu.etaxonomy.cdm.model.occurrence.Determination</value>
130
            <value>eu.etaxonomy.cdm.model.occurrence.Fossil</value>
131
            <value>eu.etaxonomy.cdm.model.occurrence.LivingIndividual</value>
132
            <value>eu.etaxonomy.cdm.model.occurrence.Observation</value>
133
            <value>eu.etaxonomy.cdm.model.occurrence.ObservationalUnit</value>
134
            <value>eu.etaxonomy.cdm.model.occurrence.Occurrence</value>
135
            <value>eu.etaxonomy.cdm.model.occurrence.PreservationMethod</value>
136
            <value>eu.etaxonomy.cdm.model.occurrence.Specimen</value>
137
            <value>eu.etaxonomy.cdm.model.reference.Article</value>
138
            <value>eu.etaxonomy.cdm.model.reference.BibtexEntryType</value>
139
            <value>eu.etaxonomy.cdm.model.reference.BibtexReference</value>
140
            <value>eu.etaxonomy.cdm.model.reference.Book</value>
141
            <value>eu.etaxonomy.cdm.model.reference.BookSection</value>
142
            <value>eu.etaxonomy.cdm.model.reference.CdDvd</value>
143
            <value>eu.etaxonomy.cdm.model.reference.ConferenceProceedings</value>
144
            <value>eu.etaxonomy.cdm.model.reference.Database</value>
145
            <value>eu.etaxonomy.cdm.model.reference.Generic</value>
146
            <value>eu.etaxonomy.cdm.model.reference.INomenclaturalReference</value>
147
            <value>eu.etaxonomy.cdm.model.reference.InProceedings</value>
148
            <value>eu.etaxonomy.cdm.model.reference.Journal</value>
149
            <value>eu.etaxonomy.cdm.model.reference.Map</value>
150
            <value>eu.etaxonomy.cdm.model.reference.Patent</value>
151
            <value>eu.etaxonomy.cdm.model.reference.PersonalCommunication</value>
152
            <value>eu.etaxonomy.cdm.model.reference.PrintedUnitBase</value>
153
            <value>eu.etaxonomy.cdm.model.reference.PrintSeries</value>
154
            <value>eu.etaxonomy.cdm.model.reference.Proceedings</value>
155
            <value>eu.etaxonomy.cdm.model.reference.PublicationBase</value>
156
            <value>eu.etaxonomy.cdm.model.reference.ReferenceBase</value>
157
            <value>eu.etaxonomy.cdm.model.reference.Report</value>
158
            <value>eu.etaxonomy.cdm.model.reference.SectionBase</value>
159
            <value>eu.etaxonomy.cdm.model.reference.StrictReferenceBase</value>
160
            <value>eu.etaxonomy.cdm.model.reference.Thesis</value>
161
            <value>eu.etaxonomy.cdm.model.reference.WebPage</value>
162
            <value>eu.etaxonomy.cdm.model.taxon.ConceptRelationshipType</value>
163
            <value>eu.etaxonomy.cdm.model.taxon.Synonym</value>
164
            <value>eu.etaxonomy.cdm.model.taxon.SynonymRelationship</value>
165
            <value>eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType</value>
166
            <value>eu.etaxonomy.cdm.model.taxon.Taxon</value>
167
            <value>eu.etaxonomy.cdm.model.taxon.TaxonBase</value>
168
            <value>eu.etaxonomy.cdm.model.taxon.TaxonRelationship</value>
169
            <value>eu.etaxonomy.cdm.model.view.View</value>
170
        </list>
171
    </property>
172
    <property name="hibernateProperties">
173
        <props>
174
            <prop key="hibernate.hbm2ddl.auto">create</prop>
175
            <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
176
            <!--                <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
177
            -->                <prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
178
            <prop key="hibernate.show_sql">true</prop>
179
            <prop key="hibernate.format_sql">false</prop>
180
        </props>
181
    </property>
182
</bean>
183

  
184
    </beans>
musiclib-hibernatetest/src/site/site.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<project name="cdmLibrary">
3
  <bannerLeft>
4
    <name>CdmLibrary</name>
5
    <src>http://www.e-taxonomy.eu/_styles/images/logo_edit.png</src>
6
    <href>http://eu.e-taxonomy.cdm/</href>
7
  </bannerLeft>
8
  <bannerRight>
9
    <src>http://www.e-taxonomy.eu/_styles/images/logo_edit.png</src>
10
  </bannerRight>
11
 <!-- <skin>
12
  	<groupId>org.apache.maven.skins</groupId>
13
  	<artifactId>maven-stylus-skin</artifactId>
14
  	<version>1.0.1</version>
15
  </skin>  -->
16
  <skin>
17
  	<groupId>org.apache.maven.skins</groupId>
18
<!--<artifactId>maven-stylus-skin</artifactId>
19
  	<version>1.0.1</version>
20
  	<artifactId>maven-default-skin</artifactId>
21
  	<version>1.0</version>
22
-->	<artifactId>maven-classic-skin</artifactId>
23
  	<version>1.0</version>
24
  </skin>
25
  
26
  <publishDate format="dd-MM-yyyy"/>  
27
  <body>
28
    <links>
29
      <item name="Edit" href="http://www.e-taxonomy.eu/" />
30
      <item name="WP5" href="http://wp5.e-taxonomy.eu/blog/index.php"/>
31
    </links>
32

  
33
    <menu name="CdmLibrary">
34
      <item name="Introduction" href="index.html"/>
35
      <item name="Download" href="source-repository.html"/>
36
     </menu>
37
     <menu name="TestMenu">
38
     	<item name="TestItem"/>
39
     </menu>
40
	${reports}
41
  </body>
42
</project>

Also available in: Unified diff