Project

General

Profile

« Previous | Next » 

Revision 4208745a

Added by Ben Clark over 15 years ago

Lots of changes, but primarily:
Enabled the marshalling / unmarshalling of LSIDAuthority
Renamed the User table to UserAccount to avoid problems on SQLServer
Major refactoring of CacheStrategyGenerators so that the generic framework extends across all IIdentifiableEntities, allowing (but not requiring) the use of @Configurable and aop to inject custom cache strategy generators at runtime

View differences:

.gitattributes
829 829
cdmlib-model/src/main/java/eu/etaxonomy/cdm/datagenerator/TaxonGenerator.java -text
830 830
cdmlib-model/src/main/java/eu/etaxonomy/cdm/hibernate/HibernateProxyHelper.java -text
831 831
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/CdmNamespacePrefixMapper.java -text
832
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/ClassAdapter.java -text
832 833
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/DateTimeAdapter.java -text
833 834
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/FormattedText.java -text
834 835
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/FormattedTextAdapter.java -text
835 836
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/LSIDAdapter.java -text
836 837
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/MultilanguageTextAdapter.java -text
837 838
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/MultilanguageTextElement.java -text
839
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/Namespace.java -text
840
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/NamespacesAdapter.java -text
841
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/NamespacesElement.java -text
838 842
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/PartialAdapter.java -text
839 843
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/TDWGNamespacePrefixMapper.java -text
840 844
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/UUIDAdapter.java -text
......
1029 1033
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/InProceedings.java -text
1030 1034
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/Journal.java -text
1031 1035
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/Map.java -text
1032
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/NomenclaturalReferenceHelper.java -text
1033 1036
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/Patent.java -text
1034 1037
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/PersonalCommunication.java -text
1035 1038
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/reference/PrintSeries.java -text
......
1074 1077
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/agent/PersonDefaultCacheStrategy.java -text
1075 1078
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/agent/TeamDefaultCacheStrategy.java -text
1076 1079
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/common/IIdentifiableEntityCacheStrategy.java -text
1080
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/common/IdentifiableEntityDefaultCacheStrategy.java -text
1077 1081
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/BotanicNameDefaultCacheStrategy.java -text
1078 1082
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/INameCacheStrategy.java -text
1079 1083
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/name/INonViralNameCacheStrategy.java -text
......
1095 1099
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/exceptions/UnknownCdmTypeException.java -text
1096 1100
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/INonViralNameParser.java -text
1097 1101
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java -text
1102
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/taxon/TaxonBaseDefaultCacheStrategy.java -text
1098 1103
cdmlib-model/src/main/resources/log4j.properties -text
1099 1104
cdmlib-model/src/main/resources/terms/AbsenceTerm.csv -text
1100 1105
cdmlib-model/src/main/resources/terms/AnnotationType.csv -text
......
1177 1182
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/taxon/TaxonTest.java -text
1178 1183
cdmlib-model/src/test/java/eu/etaxonomy/cdm/model/taxon/TaxonomicViewTest.java -text
1179 1184
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/BotanicNameCacheStrategyTest.java -text
1180
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/CdDvdDefaultCacheStrategyTest.java -text
1181 1185
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/NonViralNameDefaultCacheStrategyTest.java -text
1182 1186
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/name/ZoologicalNameCacheStrategyTest.java -text
1187
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/cache/reference/CdDvdDefaultCacheStrategyTest.java -text
1183 1188
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplTest.java -text
1184 1189
cdmlib-model/src/test/java/eu/etaxonomy/cdm/test/function/TestFullReferenceParser.java -text
1185 1190
cdmlib-model/src/test/java/eu/etaxonomy/cdm/test/function/TestModel.java -text
cdmlib-model/pom.xml
17 17
    <plugins>
18 18
      <plugin>
19 19
        <artifactId>maven-antrun-plugin</artifactId>
20
<!--        <executions>-->
21
<!--          <execution>-->
22
<!--            <id>aspectj-main</id>-->
23
<!--            <phase>process-sources</phase>-->
24
<!--            <goals>-->
25
<!--              <goal>run</goal>-->
26
<!--            </goals>-->
27
<!--            <configuration>-->
28
<!--              <tasks>-->
29
<!--                <taskdef classname="org.aspectj.tools.ant.taskdefs.AjcTask" name="iajc">-->
30
<!--                  <classpath refid="maven.plugin.classpath" />-->
31
<!--                </taskdef>-->
32
<!--                <iajc verbose="false" source="1.5" destDir="target/classes">-->
33
<!--                  <classpath refid="maven.plugin.classpath" />-->
34
<!--                  <classpath refid="maven.compile.classpath" />-->
35
<!--                  <sourceroots>-->
36
<!--                    <pathelement location="src/main/java" />-->
37
<!--                  </sourceroots>-->
38
<!--                </iajc>-->
39
<!--              </tasks>-->
40
<!--            </configuration>-->
41
<!--          </execution>-->
42
<!--          <execution>-->
43
<!--            <id>aspectj-test</id>-->
44
<!--            <phase>process-test-sources</phase>-->
45
<!--            <goals>-->
46
<!--              <goal>run</goal>-->
47
<!--            </goals>-->
48
<!--            <configuration>-->
49
<!--              <tasks>-->
50
<!--                <taskdef classname="org.aspectj.tools.ant.taskdefs.AjcTask" name="iajc">-->
51
<!--                  <classpath refid="maven.plugin.classpath" />-->
52
<!--                </taskdef>-->
53
<!--                <iajc verbose="false" source="1.5" destDir="target/test-classes">-->
54
<!--                  <classpath refid="maven.plugin.classpath" />-->
55
<!--                  <classpath refid="maven.compile.classpath" />-->
56
<!--                  <classpath refid="maven.test.classpath" />-->
57
<!--                  <sourceroots>-->
58
<!--                    <pathelement location="src/test/java" />-->
59
<!--                  </sourceroots>-->
60
<!--                </iajc>-->
61
<!--              </tasks>-->
62
<!--            </configuration>-->
63
<!--          </execution>-->
64
<!--        </executions>-->
20
        <executions>
21
          <execution>
22
            <id>aspectj-main</id>
23
            <phase>process-sources</phase>
24
            <goals>
25
              <goal>run</goal>
26
            </goals>
27
            <configuration>
28
              <tasks>
29
                <property name="spring.aspects.jar" value="${settings.localRepository}/org/springframework/spring-aspects/2.5.6/spring-aspects-2.5.6.jar"/>
30
                <path id="aspectPath">
31
                  <pathelement location="${spring.aspects.jar}"/>
32
                </path>
33
                <taskdef classname="org.aspectj.tools.ant.taskdefs.AjcTask" name="iajc">
34
                  <classpath refid="maven.plugin.classpath" />
