*/
public class DistributionInfoConfiguration {
- private boolean subAreaPreference = false;
+ private boolean preferSubAreas = false;
private boolean statusOrderPreference = false;
//********************* GETTER / SETTER ***************************/
- public boolean isSubAreaPreference() {
- return subAreaPreference;
+ public boolean isPreferSubareas() {
+ return preferSubAreas;
}
- public void setSubAreaPreference(boolean subAreaPreference) {
- this.subAreaPreference = subAreaPreference;
+ public void setPreferSubAreas(boolean preferSubAreas) {
+ this.preferSubAreas = preferSubAreas;
}
public boolean isStatusOrderPreference() {
/**
* Enumeration that defines the ordering method for distribution trees.
+ * Either by {@link #LABEL} or {@link #AREA_ORDER}
*
* @author a.mueller
* @since 04.04.2016
return map.entrySet();
}
+ @Override
+ public String toString() {
+ return map.toString();
+ }
}
removeFallbackAreasWithChildDistributions(areaNodeMap, introducedAreaNodeMap, config);
@SuppressWarnings("unchecked")
- Map<NamedArea, AreaNode>[] result = new Map[]{areaNodeMap,introducedAreaNodeMap};
+ Map<NamedArea, AreaNode>[] result = new Map[]{areaNodeMap, introducedAreaNodeMap};
return result;
}
@Override
protected void setDefaultTerms(TermVocabulary<NamedAreaLevel> termVocabulary) {
- termMap = new HashMap<UUID, NamedAreaLevel>();
+ termMap = new HashMap<>();
for (NamedAreaLevel term : termVocabulary.getTerms()){
termMap.put(term.getUuid(), term);
}
*/
//TODO do we need to pass the terms parameter? Maybe a bit more performant
// but more difficult to handle. We could use this internally but offer
- //the method with return value as public
+ // the method with return value as public
@Transient
public Set<T> getDistinctTermsRecursive(Set<T> terms){
T term = this.getTerm();
result = parent.getPath() ;
}
if (getTerm()!= null){
- String sep = StringUtils.isBlank(result)?"":"/";
+ String sep = StringUtils.isBlank(result)? "" : "/";
result += sep+ getTerm().getLabel();
}
return result;
public List<T> loadList(Collection<Integer> ids, List<OrderHint> orderHints, List<String> propertyPaths) throws DataAccessException;
+ /**
+ * Returns the CDM entity with the given UUID without initializing it further.
+ */
public T findByUuid(UUID Uuid) throws DataAccessException;
/**
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
+import eu.etaxonomy.cdm.common.CdmUtils;
import eu.etaxonomy.cdm.model.common.LSID;
import eu.etaxonomy.cdm.model.common.MarkerType;
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
if(type != null){
queryString += " and de.class = :type";
}
- if (features != null && features.size() > 0){
+ boolean hasFeatureFilter = !CdmUtils.isNullSafeEmpty(features);
+ if (hasFeatureFilter){
queryString += " and de.feature in (:features) ";
}
Query<R> query = getSession().createQuery(queryString);
if(type != null){
query.setParameter("type", type.getSimpleName());
}
- if(features != null && features.size() > 0){
+ if(hasFeatureFilter){
query.setParameterList("features", features) ;
}
* @param parts
* possible values: condensedStatus, tree, mapUriParams,
* elements,
- * @param subAreaPreference
+ * @param preferSubAreas
* @param statusOrderPreference
* @param hideMarkedAreasList
* @param omitLevels
public ModelAndView doGetDistributionInfo(
@PathVariable("uuid") UUID taxonUuid,
@RequestParam("part") Set<InfoPart> partSet,
- @RequestParam(value = "subAreaPreference", required = false) boolean subAreaPreference,
+ @RequestParam(value = "subAreaPreference", required = false) boolean preferSubAreas,
@RequestParam(value = "statusOrderPreference", required = false) boolean statusOrderPreference,
- @RequestParam(value = "features", required = false ) Set<UUID> featureUuids,
@RequestParam(value = "hiddenAreaMarkerType", required = false) DefinedTermBaseList<MarkerType> hiddenAreaMarkerTypeList,
+ @RequestParam(value = "features", required = false ) Set<UUID> featureUuids,
@RequestParam(value = "areaTree", required = false ) UUID areaTreeUuid,
@RequestParam(value = "omitLevels", required = false) Set<NamedAreaLevel> omitLevels,
@RequestParam(value = "statusColors", required = false) String statusColorsString,
DistributionInfoConfiguration config = new DistributionInfoConfiguration();
config.setInfoParts(parts);
- config.setSubAreaPreference(subAreaPreference);
+ config.setPreferSubAreas(preferSubAreas);
config.setStatusOrderPreference(statusOrderPreference);
config.setHiddenAreaMarkerTypeList(hiddenAreaMarkerTypes);
config.setOmitLevels(omitLevels);
List<Language> languages){
EnumSet<DistributionInfoDto.InfoPart> parts = config.getInfoParts();
- boolean subAreaPreference = config.isSubAreaPreference();
+ boolean subAreaPreference = config.isPreferSubareas();
boolean statusOrderPreference = config.isStatusOrderPreference();
Set<MarkerType> hiddenAreaMarkerTypes = config.getHiddenAreaMarkerTypeList();
Set<NamedAreaLevel> omitLevels = config.getOmitLevels();
/**
* <b>NOTE: To avoid LayzyLoadingExceptions this method must be used in a transactional context.</b>
*
- * Filters the given set of {@link Distribution}s for publication purposes
+ * Filters the given set of {@link Distribution}s for publication purposes.
* The following rules are respected during the filtering:
* <ol>
* <li><b>Marked area filter</b>: Skip distributions for areas having a {@code TRUE} {@link Marker}
* with one of the specified {@link MarkerType}s. Existing sub-areas of a marked area must also be marked
* with the same marker type, otherwise the marked area acts as a <b>fallback area</b> for the sub areas.
- * An area is a <b>fallback area</b> if it is marked to be hidden and if it has at least one of
- * sub area which is not marked to be hidden. The fallback area will be show if there is no {@link Distribution}
+ * An area is a <b>fallback area</b> if it is marked to be hidden and if it has at least one
+ * sub area which is not marked to be hidden. The fallback area will be shown if there is no {@link Distribution}
* for any of the non hidden sub-areas. For more detailed discussion on fallback areas see
* https://dev.e-taxonomy.eu/redmine/issues/4408</li>
+ *
* <li><b>Prefer aggregated rule</b>: if this flag is set to <code>true</code> aggregated
* distributions are preferred over non-aggregated elements.
* (Aggregated description elements are identified by the description having type
* information exists for the same area for which aggregated data is available,
* the aggregated data has to be given preference over other data.
* see parameter <code>preferAggregated</code></li>
+ *
* <li><b>Status order preference rule</b>: In case of multiple distribution
* status ({@link PresenceAbsenceTermBase}) for the same area the status
* with the highest order is preferred, see
}
/**
- * This method will cause all parent areas to be loaded into the session cache to that
- * all initialization of the NamedArea term instances in necessary. This improves the
+ * This method will cause all parent areas to be loaded into the session cache so that
+ * all initialization of the NamedArea term instances is ready. This improves the
* performance of the tree building
*/
private void loadAllParentAreas(Set<NamedArea> areas) {
}
/**
- * This method will cause all parent areas to be loaded into the session cache to that
- * all initialization of the NamedArea term instances in necessary. This improves the
+ * This method will cause all parent areas to be loaded into the session cache so that
+ * all initialization of the NamedArea term instances is ready. This improves the
* performance of the tree building
*/
private void loadAllParentAreas(Set<NamedAreaDto> areas) {
subTestWithEditMapService(result);
}
- @SuppressWarnings("deprecation")
// @Test
@DataSet( value="EditGeoServiceTest.getDistributionServiceRequestParameterString.xml")
// @DataSets({
String distributions = distributionService.getDistributionServiceRequestParameterString(taxonDescriptions,
subAreaPreference, statusOrderPreference, hideMarkedAreas, presenceAbsenceTermColors, langs);
- System.out.println(distributions);
+// System.out.println(distributions);
Assert.assertTrue("Distribution string should contain the non-persited distribution Germany", distributions.contains("DEU"));
Assert.assertFalse("Distribution string should contain France as it has a non-distribution feature", distributions.contains("FRA"));
// CHE,POL
/* 1.
* Aggregated elements are preferred over entered or imported elements
- * if the according flag ist set to true.
+ * if the according flag is set to true.
* (Aggregated description elements are identified by belonging to descriptions
* which have the type DescriptionType#AGGREGATED_DISTRIBUTION).
* This means if a non-aggregated status information exist for the same
* area for which aggregated data is available, the aggregated data has to be
* given preference over other data.
* Note by AM: be aware that according to #5050 the preference of aggregated
- * distributions is not valid anymore (for the E+M usecase). However, the functionality
+ * distributions is not valid anymore (for the E+M use-case). However, the functionality
* might be interesting for future use-cases.
*/
TaxonDescription aggregatedDescription = TaxonDescription.NewInstance();