import javax.persistence.Entity;
import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
+import javax.persistence.OrderColumn;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import org.apache.log4j.Logger;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
-import org.hibernate.annotations.IndexColumn;
+import org.hibernate.annotations.ListIndexBase;
import org.hibernate.envers.Audited;
-import org.hibernate.search.annotations.Indexed;
import org.springframework.beans.factory.annotation.Configurable;
import eu.etaxonomy.cdm.strategy.cache.agent.TeamDefaultCacheStrategy;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Team", propOrder = {
"protectedNomenclaturalTitleCache",
- "teamMembers"
+ "protectedCollectorTitleCache",
+ "teamMembers",
+ "hasMoreMembers"
})
@XmlRootElement(name = "Team")
@Entity
-@Indexed(index = "eu.etaxonomy.cdm.model.agent.AgentBase")
+//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
+//@Indexed(index = "eu.etaxonomy.cdm.model.agent.AgentBase")
@Audited
@Configurable
public class Team extends TeamOrPersonBase<Team> {
@XmlElement(name = "ProtectedNomenclaturalTitleCache")
private boolean protectedNomenclaturalTitleCache = false;
- //An abbreviated name for the team (e. g. in case of nomenclatural authorteams). A non abbreviated name for the team (e. g.
+ //under construction #4311
+ @XmlElement(name = "ProtectedCollectorTitleCache")
+ private final boolean protectedCollectorTitleCache = false;
+
+ //An abbreviated name for the team (e. g. in case of nomenclatural authorteams).
+ //A non abbreviated name for the team (e. g.
//in case of some bibliographical references)
@XmlElementWrapper(name = "TeamMembers", nillable = true)
@XmlElement(name = "TeamMember")
@XmlIDREF
@XmlSchemaType(name = "IDREF")
- @IndexColumn(name="sortIndex", base = 0)
+ @OrderColumn(name="sortIndex")
+ @ListIndexBase(value=0) //not really needed as this is the default
@ManyToMany(fetch = FetchType.LAZY)
- @Cascade(CascadeType.SAVE_UPDATE)
+ @Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE})
@Match(MatchMode.MATCH)
+ //preliminary #5369
+ @JoinTable(joinColumns = @JoinColumn( name="AgentBase_id"))
private List<Person> teamMembers;
+ @XmlElement(name = "hasMoreMembers")
+ private boolean hasMoreMembers;
+
+
/**
* Creates a new team instance without any concrete {@link Person members}.
if (wasMember){
firePropertyChange("teamMember", person, null);
}
-
}
*/
public void setNomenclaturalTitle(String nomenclaturalTitle, boolean protectedNomenclaturalTitleCache) {
firePropertyChange("nomenclaturalTitle", this.nomenclaturalTitle, nomenclaturalTitle);
- this.nomenclaturalTitle = nomenclaturalTitle;
+ this.nomenclaturalTitle = nomenclaturalTitle == "" ? null: nomenclaturalTitle;
this.protectedNomenclaturalTitleCache = protectedNomenclaturalTitleCache;
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getTitleCache()
- */
+
@Override
//@Transient //TODO a.kohlbecker remove??
public String getTitleCache() {
return result;
}
+ /**
+ * Protected nomenclatural title cache flag should be set to true, if
+ * the title cache is to be preferred against the atomized data.
+ * This may be the case if no atomized data exists or if atomization
+ * was incomplete for whatever reason.
+ * @return
+ */
public boolean isProtectedNomenclaturalTitleCache() {
return protectedNomenclaturalTitleCache;
}
this.protectedNomenclaturalTitleCache = protectedNomenclaturalTitleCache;
}
+
+ /**
+ * The hasMoreMembers flag is true if this team has more members than
+ * mentioned in the {@link #teamMembers} list. This is usually the case
+ * when "et al." is used in the team representation. Formatters should add
+ * "et al." or an according post fix to the team string representation
+ * if this flag is set.
+ * @return
+ */
+ public boolean isHasMoreMembers() {
+ return hasMoreMembers;
+ }
+
+ public void setHasMoreMembers(boolean hasMoreMembers) {
+ this.hasMoreMembers = hasMoreMembers;
+ }
+
//*********************** CLONE ********************************************************/
/**
e.printStackTrace();
return null;
}
-
-
}
-
-
}
\ No newline at end of file