{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/d8759fea685fc18baf193567c4e8aff5?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"d8759fea685fc18baf193567c4e8aff5","url":"https://api.github.com/users/rathrio","login":"rathrio","id":868879},"milestone":{"state":"open","open_issues":6,"url":"https://api.github.com/repos/ese-unibe-ch/ese2011-team2/milestones/3","due_on":"2011-11-02T07:00:00Z","number":3,"creator":{"avatar_url":"https://secure.gravatar.com/avatar/66ba51197ba0b7c15dd60eee30c41532?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"66ba51197ba0b7c15dd60eee30c41532","url":"https://api.github.com/users/panmari","login":"panmari","id":719020},"description":"Lots of lots of lots of stuff!","title":"Week 3","closed_issues":0,"created_at":"2011-10-26T19:24:02Z"},"assignee":null,"labels":[{"name":"refactor","color":"02e10c","url":"https://api.github.com/repos/ese-unibe-ch/ese2011-team2/labels/refactor"}],"updated_at":"2011-10-29T15:24:46Z","comments":3,"closed_at":null,"url":"https://api.github.com/repos/ese-unibe-ch/ese2011-team2/issues/22","body":"It is more and more getting a necessity, since we're merging multiple calendars together, that a single event, or an event series knows who originally created it.\r\n\r\nQuestion for everybody:\r\n\r\n__When we create an event/event series, should we pass the calendar, which knows its owner, or directly the user who owns the calendar, i.e. the event?__\r\n\r\n\r\n```java\r\npublic abstract class CalendarEntry {\r\n\r\n\tprivate boolean isPublic;\r\n\tprivate Date end;\r\n\tprivate Date start;\r\n\tprivate String name;\r\n    private EseCalendar calendar;\r\n\r\n\tCalendarEntry(Date start, Date end, String name, boolean isPublic, EseCalendar calendar) {\r\n\t\tif (name==null || start==null || end==null) {\r\n\t\t\tthrow new IllegalArgumentException();\r\n\t\t}\r\n\t\tthis.name = name;\r\n\t\tthis.start = start;\r\n\t\tthis.end = end;\r\n\t\tthis.isPublic = isPublic;\r\n        this.calendar = calendar;\r\n\t}\r\n        ...\r\n}\r\n```\r\n\r\nor\r\n\r\n```java\r\npublic abstract class CalendarEntry {\r\n\r\n\tprivate boolean isPublic;\r\n\tprivate Date end;\r\n\tprivate Date start;\r\n\tprivate String name;\r\n    private User owner;\r\n\r\n\tCalendarEntry(Date start, Date end, String name, boolean isPublic, User owner) {\r\n\t\tif (name==null || start==null || end==null) {\r\n\t\t\tthrow new IllegalArgumentException();\r\n\t\t}\r\n\t\tthis.name = name;\r\n\t\tthis.start = start;\r\n\t\tthis.end = end;\r\n\t\tthis.isPublic = isPublic;\r\n        this.user = user;\r\n\t}\r\n        ...\r\n}\r\n```\r\n\r\nAn advantage of passing the user could be, that in case we'd have to implement, that a user should be able to move events in between his calendars, it would be enough for an event to know which user it belongs to.\r\n\r\nThat might be a long shot, though.\r\n\r\nIs there a more elegant solution to this? If not, which one of the above would you choose?\r\n\r\n\r\n\r\n\r\n\r\n","html_url":"https://github.com/ese-unibe-ch/ese2011-team2/issues/22","number":22,"title":"A CalendarEntry needs to know who it belongs to.","id":2086436,"created_at":"2011-10-29T09:46:52Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/c09ea6d88776aaac39f3f30c3a6af19b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"c09ea6d88776aaac39f3f30c3a6af19b","url":"https://api.github.com/users/retobg","login":"retobg","id":110756},"updated_at":"2011-10-29T15:24:46Z","url":"https://api.github.com/repos/ese-unibe-ch/ese2011-team2/issues/comments/2565333","body":"> To your question\n>\n>\n> __When we create an event/event series, should we pass the calendar, which\n>> knows its owner, or directly the user who owns the calendar, i.e. the\n>> event?__\n>>\n>\n> We create an event by invoking a method on a calendar instance, we don't\n> need to pass a calendar as argument as the calendar is only capable of\n> adding events to itself. A user is passed to the method, this is the user on\n> which behalf the method is invoked. The method need the user for access\n> control, the user must have permission to create an event in that calendar,\n> typically this means the user must be the owner of the calendar or admin.\n>\n\nSorry, I misread your questions, new answer:\nThe constructor should get the calendar, but the constructor should no\nlonger be visible to the client anyway.","id":2565333,"created_at":"2011-10-29T15:24:46Z"}}