diff --git a/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/ItemListLoaderServlet.java b/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/ItemListLoaderServlet.java index c84eac6f..77f6c04f 100644 --- a/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/ItemListLoaderServlet.java +++ b/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/ItemListLoaderServlet.java @@ -147,7 +147,7 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp //Getting the master language RegLanguagecode masterLanguage = regLanguagecodeManager.getMasterLanguage(); request.setAttribute(BaseConstants.KEY_REQUEST_MASTERLANGUAGE, masterLanguage); - + RegLanguagecode english = regLanguagecodeManager.getByIso6391code("en"); // Getting the language by parameter (if not available the master language is used) @@ -415,7 +415,7 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp j++; } else if (tmpRegFieldmapping.getRegField().getRegFieldtype().getLocalid().equals(BaseConstants.KEY_FIELD_TYPE_SUCCESSOR)) { - + // Get the "successor" reg relation List tmpRegRelations = regRelationManager.getAll(tmpRegItem, regRelationpredicateSuccessor); if (!tmpRegRelations.isEmpty()) { @@ -473,12 +473,16 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp RegStatus regStatusProposedItem = regItemproposed.getRegStatus(); //Getting the RegStatus localization - RegStatuslocalization regStatusLocalizationProposedItem; + RegStatuslocalization regStatusLocalizationProposedItem = null; try { regStatusLocalizationProposedItem = regStatuslocalizationManager.get(regStatusProposedItem, regLanguagecode); } catch (NoResultException e) { regStatusLocalizationProposedItem = regStatuslocalizationManager.get(regStatusProposedItem, masterLanguage); } + + if(regStatusLocalizationProposedItem == null) { + regStatusLocalizationProposedItem = regStatuslocalizationManager.get(regStatusProposedItem, masterLanguage); + } regItemproposedStatus = " / " + regStatusLocalizationProposedItem.getLabel(); @@ -490,14 +494,14 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp try { regStatusLocalization = regStatuslocalizationManager.get(regStatus, regLanguagecode); } catch (NoResultException e) { - try{ - regStatusLocalization = regStatuslocalizationManager.get(regStatus, masterLanguage); - } catch (Exception ex){ + try { + regStatusLocalization = regStatuslocalizationManager.get(regStatus, masterLanguage); + } catch (Exception ex) { regStatusLocalization = regStatuslocalizationManager.get(regStatus, english); } } - String statusURI = regStatusgroup.getBaseuri()+ "/" + regStatusgroup.getLocalid() + "/" + regStatus.getLocalid(); + String statusURI = regStatusgroup.getBaseuri() + "/" + regStatusgroup.getLocalid() + "/" + regStatus.getLocalid(); outs += "\"" + regStatusLocalization.getLabel() + regItemproposedStatus + "\""; j++; @@ -550,6 +554,9 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp } catch (NoResultException e) { regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), masterLanguage); } + if (regLocalizationTmps.isEmpty()) { + regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), masterLanguage); + } for (RegLocalization regLocalizationTmp : regLocalizationTmps) { outs += "\"" + StringEscapeUtils.escapeJson(regLocalizationTmp.getValue()) + "\""; @@ -571,7 +578,11 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp } catch (NoResultException e) { regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), masterLanguage); } - + + /* if(regLocalizationTmps.isEmpty()){ + regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), masterLanguage); + } */ + if (k != 0) { outs += ","; } diff --git a/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/ItemProposedListLoaderServlet.java b/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/ItemProposedListLoaderServlet.java index 6ab26209..b0e3bc5c 100644 --- a/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/ItemProposedListLoaderServlet.java +++ b/sources/Re3gistry2/src/main/java/eu/europa/ec/re3gistry2/web/controller/ItemProposedListLoaderServlet.java @@ -180,8 +180,7 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp // } List containedRegItemsCheck = regItemproposedManager.getAllNew(regItemclasses, regItem, regRelationpredicateCollection, start, length); - if (!containedRegItemsCheck.isEmpty() -// && containedRegItemsCheck.size() != containedRegItems.size() + if (!containedRegItemsCheck.isEmpty() // && containedRegItemsCheck.size() != containedRegItems.size() ) { containedRegItems = containedRegItemsCheck; totalCount = regItemproposedManager.countAllNew(regItemclasses, regItem, regRelationpredicateCollection); @@ -224,7 +223,7 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp if (i != 0) { outs += ","; } - outs += "[\"" + StringEscapeUtils.escapeJson(tmpRegLocalozations.get(0).getValue()) + "\"]"; + outs += "[\"" + StringEscapeUtils.escapeJson(tmpRegLocalozations.get(0).getValue()) + "\"]"; // It the contained itemclass is just one } else { @@ -459,7 +458,7 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp regStatusLocalization = regStatuslocalizationManager.get(regStatus, masterLanguage); } - String statusURI = regStatusgroup.getBaseuri()+ "/" + regStatusgroup.getLocalid() + "/" + regStatus.getLocalid(); + String statusURI = regStatusgroup.getBaseuri() + "/" + regStatusgroup.getLocalid() + "/" + regStatus.getLocalid(); outs += "\"" + regStatusLocalization.getLabel() + "\""; j++; @@ -510,7 +509,9 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp } catch (NoResultException e) { regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), masterLanguage); } - + if (regLocalizationTmps.isEmpty()) { + regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), masterLanguage); + } for (RegLocalization regLocalizationTmp : regLocalizationTmps) { outs += "\"" + StringEscapeUtils.escapeJson(regLocalizationTmp.getValue()) + "\""; } @@ -528,10 +529,12 @@ private void processRequest(HttpServletRequest request, HttpServletResponse resp List regLocalizationTmps; try { regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), regLanguagecode); - } catch (NoResultException e) { + } catch (Exception e) { + regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), masterLanguage); + } + if (regLocalizationTmps.isEmpty()) { regLocalizationTmps = regLocalizationManager.getAll(regFieldManager.getTitleRegField(), regRelation.getRegItemObject(), masterLanguage); } - if (k != 0) { outs += ","; }