Skip to content

Commit

Permalink
4.8.14 dev v7 (#197) (#198)
Browse files Browse the repository at this point in the history
Co-authored-by: ravisaurav-tarento <[email protected]>
  • Loading branch information
karthik-tarento and ravisaurav-tarento authored Jun 11, 2024
1 parent 5d5541c commit 6787a93
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -651,17 +651,18 @@ private boolean validateGroupValue(String groupValue){
return groupValuesList.contains(groupValue);
}

private boolean validateFieldValue(String fieldKey, String fieldValue) throws IOException {
private boolean validateFieldValue(String fieldKey, String fieldValue) {
if(redisCacheMgr.keyExists(fieldKey)){
return !redisCacheMgr.valueExists(fieldKey, fieldValue);
} else{
Set<String> designationsSet = new HashSet<>();
Map<String,Object> propertiesMap = new HashMap<>();
propertiesMap.put(Constants.CONTEXT_TYPE, fieldKey);
List<Map<String, Object>> languagesList = cassandraOperation.getRecordsByProperties(Constants.KEYSPACE_SUNBIRD, Constants.TABLE_MASTER_DATA, propertiesMap, Collections.singletonList(Constants.CONTEXT_NAME));
if(!CollectionUtils.isEmpty(languagesList)) {
for(Map<String, Object> languageMap : languagesList){
designationsSet.add((String)languageMap.get("contextname"));
List<Map<String, Object>> fieldValueList = cassandraOperation.getRecordsByProperties(Constants.KEYSPACE_SUNBIRD, Constants.TABLE_MASTER_DATA, propertiesMap, Collections.singletonList(Constants.CONTEXT_NAME));
if(!CollectionUtils.isEmpty(fieldValueList)) {
String columnName = fieldValueList.get(0).get("contextname") != null ? "contextname" : "contextName";
for(Map<String, Object> languageMap : fieldValueList){
designationsSet.add((String)languageMap.get(columnName));
}
}
redisCacheMgr.putCache(fieldKey, designationsSet.toArray(new String[0]), null);
Expand Down

0 comments on commit 6787a93

Please sign in to comment.