35
                </taskdef>
36
                <iajc verbose="false" source="1.5" destDir="target/classes"
37
                  aspectPathRef="aspectPath">
38
                  <classpath refid="maven.plugin.classpath" />
39
                  <classpath refid="maven.compile.classpath" />
40
                  <sourceroots>
41
                    <pathelement location="src/main/java" />
42
                  </sourceroots>
43
                </iajc>
44
              </tasks>
45
            </configuration>
46
          </execution>
47
          <execution>
48
            <id>aspectj-test</id>
49
            <phase>process-test-sources</phase>
50
            <goals>
51
              <goal>run</goal>
52
            </goals>
53
            <configuration>
54
              <tasks>
55
                <taskdef classname="org.aspectj.tools.ant.taskdefs.AjcTask" name="iajc">
56
                  <classpath refid="maven.plugin.classpath" />
57
                </taskdef>
58
                <iajc verbose="false" source="1.5" destDir="target/test-classes">
59
                  <classpath refid="maven.plugin.classpath" />
60
                  <classpath refid="maven.compile.classpath" />
61
                  <classpath refid="maven.test.classpath" />
62
                  <sourceroots>
63
                    <pathelement location="src/test/java" />
64
                  </sourceroots>
65
                </iajc>
66
              </tasks>
67
            </configuration>
68
          </execution>
69
        </executions>
65 70
        <dependencies>
66 71
          <dependency>
67 72
            <groupId>org.aspectj</groupId>
68 73
            <artifactId>aspectjtools</artifactId>
69
            <version>1.5.4</version>
74
            <version>1.6.3</version>
70 75
          </dependency>
71 76
          <dependency>
72 77
            <groupId>org.aspectj</groupId>
73 78
            <artifactId>aspectjrt</artifactId>
74
            <version>1.5.4</version>
79
            <version>1.6.3</version>
75 80
          </dependency>
76 81
        </dependencies>
77 82
      </plugin>
......
138 143
      <groupId>org.springframework</groupId>
139 144
      <artifactId>spring-test</artifactId>
140 145
    </dependency>
146
    <dependency>
147
      <groupId>org.springframework</groupId>
148
      <artifactId>spring-aspects</artifactId>
149
    </dependency>
141 150
    <dependency>
142 151
      <groupId>net.sf.opencsv</groupId>
