Changeset 7545
- Timestamp:
- 03/24/09 14:07:08 (16 months ago)
- Location:
- head/ambra/webapp/src/main
- Files:
-
- 2 modified
-
java/org/topazproject/ambra/admin/action/IssueManagementAction.java (modified) (9 diffs)
-
webapp/admin/issueManagement.ftl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
head/ambra/webapp/src/main/java/org/topazproject/ambra/admin/action/IssueManagementAction.java
r7502 r7545 2 2 * $$Id$ 3 3 * 4 * Copyright (c) 2006-200 7by Topaz, Inc.4 * Copyright (c) 2006-2009 by Topaz, Inc. 5 5 * http://topazproject.org 6 6 * … … 25 25 import org.topazproject.ambra.admin.service.AdminService; 26 26 import org.topazproject.ambra.admin.service.AdminService.JournalInfo; 27 import org.topazproject.ambra.model.article.ArticleInfo; 27 28 import org.apache.commons.logging.Log; 28 29 import org.apache.commons.logging.LogFactory; … … 32 33 import java.util.List; 33 34 import java.util.ArrayList; 35 import java.util.Iterator; 34 36 import java.net.URI; 35 37 import java.net.URISyntaxException; … … 55 57 private Issue issue; 56 58 private String articleOrderCSV; 59 private List<URI> orphans; 57 60 private List<TOCArticleGroup> articleGroups = new ArrayList<TOCArticleGroup>(); 58 61 … … 142 145 */ 143 146 if (validateCSV(issue, issueURIs)) 144 issue = adminService.updateIssue(issueURI,imageURI,displayName, 145 issueURIs,respectOrder); 147 issue = adminService.updateIssue(issueURI,imageURI,displayName,issueURIs,respectOrder); 146 148 147 149 } catch (Exception e) { … … 160 162 articleGroups = browseService.getArticleGrpList(issue); 161 163 articleOrderCSV = browseService.articleGrpListToCSV(articleGroups); 164 orphans = getOrphannedArticles(issue, articleGroups); 165 166 /* 167 * Add the Orphans so that validateCSV doesn't prevent 168 * all updates. 169 */ 170 String orphanCSV = convertURIsToCSV(orphans); 171 articleOrderCSV = (orphanCSV.length() > 0) ? articleOrderCSV +","+ orphanCSV : articleOrderCSV; 162 172 journalInfo = adminService.createJournalInfo(); 163 173 164 174 return SUCCESS; 175 } 176 177 /** 178 * 179 * @param uriList 180 * @return 181 */ 182 private String convertURIsToCSV(List<URI> uriList) { 183 StringBuilder csv = new StringBuilder(); 184 185 for(URI uri : uriList) { 186 if (csv.length() > 0) 187 csv.append(','); 188 csv.append(uri.toString()); 189 } 190 191 return csv.toString(); 192 } 193 194 /** 195 * 196 * @param issue 197 * @param articleGroups 198 * @return 199 */ 200 private List<URI> getOrphannedArticles(Issue issue, List<TOCArticleGroup> articleGroups) { 201 List<URI> articleList = issue.getArticleList(); 202 List<URI> orphans = new ArrayList<URI>(); 203 204 for(URI articleURI : articleList) { 205 Boolean found = false; 206 for (TOCArticleGroup ag : articleGroups) { 207 List<ArticleInfo> infoList = ag.getArticles(); 208 for(ArticleInfo info : infoList ) { 209 if (info.getId().equals(articleURI)) { 210 found = true; 211 break; 212 } 213 } 214 } 215 if (!found) 216 orphans.add(articleURI); 217 } 218 219 return orphans; 165 220 } 166 221 … … 191 246 } 192 247 return true; 248 } 249 250 /** 251 * 252 * @return 253 */ 254 public List<URI> getOrphans() { 255 return this.orphans; 193 256 } 194 257 … … 254 317 this.imageURI = null; 255 318 if (log.isDebugEnabled()) 256 log.debug("setImage URI conversion failed. "); 319 log.debug("setImage URI conversion failed." + 320 "imageURI set to null to indicate this: " + uri.trim(), e); 257 321 } 258 322 } … … 267 331 this.volumeURI = null; 268 332 if (log.isDebugEnabled()) 269 log.debug("setVolume URI conversion failed. "); 333 log.debug("setVolume URI conversion failed." + 334 "volumeURI set to null to indicate this: " + uri.trim(), e); 270 335 } 271 336 } -
head/ambra/webapp/src/main/webapp/admin/issueManagement.ftl
r7496 r7545 145 145 </tr> 146 146 </#list> 147 </table> 148 </#list> 147 </table> 148 </#list> 149 <b>Ophanned Articles</b> 150 <table border="1" cellpadding="10" cellspacing="0"> 151 <tr> 152 <td colspan="2"> 153 <ul> 154 <li><kbd>Articles with types no longer in the configuration file.</kbd></li> 155 <li><kbd>Incorrect URIs not associated with an article.</kbd></li> 156 </ul> 157 </td> 158 </tr> 159 <tr> 160 <th>Delete</th> 161 <th>Article URI</th> 162 </tr> 163 <#list orphans as orphan> 164 <tr> 165 <td align="center"> 166 <@s.checkbox name="articlesToRemove" fieldValue="${orphan}"/> 167 </td> 168 <td> 169 ${orphan} 170 </td> 171 </tr> 172 </#list> 173 </table> 149 174 <@s.submit value="Remove Selected Articles"/> 150 175 </@s.form>
