Map<String, Optional<String>> builder = new HashMap<>(keys.size()); res.forEach(internalPropertyDto -> { String key = internalPropertyDto.getKey(); if (internalPropertyDto.isEmpty()) { builder.put(key, OPTIONAL_OF_EMPTY_STRING); if (internalPropertyDto.getValue() != null) { builder.put(key, Optional.of(internalPropertyDto.getValue())); res.forEach(internalPropertyDto -> builder.put(internalPropertyDto.getKey(), Optional.of(internalPropertyDto.getValue())));
/** * No streaming of value */ public Optional<String> selectByKey(DbSession dbSession, String key) { checkKey(key); InternalPropertiesMapper mapper = getMapper(dbSession); InternalPropertyDto res = enforceSingleElement(key, mapper.selectAsText(singletonList(key))); if (res == null) { return Optional.empty(); } if (res.isEmpty()) { return OPTIONAL_OF_EMPTY_STRING; } if (res.getValue() != null) { return Optional.of(res.getValue()); } res = enforceSingleElement(key, mapper.selectAsClob(singletonList(key))); if (res == null) { Loggers.get(InternalPropertiesDao.class) .debug("Internal property {} has been found in db but has neither text value nor is empty. " + "Still it couldn't be retrieved with clob value. Ignoring the property.", key); return Optional.empty(); } return Optional.of(res.getValue()); }
/** * No streaming of value */ public Optional<String> selectByKey(DbSession dbSession, String key) { checkKey(key); InternalPropertiesMapper mapper = getMapper(dbSession); InternalPropertyDto res = mapper.selectAsText(key); if (res == null) { return Optional.empty(); } if (res.isEmpty()) { return OPTIONAL_OF_EMPTY_STRING; } if (res.getValue() != null) { return Optional.of(res.getValue()); } res = mapper.selectAsClob(key); if (res == null) { Loggers.get(InternalPropertiesDao.class) .debug("Internal property {} has been found in db but has neither text value nor is empty. " + "Still we couldn't be retrieved with clob value. Ignoring the property.", key); return Optional.empty(); } return Optional.of(res.getValue()); }