Skip to content

Commit b70ba7e

Browse files
committed
Remove dependency on jmap-extensions
1 parent 2f44a59 commit b70ba7e

File tree

7 files changed

+88
-58
lines changed

7 files changed

+88
-58
lines changed

tmail-backend/jmap/extensions-api/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@
7171
<groupId>com.google.guava</groupId>
7272
<artifactId>guava</artifactId>
7373
</dependency>
74+
<dependency>
75+
<groupId>com.ibm.icu</groupId>
76+
<artifactId>icu4j</artifactId>
77+
</dependency>
78+
<dependency>
79+
<groupId>org.mnode.ical4j</groupId>
80+
<artifactId>ical4j</artifactId>
81+
<version>3.2.9</version>
82+
</dependency>
7483
<dependency>
7584
<groupId>org.mockito</groupId>
7685
<artifactId>mockito-core</artifactId>
Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,20 @@ import eu.timepit.refined.auto._
3535
import net.fortuna.ical4j.data.{CalendarBuilder, CalendarParserFactory, ContentHandlerContext}
3636
import net.fortuna.ical4j.model.Recur.{Frequency, Skip}
3737
import net.fortuna.ical4j.model.WeekDay.Day
38+
import net.fortuna.ical4j.model._
3839
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._
4141
import net.fortuna.ical4j.util.CompatibilityHints
4242
import org.apache.james.core.MailAddress
4343
import org.apache.james.jmap.core.SetError.SetErrorDescription
4444
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
4947

5048
import scala.jdk.CollectionConverters._
5149
import scala.language.implicitConversions
5250
import scala.util.Try
5351

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-
}
6452

6553
object CalendarEventParse {
6654
type UnparsedBlobId = String Refined Id.IdConstraint
@@ -600,32 +588,4 @@ case class CalendarEventParsed(uid: Option[CalendarUidField] = None,
600588
participants: CalendarParticipantsField = CalendarParticipantsField(),
601589
extensionFields: CalendarExtensionFields = CalendarExtensionFields(),
602590
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()))

tmail-backend/jmap/extensions/pom.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,6 @@
152152
<groupId>com.google.inject</groupId>
153153
<artifactId>guice</artifactId>
154154
</dependency>
155-
<dependency>
156-
<groupId>org.mnode.ical4j</groupId>
157-
<artifactId>ical4j</artifactId>
158-
<version>3.2.9</version>
159-
</dependency>
160-
<dependency>
161-
<groupId>com.ibm.icu</groupId>
162-
<artifactId>icu4j</artifactId>
163-
</dependency>
164155
<dependency>
165156
<groupId>io.jsonwebtoken</groupId>
166157
<artifactId>jjwt-api</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/********************************************************************
2+
* As a subpart of Twake Mail, this file is edited by Linagora. *
3+
* *
4+
* https://twake-mail.com/ *
5+
* https://linagora.com *
6+
* *
7+
* This file is subject to The Affero Gnu Public License *
8+
* version 3. *
9+
* *
10+
* https://www.gnu.org/licenses/agpl-3.0.en.html *
11+
* *
12+
* This program is distributed in the hope that it will be *
13+
* useful, but WITHOUT ANY WARRANTY; without even the implied *
14+
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *
15+
* PURPOSE. See the GNU Affero General Public License for *
16+
* more details. *
17+
********************************************************************/
18+
19+
package com.linagora.tmail.james.jmap.model
20+
21+
import org.apache.james.jmap.core.{AccountId, Properties}
22+
import org.apache.james.jmap.mail.MDNParseRequest.MAXIMUM_NUMBER_OF_BLOB_IDS
23+
import org.apache.james.jmap.mail.{BlobIds, RequestTooLargeException}
24+
import org.apache.james.jmap.method.WithAccountId
25+
26+
import scala.language.implicitConversions
27+
28+
case class CalendarEventParseRequest(accountId: AccountId,
29+
blobIds: BlobIds,
30+
properties: Option[Properties]) extends WithAccountId {
31+
def validate: Either[RequestTooLargeException, CalendarEventParseRequest] =
32+
if (blobIds.value.length > MAXIMUM_NUMBER_OF_BLOB_IDS) {
33+
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"))
34+
} else {
35+
scala.Right(this)
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.linagora.tmail.james.jmap.model
2+
3+
import org.apache.james.jmap.core.AccountId
4+
import org.apache.james.jmap.mail.BlobId
5+
6+
case class CalendarEventParseResponse(accountId: AccountId,
7+
parsed: Option[Map[BlobId, CalendarEventParsedList]],
8+
notFound: Option[CalendarEventNotFound],
9+
notParsable: Option[CalendarEventNotParsable])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.linagora.tmail.james.jmap.model
2+
3+
import com.linagora.tmail.james.jmap.model.CalendarEventParse.UnparsedBlobId
4+
import org.apache.james.jmap.core.AccountId
5+
import org.apache.james.jmap.mail.BlobId
6+
7+
object CalendarEventParseResults {
8+
def notFound(blobId: UnparsedBlobId): CalendarEventParseResults = CalendarEventParseResults(None, Some(CalendarEventNotFound(Set(blobId))), None)
9+
10+
def notFound(blobId: BlobId): CalendarEventParseResults = CalendarEventParseResults(None, Some(CalendarEventNotFound(Set(blobId.value))), None)
11+
12+
def notParse(blobId: BlobId): CalendarEventParseResults = CalendarEventParseResults(None, None, Some(CalendarEventNotParsable(Set(blobId.value))))
13+
14+
def parse(blobId: BlobId, calendarEventParsed: List[CalendarEventParsed]): CalendarEventParseResults = CalendarEventParseResults(Some(Map(blobId -> CalendarEventParsedList(calendarEventParsed))), None, None)
15+
16+
def empty(): CalendarEventParseResults = CalendarEventParseResults(None, None, None)
17+
18+
def merge(response1: CalendarEventParseResults, response2: CalendarEventParseResults): CalendarEventParseResults = CalendarEventParseResults(
19+
parsed = (response1.parsed ++ response2.parsed).reduceOption((parsed1, parsed2) => parsed1 ++ parsed2),
20+
notFound = (response1.notFound ++ response2.notFound).reduceOption((notFound1, notFound2) => notFound1.merge(notFound2)),
21+
notParsable = (response1.notParsable ++ response2.notParsable).reduceOption((notParsable1, notParsable2) => notParsable1.merge(notParsable2)))
22+
}
23+
24+
case class CalendarEventParseResults(parsed: Option[Map[BlobId, CalendarEventParsedList]],
25+
notFound: Option[CalendarEventNotFound],
26+
notParsable: Option[CalendarEventNotParsable]) {
27+
def asResponse(accountId: AccountId): CalendarEventParseResponse = CalendarEventParseResponse(accountId, parsed, notFound, notParsable)
28+
}

tmail-backend/tmail-third-party/openpaas/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@
3737
<groupId>${james.groupId}</groupId>
3838
<artifactId>apache-james-backends-rabbitmq</artifactId>
3939
</dependency>
40-
<dependency>
41-
<groupId>${project.groupId}</groupId>
42-
<artifactId>jmap-extensions</artifactId>
43-
</dependency>
4440
<dependency>
4541
<groupId>${james.groupId}</groupId>
4642
<artifactId>apache-james-backends-rabbitmq</artifactId>

0 commit comments

Comments
 (0)