cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/HibernateProxyBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/MediaBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/NameRelationshipBeanProcessor.java -text
+cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/PointBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/ReferenceBaseBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TaxonBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TaxonNameBaseBeanProcessor.java -text
}
getTermService().saveLanguageData(unitsGatheringEvent.getLocality());//TODO needs to be saved ?? save it sooner
- getOccurrenceService().save(derivedUnitFacade.getDerivedUnit());
+ getOccurrenceService().save(derivedUnitFacade.innerDerivedUnit());
logger.info("saved ABCD specimen ...");
}
}
IndividualsAssociation individualsAssociation = IndividualsAssociation.NewInstance();
- individualsAssociation.setAssociatedSpecimenOrObservation(facade.getDerivedUnit());
+ individualsAssociation.setAssociatedSpecimenOrObservation(facade.innerDerivedUnit());
individualsAssociation.setFeature(Feature.INDIVIDUALS_ASSOCIATION());
for(ReferenceBase citation : determinationEvent.getReferences()){
individualsAssociation.addSource(DescriptionElementSource.NewInstance(null, null, citation, null));
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
">
-
- <!-- include default application context and customization -->
- <import resource="classpath:/eu/etaxonomy/cdm/defaultApplicationContext.xml"/>
- <bean id="persistentTermInitializer" class="eu.etaxonomy.cdm.database.PersistentTermInitializer">
- <property name="omit" value="false" />
- </bean>
- <context:component-scan base-package="eu/etaxonomy/cdm/ext" />
+
+ <!-- include default application context and customization -->
+ <import resource="classpath:/eu/etaxonomy/cdm/defaultApplicationContext.xml"/>
+ <bean id="persistentTermInitializer" class="eu.etaxonomy.cdm.database.PersistentTermInitializer">
+ <property name="omit" value="false" />
+ </bean>
+ <context:component-scan base-package="eu/etaxonomy/cdm/ext" />
+
+ <import resource="classpath:/eu/etaxonomy/cdm/remote.xml"/>
- <import resource="classpath:/eu/etaxonomy/cdm/remote.xml"/>
+ <context:component-scan base-package="eu/etaxonomy/cdm/io">
+ <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.pesi.*" />
+ <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.faunaEuropaea.*" />
+ <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.erms.*" />
+ <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.eflora.*" />
+ <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.berlinModel.*" />
+ </context:component-scan>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="properties">
super();\r
setInitializationStrategy(Arrays.asList(new String []{\r
"*",\r
- "gatheringEvent.*",\r
+ "titleCache",\r
+// "gatheringEvent.*",\r
"ecologyAll",\r
"plantDescriptionAll",\r
\r
- "fieldObservation.*",\r
+// "fieldObservation.*",\r
"fieldObjectMedia.representations.parts",\r
\r
- "derivedUnit.*",\r
+// "derivedUnit.*",\r
"derivedUnitMedia.representations.parts",\r
"derivedUnitDefinitions",\r
\r
\r
import java.util.List;\r
\r
-import org.hibernate.Hibernate;\r
-\r
import net.sf.json.JSONObject;\r
import net.sf.json.JsonConfig;\r
+\r
+import org.hibernate.Hibernate;\r
+\r
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;\r
import eu.etaxonomy.cdm.api.facade.MethodNotSupportedByDerivedUnitTypeException;\r
import eu.etaxonomy.cdm.model.common.Language;\r
-import eu.etaxonomy.cdm.model.location.NamedArea;\r
import eu.etaxonomy.cdm.remote.l10n.LocaleContext;\r
\r
/**\r
\r
List<Language> languages = LocaleContext.getLanguages();\r
\r
- if(Hibernate.isInitialized(bean.getGatheringEvent())){\r
-// TODO is this needed? addJsonElement(json, jsonConfig, "gatheringEvent", bean.getGatheringEvent());\r
+ if(Hibernate.isInitialized(bean.innerGatheringEvent())){\r
+\r
addJsonElement(json, jsonConfig, "country",bean.getCountry());\r
addJsonElement(json, jsonConfig, "collectingAreas", bean.getCollectingAreas());\r
addJsonElement(json, jsonConfig, "absoluteElevation", bean.getAbsoluteElevation());\r
addJsonElement(json, jsonConfig, "gatheringEventDescription", bean.getGatheringEventDescription());\r
addJsonElement(json, jsonConfig, "getGatheringPeriod", bean.getGatheringPeriod());\r
addJsonElement(json, jsonConfig, "locality", bean.getLocality());\r
-//FIXME remove bean.getLocalityLanguage() from DUF : addJsonElement(json, jsonConfig, "localityLanguage", bean.getLocalityLanguage());\r
}\r
\r
// FIXME: addJsonElement(json, jsonConfig, "ecology", bean.getEcology(languages));\r
// FIXME: addJsonElement(json, jsonConfig, "plantDescription", bean.getPlantDescription(languages));\r
addJsonElement(json, jsonConfig, "plantDescription", bean.getPlantDescription());\r
\r
- if(Hibernate.isInitialized(bean.getFieldObservation())){\r
-// TODO is this needed? addJsonElement(json, jsonConfig, "fieldObservation", bean.getFieldObservation());\r
+ if(Hibernate.isInitialized(bean.innerFieldObservation())){\r
addJsonElement(json, jsonConfig, "fieldObjectMedia", bean.getFieldObjectMedia());\r
addJsonElement(json, jsonConfig, "fieldNumber", bean.getFieldNumber()); \r
addJsonElement(json, jsonConfig, "fieldNotes", bean.getFieldNotes()); \r
addJsonElement(json, jsonConfig, "sex", bean.getSex()); \r
}\r
\r
- if(Hibernate.isInitialized(bean.getDerivedUnit())){\r
- // TODO is this needed? addJsonElement(json, jsonConfig, "derivedUnit", bean.getDerivedUnit()); \r
+ if(Hibernate.isInitialized(bean.innerDerivedUnit())){ \r
addJsonElement(json, jsonConfig, "derivedUnitDefinitions", bean.getDerivedUnitDefinitions()); \r
addJsonElement(json, jsonConfig, "determinations", bean.getDeterminations());\r
addJsonElement(json, jsonConfig, "derivedUnitMedia", bean.getDerivedUnitMedia()); \r
addJsonElement(json, jsonConfig, "exsiccatum", bean.getExsiccatum());\r
addJsonElement(json, jsonConfig, "sources", bean.getSources());\r
addJsonElement(json, jsonConfig, "collection", bean.getCollection());\r
- if(Hibernate.isInitialized(bean.getDerivedUnit().getDerivedFrom().getDerivatives())){\r
+ if(Hibernate.isInitialized(bean.innerDerivedUnit().getDerivedFrom().getDerivatives())){\r
addJsonElement(json, jsonConfig, "duplicates", bean.getDuplicates());\r
}\r
}\r
--- /dev/null
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy \r
+* http://www.e-taxonomy.eu\r
+* \r
+* The contents of this file are subject to the Mozilla Public License Version 1.1\r
+* See LICENSE.TXT at the top of this package for the full license terms.\r
+*/\r
+package eu.etaxonomy.cdm.remote.json.processor.bean;\r
+\r
+import java.util.List;\r
+\r
+import net.sf.json.JSONObject;\r
+import net.sf.json.JsonConfig;\r
+import eu.etaxonomy.cdm.model.location.Point;\r
+\r
+/**\r
+ * @author a.kohlbecker\r
+ * @date 20.10.2010\r
+ *\r
+ */\r
+public class PointBeanProcessor extends AbstractBeanProcessor<Point> {\r
+\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor#getIgnorePropNames()\r
+ */\r
+ @Override\r
+ public List<String> getIgnorePropNames() {\r
+ // TODO Auto-generated method stub\r
+ return null;\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor#processBeanSecondStep(java.lang.Object, net.sf.json.JSONObject, net.sf.json.JsonConfig)\r
+ */\r
+ @Override\r
+ public JSONObject processBeanSecondStep(Point bean, JSONObject json,\r
+ JsonConfig jsonConfig) {\r
+ json.element("sexagesimalString", bean.toSexagesimalString(false, true));\r
+ return json;\r
+ }\r
+\r
+}\r
</entry>\r
<entry key="eu.etaxonomy.cdm.api.facade.DerivedUnitFacade">\r
<bean class="eu.etaxonomy.cdm.remote.json.processor.bean.DerivedUnitFacadeBeanProcessor"/>\r
+ </entry>\r
+ <entry key="eu.etaxonomy.cdm.model.location.Point">\r
+ <bean class="eu.etaxonomy.cdm.remote.json.processor.bean.PointBeanProcessor"/>\r
</entry>\r
</map>\r
</property>\r
public LanguageString getLocality(){\r
return (hasGatheringEvent() ? getGatheringEvent(true).getLocality() : null);\r
}\r
+ /**\r
+ * convienience method for {@link #getLocality()}.{@link LanguageString#getText() getText()}\r
+ * @return\r
+ */\r
@Transient\r
public String getLocalityText(){\r
LanguageString locality = getLocality();\r
}\r
return null;\r
}\r
+ /**\r
+ * convienience method for {@link #getLocality()}.{@link LanguageString#getLanguage() getLanguage()}\r
+ * @return\r
+ */\r
@Transient\r
public Language getLocalityLanguage(){\r
LanguageString locality = getLocality();\r
public boolean hasGatheringEvent(){\r
return (getGatheringEvent(false) != null);\r
}\r
- @Transient\r
- public GatheringEvent getGatheringEvent() {\r
+ \r
+ public GatheringEvent innerGatheringEvent() {\r
return getGatheringEvent(false);\r
}\r
\r
* Returns the field observation as an object.\r
* @return\r
*/\r
- @Transient\r
- public FieldObservation getFieldObservation(){\r
+ public FieldObservation innerFieldObservation(){\r
return getFieldObservation(false);\r
}\r
\r
* Returns the derived unit itself.\r
* @return the derived unit\r
*/\r
- @Transient\r
- public DerivedUnitBase getDerivedUnit() {\r
+ public DerivedUnitBase innerDerivedUnit() {\r
return this.derivedUnit;\r
}\r
\r
*/\r
@Test\r
public void testNewInstance() {\r
- Assert.assertNotNull("The specimen should have been created", specimenFacade.getDerivedUnit());\r
+ Assert.assertNotNull("The specimen should have been created", specimenFacade.innerDerivedUnit());\r
//???\r
// Assert.assertNotNull("The derivation event should have been created", specimenFacade.getSpecimen().getDerivedFrom());\r
// Assert.assertNotNull("The field observation should have been created", specimenFacade.getFieldObservation());\r
*/\r
@Test\r
public void testNewInstanceSpecimen() {\r
- Assert.assertSame("Specimen should be same", specimen, specimenFacade.getDerivedUnit());\r
- Assert.assertSame("Derivation event should be same", derivationEvent, specimenFacade.getDerivedUnit().getDerivedFrom());\r
- Assert.assertSame("Field observation should be same", fieldObservation, specimenFacade.getFieldObservation());\r
- Assert.assertSame("Gathering event should be same", gatheringEvent, specimenFacade.getGatheringEvent());\r
+ Assert.assertSame("Specimen should be same", specimen, specimenFacade.innerDerivedUnit());\r
+ Assert.assertSame("Derivation event should be same", derivationEvent, specimenFacade.innerDerivedUnit().getDerivedFrom());\r
+ Assert.assertSame("Field observation should be same", fieldObservation, specimenFacade.innerFieldObservation());\r
+ Assert.assertSame("Gathering event should be same", gatheringEvent, specimenFacade.innerGatheringEvent());\r
\r
}\r
\r
specimenFacade = DerivedUnitFacade.NewInstance(specimen);\r
specimenFacade.setDistanceToGround(2);\r
FieldObservation specimenFieldObservation = (FieldObservation)specimen.getDerivedFrom().getOriginals().iterator().next();\r
- Assert.assertSame("Facade gathering event and specimen gathering event should be the same",specimenFacade.getGatheringEvent(), specimenFieldObservation.getGatheringEvent());\r
+ Assert.assertSame("Facade gathering event and specimen gathering event should be the same",specimenFacade.innerGatheringEvent(), specimenFieldObservation.getGatheringEvent());\r
} catch (DerivedUnitFacadeNotSupportedException e) {\r
Assert.fail("An error should not occur in NewInstance()");\r
}\r
DerivedUnitFacade specimenFacade;\r
try {\r
specimenFacade = DerivedUnitFacade.NewInstance(specimen);\r
- Assert.assertNull("No field observation should exists", specimenFacade.getFieldObservation());\r
+ Assert.assertNull("No field observation should exists", specimenFacade.innerFieldObservation());\r
} catch (DerivedUnitFacadeNotSupportedException e) {\r
Assert.fail("An error should not occur in NewInstance()");\r
}\r
NamedArea newCollectingArea = NamedArea.NewInstance("A nice area", "nice", "n");\r
specimenFacade.addCollectingArea(newCollectingArea);\r
Assert.assertEquals("Exactly 1 area must exist", 1, specimenFacade.getCollectingAreas().size());\r
- Assert.assertSame("Areas should be same", newCollectingArea, specimenFacade.getFieldObservation().getGatheringEvent().getCollectingAreas().iterator().next());\r
+ Assert.assertSame("Areas should be same", newCollectingArea, specimenFacade.innerFieldObservation().getGatheringEvent().getCollectingAreas().iterator().next());\r
specimenFacade.addCollectingArea(tdwgArea);\r
Assert.assertEquals("Exactly 2 areas must exist", 2, specimenFacade.getCollectingAreas().size());\r
specimenFacade.removeCollectingArea(newCollectingArea);\r
emptyFacade.setDistanceToWaterSurface(13);\r
Assert.assertNotNull("Field observation must exist if distance to water exists", emptyFacade.getFieldObservation(false));\r
Assert.assertNotNull("Gathering event must exist if distance to water exists", emptyFacade.getGatheringEvent(false));\r
- FieldObservation specimenFieldObservation = (FieldObservation)emptyFacade.getDerivedUnit().getDerivedFrom().getOriginals().iterator().next();\r
+ FieldObservation specimenFieldObservation = (FieldObservation)emptyFacade.innerDerivedUnit().getDerivedFrom().getOriginals().iterator().next();\r
Assert.assertSame("Gathering event of facade and of specimen must be the same", specimenFieldObservation.getGatheringEvent(), emptyFacade.getGatheringEvent(false));\r
}\r
\r
Assert.assertNull("Empty facace must not have any field value" ,emptyFacade.getFieldNumber());\r
emptyFacade.setFieldNumber("1256A");\r
Assert.assertNotNull("Field observation must exist if field number exists", emptyFacade.getFieldObservation(false));\r
- FieldObservation specimenFieldObservation = (FieldObservation)emptyFacade.getDerivedUnit().getDerivedFrom().getOriginals().iterator().next();\r
+ FieldObservation specimenFieldObservation = (FieldObservation)emptyFacade.innerDerivedUnit().getDerivedFrom().getOriginals().iterator().next();\r
Assert.assertSame("Field observation of facade and of specimen must be the same", specimenFieldObservation, emptyFacade.getFieldObservation(false));\r
Assert.assertEquals("1256A", emptyFacade.getFieldNumber());\r
}\r
Assert.assertFalse("The initial distance to ground should not be 43", specimenFacade.getDistanceToGround() == 43);\r
specimenFacade.setGatheringEvent(newGatheringEvent);\r
Assert.assertTrue("The final distance to ground should be 43", specimenFacade.getDistanceToGround() == 43);\r
- Assert.assertSame("The new gathering event should be 'newGatheringEvent'", newGatheringEvent, specimenFacade.getGatheringEvent());\r
+ Assert.assertSame("The new gathering event should be 'newGatheringEvent'", newGatheringEvent, specimenFacade.innerGatheringEvent());\r
}\r
\r
/**\r
- * Test method for {@link eu.etaxonomy.cdm.api.facade.DerivedUnitFacade#getGatheringEvent()}.\r
+ * Test method for {@link eu.etaxonomy.cdm.api.facade.DerivedUnitFacade#innerGatheringEvent()}.\r
*/\r
@Test\r
public void testGetGatheringEvent() {\r
- Assert.assertNotNull("Gathering event must not be null", specimenFacade.getGatheringEvent()); \r
- Assert.assertEquals("Gathering event must be field observations gathering event", specimenFacade.getFieldObservation().getGatheringEvent(), specimenFacade.getGatheringEvent());\r
+ Assert.assertNotNull("Gathering event must not be null", specimenFacade.innerGatheringEvent()); \r
+ Assert.assertEquals("Gathering event must be field observations gathering event", specimenFacade.innerFieldObservation().getGatheringEvent(), specimenFacade.innerGatheringEvent());\r
}\r
\r
/**\r
}\r
\r
/**\r
- * Test method for {@link eu.etaxonomy.cdm.api.facade.DerivedUnitFacade#getDerivedUnit()}.\r
+ * Test method for {@link eu.etaxonomy.cdm.api.facade.DerivedUnitFacade#innerDerivedUnit()}.\r
*/\r
@Test\r
public void testGetSpecimen() {\r
- Assert.assertEquals("Specimen must be same", specimen, specimenFacade.getDerivedUnit()); \r
+ Assert.assertEquals("Specimen must be same", specimen, specimenFacade.innerDerivedUnit()); \r
}\r
\r
/**\r
specimenFacade.removeDuplicate(newSpecimen1);\r
Assert.assertEquals("There should be 1 duplicate now", 1, specimenFacade.getDuplicates().size());\r
Assert.assertSame("The only duplicate should be 'newSpecimen2' now", newSpecimen2, specimenFacade.getDuplicates().iterator().next());\r
- specimenFacade.addDuplicate(specimenFacade.getDerivedUnit());\r
+ specimenFacade.addDuplicate(specimenFacade.innerDerivedUnit());\r
Assert.assertEquals("There should be still 1 duplicate because the facade specimen is not a duplicate", 1, specimenFacade.getDuplicates().size());\r
\r
Collection newCollection = Collection.NewInstance();\r
} catch (DerivedUnitFacadeNotSupportedException e) {\r
Assert.fail("Multiple derivation events in line should not throw a not supported exception");\r
}\r
- Assert.assertSame("Gathering event should derive from the derivation line", existingGatheringEvent, specimenFacade.getGatheringEvent());\r
+ Assert.assertSame("Gathering event should derive from the derivation line", existingGatheringEvent, specimenFacade.innerGatheringEvent());\r
Assert.assertEquals("Mediasize should be 0. Only Imagegallery media are supported", 0, specimenFacade.getFieldObjectMedia().size());\r
}\r
\r