From: n.hoffmann Date: Wed, 18 Jan 2012 17:12:41 +0000 (+0000) Subject: Added documentation X-Git-Tag: 3.6.0~1115 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/caaaa63633a41cab30e828184aa47c417796777a Added documentation --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java index a6a72d039..16c07dfc9 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/DefaultTermComparator.java @@ -15,6 +15,10 @@ import eu.etaxonomy.cdm.model.common.DefinedTermBase; import eu.etaxonomy.taxeditor.store.CdmStore; /** + * Implements a {@link Comparator} for {@link DefinedTermBase} objects based on the term's label. + * The compare algorithm compares a term's label. Example: If used on an unsorted list of terms, the + * list will be alphabetically sorted by label afterwards. + * * @author n.hoffmann * @date Jan 18, 2012 * diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermStore.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermStore.java index 9111b0eb1..ab5213636 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermStore.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/TermStore.java @@ -42,6 +42,12 @@ import eu.etaxonomy.taxeditor.preference.PreferencesUtil; */ public class TermStore { + /** + * Returns an alphabetically sorted list of terms (anything that extends {@link DefinedTermBase}) of the given type currently available in the system. + * + * @param clazz a class that inherits from {@link DefinedTermBase} + * @return an alphabetically sorted list of terms + */ public static List getTerms(Class clazz){ return getTerms(clazz, null, true); } @@ -51,10 +57,10 @@ public class TermStore { * If filtered is set to true, all terms for certain types will be * gathered from edge cases. * - * @param clazz - * @param comparator - * @param filtered Will filter out some results - * @return + * @param clazz a class that inherits from {@link DefinedTermBase} + * @param comparator a {@link Comparator} that defines the sorting algorithm. If set to null, {@link DefaultTermComparator} will be used + * @param filtered if set to true, some terms are filtered from the result (according to definition in {@link ITermStoreEdgeCase}s) + * @return a sorted list of terms */ public static List getTerms(Class clazz, Comparator comparator, boolean filtered){ List terms = new ArrayList(); @@ -70,6 +76,12 @@ public class TermStore { } + /** + * + * @param termClass + * @param comparator + * @return + */ private static List getTermsFromService(Class termClass, Comparator comparator){ if (comparator == null){ comparator = new DefaultTermComparator(); @@ -80,70 +92,6 @@ public class TermStore { return terms; } -// /** -// *

getFeatures

-// * -// * @return a {@link java.util.List} object. -// */ -// public static List getFeatures() { -// List features = getTerms(Feature.class); -// features.remove(Feature.IMAGE()); -// return features; -// -// } -// -// -// /** -// *

getNonTechnicalMarkerTypes

-// * -// * @return a {@link java.util.List} object. -// */ -// public static List getNonTechnicalMarkerTypes() { -// List nonTechnicalMarkerTypes = new ArrayList(); -// List markerTypes = getTerms(MarkerType.class); -// -// for (Object type : markerTypes) { -// if (((MarkerType) type).isTechnical() == false) { -// nonTechnicalMarkerTypes.add((MarkerType) type); -// } -// } -// -// return nonTechnicalMarkerTypes; -// } -// -// /** -// * Retrieve all ranks from data store. -// * -// * @return a {@link java.util.List} object. -// */ -// public static List getRanks(){ -// if(PreferencesUtil.getSortRanksHierarchichally()){ -// return getTerms(Rank.class, new Comparator(){ -// -// @Override -// public int compare(Rank o1, Rank o2) { -// return o1.compareTo(o2); -// } -// -// }); -// }else{ -// return getTerms(Rank.class); -// } -// } -// -// -// /** -// * Retrieve all presence and absence terms from data store. -// * -// * @return a {@link java.util.List} object. -// */ -// public static List getPresenceAbsenceTerms() { -// List presenceAbsenceTerms = getTerms(PresenceTerm.class); -// presenceAbsenceTerms.addAll(getTerms(AbsenceTerm.class)); -// -// return presenceAbsenceTerms; -// } - /** * @param term a {@link eu.etaxonomy.cdm.model.common.DefinedTermBase} object. */ @@ -168,6 +116,10 @@ public class TermStore { public static void updateVocabulary(DefinedTermBase term) { CdmStore.getService(ITermService.class).saveOrUpdate(term); } + + /** + * Handingling of special cases + */ private static Set> termStoreEdgeCases = new HashSet>();