Changeset 99
- Timestamp:
- 02/07/06 10:16:06
- Files:
-
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java (added)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfHelper.java (added)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java (modified) (26 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/EventProperties.java (modified) (6 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java (modified) (24 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeException.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/CalendarsI.java (added)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java (modified) (3 diffs)
- trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/TimezonesImpl.java (modified) (2 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/DeleteCalendarAction.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java
r86 r99 144 144 private AccessUtil access; 145 145 146 /* From core environment properties * /147 private String systemId;148 149 private String publicCalendarRoot;150 private String userCalendarRoot;151 private String userDefaultCalendar;152 private String defaultTrashCalendar;153 */154 private String publicCalendarRootPath;155 private String userCalendarRootPath;156 157 146 /** Ensure we don't open while open 158 147 */ … … 171 160 172 161 private Events events; 162 163 private Calendars calendars; 173 164 174 165 private EventProperties categories; … … 263 254 throw new CalFacadeException("synch only valid for non admin"); 264 255 } 265 266 /** Define the roots of the calendars.267 * /268 publicCalendarRoot = CalEnv.getGlobalProperty("public.calroot");269 userCalendarRoot = CalEnv.getGlobalProperty("user.calroot");270 userDefaultCalendar = CalEnv.getGlobalProperty("default.user.calendar");271 defaultTrashCalendar = CalEnv.getGlobalProperty("default.trash.calendar");272 273 systemId = CalEnv.getGlobalProperty("systemid");274 */275 256 } catch (Throwable t) { 276 257 throw new CalFacadeException(t); 277 258 } 278 279 publicCalendarRootPath = "/" + getSyspars().getPublicCalendarRoot();280 userCalendarRootPath = "/" + getSyspars().getUserCalendarRoot();281 //systemId = getSyspars().getSystemid();282 259 283 260 if (user == null) { … … 302 279 */ 303 280 getLogger().info("Add new user " + authenticatedUser); 304 add User(new BwUser(authenticatedUser));281 addNewUser(new BwUser(authenticatedUser)); 305 282 authUser = getUser(authenticatedUser); 306 283 userCreated = true; … … 332 309 access.setAuthUser(authUser); 333 310 334 events = new Events(this, access, sess, this.user, debug); 335 336 categories = new EventProperties(this, 311 events = new Events(this, access, this.user, debug); 312 313 calendars = new Calendars(this, access, this.user, debug); 314 315 categories = new EventProperties(this, access, this.user, 337 316 "word", BwCategory.class.getName(), 338 317 "getCategoryRefs", 339 318 -1, debug); 340 locations = new EventProperties(this, 319 locations = new EventProperties(this, access, this.user, 341 320 "address", BwLocation.class.getName(), 342 321 "getLocationRefs", 343 322 CalFacadeDefs.maxReservedLocationId, debug); 344 sponsors = new EventProperties(this, 323 sponsors = new EventProperties(this, access, this.user, 345 324 "name", BwSponsor.class.getName(), 346 325 "getSponsorRefs", … … 350 329 timezones.setDefaultTimeZoneId(getSyspars().getTzid()); 351 330 331 if (userCreated) { 332 calendars.addNewCalendars(); 333 } 352 334 return userCreated; 353 335 } … … 451 433 } 452 434 sess = new HibSession(sessFactory, log); 453 if (events != null) {454 events.setHibSession(sess);455 }456 435 } else { 457 436 if (debug) { … … 616 595 617 596 public void addUser(BwUser user) throws CalFacadeException { 597 addNewUser(user); 598 calendars.addNewCalendars(); 599 } 600 601 private void addNewUser(BwUser user) throws CalFacadeException { 618 602 checkOpen(); 619 603 … … 625 609 626 610 sess.save(user); 627 628 /* Add a user collection to the userCalendarRoot and then a default629 calendar collection. */630 631 sess.namedQuery("getCalendarByPath");632 633 String path = "/" + getSyspars().getUserCalendarRoot();634 sess.setString("path", path);635 636 BwCalendar userrootcal = (BwCalendar)sess.getUnique();637 638 if (userrootcal == null) {639 throw new CalFacadeException("No user root at " + path);640 }641 642 path += "/" + user.getAccount();643 sess.namedQuery("getCalendarByPath");644 sess.setString("path", path);645 646 BwCalendar usercal = (BwCalendar)sess.getUnique();647 if (usercal != null) {648 throw new CalFacadeException("User calendar already exists at " + path);649 }650 651 /* Create a folder for the user */652 usercal = new BwCalendar();653 usercal.setName(user.getAccount());654 usercal.setCreator(user);655 usercal.setOwner(user);656 usercal.setPublick(false);657 usercal.setPath(path);658 usercal.setCalendar(userrootcal);659 userrootcal.addChild(usercal);660 661 sess.save(userrootcal);662 663 /* Create a default calendar */664 BwCalendar cal = new BwCalendar();665 cal.setName(getSyspars().getUserDefaultCalendar());666 cal.setCreator(user);667 cal.setOwner(user);668 cal.setPublick(false);669 cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar());670 cal.setCalendar(usercal);671 cal.setCalendarCollection(true);672 usercal.addChild(cal);673 674 /* Add the trash calendar */675 cal = new BwCalendar();676 cal.setName(getSyspars().getDefaultTrashCalendar());677 cal.setCreator(user);678 cal.setOwner(user);679 cal.setPublick(false);680 cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar());681 cal.setCalendar(usercal);682 cal.setCalendarCollection(true);683 usercal.addChild(cal);684 685 /* Add the inbox */686 cal = new BwCalendar();687 cal.setName(getSyspars().getUserInbox());688 cal.setCreator(user);689 cal.setOwner(user);690 cal.setPublick(false);691 cal.setPath(path + "/" + getSyspars().getUserInbox());692 cal.setCalendar(usercal);693 cal.setCalendarCollection(true);694 usercal.addChild(cal);695 696 /* Add the outbox */697 cal = new BwCalendar();698 cal.setName(getSyspars().getUserOutbox());699 cal.setCreator(user);700 cal.setOwner(user);701 cal.setPublick(false);702 cal.setPath(path + "/" + getSyspars().getUserOutbox());703 cal.setCalendar(usercal);704 cal.setCalendarCollection(true);705 usercal.addChild(cal);706 707 sess.save(usercal);708 709 sess.update(user);710 611 } 711 612 … … 855 756 856 757 /* ==================================================================== 857 * Calendars and search758 * Calendars 858 759 * ==================================================================== */ 859 760 … … 861 762 checkOpen(); 862 763 863 sess.namedQuery("getCalendarByPath"); 864 sess.setString("path", publicCalendarRootPath); 865 sess.cacheableQuery(); 866 867 /* XXX access checks */ 868 return (BwCalendar)sess.getUnique(); 764 return calendars.getPublicCalendars(); 869 765 } 870 766 … … 872 768 checkOpen(); 873 769 874 sess.namedQuery("getPublicCalendarCollections"); 875 sess.cacheableQuery(); 876 877 return access.checkAccess(sess.getList(), privWrite, true); 770 return calendars.getPublicCalendarCollections(); 878 771 } 879 772 … … 885 778 checkOpen(); 886 779 887 sess.namedQuery("getCalendarByPath"); 888 sess.setString("path", userCalendarRootPath + "/" + user.getAccount()); 889 sess.cacheableQuery(); 890 891 return (BwCalendar)sess.getUnique(); 780 return calendars.getCalendars(); 892 781 } 893 782 … … 895 784 checkOpen(); 896 785 897 sess.namedQuery("getUserCalendarCollections"); 898 sess.setEntity("owner", user); 899 sess.cacheableQuery(); 900 901 return access.checkAccess(sess.getList(), privWrite, true); 786 return calendars.getCalendarCollections(); 902 787 } 903 788 … … 906 791 checkOpen(); 907 792 908 sess.namedQuery("getPublicCalendarCollections"); 909 sess.cacheableQuery(); 910 911 return access.checkAccess(sess.getList(), privWriteContent, true); 793 return calendars.getAddContentPublicCalendarCollections(); 912 794 } 913 795 … … 920 802 checkOpen(); 921 803 922 sess.namedQuery("getUserCalendarCollections"); 923 sess.setEntity("owner", user); 924 sess.cacheableQuery(); 925 926 return access.checkAccess(sess.getList(), privWriteContent, true); 804 return calendars.getAddContentCalendarCollections(); 927 805 } 928 806 … … 930 808 checkOpen(); 931 809 932 sess.namedQuery("getCalendarById"); 933 sess.setInt("id", val); 934 sess.cacheableQuery(); 935 936 return (BwCalendar)sess.getUnique(); 810 return calendars.getCalendar(val); 937 811 } 938 812 … … 940 814 checkOpen(); 941 815 942 sess.namedQuery("getCalendarByPath"); 943 sess.setString("path", path); 944 sess.cacheableQuery(); 945 946 BwCalendar cal = (BwCalendar)sess.getUnique(); 947 948 if (cal != null) { 949 access.accessible(cal, privRead, false); 950 } 951 952 return cal; 816 return calendars.getCalendar(path); 953 817 } 954 818 955 819 public BwCalendar getDefaultCalendar() throws CalFacadeException { 956 StringBuffer sb = new StringBuffer(); 957 958 sb.append("/"); 959 sb.append(getSyspars().getUserCalendarRoot()); 960 sb.append("/"); 961 sb.append(user.getAccount()); 962 sb.append("/"); 963 sb.append(getSyspars().getUserDefaultCalendar()); 964 965 return getCalendar(sb.toString()); 820 return calendars.getDefaultCalendar(); 966 821 } 967 822 968 823 public BwCalendar getTrashCalendar() throws CalFacadeException { 969 StringBuffer sb = new StringBuffer(); 970 971 sb.append("/"); 972 sb.append(getSyspars().getUserCalendarRoot()); 973 sb.append("/"); 974 sb.append(user.getAccount()); 975 sb.append("/"); 976 sb.append(getSyspars().getDefaultTrashCalendar()); 977 978 return getCalendar(sb.toString()); 824 return calendars.getTrashCalendar(); 979 825 } 980 826 … … 982 828 checkOpen(); 983 829 984 /* We need write access to the parent */ 985 access.accessible(parent, privWrite, false); 986 987 /** Is the parent a calendar collection? 988 */ 989 /* sess.namedQuery("countCalendarEventRefs"); 990 sess.setEntity("cal", parent); 991 992 Integer res = (Integer)sess.getUnique(); 993 994 if (res.intValue() > 0) {*/ 995 996 if (parent.getCalendarCollection()) { 997 throw new CalFacadeException(CalFacadeException.illegalCalendarCreation); 998 } 999 1000 /* Ensure the path is unique */ 1001 String path = parent.getPath(); 1002 if (path == null) { 1003 if (parent.getPublick()) { 1004 path = ""; 1005 } else { 1006 path = "/users/" + parent.getOwner().getAccount(); 1007 } 1008 } 1009 1010 path += "/" + val.getName(); 1011 1012 sess.namedQuery("getCalendarByPath"); 1013 sess.setString("path", path); 1014 1015 if (sess.getUnique() != null) { 1016 throw new CalFacadeException(CalFacadeException.duplicateCalendar); 1017 } 1018 1019 val.setPath(path); 1020 val.setOwner(user); 1021 val.setCalendar(parent); 1022 parent.addChild(val); 1023 1024 sess.save(parent); 830 calendars.addCalendar(val, parent); 1025 831 } 1026 832 1027 833 public void updateCalendar(BwCalendar val) throws CalFacadeException { 1028 834 checkOpen(); 1029 sess.update(val);835 calendars.updateCalendar(val); 1030 836 } 1031 837 … … 1033 839 checkOpen(); 1034 840 1035 BwCalendar parent = val.getCalendar(); 1036 if (parent == null) { 1037 throw new CalFacadeException(CalFacadeException.cannotDeleteCalendarRoot); 1038 } 1039 1040 //sess.delete(val); 1041 parent.removeChild(val); 1042 sess.update(parent); 1043 1044 return true; 841 return calendars.deleteCalendar(val); 1045 842 } 1046 843 … … 1048 845 checkOpen(); 1049 846 1050 sess.namedQuery("countCalendarEventRefs"); 1051 sess.setEntity("cal", val); 1052 1053 Integer res = (Integer)sess.getUnique(); 1054 1055 if (debug) { 1056 trace(" ----------- count = " + res); 1057 } 1058 1059 if (res == null) { 1060 return false; 1061 } 1062 1063 return res.intValue() > 0; 847 return calendars.checkCalendarRefs(val); 1064 848 } 1065 849 … … 1077 861 return null; 1078 862 } 1079 1080 /*1081 public BwFilter getFilter(String name) throws CalFacadeException {1082 checkOpen();1083 if (currentMode != CalintfUtil.guestMode) {1084 return null;1085 }1086 1087 sess.createQuery("from " + BwFilter.class.getName() + " as cal " +1088 "where cal.name = :name");1089 sess.setString("name", name);1090 1091 return (BwFilter)sess.getUnique();1092 }1093 1094 public BwFilter getFilter(int id) throws CalFacadeException {1095 checkOpen();1096 1097 /* Object o = sess.get(FilterVO.class, id);1098 if (o != null) {1099 return (FilterVO)o;1100 }1101 * /1102 sess.createQuery("from " + BwFilter.class.getName() + " as cal " +1103 "where cal.id = :id");1104 sess.setInt("id", id);1105 1106 return (BwFilter)sess.getUnique();1107 } */1108 863 1109 864 public void addFilter(BwFilter val) throws CalFacadeException { … … 1521 1276 1522 1277 /* ==================================================================== 1523 * Arbitrary query1524 * ==================================================================== */1525 1526 /*1527 public Collection arbQuery(String q) throws CalFacadeException {1528 checkOpen();1529 sess.createQuery(q);1530 1531 return sess.getList();1532 }*/1533 1534 /* ====================================================================1535 1278 * Private methods 1536 1279 * ==================================================================== */ … … 1540 1283 throw new CalFacadeException("Calintf call when closed"); 1541 1284 } 1542 }1543 1544 /*1545 private void updated(BwUser user) {1546 personalModified.add(user);1547 1285 } 1548 1286 … … 1557 1295 } 1558 1296 1559 /*1560 private void error(String msg) {1561 getLogger().error(msg);1562 }*/1563 1564 1297 private void trace(String msg) { 1565 1298 getLogger().debug(msg); … … 1575 1308 throw new CalFacadeAccessException(); 1576 1309 } 1577 1578 /* Ensure the current user is not a guest.1579 * /1580 private void requireNotGuest() throws CalFacadeException {1581 if (!user.isGuest()) {1582 return;1583 }1584 1585 throw new CalFacadeAccessException();1586 }*/1587 1310 } 1588 1311 trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/EventProperties.java
r2 r99 57 57 import org.bedework.calfacade.BwUser; 58 58 import org.bedework.calfacade.CalFacadeException; 59 import org.bedework.calfacade.CalintfDefs; 60 61 import java.io.Serializable; 59 import org.bedework.calfacade.ifs.Calintf; 60 62 61 import java.util.Collection; 63 64 import org.apache.log4j.Logger;65 62 66 63 /** Class which handles manipulation of BwEventProperty subclasses which are … … 76 73 * 77 74 */ 78 public class EventProperties implements CalintfDefs, Serializable { 79 private boolean debug; 80 81 private CalintfImpl cal; 82 75 public class EventProperties extends CalintfHelper { 83 76 private String keyFieldName; 84 77 … … 91 84 private int minId; 92 85 93 private transient Logger log;94 95 86 /** Constructor 96 87 * 97 * @param cal CalintImpl object 88 * @param cal Calintf object 89 * @param access 90 * @param user 98 91 * @param keyFieldName Name of entity keyfield 99 92 * @param className Class of entity … … 102 95 * @param debug 103 96 */ 104 public EventProperties(Calintf Impl cal,97 public EventProperties(Calintf cal, AccessUtil access, BwUser user, 105 98 String keyFieldName, 106 99 String className, … … 108 101 int minId, 109 102 boolean debug) { 110 this.cal = cal; 103 super(cal, access, user, debug); 104 111 105 this.keyFieldName = keyFieldName; 112 106 this.className = className; 113 107 this.refQuery = refQuery; 114 108 this.minId = minId; 115 this.debug = debug;116 109 } 117 110 … … 308 301 return refs; 309 302 } 310 311 private HibSession getSess() throws CalFacadeException {312 return (HibSession)cal.getDbSession();313 }314 315 /** Get a logger for messages316 */317 private Logger getLogger() {318 if (log == null) {319 log = Logger.getLogger(this.getClass());320 }321 322 return log;323 }324 325 private void trace(String msg) {326 getLogger().debug(msg);327 }328 303 } 329 304 trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java
r31 r99 65 65 import org.bedework.calfacade.CalFacadeDefs; 66 66 import org.bedework.calfacade.CalFacadeUtil; 67 import org.bedework.calfacade.CalintfDefs;68 67 import org.bedework.calfacade.filter.BwFilter; 69 68 import org.bedework.calfacade.ifs.CalTimezones; … … 73 72 import org.bedework.icalendar.VEventUtil; 74 73 75 import edu.rpi.cct.uwcal.access.PrivilegeDefs;76 77 74 import net.fortuna.ical4j.model.component.VEvent; 78 75 import net.fortuna.ical4j.model.Date; … … 82 79 import net.fortuna.ical4j.model.property.DtStart; 83 80 84 import org.apache.log4j.Logger;85 86 81 import org.hibernate.Criteria; 87 82 import org.hibernate.criterion.Expression; … … 90 85 import org.hibernate.id.UUIDHexGenerator; 91 86 92 import java.io.Serializable;93 87 import java.util.Collection; 94 88 import java.util.HashMap; … … 101 95 * @author Mike Douglass douglm@rpi.edu 102 96 */ 103 public class Events implements CalintfDefs, PrivilegeDefs, Serializable { 104 private boolean debug; 105 106 private Calintf cal; 107 108 private AccessUtil access; 109 110 private HibSession sess; 111 112 private BwUser user; 113 114 private transient Logger log; 115 97 public class Events extends CalintfHelper { 116 98 private UUIDHexGenerator uuidGen; 117 99 … … 120 102 * @param cal 121 103 * @param access 122 * @param sess123 104 * @param user 124 105 * @param debug 125 106 */ 126 public Events(Calintf cal, AccessUtil access, HibSession sess, 127 BwUser user, boolean debug) { 128 this.cal = cal; 129 this.access = access; 130 this.sess = sess; 131 this.user = user; 132 this.debug = debug; 107 public Events(Calintf cal, AccessUtil access, BwUser user, boolean debug) { 108 super(cal, access, user, debug); 133 109 134 110 Properties uidprops = new Properties(); … … 136 112 uuidGen = new UUIDHexGenerator(); 137 113 ((Configurable)uuidGen).configure(Hibernate.STRING, uidprops, null); 138 }139 140 /** (Re)set the HibSession141 *142 * @param val143 */144 public void setHibSession(HibSession val) {145 sess = val;146 114 } 147 115 … … 179 147 BwEvent master = null; 180 148 TreeSet ts = new TreeSet(); 149 HibSession sess = getSess(); 181 150 182 151 if (rid == null) { … … 357 326 */ 358 327 public BwEvent getEvent(int id) throws CalFacadeException { 328 HibSession sess = getSess(); 359 329 Criteria cr = sess.createCriteria(BwEventObj.class); 360 330 … … 378 348 public void addEvent(BwEvent val, Collection overrides) throws CalFacadeException { 379 349 RecuridTable recurids = null; 350 HibSession sess = getSess(); 380 351 381 352 if ((overrides != null) && (overrides.size() != 0)) { … … 502 473 override.setOwner(user); 503 474 504 sess.saveOrUpdate(override);475 getSess().saveOrUpdate(override); 505 476 inst.setOverride(override); 506 477 } … … 512 483 */ 513 484 public void updateEvent(BwEvent val) throws CalFacadeException { 485 HibSession sess = getSess(); 514 486 if (!(val instanceof BwEventProxy)) { 515 487 sess.saveOrUpdate(val); … … 598 570 */ 599 571 private void updateRecurrences(BwEvent val) throws CalFacadeException { 572 HibSession sess = getSess(); 600 573 VEvent vev = VEventUtil.toIcalEvent(val, null); 601 574 … … 688 661 */ 689 662 public DelEventResult deleteEvent(BwEvent val) throws CalFacadeException { 663 HibSession sess = getSess(); 690 664 DelEventResult der = new DelEventResult(false, 0); 691 665 … … 828 802 int currentMode, boolean ignoreCreator) 829 803 throws CalFacadeException { 804 HibSession sess = getSess(); 830 805 StringBuffer sb = new StringBuffer(); 831 806 … … 921 896 public Collection getEventsByName(BwCalendar cal, String val) 922 897 throws CalFacadeException { 898 HibSession sess = getSess(); 923 899 sess.namedQuery("eventsByName"); 924 900 sess.setString("name", val); … … 936 912 private void eventQuery(Class cl, String guid, String rid, Integer seqnum, 937 913 boolean masterOnly) throws CalFacadeException { 914 HibSession sess = getSess(); 938 915 StringBuffer sb = new StringBuffer(); 939 916 … … 992 969 int recurRetrieval) 993 970 throws CalFacadeException { 971 HibSession sess = getSess(); 994 972 StringBuffer sb = new StringBuffer(); 995 973 … … 1146 1124 private void doCalendarEntities(boolean setUser, BwCalendar calendar) 1147 1125 throws CalFacadeException { 1126 HibSession sess = getSess(); 1148 1127 if (setUser) { 1149 1128 sess.setEntity("user", user); … … 1165 1144 if (calendar.getCalendarCollection()) { 1166 1145 // leaf calendar 1167 sess.setEntity("calendar" + calTerm.i, calendar);1146 getSess().setEntity("calendar" + calTerm.i, calendar); 1168 1147 calTerm.i++; 1169 1148 } else { … … 1397 1376 1398 1377 private int deleteAlarms(BwEvent ev) throws CalFacadeException { 1378 HibSession sess = getSess(); 1399 1379 sess.namedQuery("deleteEventAlarms"); 1400 1380 sess.setEntity("ev", ev); … … 1413 1393 BwEvent ev = (BwEvent)it.next(); 1414 1394 1415 if (access.accessible(ev, desiredAccess, n oAccessReturnsNull)) {1395 if (access.accessible(ev, desiredAccess, nullForNoAccess)) { 1416 1396 outevs.add(ev); 1417 1397 } … … 1429 1409 } 1430 1410 1431 if (!access.accessible(ev, desiredAccess, n oAccessReturnsNull)) {1411 if (!access.accessible(ev, desiredAccess, nullForNoAccess)) { 1432 1412 return null; 1433 1413 } … … 1461 1441 } 1462 1442 } 1463 1464 private Logger getLog() {1465 if (log == null) {1466 log = Logger.getLogger(getClass());1467 }1468 1469 return log;1470 }1471 1472 private void debugMsg(String msg) {1473 getLog().debug(msg);1474 }1475 1443 } trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java
r36 r99 325 325 } 326 326 327 /** Create a copy of this object but do not clone the children 328 * 329 * @return BwCalendar object 330 */ 331 public BwCalendar shallowClone() { 332 return new BwCalendar((BwUser)getOwner().clone(), 333 getPublick(), 334 (BwUser)getCreator().clone(), 335 getAccess(), 336 getName(), 337 getPath(), 338 getSummary(), 339 getDescription(), 340 getMailListId(), 341 getCalendarCollection(), 342 getCalendar(), 343 null); 344 } 345 327 346 /* ==================================================================== 328 347 * Object methods trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeException.java
r36 r99 64 64 */ 65 65 66 /** Couldn't find calendar */ 67 public static final String calendarNotFound = 68 "org.bedework.exception.calendarnotfound"; 69 66 70 /** Somebody tried to create a duplicate calendar */ 67 71 public static final String duplicateCalendar = 68 72 "org.bedework.exception.duplicatecalendar"; 73 74 /** Somebody tried to create a calendar with children */ 75 public static final String calendarNotEmpty = 76 "org.bedework.exception.calendarnotempty"; 69 77 70 78 /** */ trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java
r55 r99 70 70 import org.bedework.calfacade.ifs.Groups; 71 71 72 import java.io.Serializable;73 72 import java.util.Collection; 74 73 75 74 import net.fortuna.ical4j.model.component.VTimeZone; 76 75 77 /** This class acts as alow level interface to the calendar database.76 /** This is the low level interface to the calendar database. 78 77 * 79 78 * <p>This interface provides a view of the data as seen by the supplied user … … 92 91 * @author Mike Douglass douglm@rpi.edu 93 92 */ 94 public interface Calintf extends Serializable{93 public interface Calintf extends CalendarsI { 95 94 /** Must be called to initialise the new object. 96 95 * … … 412 411 */ 413 412 public void clearPublicTimezones() throws CalFacadeException; 414 415 /* ====================================================================416 * Calendars417 * ==================================================================== */418 419 /** Returns the tree of public calendars420 *421 * @return BwCalendar root with all children attached422 * @throws CalFacadeException423 */424 public BwCalendar getPublicCalendars() throws CalFacadeException;425 426 /** Return a list of public calendars in which calendar objects can be427 * placed by the current user.428 *429 * <p>Caldav currently does not allow collections inside collections so that430 * calendar collections are the leaf nodes only.431 *432 * @return Collection of CalendarVO433 * @throws CalFacadeException434 */435 public Collection getPublicCalendarCollections() throws CalFacadeException;436 437 /** Returns calendars owned by the current user.438 *439 * <p>For anonymous (public events) access, this method returns the same440 * as getPublicCalendars().441 *442 * <p>For authenticated, personal access this always returns the user443 * entry in the /user calendar tree, e.g. for user smithj it would return444 * an entry smithj445 *446 * @return BwCalendar root with all children attached447 * @throws CalFacadeException448 */449 public BwCalendar getCalendars() throws CalFacadeException;450 451 /** Return a list of user calendars in which calendar objects can be452 * placed by the current user.453 *454 * <p>Caldav currently does not allow collections inside collections so that455 * calendar collections are the leaf nodes only.456 *457 * @return Collection of CalendarVO458 * @throws CalFacadeException459 */460 public Collection getCalendarCollections() throws CalFacadeException;461 462 /** Return a list of calendars in which calendar objects can be463 * placed by the current user.464 *465 * <p>Caldav currently does not allow collections inside collections so that466 * calendar collections are the leaf nodes only.467 *468 * @return Collection of BwCalendar469 * @throws CalFacadeException470 */471 public Collection getAddContentPublicCalendarCollections()472 throws CalFacadeException;473 474 /** Return a list of calendars in which calendar objects can be475 * placed by the current user.476 *477 * <p>Caldav currently does not allow collections inside collections so that478 * calendar collections are the leaf nodes only.479 *480 * @return Collection of BwCalendar481 * @throws CalFacadeException482 */483 public Collection getAddContentCalendarCollections()484 throws CalFacadeException;485 486 /** Get a calendar we are interested in. This is represented by the id487 * of a calendar.488 *489 * @param val int id of calendar490 * @return CalendarVO null for unknown calendar491 * @throws CalFacadeException492 */493 public BwCalendar getCalendar(int val) throws CalFacadeException;494 495 /** Get a calendar given the path496 *497 * @param path String path of calendar498 * @return BwCalendar null for unknown calendar499 * @throws CalFacadeException500 */501 public BwCalendar getCalendar(String path) throws CalFacadeException;502 503 /** Get the default calendar for the current user.504 *505 * @return BwCalendar null for unknown calendar506 * @throws CalFacadeException507 */508 public BwCalendar getDefaultCalendar() throws CalFacadeException;509 510 /** Get the trash calendar for the current user.511 *512 * @return BwCalendar null for unknown calendar513 * @throws CalFacadeException514 */515 public BwCalendar getTrashCalendar() throws CalFacadeException;516 517 /** Add a calendar object518 *519 * <p>The new calendar object will be added to the db. If the indicated parent520 * is null it will be added as a root level calendar.521 *522 * <p>Certain restrictions apply, mostly because of interoperability issues.523 * A calendar cannot be added to another calendar which already contains524 * entities, e.g. events etc.525 *526 * <p>Names cannot contain certain characters - (complete this)527 *528 * <p>Name must be unique at this level, i.e. all paths must be unique529 *530 * @param val CalendarVO new object531 * @param parent CalendarVO object or null for root level532 * @throws CalFacadeException533 */534 public void addCalendar(BwCalendar val, BwCalendar parent) throws CalFacadeException;535 536 /** Update a calendar object537 *538 * @param val CalendarVO object539 * @throws CalFacadeException540 */541 public void updateCalendar(BwCalendar val) throws CalFacadeException;542 543 /** Delete the given calendar544 *545 * @param val CalendarVO object to be deleted546 * @return boolean false if it didn't exist, true if it was deleted.547 * @throws CalFacadeException548 */549 public boolean deleteCalendar(BwCalendar val) throws CalFacadeException;550 551 /** Check to see if a calendar is referenced.552 *553 * @param val CalendarVO object to check554 * @return boolean true if the calendar is referenced somewhere555 * @throws CalFacadeException556 */557 public boolean checkCalendarRefs(BwCalendar val) throws CalFacadeException;558 413 559 414 /* ==================================================================== trunk/calendar3/dumprestore/src/org/bedework/dumprestore/restore/TimezonesImpl.java
r96 r99 282 282 throw new RuntimeException("Unable to initialise UTC timezone"); 283 283 } 284 cal.setTimeZone(utctz); 284 285 } 285 286 … … 337 338 } 338 339 339 cal.setTimeZone(utctz);340 340 cal.setTime(formatTd.parse(time)); 341 341 trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/DeleteCalendarAction.java
r55 r99 83 83 84 84 BwCalendar cal = form.getCalendar(); 85 if (cal.getChildren().size() > 0) { 86 form.getErr().emit("org.bedework.client.error.calendar.referenced"); 87 return "inUse"; 88 } 89 85 90 int delResult = form.fetchSvci().deleteCalendar(cal); 86 91
