Revision 59449
Added by Konstantina Galouni over 3 years ago
EntityService.java | ||
---|---|---|
10 | 10 |
import org.springframework.beans.factory.annotation.Autowired; |
11 | 11 |
import org.springframework.stereotype.Service; |
12 | 12 |
|
13 |
import java.util.Iterator; |
|
13 | 14 |
import java.util.List; |
14 | 15 |
import java.util.Map; |
15 | 16 |
|
... | ... | |
84 | 85 |
|
85 | 86 |
public Boolean deleteEntities(List<String> entities) throws Exception { |
86 | 87 |
for (String id: entities) { |
87 |
entityDAO.delete(id); |
|
88 |
|
|
89 | 88 |
// delete entity from portals |
90 | 89 |
List<Portal> portals = portalService.getAllPortals(); |
91 | 90 |
for( Portal portal : portals ) { |
... | ... | |
99 | 98 |
List<Page> pages = pageService.getAllPages(null, null, null); |
100 | 99 |
for( Page page : pages ) { |
101 | 100 |
List<String> pageEntities = page.getEntities(); |
102 |
int index = 0; |
|
103 |
for(String pageEntity : pageEntities) { |
|
104 |
if(pageEntity == id) { |
|
105 |
pageEntities.remove(index); |
|
101 |
Iterator<String> pageEntityIterator = pageEntities.iterator(); |
|
102 |
while(pageEntityIterator.hasNext()) { |
|
103 |
String pageEntity = pageEntityIterator.next(); |
|
104 |
if(pageEntity.equals(id)) { |
|
105 |
pageEntityIterator.remove(); |
|
106 | 106 |
break; |
107 | 107 |
} |
108 |
index++; |
|
109 | 108 |
} |
110 | 109 |
page.setEntities(pageEntities); |
111 | 110 |
pageService.insertOrUpdatePage(page); |
112 | 111 |
} |
112 |
entityDAO.delete(id); |
|
113 | 113 |
} |
114 | 114 |
|
115 | 115 |
return true; |
Also available in: Unified diff
[Trunk | Admin Tools Library]:
1. AdminPortalRelationsController.java: In "getDivIdsFull()" (/{pid}/div/full) set RequestParam page as NOT required (bug fix in admin portal).
2. EntityService.java: [Bug fix]
a. In "deleteEntities()", delete entity, after all relations with it have been deleted.
b. Check equality of page entity with id with "equals" not "==".
3. PageService.java: [Bug fix]
a. Delete page, after all related divIds, related div help contents, related page help contents have been deleted.
b. Delete divId, after all related div help contents have been deleted.
c. In "getDivHelpContents()" and "getPageHelpContents()" param is "page.getRoute()" (not its id).