[Trunk | Admin Tools Library]:
1. DivHelpContentDAO.java & MongoDBDivHelpContentDAO.java: [Bug fix] Remove method "findByPortalAndPage()" as there is no "page" field in "DivHelpContent" class. 2. DivHelpContentService.java: [Bug fix] In method "getDivHelpContentsBasic()" change the way parameter "pageId" is used to filter results - find page in "DivId" not "DivHelpContent". 3. AdminPortalRelationsController.java: In method "getPagesForPortalByType()" add again optional parameter "page_route".
This commit is contained in:
parent
a265d414a4
commit
2a3f6c6a58
|
@ -200,10 +200,10 @@ public class AdminPortalRelationsController {
|
|||
public List<PortalPage> getPagesForPortalByType(@PathVariable PortalType portalType,
|
||||
@PathVariable(value = "pid") String pid,
|
||||
@RequestParam(value="page_type", required=false) String page_type,
|
||||
//@RequestParam(value="page_route", required=false) String page_route,
|
||||
@RequestParam(value="page_route", required=false) String page_route,
|
||||
@RequestParam(value="div", required = false) String div,
|
||||
@RequestParam(value="with_positions", required = false) String with_positions) {
|
||||
return portalService.getPagesForPortalByType(pid, page_type, null, div, with_positions);
|
||||
return portalService.getPagesForPortalByType(pid, page_type, page_route, div, with_positions);
|
||||
}
|
||||
|
||||
// not used by portals
|
||||
|
|
|
@ -14,7 +14,7 @@ public interface DivHelpContentDAO {
|
|||
List<DivHelpContent> findByPortalAndIsActive(String portalId, boolean isActive);
|
||||
List<DivHelpContent> findByDivIdAndIsActive(String divId, boolean isActive);
|
||||
List<DivHelpContent> findByPortalAndDivIdAndIsActive(String portalId, String divId, boolean isActive);
|
||||
List<DivHelpContent> findByPortalAndPage(String portalId, String page);
|
||||
// List<DivHelpContent> findByPortalAndPage(String portalId, String page);
|
||||
|
||||
DivHelpContent findById(String Id);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface MongoDBDivHelpContentDAO extends DivHelpContentDAO, MongoReposi
|
|||
List<DivHelpContent> findByPortalAndIsActive(String portalId, boolean isActive);
|
||||
List<DivHelpContent> findByDivIdAndIsActive(String divId, boolean isActive);
|
||||
List<DivHelpContent> findByPortalAndDivIdAndIsActive(String portalId, String divId, boolean isActive);
|
||||
List<DivHelpContent> findByPortalAndPage(String portalId, String page);
|
||||
// List<DivHelpContent> findByPortalAndPage(String portalId, String page);
|
||||
|
||||
DivHelpContent findById(String Id);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
@ -104,14 +105,33 @@ public class DivHelpContentService {
|
|||
}
|
||||
}
|
||||
|
||||
if(pid != null && pageId != null) {
|
||||
divHelpContents = divHelpContentDAO.findByPortalAndPage(portalId, pageId);
|
||||
} else if(pid != null) {
|
||||
if(pid != null) {
|
||||
divHelpContents = divHelpContentDAO.findByPortal(portalId);
|
||||
} else {
|
||||
divHelpContents = divHelpContentDAO.findAll();
|
||||
}
|
||||
|
||||
if(pageId != null) {
|
||||
Iterator<DivHelpContent> divHelpContentsIterator = divHelpContents.iterator();
|
||||
while (divHelpContentsIterator.hasNext()) {
|
||||
DivHelpContent divHelpContent = divHelpContentsIterator.next();
|
||||
|
||||
String divIdId = divHelpContent.getDivId();
|
||||
DivId divId = divIdService.getDivId(divIdId);
|
||||
|
||||
Boolean remove = true;
|
||||
for (String pageIdInDivId : divId.getPages()) {
|
||||
if (pageId.equals(pageIdInDivId)) {
|
||||
remove = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(remove) {
|
||||
divHelpContentsIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return divHelpContents;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue