exactlocation_longitude double,
createdby_id integer,
updatedby_id integer,
+ country_id integer,
actor_id integer,
exactlocation_referencesystem_id integer,
locality_id integer,
exactlocation_longitude double,
createdby_id integer,
updatedby_id integer,
+ country_id integer,
actor_id integer,
exactlocation_referencesystem_id integer,
locality_id integer,
EXACTLOCATION_LONGITUDE CDATA #IMPLIED
CREATEDBY_ID CDATA #IMPLIED
UPDATEDBY_ID CDATA #IMPLIED
+ COUNTRY_ID CDATA #IMPLIED
ACTOR_ID CDATA #IMPLIED
EXACTLOCATION_REFERENCESYSTEM_ID CDATA #IMPLIED
LOCALITY_ID CDATA #IMPLIED
EXACTLOCATION_LONGITUDE CDATA #IMPLIED
CREATEDBY_ID CDATA #IMPLIED
UPDATEDBY_ID CDATA #IMPLIED
+ COUNTRY_ID CDATA #IMPLIED
ACTOR_ID CDATA #IMPLIED
EXACTLOCATION_REFERENCESYSTEM_ID CDATA #IMPLIED
LOCALITY_ID CDATA #IMPLIED
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import eu.etaxonomy.cdm.model.common.TimePeriod;
import eu.etaxonomy.cdm.model.location.NamedArea;
import eu.etaxonomy.cdm.model.location.Point;
+import eu.etaxonomy.cdm.model.reference.ReferenceBase;
+import eu.etaxonomy.cdm.strategy.cache.name.CacheUpdate;
import eu.etaxonomy.cdm.validation.annotation.NullOrNotEmpty;
/**
@XmlType(name = "GatheringEvent", propOrder = {
"locality",
"exactLocation",
+ "country",
"collectingAreas",
"collectingMethod",
"absoluteElevation",
@XmlElement(name = "ExactLocation")
private Point exactLocation;
+
+ @XmlElement(name = "Country")
+ @XmlIDREF
+ @XmlSchemaType(name = "IDREF")
+ @ManyToOne(fetch = FetchType.LAZY)
+ @Cascade({CascadeType.SAVE_UPDATE})
+ private NamedArea country;
+
@XmlElementWrapper(name = "CollectingAreas")
@XmlElement(name = "CollectingArea")
@XmlIDREF
@XmlSchemaType(name = "IDREF")
@ManyToMany(fetch = FetchType.LAZY)
@NotNull
+ // further collecting areas. Should not include country
private Set<NamedArea> collectingAreas = new HashSet<NamedArea>();
@XmlElement(name = "CollectingMethod")
this.exactLocation = exactLocation;
}
+
+
+ public NamedArea getCountry() {
+ return country;
+ }
+ public void setCountry(NamedArea country) {
+ this.country = country;
+ }
+
+ /**
+ * Further collecting areas. Should not include #getCountry()
+ * @return
+ */
public Set<NamedArea> getCollectingAreas(){
if(collectingAreas == null) {
this.collectingAreas = new HashSet<NamedArea>();
}
+ /**
+ * Further collecting areas. Should not include #getCountry()
+ * @param area
+ */
public void addCollectingArea(NamedArea area){
if (this.collectingAreas == null)
this.collectingAreas = getNewNamedAreaSet();
// TableNameChanger tableChanger = TableNameChanger.NewInstance(stepName, "TaxonomicTree", "Classification", INCLUDE_AUDIT);\r
// stepList.add(tableChanger);\r
\r
+ //update sortindex on FeatureNode children\r
+ stepName = "Add country column to gathering event";\r
+ step = ColumnAdder.NewIntegerInstance(stepName, "GatheringEvent", "country_id", INCLUDE_AUDIT);\r
+ stepList.add(step);\r
\r
return stepList;\r
}\r
exactlocation_longitude double,
createdby_id integer,
updatedby_id integer,
+ country_id integer,
actor_id integer,
exactlocation_referencesystem_id integer,
locality_id integer,
exactlocation_longitude double,
createdby_id integer,
updatedby_id integer,
+ country_id integer,
actor_id integer,
exactlocation_referencesystem_id integer,
locality_id integer,
\r
\r
import org.apache.log4j.Logger;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
\r
import eu.etaxonomy.cdm.api.service.IOccurrenceService;\r
import eu.etaxonomy.cdm.model.agent.AgentBase;\r
\r
// ****************** Gathering Event *********************************/\r
\r
+ //country\r
+ public NamedArea getCountry(){\r
+ return (hasGatheringEvent() ? getGatheringEvent(true).getCountry() : null);\r
+ }\r
+ \r
+ public void setCountry(NamedArea country){\r
+ getGatheringEvent(true).setCountry(country);\r
+ }\r
+ \r
+ \r
//Collecting area\r
public void addCollectingArea(NamedArea area) {\r
getGatheringEvent(true).addCollectingArea(area);\r
\r
import eu.etaxonomy.cdm.common.CdmUtils;\r
import eu.etaxonomy.cdm.model.agent.Institution;\r
+import eu.etaxonomy.cdm.model.common.Language;\r
+import eu.etaxonomy.cdm.model.common.Representation;\r
import eu.etaxonomy.cdm.model.common.TimePeriod;\r
+import eu.etaxonomy.cdm.model.location.NamedArea;\r
import eu.etaxonomy.cdm.model.occurrence.Collection;\r
import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;\r
import eu.etaxonomy.cdm.strategy.StrategyBase;\r
try {\r
facade = DerivedUnitFacade.NewInstance(derivedUnit);\r
//country\r
- //TODO\r
+ String strCountry = null;\r
+ NamedArea country = facade.getCountry();\r
+ Representation repCountry = country == null ? null : country.getRepresentation(Language.DEFAULT());\r
+ //TODO currently the label is the 3 digit representation of the country and text is the full text.\r
+ //this is against the common way of handling text, label and labelabbrev in defined terms\r
+ strCountry = repCountry == null ? null: repCountry.getText();\r
+ result = CdmUtils.concat(", ", result, strCountry);\r
\r
// FIXME hasGatheringEvent needed;\r
//locality\r
import eu.etaxonomy.cdm.model.common.TimePeriod;\r
import eu.etaxonomy.cdm.model.description.Sex;\r
import eu.etaxonomy.cdm.model.description.Stage;\r
+import eu.etaxonomy.cdm.model.location.NamedArea;\r
import eu.etaxonomy.cdm.model.location.Point;\r
import eu.etaxonomy.cdm.model.location.ReferenceSystem;\r
+import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;\r
import eu.etaxonomy.cdm.model.media.Media;\r
import eu.etaxonomy.cdm.model.name.BotanicalName;\r
import eu.etaxonomy.cdm.model.name.Rank;\r
Stage lifeStage = Stage.NewInstance("A wonderful stage", "stage", "st");\r
Sex sex = Sex.NewInstance("FemaleMale", "FM", "FM");\r
LanguageString locality = LanguageString.NewInstance("Berlin-Dahlem, E side of Englerallee", Language.DEFAULT());\r
-\r
+ NamedArea country = WaterbodyOrCountry.GERMANY();\r
+ \r
String accessionNumber = "8909756";\r
String catalogNumber = "UU879873590";\r
TaxonNameBase taxonName = BotanicalName.NewInstance(Rank.GENUS(), "Abies", null, null, null, null, null, null, null);\r
\r
gatheringEvent.setTimeperiod(gatheringPeriod);\r
gatheringEvent.setLocality(locality);\r
+ gatheringEvent.setCountry(country);\r
\r
fieldObservation.setFieldNumber(fieldNumber);\r
fieldObservation.setFieldNotes(fieldNotes);\r
*/\r
@Test\r
public void testGetTitleCache() {\r
- String correctCache = "Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10°34'1\"N, 12°18'E (WGS84), sand dunes, 05.05.2005 (B 8909756); flowers blue.";\r
+ String correctCache = "Germany, Berlin-Dahlem, E side of Englerallee, alt. 40 m, 10°34'1\"N, 12°18'E (WGS84), sand dunes, 05.05.2005 (B 8909756); flowers blue.";\r
specimenFacade.setEcology(ecology);\r
specimenFacade.setPlantDescription(plantDescription);\r
collection.setCode("B");\r
import eu.etaxonomy.cdm.model.location.Point;\r
import eu.etaxonomy.cdm.model.location.ReferenceSystem;\r
import eu.etaxonomy.cdm.model.location.TdwgArea;\r
+import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;\r
import eu.etaxonomy.cdm.model.media.Media;\r
import eu.etaxonomy.cdm.model.name.BotanicalName;\r
import eu.etaxonomy.cdm.model.name.Rank;\r
\r
DerivedUnitFacade emptyFacade;\r
\r
+ NamedArea country = WaterbodyOrCountry.GERMANY();\r
+ \r
\r
//****************************** SET UP *****************************************/\r
\r
gatheringEvent.setDistanceToWaterSurface(distanceToSurface);\r
gatheringEvent.setExactLocation(exactLocation);\r
gatheringEvent.setDescription(gatheringEventDescription);\r
+ gatheringEvent.setCountry(country);\r
\r
gatheringEvent.setTimeperiod(gatheringPeriod);\r
gatheringEvent.setLocality(locality);\r
}\r
}\r
\r
+ @Test\r
+ public void testGetSetCountry(){\r
+ \r
+ }\r
\r
\r
/**\r
exactlocation_longitude double,
createdby_id integer,
updatedby_id integer,
+ country_id integer,
actor_id integer,
exactlocation_referencesystem_id integer,
locality_id integer,
exactlocation_longitude double,
createdby_id integer,
updatedby_id integer,
+ country_id integer,
actor_id integer,
exactlocation_referencesystem_id integer,
locality_id integer,