Skip to content

Commit

Permalink
implementation
Browse files Browse the repository at this point in the history
Issue imixs#556
  • Loading branch information
rsoika committed Aug 26, 2019
1 parent fdc150c commit 069f7a9
Showing 1 changed file with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,21 @@ public String getValue(String key) {
if (properties == null) {
loadProperties();
}
return properties.get(key);

String value = properties.get(key);
// search alterntive / deprecated imixs.property?
if (value == null || value.isEmpty()) {
String keyAlternative = getAlternative(key);
if (keyAlternative != null && !keyAlternative.isEmpty()) {
value = properties.get(keyAlternative);
if (value != null && !value.isEmpty()) {
logger.warning(
"Deprecated imixs.property '" + keyAlternative + "' should be replaced by '" + key + "'");
}
}

}
return value;
}

@Override
Expand Down Expand Up @@ -91,4 +105,44 @@ private void loadProperties() {

}

/**
* This method provides key alternatives for deprecated imixs.property values
*
* <ul>
* <li>lucence.fulltextFieldList - index.fields</li>
* <li>lucence.indexFieldListAnalyze - index.fields.analyse</li>
* <li>lucence.indexFieldListNoAnalyze - index.fields.noanalyse</li>
* <li>lucence.indexFieldListStore - index.fields.store</li>
*
* <li>lucence.defaultOperator - index.operator</li>
* <li>lucence.splitOnWhitespace - index.splitwhitespace</li>
* </ul>
*
* @param key
* @return
*/
private String getAlternative(String key) {

if ("index.fields".equals(key)) {
return "lucence.fulltextFieldList";
}
if ("index.fields.analyse".equals(key)) {
return "lucence.indexFieldListAnalyze";
}
if ("index.fields.noanalyse".equals(key)) {
return "lucence.indexFieldListNoAnalyze";
}
if ("index.fields.store".equals(key)) {
return "lucence.indexFieldListStore";
}

if ("index.operator".equals(key)) {
return "lucence.defaultOperator";
}
if ("index.splitwhitespace".equals(key)) {
return "lucence.splitOnWhitespace";
}

return null;
}
}

0 comments on commit 069f7a9

Please sign in to comment.