This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit d42c625b47aba892c9b78fe423c74fc73a64ec5f Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Oct 14 17:14:27 2014 +0200 Qualité du code dans WaoUtils --- .../src/main/java/fr/ifremer/wao/BoatsFilter.java | 10 ++--- .../main/java/fr/ifremer/wao/ContactsFilter.java | 22 +++++----- .../main/java/fr/ifremer/wao/SampleRowsFilter.java | 24 +++++------ .../src/main/java/fr/ifremer/wao/WaoUtils.java | 50 +--------------------- 4 files changed, 30 insertions(+), 76 deletions(-) diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/BoatsFilter.java b/wao-persistence/src/main/java/fr/ifremer/wao/BoatsFilter.java index 45958ac..192381d 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/BoatsFilter.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/BoatsFilter.java @@ -185,11 +185,11 @@ public class BoatsFilter extends AbstractWaoFilter { hashCode = 31 * hashCode + Objects.hashCode(boatName); hashCode = 31 * hashCode + Objects.hashCode(registrationCode); hashCode = 31 * hashCode + Objects.hashCode(boatNameOrRegistrationCode); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(boatIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(shipOwnerIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(districtIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(portOfRegistryIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(fleetIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(boatIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(shipOwnerIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(districtIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(portOfRegistryIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(fleetIds); return hashCode; } diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java b/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java index 1c804ff..7dcb6e9 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/ContactsFilter.java @@ -351,22 +351,22 @@ public class ContactsFilter extends AbstractWaoFilter { hashCode = 31 * hashCode + Objects.hashCode(boatFilter); hashCode = 31 * hashCode + Objects.hashCode(periodFrom); hashCode = 31 * hashCode + Objects.hashCode(periodFrom); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(contactIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(contactStates); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(dataReliabilities); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(actualSamplingStrategies); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(observedDataControls); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(observerIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(terrestrialLocationIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(contactStateMotiveIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(contactIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(contactStates); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(dataReliabilities); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(actualSamplingStrategies); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(observedDataControls); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(observerIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(terrestrialLocationIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(contactStateMotiveIds); hashCode = 31 * hashCode + Objects.hashCode(mammalsCaptureOnly); hashCode = 31 * hashCode + Objects.hashCode(mammalsObservationOnly); hashCode = 31 * hashCode + Objects.hashCode(commentDefinedOnly); hashCode = 31 * hashCode + Objects.hashCode(commentAdminDefinedOnly); hashCode = 31 * hashCode + Objects.hashCode(commentCompanyDefinedOnly); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(companyAcceptations); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(programAcceptations); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(completeSamplings); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(companyAcceptations); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(programAcceptations); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(completeSamplings); hashCode = 31 * hashCode + Objects.hashCode(filterOnObservationBeginDate); hashCode = 31 * hashCode + Objects.hashCode(sortedByBoardingDate); return hashCode; diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java b/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java index 0bcc1b5..1bd98e0 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/SampleRowsFilter.java @@ -237,18 +237,18 @@ public class SampleRowsFilter extends AbstractWaoFilter { if (periodTo != null) { hashCode = 31 * hashCode + periodTo.hashCode(); } - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(sampleRowIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(sampleRowIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(fishingZoneFacadeNames); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(fishingZoneSectorNames); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(sampleRowCodes); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(programNames); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(fishingGearDcfIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(targetSpeciesDcfIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(samplingStrategies); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(terrestrialDistrictIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(companyIds); - hashCode = 31 * hashCode + WaoUtils.collectionHashcode(orderByArguments); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(sampleRowIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(sampleRowIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(fishingZoneFacadeNames); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(fishingZoneSectorNames); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(sampleRowCodes); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(programNames); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(fishingGearDcfIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(targetSpeciesDcfIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(samplingStrategies); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(terrestrialDistrictIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(companyIds); + hashCode = 31 * hashCode + WaoUtils.collectionHashCode(orderByArguments); return hashCode; } diff --git a/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java b/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java index fc25e7e..cbda03d 100644 --- a/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java +++ b/wao-persistence/src/main/java/fr/ifremer/wao/WaoUtils.java @@ -36,8 +36,6 @@ import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TreeMap; @@ -47,48 +45,13 @@ public class WaoUtils { @Deprecated protected static final String MONTH_PATTERN = "MM/yyyy"; - @Deprecated - protected static final String MONTH_ONLY_PATTERN = "MM"; - - @Deprecated - protected static final String YEAR_ONLY_PATTERN = "yyyy"; - - @Deprecated - protected static final String DATE_PATTERN = "dd/MM/yyyy"; - - @Deprecated - protected static final String DATE_TIME_PATTERN = "dd/MM/yyyy HH:mm"; - - @Deprecated - protected static final String TIME_PATTERN = "HH:mm"; - protected static final String FRENCH_LANGUAGE = new Locale("fr").getLanguage(); protected static final Date WAO_CREATION_DATE = DateUtil.createDate(27, 1, 2010); @Deprecated public static String formatMonth(Date date) { - return formatDate(date, MONTH_PATTERN); - } - - @Deprecated - public static String formatDate(Date date) { - return formatDate(date, DATE_PATTERN); - } - - @Deprecated - public static String formatDateTime(Date date) { - return formatDate(date, DATE_TIME_PATTERN); - } - - @Deprecated - public static String formatTime(Date date) { - return formatDate(date, TIME_PATTERN); - } - - @Deprecated - protected static String formatDate(Date date, String pattern) { - DateFormat dateFormat = new SimpleDateFormat(pattern); + DateFormat dateFormat = new SimpleDateFormat(MONTH_PATTERN); return dateFormat.format(date); } @@ -141,15 +104,6 @@ public class WaoUtils { return I18n.l(locale, i18nAble.getI18nKey()); } - @Deprecated - public static <T extends Enum> Collection<Integer> toOrdinals(Collection<T> enums) { - List<Integer> ordinals = new LinkedList<>(); - for (Enum anEnum : enums) { - ordinals.add(anEnum.ordinal()); - } - return ordinals; - } - public static Date getEndOfMonth(Date month) { return DateUtils.addMilliseconds( DateUtils.addMonths(month, 1), -1); @@ -177,7 +131,7 @@ public class WaoUtils { return isEqualCollection; } - public static int collectionHashcode(Collection<?> a) { + public static int collectionHashCode(Collection<?> a) { return a == null ? 0 : a.size(); } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.