1 20 package org.openi.project; 21 22 import org.openi.menu.MenuItem; 23 import org.openi.util.*; 24 import java.io.*; 25 import java.util.*; 26 27 28 31 public class Project implements Serializable { 32 private String projectId; 33 private String projectName; 34 private String externalUrl; 35 private String cssName; 36 private String logoUrl; private String splashImageUrl; private String splashPage = "splash.htm"; private List modules; 40 private Map dataSourceMap; 41 private String category; 42 private String message; private Map menuConfig; 44 45 49 private Map colorPaletteMap; 50 private String defaultPaletteName; 51 52 55 private String projectAdmins; 56 57 60 private String projectUsers; 61 62 65 private String projectReadOnlyUsers; 66 67 70 private Map jdbcMap; 71 72 private boolean writeImageMap = true; 75 76 81 private Map overviews = new HashMap(); 82 83 84 public Project() { 86 } 87 88 91 public String getCssName() { 92 return cssName; 93 } 94 95 98 public void setCssName(String cssName) { 99 this.cssName = cssName; 100 } 101 102 105 public String getExternalUrl() { 106 return externalUrl; 107 } 108 109 112 public void setExternalUrl(String externalUrl) { 113 this.externalUrl = externalUrl; 114 } 115 116 119 120 123 public String getProjectId() { 124 return projectId; 125 } 126 127 130 public void setProjectId(String projectId) { 131 this.projectId = projectId; 132 } 133 134 137 public String getProjectName() { 138 return projectName; 139 } 140 141 144 public void setProjectName(String projectName) { 145 this.projectName = projectName; 146 } 147 148 151 public List getModules() { 152 return modules; 153 } 154 155 158 public void setModules(List modules) { 159 this.modules = modules; 160 } 161 162 165 public String getLogoUrl() { 166 return logoUrl; 167 } 168 169 172 public void setLogoUrl(String logoUrl) { 173 this.logoUrl = logoUrl; 174 } 175 176 179 public String getSplashImageUrl() { 180 return splashImageUrl; 181 } 182 183 187 public Map getDataSourceMap() { 188 return dataSourceMap; 189 } 190 191 195 public void setSplashImageUrl(String splashImageUrl) { 196 this.splashImageUrl = splashImageUrl; 197 } 198 199 203 public void setDataSourceMap(Map dataSource) { 204 this.dataSourceMap = dataSource; 205 } 206 207 210 public Map getColorPaletteMap() { 211 233 return this.colorPaletteMap; 234 } 235 236 240 public String getProjectUsers() { 241 return projectUsers; 242 } 243 244 248 public String getProjectAdmins() { 249 return projectAdmins; 250 } 251 252 256 public String getProjectReadOnlyUsers() { 257 return projectReadOnlyUsers; 258 } 259 260 263 public void setColorPaletteMap(Map colorPaletteMap) { 264 this.colorPaletteMap = colorPaletteMap; 265 } 266 267 public void setProjectUsers(String projectUsers) { 268 this.projectUsers = projectUsers; 269 } 270 271 public void setProjectAdmins(String pojectAdmins) { 272 this.projectAdmins = pojectAdmins; 273 } 274 275 public void setProjectReadOnlyUsers(String projectReadOnlyUsers) { 276 this.projectReadOnlyUsers = projectReadOnlyUsers; 277 } 278 279 public List getColorPalette(String colorPaletteName) { 280 List palette = null; 281 282 if (colorPaletteName != null) { 283 palette = (List) this.getColorPaletteMap().get(colorPaletteName); 284 } 285 286 return palette; 287 } 288 289 292 public String getDefaultPaletteName() { 293 return defaultPaletteName; 294 } 295 296 299 public void setDefaultPaletteName(String defaultPaletteName) { 300 this.defaultPaletteName = defaultPaletteName; 301 } 302 303 308 public boolean validateUser(String userName) { 309 return Util.isItemInList(userName, projectUsers) 310 || Util.isItemInList(userName, projectReadOnlyUsers); 311 } 312 313 318 public boolean validateAdmin(String userName) { 319 return Util.isItemInList(userName, projectAdmins); 320 } 321 322 325 public String getCategory() { 326 return category; 327 } 328 329 public String getSplashPage() { 330 return splashPage; 331 } 332 333 336 public void setCategory(String category) { 337 this.category = category; 338 } 339 340 public void setSplashPage(String splashPage) { 341 this.splashPage = splashPage; 342 } 343 344 347 public String getMessage() { 348 return message; 349 } 350 351 354 public void setMessage(String message) { 355 this.message = message; 356 } 357 358 361 public boolean getWriteImageMap() { 362 return writeImageMap; 363 } 364 365 368 public void setWriteImageMap(boolean writeImageMap) { 369 this.writeImageMap = writeImageMap; 370 } 371 372 public Map getMenuConfig() { 373 if (menuConfig == null) { 374 this.menuConfig = this.createDefaultAdminMenuConfig(); 375 } 376 377 return menuConfig; 378 } 379 380 public void setMenuConfig(Map menuConfig) { 381 this.menuConfig = menuConfig; 382 } 383 384 public Map getJdbcMap() { 385 return this.jdbcMap; 386 } 387 388 public void setJdbcMap(Map jdbcMap) { 389 this.jdbcMap = jdbcMap; 390 } 391 392 396 private Map createDefaultAdminMenuConfig() { 397 Map config = new HashMap(); 398 399 List appAdminList = new LinkedList(); 400 appAdminList.add(new MenuItem("Manage Application", 401 "editapplication.htm")); 402 config.put("appAdminList", appAdminList); 403 404 List projectAdminList = new LinkedList(); 405 projectAdminList.add(new MenuItem("Manage Project", "editproject.htm")); 406 projectAdminList.add(new MenuItem("Configure Datasource", 407 "datasource.htm")); 408 409 projectAdminList.add(new MenuItem("Manage R Functions", "managerfunction.htm")); 410 411 config.put("projectAdminList", projectAdminList); 412 413 List projectUserList = new LinkedList(); 414 projectUserList.add(new MenuItem("Manage Files", "managefiles.htm")); 415 projectUserList.add(new MenuItem("Upload File", "uploadfile.htm")); 416 projectUserList.add(new MenuItem("Create New Analysis", 417 "newanalysis.htm")); 418 419 config.put("projectUserList", projectUserList); 420 421 return config; 422 } 423 public Map getOverviews() { 424 return overviews; 425 } 426 public void setOverviews(Map overviews) { 427 this.overviews = overviews; 428 } 429 public Overview getOverview(String key){ 430 return (Overview)this.overviews.get(key); 431 } 432 433 public void removeOverview(String overviewKey) { 434 this.overviews.remove(overviewKey); 435 436 } 437 } 438 | Popular Tags |