package eu.etaxonomy.taxeditor.editor;
+import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
*/
private void initForTaxonNode(UUID taxonNodeUuid) {
- List<String> taxonNodePropertyPaths = Arrays.asList(new String[] {
- "taxon.annotations",
- "taxon.markers",
- "taxon.credits",
- "taxon.extensions",
- "taxon.rights",
- "taxon.sources",
- "taxon.descriptions",
- "taxon.synonymRelations.relatedFrom.name.homotypicalGroup.typifiedNames",
- "taxon.relationsToThisTaxon",
- "taxon.relationsFromThisTaxon",
- "taxon.taxonNodes",
- "taxon.name.status",
- "taxon.name.homotypicalGroup.typifiedNames",
- "taxon.name.taxonBases",
- "taxon.name.descriptions.descriptionElements",
- "taxon.name.descriptions.markers"
-
- });
-
- TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, taxonNodePropertyPaths);
+ TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load(taxonNodeUuid, getTaxonNodePropertyPaths());
if(taxonNode == null){
MessagingUtils.warningDialog("Not yet implemented", TaxonEditorInput.class, "Selected element is not type TaxonBase.");
}
private void initForTaxonBase(UUID taxonBaseUuid) {
-
-
- List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
- "annotations",
- "markers",
- "credits",
- "extensions",
- "rights",
- "sources",
- "descriptions",
- "relationsToThisTaxon",
- "relationsFromThisTaxon",
- "taxonNodes",
- "name.status",
- "name.nomenclaturalReference",
- "synonymRelations.relatedFrom.name.status.type",
- "synonymRelations.relatedFrom.name.nomenclaturalReference.inReference",
- "name.taxonBases",
- "name.descriptions.descriptionElements",
- "name.descriptions.markers",
- "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.relatedFrom.name.*"
- });
- TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, taxonBasePropertyPaths);
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, getTaxonBasePropertyPaths());
if (taxonBase != null){
if(taxonBase.isInstanceOf(Taxon.class)){
Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
@Override
public Map<Object, List<String>> getPropertyPathsMap() {
- Map<Object, List<String>> propertyPathsMap = new HashMap<Object, List<String>>();
-// List<String> taxonNameBasePropertyPaths = Arrays.asList(new String[] {
-// "status",
-// "taxonBases.taxonNodes",
-// "homotypicalGroup.typifiedNames.taxonBases.synonymRelations",
-// "taxonBases.relationsToThisTaxon",
-// "taxonBases.relationsFromThisTaxon",
-// "descriptions"
-// });
-// propertyPathsMap.put(TaxonNameBase.class, taxonNameBasePropertyPaths);
-//
-// List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
-// "taxon.annotations",
-// "taxon.markers",
-// "taxon.credits",
-// "taxon.extensions",
-// "taxon.rights",
-// "taxon.sources",
-// "taxon.descriptions"
-// });
-// propertyPathsMap.put(TaxonNode.class, taxonBasePropertyPaths);
-// List<String> homotypicalGroupPropertyPaths = Arrays.asList(new String[] {
-// "typifiedNames.taxonBases.synonymRelations.relatedFrom.name",
-// "typifiedNames.taxonBases.synonymRelations.relatedFrom.name.status"
-// });
-// propertyPathsMap.put(HomotypicalGroup.class, homotypicalGroupPropertyPaths);
-// return propertyPathsMap;
return null;
}
+ private List<String> getTaxonNodePropertyPaths() {
+ List<String> taxonNodePropertyPaths = new ArrayList<String>();
+ for(String propertyPath : getTaxonBasePropertyPaths()) {
+ taxonNodePropertyPaths.add("taxon." + propertyPath);
+ }
+ return taxonNodePropertyPaths;
+ }
+
+ private List<String> getTaxonBasePropertyPaths() {
+ List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
+ "sec",
+ "createdBy",
+ "updatedBy",
+ "annotations",
+ "markers",
+ "credits",
+ "extensions",
+ "rights",
+ "sources",
+ "descriptions",
+ "relationsToThisTaxon",
+ "relationsFromThisTaxon",
+ "taxonNodes",
+ "descriptions.descriptionElements.feature",
+ "descriptions.descriptionElements.area",
+ "descriptions.descriptionElements.status",
+ "descriptions.markers",
+ "name.descriptions",
+ "name.typeDesignations",
+ "name.status",
+ "name.nomenclaturalReference.inReference",
+ "name.taxonBases.taxonNodes",
+ "name.relationsFromThisName",
+ "name.relationsToThisName",
+ "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.synonym.name.status",
+ "name.homotypicalGroup.typifiedNames.relationsToThisName.fromName",
+ "synonymRelations.synonym.name.status.type",
+ "synonymRelations.synonym.name.relationsToThisName.fromName",
+ "synonymRelations.synonym.name.nomenclaturalReference.inReference.authorship",
+ "synonymRelations.synonym.name.nomenclaturalReference.authorship",
+ "synonymRelations.synonym.name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations"
+ });
+
+ return taxonBasePropertyPaths;
+ }
+
}
*/
package eu.etaxonomy.taxeditor.lazyloading;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.junit.Ignore;
import org.junit.Test;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.httpinvoker.BaseRemotingTest;
+import eu.etaxonomy.taxeditor.store.CdmStore;
/**
+ * This test class is primarily for performance testing.
+ * It should be used to make read-only calls to the target cdm-server.
+ *
* @author cmathew
* @date 26 Aug 2015
*
*/
+//FIXME:Remoting ignoring until we can target integration servers
+@Ignore
public class PropertyPathsTest extends BaseRemotingTest {
@Test
public void taxonLoadTest() {
-
+ // load taxon Crepis from cichorieae
+ UUID taxonBaseUuid = UUID.fromString("d0ae2121-1c32-4737-8c49-f871d429fd90");
+ List<String> taxonBasePropertyPaths = Arrays.asList(new String[] {
+ "synonymRelations.synonym.name.status.type",
+ "name.homotypicalGroup.typifiedNames.taxonBases.synonymRelations.relatedFrom.name.status"
+ });
+ TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).load(taxonBaseUuid, taxonBasePropertyPaths);
+ Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
+ Set<SynonymRelationship> synonymRelations = taxon.getSynonymRelations();
+ for(SynonymRelationship rel : synonymRelations) {
+ rel.getSynonym().getName().getStatus().size();
+ }
+ Set<TaxonNameBase> typifiedNames = taxon.getName().getHomotypicalGroup().getTypifiedNames();
+ for(TaxonNameBase name : typifiedNames) {
+ Set<TaxonBase> taxonBases = name.getTaxonBases();
+ for(TaxonBase tb : taxonBases) {
+ if(tb instanceof Synonym) {
+ Synonym syn = CdmBase.deproxy(tb, Synonym.class);
+ Set<SynonymRelationship> rels = syn.getSynonymRelations();
+ for(SynonymRelationship rel : rels) {
+ rel.getSynonym().getName().getStatus().size();
+ }
+ }
+ if(tb instanceof Taxon) {
+ Taxon syn = CdmBase.deproxy(tb, Taxon.class);
+ Set<SynonymRelationship> rels = syn.getSynonymRelations();
+ for(SynonymRelationship rel : rels) {
+ rel.getSynonym().getName().getStatus().size();
+ }
+ }
+ }
+ }
}
}