Changeset 568
- Timestamp:
- 06/09/06 16:50:37
- Files:
-
- trunk/calendar3/deployment/dumprestore/shellscr/resources/dumpres.sh (modified) (1 diff)
- trunk/calendar3/dumprestore/build.xml (modified) (1 diff)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/HibRestore.java (modified) (20 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/OnlyUsersMap.java (added)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java (modified) (1 diff)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/deployment/dumprestore/shellscr/resources/dumpres.sh
r492 r568 23 23 echo $RESTORECMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9 24 24 $RESTORECMD -appname $APPNAME -f $2 $3 $4 $5 $6 $7 $8 $9 25 ;; 26 restore-for-quickstart) 27 echo $RESTORECMD -appname $APPNAME -onlyusers "public-user,caladmin,douglm,agrp_*" -f $2 $3 $4 $5 $6 $7 $8 $9 28 $RESTORECMD -appname $APPNAME -onlyusers "public-user,caladmin,douglm,agrp_*" -f $2 $3 $4 $5 $6 $7 $8 $9 25 29 ;; 26 30 backup) trunk/calendar3/dumprestore/build.xml
r463 r568 103 103 description="Run bedework db restore app to initialise db"> 104 104 <property name="org.bedework.onlyusers" 105 value="public-user,caladmin,douglm,agrp_ cct,agrp_arc,agrp_Admissions,agrp_HSS,agrp_IACS,agrp_Arch,agrp_OoC,agrp_MANE,agrp_health,agrp_ccc,agrp_hr,agrp_physics,agrp_advance,agrp_provost,agrp_empac,agrp_it,agrp_soe,agrp_lally,agrp_CogSci,agrp_alum,agrp_parking,agrp_Athletics,agrp_construct,agrp_union,agrp_Library,agrp_chemistry,agrp_ItOps,agrp_Arts,agrp_President,agrp_facilities,agrp_CDC,agrp_fye,agrp_ECSE,agrp_NetTel,agrp_Math,agrp_dses,agrp_compsci,agrp_Economics,agrp_govrel,agrp_CHME,agrp_Bookstore,agrp_mse,agrp_Diversity,agrp_OriginsOfLife,agrp_doso,agrp_CEE,agrp_SoS,agrp_CreditUnion,agrp_ResLife,agrp_Purchasing,agrp_LRC,agrp_STS,agrp_ComputerStore,agrp_catering,agrp_CIUE,agrp_Biology,agrp_PublicSafety,agrp_UnionClubs,agrp_cpfd,agrp_FYS,agrp_SRFS,agrp_EES,agrp_ALAC,agrp_SCOREC,agrp_CFES,agrp_CATS,agrp_LLC,agrp_Archer,agrp_OMSA,agrp_Nanotech,agrp_BioMed,agrp_CBIS" />105 value="public-user,caladmin,douglm,agrp_*" /> 106 106 <antcall target="restoredb" inheritrefs="true" /> 107 107 </target> trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/HibRestore.java
r534 r568 182 182 */ 183 183 public void restoreUser(BwUser o) throws Throwable { 184 if (globals.onlyUsers && 185 (globals.onlyUsersMap.get(o.getAccount()) == null)) { 184 if (!globals.onlyUsersMap.check(o)) { 186 185 return; 187 186 } … … 206 205 */ 207 206 public void restoreUserInfo(BwUserInfo o) throws Throwable { 208 if (globals.onlyUsers && 209 (globals.onlyUsersMap.get(o.getUser().getAccount()) == null)) { 207 if (!globals.onlyUsersMap.check(o.getUser())) { 210 208 return; 211 209 } … … 219 217 220 218 public void restoreTimezone(BwTimeZone o) throws Throwable { 221 if (! checkOnlyUser(o)) {219 if (!globals.onlyUsersMap.check(o)) { 222 220 return; 223 221 } … … 253 251 } 254 252 255 if (globals.onlyUsers) { 256 if (globals.onlyUsersMap.get(o.getGroupOwner().getAccount()) == null) { 257 o.setGroupOwner(globals.getPublicUser()); 258 } 253 if (!globals.onlyUsersMap.check(o.getGroupOwner())) { 254 o.setGroupOwner(globals.getPublicUser()); 259 255 } 260 256 … … 272 268 BwPrincipal pr = (BwPrincipal)it.next(); 273 269 274 if (globals.onlyUsers && 275 (pr instanceof BwUser) && 276 (globals.onlyUsersMap.get(((BwUser)pr).getAccount()) == null)) { 270 if ((pr instanceof BwUser) && !globals.onlyUsersMap.check(pr)) { 277 271 continue; 278 272 } … … 306 300 */ 307 301 public void restoreAuthUser(BwAuthUser o) throws Throwable { 308 if (globals.onlyUsers && 309 (globals.onlyUsersMap.get(o.getUser().getAccount()) == null)) { 302 if (!globals.onlyUsersMap.check(o.getUser())) { 310 303 return; 311 304 } … … 326 319 */ 327 320 public void restoreEvent(BwEvent o) throws Throwable { 328 if (! checkOnlyUser(o)) {321 if (!globals.onlyUsersMap.check(o)) { 329 322 return; 330 323 } … … 339 332 */ 340 333 public void update(BwEvent o) throws Throwable { 341 if (! checkOnlyUser(o)) {334 if (!globals.onlyUsersMap.check(o)) { 342 335 return; 343 336 } … … 354 347 */ 355 348 public void restoreCategory(BwCategory o) throws Throwable { 356 if (! checkOnlyUser(o)) {349 if (!globals.onlyUsersMap.check(o)) { 357 350 return; 358 351 } … … 376 369 */ 377 370 public Integer restoreLocation(BwLocation o) throws Throwable { 378 if (! checkOnlyUser(o)) {371 if (!globals.onlyUsersMap.check(o)) { 379 372 return null; 380 373 } … … 405 398 406 399 public Integer restoreSponsor(BwSponsor o) throws Throwable { 407 if (! checkOnlyUser(o)) {400 if (!globals.onlyUsersMap.check(o)) { 408 401 return null; 409 402 } … … 453 446 454 447 public void restoreUserPrefs(BwPreferences o) throws Throwable { 455 if (! checkOnlyUser(o)) {448 if (!globals.onlyUsersMap.check(o)) { 456 449 return; 457 450 } … … 485 478 486 479 public void restoreAlarm(BwAlarm o) throws Throwable { 487 if (! checkOnlyUser(o)) {480 if (!globals.onlyUsersMap.check(o)) { 488 481 return; 489 482 } … … 497 490 498 491 public void update(BwUser user) throws Throwable { 499 if (globals.onlyUsers && 500 (globals.onlyUsersMap.get(user.getAccount()) == null)) { 492 if (!globals.onlyUsersMap.check(user)) { 501 493 return; 502 494 } … … 554 546 */ 555 547 public void restoreCalendars(BwCalendar o) throws Throwable { 556 if (! checkOnlyUser(o)) {548 if (!globals.onlyUsersMap.check(o)) { 557 549 return; 558 550 } … … 579 571 580 572 public void saveRootCalendar(BwCalendar val) throws Throwable { 581 if (! checkOnlyUser(val)) {573 if (!globals.onlyUsersMap.check(val)) { 582 574 return; 583 575 } … … 600 592 */ 601 593 public void addCalendar(BwCalendar o) throws Throwable { 602 if (! checkOnlyUser(o)) {594 if (!globals.onlyUsersMap.check(o)) { 603 595 return; 604 596 } … … 623 615 624 616 private void restoreCalendars(BwCalendar val, Connection conn) throws Throwable { 625 if (! checkOnlyUser(val)) {617 if (!globals.onlyUsersMap.check(val)) { 626 618 return; 627 619 } … … 649 641 */ 650 642 private void restoreCalendar(BwCalendar val, Connection conn) throws Throwable { 651 if (! checkOnlyUser(val)) {643 if (!globals.onlyUsersMap.check(val)) { 652 644 return; 653 645 } … … 779 771 }*/ 780 772 781 private boolean checkOnlyUser(BwOwnedDbentity ent) {782 if (!globals.onlyUsers) {783 return true;784 }785 786 if (globals.onlyUsersMap.get(ent.getOwner().getAccount()) == null) {787 return false;788 }789 790 return true;791 }792 793 private boolean checkOnlyUser(BwShareableDbentity ent) {794 if (!globals.onlyUsers) {795 return true;796 }797 798 if (globals.onlyUsersMap.get(ent.getOwner().getAccount()) == null) {799 return false;800 }801 802 if (globals.onlyUsersMap.get(ent.getCreator().getAccount()) == null) {803 ent.setCreator(ent.getOwner());804 }805 806 return true;807 }808 809 773 private String boolVal(boolean val) { 810 774 if (val) { trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/Restore.java
r544 r568 323 323 // means ignore this par 324 324 } else { 325 globals.onlyUsers = true;325 globals.onlyUsersMap.setOnlyUsers(true); 326 326 String[] users = args[i].split(","); 327 327 for (int oui = 0; oui < users.length; oui++) { 328 info("Only user: " + users[oui]); 329 globals.onlyUsersMap.put(users[oui], users[oui]); 328 String ou = users[oui]; 329 info("Only user: " + ou); 330 331 globals.onlyUsersMap.add(ou); 330 332 } 331 333 } trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/RestoreGlobals.java
r556 r568 223 223 public int alarms; 224 224 225 /** If true we should discard all but users in onlyUsers 226 * This helps when building demo data 227 */ 228 public boolean onlyUsers; 229 230 /** Users we preserve */ 231 public HashMap onlyUsersMap = new HashMap(); 225 /** Only Users mapping */ 226 public OnlyUsersMap onlyUsersMap = new OnlyUsersMap(); 232 227 233 228 // 3.0
