Commit 373f2198 authored by LAVENIER's avatar LAVENIER
Browse files

Merge remote-tracking branch 'origin/develop' into develop

parents c529b239 3e2289e3
......@@ -25,6 +25,7 @@ package net.sumaris.core.dao.technical.model.annotation;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import net.sumaris.core.config.SumarisConfiguration;
import net.sumaris.core.util.Beans;
import net.sumaris.core.util.StringUtils;
......@@ -32,13 +33,14 @@ import org.nuiton.config.ConfigOptionDef;
import org.reflections.Reflections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Helper class for enumerations
*/
@Slf4j
public final class EntityEnums {
private static final String MODEL_PACKAGE_NAME = "net.sumaris.core.model";
......@@ -50,7 +52,16 @@ public final class EntityEnums {
public static Set<Class<?>> getEntityEnumClasses(SumarisConfiguration config) {
// Add annotations entities
Reflections reflections = (config != null && config.isProduction() ? Reflections.collect() : new Reflections(MODEL_PACKAGE_NAME));
Reflections reflections = null;
// Try to use saved reflexions file from classpath
if (config != null && config.isProduction()) {
reflections = Reflections.collect();
if (reflections == null) {
log.warn("Reflections.collect() in production mode returned null. Fallback to default scanner");
}
}
// Or use reflexions scanner
reflections = Optional.ofNullable(reflections).orElse(new Reflections(MODEL_PACKAGE_NAME));
return reflections.getTypesAnnotatedWith(EntityEnum.class);
}
......
......@@ -69,7 +69,7 @@
<SOFTWARE_PROPERTY ID="74" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.favicon" NAME="image:22"/>
<SOFTWARE_PROPERTY ID="75" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.defaultLocale" NAME="en"/>
<SOFTWARE_PROPERTY ID="76" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.observedLocation.enable" NAME="true"/>
<SOFTWARE_PROPERTY ID="77" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.observedLocation.name" NAME="Observations"/>
<SOFTWARE_PROPERTY ID="77" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.observedLocation.name" NAME="MENU.OCCASIONS"/>
<SOFTWARE_PROPERTY ID="78" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.trip.enable" NAME="true"/>
<SOFTWARE_PROPERTY ID="79" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.vessel.status.default" NAME="2"/>
<SOFTWARE_PROPERTY ID="80" STATUS_FK="1" SOFTWARE_FK="4" CREATION_DATE="2019-02-11" LABEL="sumaris.android.install.url" NAME="./download/android/sumaris-app-latest.apk"/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment