IDEMPIERE-5501 Misses in cache IDisplayTypeFactory (#1592)
This commit is contained in:
parent
7cac30ad13
commit
2fa0d49ac4
|
@ -232,12 +232,15 @@ public final class DisplayType
|
||||||
if (service != null)
|
if (service != null)
|
||||||
return service.isID(displayType);
|
return service.isID(displayType);
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().isID(displayType))
|
.filter(e -> e.getService() != null && e.getService().isID(displayType))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (found.isPresent()) {
|
if (found.isPresent()) {
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return true;
|
return found.get().getService().isID(displayType);
|
||||||
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -261,12 +264,15 @@ public final class DisplayType
|
||||||
if (service != null)
|
if (service != null)
|
||||||
return service.isNumeric(displayType);
|
return service.isNumeric(displayType);
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().isNumeric(displayType))
|
.filter(e -> e.getService() != null && e.getService().isNumeric(displayType))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (found.isPresent()) {
|
if (found.isPresent()) {
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return true;
|
return found.get().getService().isNumeric(displayType);
|
||||||
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -296,6 +302,7 @@ public final class DisplayType
|
||||||
return v != null ? v.intValue() : 0;
|
return v != null ? v.intValue() : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().getDefaultPrecision(displayType) != null)
|
.filter(e -> e.getService() != null && e.getService().getDefaultPrecision(displayType) != null)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
@ -304,6 +311,8 @@ public final class DisplayType
|
||||||
Integer v = found.get().getService().getDefaultPrecision(displayType);
|
Integer v = found.get().getService().getDefaultPrecision(displayType);
|
||||||
return v != null ? v.intValue() : 0;
|
return v != null ? v.intValue() : 0;
|
||||||
}
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} // getDefaultPrecision
|
} // getDefaultPrecision
|
||||||
|
|
||||||
|
@ -334,12 +343,15 @@ public final class DisplayType
|
||||||
if (service != null)
|
if (service != null)
|
||||||
return service.isText(displayType);
|
return service.isText(displayType);
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().isText(displayType))
|
.filter(e -> e.getService() != null && e.getService().isText(displayType))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (found.isPresent()) {
|
if (found.isPresent()) {
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return true;
|
return found.get().getService().isText(displayType);
|
||||||
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} // isText
|
} // isText
|
||||||
|
@ -364,12 +376,15 @@ public final class DisplayType
|
||||||
if (service != null)
|
if (service != null)
|
||||||
return service.isDate(displayType);
|
return service.isDate(displayType);
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().isDate(displayType))
|
.filter(e -> e.getService() != null && e.getService().isDate(displayType))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (found.isPresent()) {
|
if (found.isPresent()) {
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return true;
|
return found.get().getService().isDate(displayType);
|
||||||
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -394,12 +409,15 @@ public final class DisplayType
|
||||||
if (service != null)
|
if (service != null)
|
||||||
return service.isList(displayType);
|
return service.isList(displayType);
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().isList(displayType))
|
.filter(e -> e.getService() != null && e.getService().isList(displayType))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (found.isPresent()) {
|
if (found.isPresent()) {
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return true;
|
return found.get().getService().isList(displayType);
|
||||||
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -427,12 +445,15 @@ public final class DisplayType
|
||||||
if (service != null)
|
if (service != null)
|
||||||
return service.isLookup(displayType);
|
return service.isLookup(displayType);
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().isLookup(displayType))
|
.filter(e -> e.getService() != null && e.getService().isLookup(displayType))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (found.isPresent()) {
|
if (found.isPresent()) {
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return true;
|
return found.get().getService().isLookup(displayType);
|
||||||
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -455,12 +476,15 @@ public final class DisplayType
|
||||||
if (service != null)
|
if (service != null)
|
||||||
return service.isLOB(displayType);
|
return service.isLOB(displayType);
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().isLOB(displayType))
|
.filter(e -> e.getService() != null && e.getService().isLOB(displayType))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
if (found.isPresent()) {
|
if (found.isPresent()) {
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return true;
|
return found.get().getService().isLOB(displayType);
|
||||||
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -542,6 +566,7 @@ public final class DisplayType
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().getNumberFormat(displayType, language, pattern) != null)
|
.filter(e -> e.getService() != null && e.getService().getNumberFormat(displayType, language, pattern) != null)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
@ -549,6 +574,8 @@ public final class DisplayType
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return found.get().getService().getNumberFormat(displayType, language, pattern);
|
return found.get().getService().getNumberFormat(displayType, language, pattern);
|
||||||
}
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
|
}
|
||||||
|
|
||||||
format.setMaximumIntegerDigits(MAX_DIGITS);
|
format.setMaximumIntegerDigits(MAX_DIGITS);
|
||||||
format.setMaximumFractionDigits(MAX_FRACTION);
|
format.setMaximumFractionDigits(MAX_FRACTION);
|
||||||
|
@ -673,6 +700,7 @@ public final class DisplayType
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().getDateFormat(displayType, language, pattern) != null)
|
.filter(e -> e.getService() != null && e.getService().getDateFormat(displayType, language, pattern) != null)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
@ -680,6 +708,8 @@ public final class DisplayType
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return found.get().getService().getDateFormat(displayType, language, pattern);
|
return found.get().getService().getDateFormat(displayType, language, pattern);
|
||||||
}
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
|
@ -760,6 +790,7 @@ public final class DisplayType
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().getClass(displayType, yesNoAsBoolean) != null)
|
.filter(e -> e.getService() != null && e.getService().getClass(displayType, yesNoAsBoolean) != null)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
@ -767,6 +798,8 @@ public final class DisplayType
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return found.get().getService().getClass(displayType, yesNoAsBoolean);
|
return found.get().getService().getClass(displayType, yesNoAsBoolean);
|
||||||
}
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
return Object.class;
|
return Object.class;
|
||||||
|
@ -851,6 +884,7 @@ public final class DisplayType
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().getSQLDataType(displayType, columnName, fieldLength) != null)
|
.filter(e -> e.getService() != null && e.getService().getSQLDataType(displayType, columnName, fieldLength) != null)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
@ -858,6 +892,8 @@ public final class DisplayType
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return found.get().getService().getSQLDataType(displayType, columnName, fieldLength);
|
return found.get().getService().getSQLDataType(displayType, columnName, fieldLength);
|
||||||
}
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
|
}
|
||||||
|
|
||||||
if (!DisplayType.isText(displayType))
|
if (!DisplayType.isText(displayType))
|
||||||
s_log.severe("Unhandled Data Type = " + displayType);
|
s_log.severe("Unhandled Data Type = " + displayType);
|
||||||
|
@ -955,6 +991,7 @@ public final class DisplayType
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (! s_displayTypeFactoryCache.containsKey(displayType)) {
|
||||||
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
Optional<IServiceReferenceHolder<IDisplayTypeFactory>> found = getDisplayTypeFactories().stream()
|
||||||
.filter(e -> e.getService() != null && e.getService().getDescription(displayType) != null)
|
.filter(e -> e.getService() != null && e.getService().getDescription(displayType) != null)
|
||||||
.findFirst();
|
.findFirst();
|
||||||
|
@ -962,6 +999,8 @@ public final class DisplayType
|
||||||
s_displayTypeFactoryCache.put(displayType, found.get());
|
s_displayTypeFactoryCache.put(displayType, found.get());
|
||||||
return found.get().getService().getDescription(displayType);
|
return found.get().getService().getDescription(displayType);
|
||||||
}
|
}
|
||||||
|
s_displayTypeFactoryCache.put(displayType, null);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return "UNKNOWN DisplayType=" + displayType;
|
return "UNKNOWN DisplayType=" + displayType;
|
||||||
|
|
Loading…
Reference in New Issue