@@ -35,32 +35,20 @@ import eu.timepit.refined.auto._
35
35
import net .fortuna .ical4j .data .{CalendarBuilder , CalendarParserFactory , ContentHandlerContext }
36
36
import net .fortuna .ical4j .model .Recur .{Frequency , Skip }
37
37
import net .fortuna .ical4j .model .WeekDay .Day
38
+ import net .fortuna .ical4j .model ._
38
39
import net .fortuna .ical4j .model .component .VEvent
39
- import net .fortuna .ical4j .model .property .{Attendee , Clazz , ExRule , RRule , Status , Transp }
40
- import net .fortuna .ical4j .model .{Calendar , Month , NumberList , Parameter , Property , Recur , TimeZoneRegistryFactory }
40
+ import net .fortuna .ical4j .model .property ._
41
41
import net .fortuna .ical4j .util .CompatibilityHints
42
42
import org .apache .james .core .MailAddress
43
43
import org .apache .james .jmap .core .SetError .SetErrorDescription
44
44
import org .apache .james .jmap .core .UnsignedInt .UnsignedInt
45
- import org .apache .james .jmap .core .{AccountId , Id , Properties , SetError , UTCDate , UnsignedInt }
46
- import org .apache .james .jmap .mail .MDNParseRequest .MAXIMUM_NUMBER_OF_BLOB_IDS
47
- import org .apache .james .jmap .mail .{BlobId , BlobIds , RequestTooLargeException }
48
- import org .apache .james .jmap .method .WithAccountId
45
+ import org .apache .james .jmap .core ._
46
+ import org .apache .james .jmap .mail .BlobId
49
47
50
48
import scala .jdk .CollectionConverters ._
51
49
import scala .language .implicitConversions
52
50
import scala .util .Try
53
51
54
- case class CalendarEventParseRequest (accountId : AccountId ,
55
- blobIds : BlobIds ,
56
- properties : Option [Properties ]) extends WithAccountId {
57
- def validate : Either [RequestTooLargeException , CalendarEventParseRequest ] =
58
- if (blobIds.value.length > MAXIMUM_NUMBER_OF_BLOB_IDS ) {
59
- Left (RequestTooLargeException (" The number of ids requested by the client exceeds the maximum number the server is willing to process in a single method call" ))
60
- } else {
61
- scala.Right (this )
62
- }
63
- }
64
52
65
53
object CalendarEventParse {
66
54
type UnparsedBlobId = String Refined Id .IdConstraint
@@ -600,32 +588,4 @@ case class CalendarEventParsed(uid: Option[CalendarUidField] = None,
600
588
participants : CalendarParticipantsField = CalendarParticipantsField (),
601
589
extensionFields : CalendarExtensionFields = CalendarExtensionFields (),
602
590
recurrenceRules : RecurrenceRulesField = RecurrenceRulesField (Seq ()),
603
- excludedRecurrenceRules : ExcludedRecurrenceRulesField = ExcludedRecurrenceRulesField (Seq ()))
604
-
605
- case class CalendarEventParseResponse (accountId : AccountId ,
606
- parsed : Option [Map [BlobId , CalendarEventParsedList ]],
607
- notFound : Option [CalendarEventNotFound ],
608
- notParsable : Option [CalendarEventNotParsable ])
609
-
610
- object CalendarEventParseResults {
611
- def notFound (blobId : UnparsedBlobId ): CalendarEventParseResults = CalendarEventParseResults (None , Some (CalendarEventNotFound (Set (blobId))), None )
612
-
613
- def notFound (blobId : BlobId ): CalendarEventParseResults = CalendarEventParseResults (None , Some (CalendarEventNotFound (Set (blobId.value))), None )
614
-
615
- def notParse (blobId : BlobId ): CalendarEventParseResults = CalendarEventParseResults (None , None , Some (CalendarEventNotParsable (Set (blobId.value))))
616
-
617
- def parse (blobId : BlobId , calendarEventParsed : List [CalendarEventParsed ]): CalendarEventParseResults = CalendarEventParseResults (Some (Map (blobId -> CalendarEventParsedList (calendarEventParsed))), None , None )
618
-
619
- def empty (): CalendarEventParseResults = CalendarEventParseResults (None , None , None )
620
-
621
- def merge (response1 : CalendarEventParseResults , response2 : CalendarEventParseResults ): CalendarEventParseResults = CalendarEventParseResults (
622
- parsed = (response1.parsed ++ response2.parsed).reduceOption((parsed1, parsed2) => parsed1 ++ parsed2),
623
- notFound = (response1.notFound ++ response2.notFound).reduceOption((notFound1, notFound2) => notFound1.merge(notFound2)),
624
- notParsable = (response1.notParsable ++ response2.notParsable).reduceOption((notParsable1, notParsable2) => notParsable1.merge(notParsable2)))
625
- }
626
-
627
- case class CalendarEventParseResults (parsed : Option [Map [BlobId , CalendarEventParsedList ]],
628
- notFound : Option [CalendarEventNotFound ],
629
- notParsable : Option [CalendarEventNotParsable ]) {
630
- def asResponse (accountId : AccountId ): CalendarEventParseResponse = CalendarEventParseResponse (accountId, parsed, notFound, notParsable)
631
- }
591
+ excludedRecurrenceRules : ExcludedRecurrenceRulesField = ExcludedRecurrenceRulesField (Seq ()))
0 commit comments