query.setParameter("language_id", language_id);
query.setParameter("start", start);
query.setParameter("max", start + max);
List<Fieldlanguagesvalues> returnList = performReplace(query.getResultList());
FieldLanguage fieldLanguage = fieldLanguageDaoImpl
.getFieldLanguageById(language_id);
log.debug("GEtting all fields by language : "
+ fieldLanguage.getName());
// Check for Right To Left Languages
if (fieldLanguage.getRtl()) {
log.debug("language : " + fieldLanguage.getName()
+ " requieres RTL");
List<Fieldlanguagesvalues> returnRtlList = new LinkedList<Fieldlanguagesvalues>();
for (Iterator<Fieldlanguagesvalues> iter = returnList
.iterator(); iter.hasNext();) {
Fieldlanguagesvalues remote = iter.next();
Fieldlanguagesvalues toAdd = new Fieldlanguagesvalues();
toAdd.setFieldlanguagesvalues_id(remote
.getFieldlanguagesvalues_id());
toAdd.setFieldvalues_id(remote.getFieldvalues_id());
toAdd.setLanguage_id(remote.getLanguage_id());
String[] splitted = remote.getValue().split(" ");
String reverseOrder = "";
for (int i = splitted.length - 1; i >= 0; i--) {
reverseOrder += splitted[i];
if (splitted.length != 1) {
reverseOrder += " ";
}
}
toAdd.setValue(reverseOrder);
returnRtlList.add(toAdd);
}
return returnRtlList;
} else {
log.debug("language : " + fieldLanguage.getName()
+ " requieres NO RTL");
return returnList;
}