143 152
      <artifactId>opencsv</artifactId>
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/ClassAdapter.java
1
package eu.etaxonomy.cdm.jaxb;
2

  
3
import javax.xml.bind.annotation.adapters.XmlAdapter;
4

  
5
public class ClassAdapter extends XmlAdapter<String, Class> {
6

  
7
	@Override
8
	public String marshal(Class clazz) throws Exception {
9
		return clazz.getCanonicalName();
10
	}
11

  
12
	@Override
13
	public Class unmarshal(String string) throws Exception {
14
		return Class.forName(string);
15
	}
16

  
17
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/Namespace.java
1
package eu.etaxonomy.cdm.jaxb;
2

  
3
import javax.xml.bind.annotation.XmlAccessType;
4
import javax.xml.bind.annotation.XmlAccessorType;
5
import javax.xml.bind.annotation.XmlElement;
6
import javax.xml.bind.annotation.XmlType;
7
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
8

  
9
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
10

  
11
@XmlAccessorType(XmlAccessType.FIELD)
12
@XmlType(name = "Namespace", namespace="http://etaxonomy.eu/cdm/model/common/1.0", propOrder = {
13
    "nspace",
14
	"clazz"
15
})
16
public class Namespace {
17

  
18
	@XmlElement(name = "NSpace", namespace="http://etaxonomy.eu/cdm/model/common/1.0", required = true)
19
	private String nspace;
20
	
21
	@XmlElement(name = "Class", namespace="http://etaxonomy.eu/cdm/model/common/1.0", required = true)
22
	@XmlJavaTypeAdapter(ClassAdapter.class)
23
	private Class<? extends IIdentifiableEntity> clazz;
24

  
25
	public String getNSpace() {
26
		return nspace;
27
	}
28

  
29
	public void setNSpace(String nspace) {
30
		this.nspace = nspace;
31
	}
32

  
33
	public Class<? extends IIdentifiableEntity> getClazz() {
34
		return clazz;
35
	}
36

  
37
	public void setClazz(Class<? extends IIdentifiableEntity> clazz) {
38
		this.clazz = clazz;
39
	}
40
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/NamespacesAdapter.java
1
/**
2
* Copyright (C) 2009 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.jaxb;
11

  
12
import java.util.Map;
13
import java.util.concurrent.ConcurrentHashMap;
14

  
15
import javax.xml.bind.annotation.adapters.XmlAdapter;
16

  
17
import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
18

  
19
/**
20
 * @author a.babadshanjan
21
 * @version 1.0
22
 */
23
public class NamespacesAdapter extends XmlAdapter<NamespacesElement, Map<String,Class<? extends IIdentifiableEntity>>> {
24

  
25
	@Override
26
	public NamespacesElement marshal(Map<String,Class<? extends IIdentifiableEntity>> value)
27
			throws Exception {
28
		
29
		NamespacesElement namespacesElement = new NamespacesElement();
30
		
31
		for(String s : value.keySet()) {
32
			Namespace namespace = new Namespace();
33
			namespace.setNSpace(s);
34
			namespace.setClazz(value.get(s));
35
			namespacesElement.getNamespace().add(namespace);
36
		}
37
		return namespacesElement;
38
	}
39

  
40
    @Override
41
	public Map<String,Class<? extends IIdentifiableEntity>> unmarshal(NamespacesElement value)
42
			throws Exception {
43
		
44
        Map<String, Class<? extends IIdentifiableEntity>> map = new ConcurrentHashMap<String, Class<? extends IIdentifiableEntity>>();
45
		
46
		for(Namespace n : value.getNamespace()) {
47
			map.put(n.getNSpace(),n.getClazz());
48
		}
49
		return map;
50
	}
51
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/NamespacesElement.java
1
//
2
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1-b02-fcs 
3
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
4
// Any modifications to this file will be lost upon recompilation of the source schema. 
5
// Generated on: 2007.12.21 at 08:13:35 PM GMT 
6
//
7

  
8

  
9
package eu.etaxonomy.cdm.jaxb;
10

  
11
import java.util.ArrayList;
12
import java.util.List;
13

  
14
import javax.xml.bind.annotation.XmlAccessType;
15
import javax.xml.bind.annotation.XmlAccessorType;
16
import javax.xml.bind.annotation.XmlElement;
17
import javax.xml.bind.annotation.XmlType;
18

  
19

  
20
/**
21
 * <p>Java class for Namespaces complex type.
22
 */
23
@XmlAccessorType(XmlAccessType.FIELD)
24
@XmlType(name = "Namespaces", namespace="http://etaxonomy.eu/cdm/model/common/1.0", propOrder = {
25
    "namespace"
26
})
27
public class NamespacesElement {
28

  
29
    @XmlElement(name = "Namespace", namespace="http://etaxonomy.eu/cdm/model/common/1.0", required = true)
30
    protected List<Namespace> namespace = new ArrayList<Namespace>();
31

  
32
    /**
33
     * Gets the value of the languageString property.
34
     * 
35
     * <p>
36
     * This accessor method returns a reference to the live list,
37
     * not a snapshot. Therefore any modification you make to the
38
     * returned list will be present inside the JAXB object.
39
     * This is why there is not a <CODE>set</CODE> method for the languageString property.
40
     * 
41
     * <p>
42
     * For example, to add a new item, do as follows:
43
     * <pre>
44
     *    getLanguageString().add(newItem);
45
     * </pre>
46
     * 
47
     * 
48
     * <p>
49
     * Objects of the following type(s) are allowed in the list
50
     * {@link Namespace }
51
     * 
52
     * 
53
     */
54
    public List<Namespace> getNamespace() {
55
        return this.namespace;
56
    }
57

  
58
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/jaxb/PartialAdapter.java
73 73
				dateTimeFieldTypes[1] = DateTimeFieldType.monthOfYear();
74 74
				values[1] = Integer.parseInt(matcher.group(2));
75 75
			case 1:
76
				dateTimeFieldTypes[0] = DateTimeFieldType.yearOfEra();
76
				dateTimeFieldTypes[0] = DateTimeFieldType.year();
77 77
				values[0] = Integer.parseInt(matcher.group(1));
78 78
			}
79 79
			return new Partial(dateTimeFieldTypes, values);
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/AgentBase.java
11 11

  
12 12
import javax.persistence.Embedded;
13 13
import javax.persistence.Entity;
14
import javax.persistence.Transient;
14 15
import javax.xml.bind.annotation.XmlAccessType;
15 16
import javax.xml.bind.annotation.XmlAccessorType;
16 17
import javax.xml.bind.annotation.XmlElement;
18
import javax.xml.bind.annotation.XmlTransient;
17 19
import javax.xml.bind.annotation.XmlType;
18 20

  
19 21
import org.hibernate.annotations.Index;
......
21 23
import org.hibernate.envers.Audited;
22 24

  
23 25
import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity;
26
import eu.etaxonomy.cdm.strategy.cache.agent.INomenclaturalAuthorCacheStrategy;
27
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
24 28

  
25 29
/**
26 30
 * The upmost (abstract) class for agents such as persons, teams or institutions.
......
40 44
@Entity
41 45
@Audited
42 46
@Table(appliesTo="AgentBase", indexes = { @Index(name = "agentTitleCacheIndex", columnNames = { "titleCache" }) })
43
public abstract class AgentBase extends IdentifiableMediaEntity{
47
public abstract class AgentBase<S extends IIdentifiableEntityCacheStrategy> extends IdentifiableMediaEntity<S>{
44 48

  
45 49
	/**
46 50
	 * 
......
66 70
	public void setContact(Contact contact){
67 71
		this.contact = contact;
68 72
	}
69

  
70 73
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Contact.java
9 9

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

  
12
import java.io.Serializable;
12 13
import java.util.ArrayList;
13 14
import java.util.HashSet;
14 15
import java.util.List;
......
56 57
@XmlRootElement(name = "Contact")
57 58
@Embeddable
58 59
@Audited
59
public class Contact {
60
public class Contact implements Serializable {
60 61
	private static final long serialVersionUID = -1851305307069277625L;
61 62
	private static final Logger logger = Logger.getLogger(Contact.class);
62 63
	
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Institution.java
17 17
import javax.persistence.FetchType;
18 18
import javax.persistence.ManyToMany;
19 19
import javax.persistence.ManyToOne;
20
import javax.persistence.Transient;
20 21
import javax.xml.bind.annotation.XmlAccessType;
21 22
import javax.xml.bind.annotation.XmlAccessorType;
22 23
import javax.xml.bind.annotation.XmlElement;
......
24 25
import javax.xml.bind.annotation.XmlIDREF;
25 26
import javax.xml.bind.annotation.XmlRootElement;
26 27
import javax.xml.bind.annotation.XmlSchemaType;
28
import javax.xml.bind.annotation.XmlTransient;
27 29
import javax.xml.bind.annotation.XmlType;
28 30

  
29 31
import org.apache.log4j.Logger;
30 32
import org.hibernate.annotations.Cascade;
31 33
import org.hibernate.annotations.CascadeType;
32 34
import org.hibernate.envers.Audited;
35
import org.springframework.beans.factory.annotation.Configurable;
36

  
37
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
38
import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
33 39

  
34 40
/**
35 41
 * This class represents public or private institutions.
......
55 61
@XmlRootElement(name = "Institution")
56 62
@Entity
57 63
@Audited
58
public class Institution extends AgentBase {
64
@Configurable
65
public class Institution extends AgentBase<IIdentifiableEntityCacheStrategy<Institution>> {
59 66
	private static final long serialVersionUID = -951321271656955808L;
60 67
	public static final Logger logger = Logger.getLogger(Institution.class);
61 68
	
......
92 99
	 */
93 100
	public Institution() {
94 101
		super();
102
		this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy<Institution>();
95 103
	}
96 104

  
97 105
	/** 
......
175 183
	public void setName(String name){
176 184
		this.name = name;
177 185
	}
178

  
179
	/**
180
	 * Generates the identification string for this institution.
181
	 * The string is based on its name and code as well as on the name and code of
182
	 * its parent institution, if existing.
183
	 * This method overrides {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle() generateTitle}.
184
	 * The result might be kept as {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#setTitleCache(String) titleCache} if the
185
	 * flag {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#protectedTitleCache protectedTitleCache} is not set.
186
	 * 
187
	 * @return  the identification string
188
	 */
189
	@Override
190
	public String generateTitle(){
191
		return "";
192
	}
193

  
194 186
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Person.java
17 17
import org.hibernate.annotations.Cascade;
18 18
import org.hibernate.annotations.CascadeType;
19 19
import org.hibernate.envers.Audited;
20
import org.springframework.beans.factory.annotation.Configurable;
20 21

  
21 22
import java.util.*;
22 23
import javax.persistence.*;
......
62 63
@XmlRootElement(name = "Person")
63 64
@Entity
64 65
@Audited
66
@Configurable
65 67
public class Person extends TeamOrPersonBase<Person> {
66 68
	private static final long serialVersionUID = 4153566493065539763L;
67 69
	public static final Logger logger = Logger.getLogger(Person.class);
......
318 320
		this.lifespan = lifespan;
319 321
	}
320 322

  
321
	/**
322
	 * Generates the "full" name string of <i>this</i> person according to the strategy
323
	 * defined in {@link eu.etaxonomy.cdm.strategy.cache.agent.PersonDefaultCacheStrategy PersonDefaultCacheStrategy}.
324
	 * The used attributes are:
325
	 * {@link #getPrefix() prefix}, {@link #getFirstname() firstname}, {@link #getLastname() lastname} and {@link #getSuffix() suffix}.
326
	 * This method overrides {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle() generateTitle}.
327
	 * The result might be kept as {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#setTitleCache(String) titleCache} if the
328
	 * flag {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#protectedTitleCache protectedTitleCache} is not set.
329
	 * 
330
	 * @return  the string with the full name of <i>this</i> person
331
	 */
332
	@Override
333
	public String generateTitle() {
334
		String title = null;
335
		if (cacheStrategy != null) {
336
		title = cacheStrategy.getTitleCache(this);
337
		} 
338
        return title;
339
	}
323
//	/**
324
//	 * Generates the "full" name string of <i>this</i> person according to the strategy
325
//	 * defined in {@link eu.etaxonomy.cdm.strategy.cache.agent.PersonDefaultCacheStrategy PersonDefaultCacheStrategy}.
326
//	 * The used attributes are:
327
//	 * {@link #getPrefix() prefix}, {@link #getFirstname() firstname}, {@link #getLastname() lastname} and {@link #getSuffix() suffix}.
328
//	 * This method overrides {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle() generateTitle}.
329
//	 * The result might be kept as {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#setTitleCache(String) titleCache} if the
330
//	 * flag {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity#protectedTitleCache protectedTitleCache} is not set.
331
//	 * 
332
//	 * @return  the string with the full name of <i>this</i> person
333
//	 */
334
//	@Override
335
//	public String generateTitle() {
336
//		String title = null;
337
//		if (cacheStrategy != null) {
338
//		title = cacheStrategy.getTitleCache(this);
339
//		} 
340
//        return title;
341
//	}
340 342

  
341 343
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/Team.java
30 30
import org.hibernate.annotations.CascadeType;
31 31
import org.hibernate.annotations.IndexColumn;
32 32
import org.hibernate.envers.Audited;
33
import org.springframework.beans.factory.annotation.Configurable;
33 34

  
34 35
import eu.etaxonomy.cdm.strategy.cache.agent.TeamDefaultCacheStrategy;
35 36

  
......
60 61
@XmlRootElement
61 62
@Entity
62 63
@Audited
64
@Configurable
63 65
public class Team extends TeamOrPersonBase<Team> {
64 66
	private static final long serialVersionUID = 97640416905934622L;
65 67
	public static final Logger logger = Logger.getLogger(Team.class);
......
156 158
	 * 
157 159
	 * @return  a string which identifies <i>this</i> team
158 160
	 */
159
	@Override
160
	public String generateTitle() {
161
		return cacheStrategy.getTitleCache(this);
162
	}
161
//	@Override
162
//	public String generateTitle() {
163
//		return cacheStrategy.getTitleCache(this);
164
//	}
163 165
	
164 166
	
165 167
	/**
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/agent/TeamOrPersonBase.java
36 36
})
37 37
@Entity
38 38
@Audited
39
public abstract class TeamOrPersonBase<T extends TeamOrPersonBase<?>> extends AgentBase implements INomenclaturalAuthor {
39
public abstract class TeamOrPersonBase<T extends TeamOrPersonBase<?>> extends AgentBase<INomenclaturalAuthorCacheStrategy<T>> implements INomenclaturalAuthor {
40 40
	private static final long serialVersionUID = 5216821307314001961L;
41 41
	public static final Logger logger = Logger.getLogger(TeamOrPersonBase.class);
42 42

  
43 43
	@XmlElement(name="NomenclaturalTitle")
44 44
	protected String nomenclaturalTitle;
45
	
46
	@XmlTransient
47
	@Transient
48
	protected INomenclaturalAuthorCacheStrategy<T> cacheStrategy;
49 45

  
50 46
	/**
51 47
	 * Returns the identification string (nomenclatural abbreviation) used in
......
63 59
	public void setNomenclaturalTitle(String nomenclaturalTitle) {
64 60
		this.nomenclaturalTitle = nomenclaturalTitle;
65 61
	}
66

  
67 62
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/AnnotatableEntity.java
71 71
		}
72 72
	}
73 73
	public void removeMarker(Marker marker){
74
		marker.setMarkedObj(null);
74
		if(this.markers.contains(marker)) {
75
		    this.markers.remove(marker);
76
		    marker.setMarkedObj(null);
77
		}
75 78
	}
76 79

  
77 80
//*************** ANNOTATIONS **********************************************
......
87 90
	}
88 91
	
89 92
	public void removeAnnotation(Annotation annotation){
90
		this.annotations.remove(annotation);
91
		annotation.setAnnotatedObj(null);
93
		if(this.annotations.contains(annotation)) {
94
		    this.annotations.remove(annotation);
95
		    annotation.setAnnotatedObj(null);
96
		}
92 97
	}
93 98
	
94 99
//********************** CLONE *****************************************/
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/IdentifiableEntity.java
20 20
import javax.persistence.FetchType;
21 21
import javax.persistence.MappedSuperclass;
22 22
import javax.persistence.OneToMany;
23
import javax.persistence.Transient;
23 24
import javax.xml.bind.annotation.XmlAccessType;
24 25
import javax.xml.bind.annotation.XmlAccessorType;
25 26
import javax.xml.bind.annotation.XmlElement;
......
43 44
import eu.etaxonomy.cdm.model.name.NonViralName;
44 45
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
45 46
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
47
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
46 48

  
47 49
/**
48 50
 * Superclass for the primary CDM classes that can be referenced from outside via LSIDs and contain a simple generated title string as a label for human reading.
......
67 69
    "sources"
68 70
})
69 71
@MappedSuperclass
70
public abstract class IdentifiableEntity extends AnnotatableEntity 
72
public abstract class IdentifiableEntity<S extends IIdentifiableEntityCacheStrategy> extends AnnotatableEntity 
71 73
implements ISourceable, IIdentifiableEntity, Comparable<IdentifiableEntity> {
72 74
	private static final long serialVersionUID = -5610995424730659058L;
73 75
	private static final Logger logger = Logger.getLogger(IdentifiableEntity.class);
......
119 121
    @OneToMany(fetch = FetchType.LAZY)		
120 122
	@Cascade({CascadeType.SAVE_UPDATE})
121 123
	private Set<OriginalSource> sources = new HashSet<OriginalSource>();
122

  
124
    
125
    @XmlTransient
126
	@Transient
127
	protected S cacheStrategy;
123 128
	
124 129
	/* (non-Javadoc)
125 130
	 * @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#getLsid()
......
144 149
		return null;
145 150
	}
146 151

  
147
	/* (non-Javadoc)
148
	 * @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#generateTitle()
149
	 */
150
	public abstract String generateTitle();
151

  
152 152
	/* (non-Javadoc)
153 153
	 * @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#getTitleCache()
154 154
	 */
......
426 426
		}
427 427
		return result;
428 428
	}
429
	
430
	/**
431
	 * Returns the {@link eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy cache strategy} used to generate
432
	 * several strings corresponding to <i>this</i> identifiable entity
433
	 * (in particular taxon name caches and author strings).
434
	 * 
435
	 * @return  the cache strategy used for <i>this</i> identifiable entity
436
	 * @see     eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
437
	 */
438
	public S getCacheStrategy() {
439
		return this.cacheStrategy;
440
	}
441
	/** 
442
	 * @see 	#getCacheStrategy()
443
	 */
444
	
445
	public void setCacheStrategy(S cacheStrategy) {
446
		this.cacheStrategy = cacheStrategy;
447
	}
448
	
449
	public String generateTitle() {
450
		if (cacheStrategy == null){
451
			logger.warn("No CacheStrategy defined for "+ this.getClass() + ": " + this.getUuid());
452
			return null;
453
		}else{
454
			return cacheStrategy.getTitleCache(this);
455
		}
456
	}
429 457
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/LSID.java
1 1
package eu.etaxonomy.cdm.model.common;
2 2

  
3
import java.io.Serializable;
3 4
import java.util.NoSuchElementException;
4 5
import java.util.StringTokenizer;
5 6

  
6 7
import javax.persistence.Embeddable;
7
import javax.persistence.FetchType;
8
import javax.persistence.ManyToOne;
9 8

  
10 9
import com.ibm.lsid.MalformedLSIDException;
11 10

  
......
19 18
 * @see com.ibm.lsid.client.LSID
20 19
 */
21 20
@Embeddable
22
public class LSID {
21
public class LSID implements Serializable {
23 22

  
24 23
	private String lsid;
25 24
	
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/LSIDAuthority.java
7 7
import javax.persistence.FetchType;
8 8
import javax.persistence.Transient;
9 9
import javax.wsdl.Definition;
10
import javax.xml.bind.annotation.XmlAccessType;
11
import javax.xml.bind.annotation.XmlAccessorType;
12
import javax.xml.bind.annotation.XmlElement;
13
import javax.xml.bind.annotation.XmlRootElement;
14
import javax.xml.bind.annotation.XmlTransient;
15
import javax.xml.bind.annotation.XmlType;
16
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
10 17

  
11 18
import org.hibernate.annotations.CollectionOfElements;
12 19
import org.hibernate.annotations.NaturalId;
13 20
import org.hibernate.annotations.Type;
14 21
import org.hibernate.annotations.TypeDef;
15 22
import org.hibernate.annotations.TypeDefs;
23
import org.hibernate.envers.Audited;
16 24

  
17 25
import com.ibm.lsid.MalformedLSIDException;
18 26

  
27
import eu.etaxonomy.cdm.jaxb.NamespacesAdapter;
28

  
29
@XmlAccessorType(XmlAccessType.FIELD)
30
@XmlType(name = "LSIDAuthority", propOrder = {
31
		"authority",
32
		"server",
33
		"port",
34
		"url",
35
		"namespaces"
36
})
37
@XmlRootElement(name = "LSIDAuthority")
19 38
@Entity
20 39
@TypeDefs(@TypeDef(name="wsdlDefinitionUserType", typeClass=WSDLDefinitionUserType.class))
21 40
public class LSIDAuthority extends CdmBase {
......
30 49
	private static final String AUTHORITY_PROTOCOL="http";
31 50
    private static final String AUTHORITY_PATH="/authority/";
32 51

  
52
    @XmlElement(name = "Authority")
33 53
    @NaturalId
34 54
	private String authority;
35 55
	
36 56
	// the resolved components of the lsid
57
    @XmlElement(name = "Server")
37 58
	private String server;
59
    @XmlElement(name = "Port")
38 60
	private int port = -1;
61
    @XmlElement(name = "Url")
39 62
	private String url;
40 63
	
41 64
	// the wsdl describing how to invoke operations on the authority
65
    @XmlTransient
42 66
	@Type(type = "wsdlDefinitionUserType")
43 67
	private Definition authorityWSDL;
44 68
	
69
    @XmlElement(name = "Namespaces")
70
    @XmlJavaTypeAdapter(NamespacesAdapter.class)
45 71
	@CollectionOfElements(fetch = FetchType.LAZY)
46 72
	private Map<String,Class<? extends IIdentifiableEntity>> namespaces = new HashMap<String,Class<? extends IIdentifiableEntity>>();
47 73
	
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TermBase.java
45 45
	
46 46
	@XmlElementWrapper(name = "Representations")
47 47
	@XmlElement(name = "Representation")
48
    @OneToMany(fetch=FetchType.LAZY)
48
    @OneToMany(fetch=FetchType.EAGER)
49 49
	@Cascade( { CascadeType.SAVE_UPDATE, CascadeType.DELETE })
50 50
	private Set<Representation> representations = new HashSet<Representation>();
51 51
	
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TimePeriod.java
9 9

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

  
12
import java.io.Serializable;
12 13
import java.util.Calendar;
13 14

  
14 15
import javax.persistence.Embeddable;
......
43 44
})
44 45
@XmlRootElement(name = "TimePeriod")
45 46
@Embeddable
46
public class TimePeriod implements Cloneable {
47
public class TimePeriod implements Cloneable, Serializable {
47 48
	private static final Logger logger = Logger.getLogger(TimePeriod.class);
48 49
	private static final DateTimeFieldType monthType = DateTimeFieldType.monthOfYear();
49 50
	private static final DateTimeFieldType yearType = DateTimeFieldType.year();
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/User.java
17 17
import javax.persistence.FetchType;
18 18
import javax.persistence.ManyToMany;
19 19
import javax.persistence.OneToOne;
20
import javax.persistence.Table;
20 21
import javax.persistence.Transient;
21 22
import javax.xml.bind.annotation.XmlAccessType;
22 23
import javax.xml.bind.annotation.XmlAccessorType;
......
28 29
import javax.xml.bind.annotation.XmlTransient;
29 30
import javax.xml.bind.annotation.XmlType;
30 31

  
32
import org.hibernate.annotations.Cascade;
33
import org.hibernate.annotations.CascadeType;
31 34
import org.hibernate.annotations.NaturalId;
32 35
import org.hibernate.envers.Audited;
33 36
import org.hibernate.envers.NotAudited;
......
52 55
@XmlRootElement(name = "User")
53 56
@Entity
54 57
@Audited
58
@Table(name = "UserAccount")
55 59
public class User extends CdmBase implements UserDetails {
56 60

  
57 61
	/**
......
105 109
	@XmlIDREF
106 110
	@XmlSchemaType(name = "IDREF")
107 111
	@OneToOne(fetch = FetchType.LAZY)
112
	@Cascade({CascadeType.SAVE_UPDATE})
108 113
	protected Person person;
109 114
	
110 115
	@XmlTransient
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/DescriptionBase.java
44 44
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
45 45
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
46 46
import eu.etaxonomy.cdm.model.taxon.Taxon;
47
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
47 48

  
48 49
/**
49 50
 * The upmost (abstract) class for a description as a whole (with possibly
......
72 73
@Entity
73 74
@Audited
74 75
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
75
public abstract class DescriptionBase extends IdentifiableEntity {
76
public abstract class DescriptionBase<S extends IIdentifiableEntityCacheStrategy> extends IdentifiableEntity<S> {
76 77
	private static final long serialVersionUID = 5504218413819040193L;
77 78
	private static final Logger logger = Logger.getLogger(DescriptionBase.class);
78 79
	
......
303 304
	 * @see  	eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle()
304 305
	 * @see  	eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
305 306
	 */
306
	@Override
307
	public String generateTitle() {
308
		//TODO generate title "generate Title not yet implemented"
309
		return this.toString();
310
	}
307
//	@Override
308
//	public String generateTitle() {
309
//		//TODO generate title "generate Title not yet implemented"
310
//		return this.toString();
311
//	}
311 312

  
312
	/**
313
    /**
313 314
	 * @return the imageGallery
314 315
	 */
315 316
	public boolean isImageGallery() {
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/IdentificationKey.java
55 55
	@SuppressWarnings("unused")
56 56
	private static final Logger logger = Logger.getLogger(IdentificationKey.class);
57 57
	
58
	/*
59
     * FIXME - shouldn't this be @ManyToMany - i.e. many keys can refer to the
60
	 * same taxon and some taxa will be covered by multiple keys?
61
	 */
62 58
	@XmlElementWrapper(name = "CoveredTaxa")
63 59
	@XmlElement(name = "CoveredTaxon")
64 60
	@XmlIDREF
65 61
	@XmlSchemaType(name = "IDREF")
66
	@OneToMany(fetch = FetchType.LAZY)
62
	@ManyToMany(fetch = FetchType.LAZY)
67 63
	private Set<Taxon> coveredTaxa = new HashSet<Taxon>();
68 64
	
69 65
	@XmlElementWrapper( name = "GeoScopes")
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/SpecimenDescription.java
18 18
import org.apache.log4j.Logger;
19 19
import org.hibernate.envers.Audited;
20 20
import org.hibernate.search.annotations.Indexed;
21
import org.springframework.beans.factory.annotation.Configurable;
21 22

  
22 23
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
24
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
25
import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
23 26

  
24 27
/**
25 28
 * This class represents descriptions for {@link SpecimenOrObservationBase specimens or observations}.
......
37 40
@Entity
38 41
@Indexed(index = "eu.etaxonomy.cdm.model.description.DescriptionBase")
39 42
@Audited
40
public class SpecimenDescription extends DescriptionBase {
43
@Configurable
44
public class SpecimenDescription extends DescriptionBase<IIdentifiableEntityCacheStrategy<SpecimenDescription>> {
41 45
	private static final long serialVersionUID = -8506790426682192703L;
42 46
	@SuppressWarnings("unused")
43 47
	private static final Logger logger = Logger.getLogger(SpecimenDescription.class);
......
48 52
	 */
49 53
	public SpecimenDescription() {
50 54
		super();
55
		this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy<SpecimenDescription>();
51 56
	}
52 57
	
53 58

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TaxonDescription.java
35 35
import org.hibernate.annotations.CascadeType;
36 36
import org.hibernate.envers.Audited;
37 37
import org.hibernate.search.annotations.Indexed;
38
import org.springframework.beans.factory.annotation.Configurable;
38 39

  
39 40
import eu.etaxonomy.cdm.model.location.NamedArea;
40 41
import eu.etaxonomy.cdm.model.taxon.Taxon;
42
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
43
import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
41 44

  
42 45
/**
43 46
 * This class represents descriptions that delimit or circumscribe a real taxon.
......
62 65
@Entity
63 66
@Indexed(index = "eu.etaxonomy.cdm.model.description.DescriptionBase")
64 67
@Audited
65
public class TaxonDescription extends DescriptionBase {
68
@Configurable
69
public class TaxonDescription extends DescriptionBase<IIdentifiableEntityCacheStrategy<TaxonDescription>> {
66 70
	private static final long serialVersionUID = 8065879180505546803L;
67 71
	@SuppressWarnings("unused")
68 72
	private static final Logger logger = Logger.getLogger(TaxonDescription.class);
......
101 105
	 */
102 106
	public TaxonDescription(){
103 107
		super();
108
		this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy<TaxonDescription>();
104 109
	}
105 110
	
106 111
	/**
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TaxonNameDescription.java
26 26
import org.hibernate.annotations.CascadeType;
27 27
import org.hibernate.envers.Audited;
28 28
import org.hibernate.search.annotations.Indexed;
29
import org.springframework.beans.factory.annotation.Configurable;
29 30

  
30 31
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
31 32
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
33
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
34
import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
32 35

  
33 36
/**
34 37
 * This class represents all piece of information (not ruled by a {@link NomenclaturalCode nomenclatural code})
......
47 50
@Entity
48 51
@Indexed(index = "eu.etaxonomy.cdm.model.description.DescriptionBase")
49 52
@Audited
50
public class TaxonNameDescription extends DescriptionBase {
53
@Configurable
54
public class TaxonNameDescription extends DescriptionBase<IIdentifiableEntityCacheStrategy<TaxonNameDescription>> {
51 55
	private static final long serialVersionUID = -7349160369642038687L;
52 56
	@SuppressWarnings("unused")
53 57
	private static final Logger logger = Logger.getLogger(TaxonNameDescription.class);
......
65 69
	 */
66 70
	public TaxonNameDescription() {
67 71
		super();
72
		this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy();
68 73
	}
69 74
	
70 75
	/**
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/TextData.java
71 71
	@XmlElement(name = "MultiLanguageText")
72 72
    @XmlJavaTypeAdapter(MultilanguageTextAdapter.class)
73 73
    @OneToMany (fetch= FetchType.LAZY)
74
	@MapKey(name="language")
75 74
    @Cascade({CascadeType.SAVE_UPDATE})
76 75
    @IndexedEmbedded
77 76
	private Map<Language, LanguageString> multilanguageText = new HashMap<Language,LanguageString>();
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/location/Point.java
8 8
*/
9 9

  
10 10
package eu.etaxonomy.cdm.model.location;
11
import java.io.Serializable;
12

  
11 13
import javax.persistence.Embeddable;
12 14
import javax.persistence.FetchType;
13 15
import javax.persistence.ManyToOne;
......
38 40
})
39 41
@XmlRootElement(name = "Point")
40 42
@Embeddable
41
public class Point implements Cloneable {
43
public class Point implements Cloneable, Serializable {
42 44
	private static final Logger logger = Logger.getLogger(Point.class);
43 45
	
44 46
	//TODO was Float but H2 threw errors
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/media/IdentifiableMediaEntity.java
19 19
import org.hibernate.annotations.CascadeType;
20 20

  
21 21
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
22
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
22 23

  
23 24
@XmlAccessorType(XmlAccessType.FIELD)
24 25
@XmlType(name = "IdentifiableMediaEntity", propOrder = {
25 26
    "media"
26 27
})
27 28
@MappedSuperclass
28
public abstract class IdentifiableMediaEntity extends IdentifiableEntity implements IMediaDocumented, IMediaEntity{
29
public abstract class IdentifiableMediaEntity<S extends IIdentifiableEntityCacheStrategy> extends IdentifiableEntity<S> implements IMediaDocumented, IMediaEntity{
29 30

  
30 31
	private static final long serialVersionUID = 4038647011021908313L;
31 32

  
32
	static Logger logger = Logger.getLogger(IdentifiableMediaEntity.class);
33
	protected static Logger logger = Logger.getLogger(IdentifiableMediaEntity.class);
33 34

  
34 35
    @XmlElementWrapper(name = "Media")
35 36
    @XmlElement(name = "Medium")
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/molecular/Sequence.java
15 15
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
16 16
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
17 17
import eu.etaxonomy.cdm.model.common.IReferencedEntity;
18
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
19
import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
20

  
18 21
import org.apache.log4j.Logger;
19 22
import org.hibernate.annotations.Cascade;
20 23
import org.hibernate.annotations.CascadeType;
21 24
import org.hibernate.annotations.Index;
22 25
import org.hibernate.annotations.Table;
23 26
import org.hibernate.envers.Audited;
27
import org.springframework.beans.factory.annotation.Configurable;
24 28

  
25 29
import java.util.*;
26 30

  
......
56 60
@XmlRootElement(name = "Sequence")
57 61
@Entity
58 62
@Audited
63
@Configurable
59 64
@Table(appliesTo="Sequence", indexes = { @Index(name = "sequenceTitleCacheIndex", columnNames = { "titleCache" }) })
60
public class Sequence extends IdentifiableEntity implements IReferencedEntity, IMediaDocumented{
65
public class Sequence extends IdentifiableEntity<IIdentifiableEntityCacheStrategy<Sequence>> implements IReferencedEntity, IMediaDocumented{
61 66
	private static final long serialVersionUID = 8298983152731241775L;
62 67
	private static final Logger logger = Logger.getLogger(Sequence.class);
63 68
	
......
115 120
    @OneToMany(fetch = FetchType.LAZY)
116 121
	private Set<Media> chromatograms = new HashSet<Media>();
117 122
	
123
	protected Sequence() {
124
		super(); // FIXME I think this is explicit - do we really need to call this?
125
		this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy<Sequence>();
126
	}
127
	
118 128
	public Locus getLocus(){
119 129
		logger.debug("getLocus");
120 130
		return this.locus;
......
234 244
		this.citationMicroReference = citationMicroReference;
235 245
	}
236 246

  
237
	@Override
238
	public String generateTitle(){
239
		return "";
240
	}
241

  
242 247
	public ReferenceBase getCitation(){
243 248
		return publishedIn;
244 249
	}
245

  
246 250
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BacterialName.java
21 21
import org.apache.log4j.Logger;
22 22
import org.hibernate.envers.Audited;
23 23
import org.hibernate.search.annotations.Indexed;
24
import org.springframework.beans.factory.annotation.Configurable;
24 25

  
25 26
/**
26 27
 * The taxon name class for bacteria.
......
40 41
@Entity
41 42
@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
42 43
@Audited
44
@Configurable
43 45
public class BacterialName extends NonViralName<BacterialName> {
44 46
	
45 47
	/**
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/BotanicalName.java
29 29
import org.hibernate.annotations.CascadeType;
30 30
import org.hibernate.envers.Audited;
31 31
import org.hibernate.search.annotations.Indexed;
32
import org.springframework.beans.factory.annotation.Configurable;
32 33

  
33 34
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
34 35
import eu.etaxonomy.cdm.model.common.RelationshipBase;
......
59 60
@Entity
60 61
@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
61 62
@Audited
63
@Configurable
62 64
public class BotanicalName extends NonViralName<BotanicalName> {
63 65
	
64 66
	/**
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/CultivarPlantName.java
12 12
import org.apache.log4j.Logger;
13 13
import org.hibernate.envers.Audited;
14 14
import org.hibernate.search.annotations.Indexed;
15
import org.springframework.beans.factory.annotation.Configurable;
15 16

  
16 17
import javax.persistence.*;
17 18
import javax.xml.bind.annotation.XmlAccessType;
......
40 41
@Entity
41 42
@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
42 43
@Audited
44
@Configurable
43 45
public class CultivarPlantName extends BotanicalName {
44 46
	static Logger logger = Logger.getLogger(CultivarPlantName.class);
45 47
	
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NonViralName.java
32 32
import org.hibernate.search.annotations.Fields;
33 33
import org.hibernate.search.annotations.Index;
34 34
import org.hibernate.search.annotations.Indexed;
35
import org.springframework.beans.factory.annotation.Configurable;
35 36

  
36 37
import eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor;
37 38
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
......
76 77
@Entity
77 78
@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
78 79
@Audited
80
@Configurable
79 81
public class NonViralName<T extends NonViralName> extends TaxonNameBase<T, INonViralNameCacheStrategy> {
80 82
	
81 83
	private static final Logger logger = Logger.getLogger(NonViralName.class);
......
144 146
	@XmlElement(name = "ProtectedNameCache")
145 147
	protected boolean protectedNameCache;
146 148

  
147
    @XmlTransient
148
    @Transient
149
	protected INonViralNameCacheStrategy cacheStrategy;
149
//    @XmlTransient
150
//    @Transient
151
//	protected INonViralNameCacheStrategy cacheStrategy;
150 152
	
151 153
	// ************* CONSTRUCTORS *************/	
152 154
	
......
290 292
	 * @see 	eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
291 293
	 * @see     eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
292 294
	 */
293
	@Override
294
	@Transient
295
	public INonViralNameCacheStrategy getCacheStrategy() {
296
		return cacheStrategy;
297
	}
295
//	@Override
296
//	@Transient
297
//	public INonViralNameCacheStrategy getCacheStrategy() {
298
//		return cacheStrategy;
299
//	}
298 300
	
299 301
	/**
300 302
	 * @see  #getCacheStrategy()
301 303
	 */
302
	@Override
303
	public void setCacheStrategy(INonViralNameCacheStrategy cacheStrategy) {
304
		this.cacheStrategy = cacheStrategy;
305
	}
304
//	@Override
305
//	public void setCacheStrategy(INonViralNameCacheStrategy cacheStrategy) {
306
//		this.cacheStrategy = cacheStrategy;
307
//	}
306 308

  
307 309
	/**
308 310
	 * Returns the {@link eu.etaxonomy.cdm.model.agent.INomenclaturalAuthor author (team)} that published <i>this</i> non viral
......
499 501
	 * @see  	eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
500 502
	 * @see  	TaxonNameBase#generateTitle()
501 503
	 */
502
	@Override
503
	public String generateTitle(){
504
		if (cacheStrategy == null){
505
			logger.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
506
			return null;
507
		}else{
508
			return cacheStrategy.getTitleCache(this);
509
		}
510
	}
504
//	@Override
505
//	public String generateTitle(){
506
//		if (cacheStrategy == null){
507
//			logger.warn("No CacheStrategy defined for nonViralName: " + this.getUuid());
508
//			return null;
509
//		}else{
510
//			return cacheStrategy.getTitleCache(this);
511
//		}
512
//	}
511 513
	
512 514
	@Override
513 515
	public String generateFullTitle(){
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java
96 96
@Audited
97 97
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
98 98
@Table(appliesTo="TaxonNameBase", indexes = { @Index(name = "taxonNameBaseTitleCacheIndex", columnNames = { "titleCache" }) })
99
public abstract class TaxonNameBase<T extends TaxonNameBase<?,?>, S extends INameCacheStrategy> extends IdentifiableEntity implements IReferencedEntity, IParsable, IRelated {
99
public abstract class TaxonNameBase<T extends TaxonNameBase<?,?>, S extends INameCacheStrategy> extends IdentifiableEntity<S> implements IReferencedEntity, IParsable, IRelated {
100 100

  
101 101
	private static final long serialVersionUID = -4530368639601532116L;
102 102
	private static final Logger logger = Logger.getLogger(TaxonNameBase.class);
......
180 180
    @XmlElement(name = "Rank")
181 181
	@XmlIDREF
182 182
	@XmlSchemaType(name = "IDREF")
183
	@ManyToOne(fetch = FetchType.LAZY)
183
	@ManyToOne(fetch = FetchType.EAGER)
184 184
	private Rank rank;
185 185

  
186

  
187 186
	@XmlElement(name = "NomenclaturalReference")
188 187
    @XmlIDREF
189 188
    @XmlSchemaType(name = "IDREF")
......
606 605
		//TODO implement
607 606
		logger.warn("not yet implemented");
608 607
	}
609

  
610
	/**
611
	 * Returns the {@link eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy cache strategy} used to generate
612
	 * several strings corresponding to <i>this</i> taxon name
613
	 * (in particular taxon name caches and author strings).
614
	 * 
615
	 * @return  the cache strategy used for <i>this</i> taxon name
616
	 * @see 	eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
617
	 * @see     eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
618
	 */
619
	@Transient
620
	public abstract S getCacheStrategy();
621
	/** 
622
	 * @see 	#getCacheStrategy()
623
	 */
624
	
625
	public abstract void setCacheStrategy(S cacheStrategy);
626 608
	
627 609
	/** 
628 610
	 * Returns the taxonomic {@link Rank rank} of <i>this</i> taxon name.
......
1277 1259
	 * @see  	eu.etaxonomy.cdm.model.common.IdentifiableEntity#generateTitle()
1278 1260
	 * @see  	eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
1279 1261
	 */
1280
	@Override
1281
	public String generateTitle() {
1282
		// TODO Auto-generated method stub
1283
		logger.warn("not yet implemented");
1284
		return null;
1285
	}	
1262
//	@Override
1263
//	public abstract String generateTitle();
1286 1264
}
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/ViralName.java
24 24
import org.hibernate.search.annotations.Field;
25 25
import org.hibernate.search.annotations.Index;
26 26
import org.hibernate.search.annotations.Indexed;
27
import org.springframework.beans.factory.annotation.Configurable;
27 28

  
28 29
import eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy;
29 30

  
......
50 51
@Entity
51 52
@Indexed(index = "eu.etaxonomy.cdm.model.name.TaxonNameBase")
52 53
@Audited
54
@Configurable
53 55
public class ViralName extends TaxonNameBase<ViralName, INameCacheStrategy<ViralName>>  {
54 56
	
55 57
	private static final Logger logger = Logger.getLogger(ViralName.class);
56 58

  
57
    @XmlTransient
58
    @Transient
59
	protected INameCacheStrategy<ViralName> cacheStrategy;
59
//    @XmlTransient
60
//    @Transient
61
//	protected INameCacheStrategy<ViralName> cacheStrategy;
60 62
	
61 63
	@XmlElement(name = "Acronym")
62 64
	@Field(index=Index.TOKENIZED)
......
120 122
	 * @see  	eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()
121 123
	 * @see  	TaxonNameBase#generateTitle()
122 124
	 */
123
	@Override
124
	public String generateTitle(){
125
		logger.warn("not yet implemented");
126
		return this.toString();
127
	}
125
//	@Override
126
//	public String generateTitle(){
127
//		logger.warn("not yet implemented");
128
//		return this.toString();
129
//	}
128 130

  
129 131
	@Override
130 132
	public String generateFullTitle(){
......
176 178
	 * @see 	eu.etaxonomy.cdm.strategy.cache.name.INameCacheStrategy
177 179
	 * @see     eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy
178 180
	 */
179
	@Override
180
	@Transient
181
	public INameCacheStrategy getCacheStrategy() {
182
		return cacheStrategy;
183
	}
181
//	@Override
182
//	@Transient
183
//	public INameCacheStrategy getCacheStrategy() {
184
//		return cacheStrategy;
185
//	}
184 186

  
185 187

  
186 188
	/**
187 189
	 * @see  #getCacheStrategy()
188 190
	 */
189
	@Override
190
	public void setCacheStrategy(INameCacheStrategy cacheStrategy) {
191
		this.cacheStrategy = cacheStrategy;
192
	}
191
//	@Override
192
//	public void setCacheStrategy(INameCacheStrategy cacheStrategy) {
193
//		this.cacheStrategy = cacheStrategy;
194
//	}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff