-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Encapsulate Card/Cal dav server interactions into DavClient
- Loading branch information
1 parent
fecb130
commit 5dc96d3
Showing
17 changed files
with
295 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 0 additions & 110 deletions
110
...nd/tmail-third-party/openpaas/src/main/java/com/linagora/tmail/carddav/CardDavClient.java
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
tmail-backend/tmail-third-party/openpaas/src/main/java/com/linagora/tmail/dav/DavClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/******************************************************************** | ||
* As a subpart of Twake Mail, this file is edited by Linagora. * | ||
* * | ||
* https://twake-mail.com/ * | ||
* https://linagora.com * | ||
* * | ||
* This file is subject to The Affero Gnu Public License * | ||
* version 3. * | ||
* * | ||
* https://www.gnu.org/licenses/agpl-3.0.en.html * | ||
* * | ||
* This program is distributed in the hope that it will be * | ||
* useful, but WITHOUT ANY WARRANTY; without even the implied * | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * | ||
* PURPOSE. See the GNU Affero General Public License for * | ||
* more details. * | ||
********************************************************************/ | ||
|
||
package com.linagora.tmail.dav; | ||
|
||
import com.linagora.tmail.dav.card.CardDavCreationObjectRequest; | ||
|
||
import net.fortuna.ical4j.model.parameter.PartStat; | ||
import reactor.core.publisher.Mono; | ||
|
||
public interface DavClient { | ||
Mono<Boolean> existsCollectedContact(String username, String userId, String collectedId); | ||
|
||
Mono<Void> createCollectedContact(String username, String userId, CardDavCreationObjectRequest creationObjectRequest); | ||
|
||
Mono<PartStat> getUserParticipationStatus(String userId, String eventUuid); | ||
|
||
Mono<Void> setUserParticipationStatus(String userId, String eventUuid, PartStat partStat); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...ackend/tmail-third-party/openpaas/src/main/java/com/linagora/tmail/dav/DavClientImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/******************************************************************** | ||
* As a subpart of Twake Mail, this file is edited by Linagora. * | ||
* * | ||
* https://twake-mail.com/ * | ||
* https://linagora.com * | ||
* * | ||
* This file is subject to The Affero Gnu Public License * | ||
* version 3. * | ||
* * | ||
* https://www.gnu.org/licenses/agpl-3.0.en.html * | ||
* * | ||
* This program is distributed in the hope that it will be * | ||
* useful, but WITHOUT ANY WARRANTY; without even the implied * | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * | ||
* PURPOSE. See the GNU Affero General Public License for * | ||
* more details. * | ||
********************************************************************/ | ||
|
||
package com.linagora.tmail.dav; | ||
|
||
import java.time.Duration; | ||
|
||
import com.linagora.tmail.configuration.CardDavConfiguration; | ||
import com.linagora.tmail.dav.calendar.CalDavHandler; | ||
import com.linagora.tmail.dav.card.CardDavCreationObjectRequest; | ||
import com.linagora.tmail.dav.card.CardDavHandler; | ||
|
||
import net.fortuna.ical4j.model.parameter.PartStat; | ||
import reactor.core.publisher.Mono; | ||
import reactor.netty.http.client.HttpClient; | ||
|
||
public class DavClientImpl implements DavClient { | ||
private static final Duration RESPONSE_TIMEOUT_DEFAULT = Duration.ofSeconds(10); | ||
|
||
private final CardDavHandler cardDavHandler; | ||
private final CalDavHandler calDavHandler; | ||
|
||
public DavClientImpl(CardDavConfiguration cardDavConfiguration) { | ||
HttpClient client = HttpClient.create() | ||
.baseUrl(cardDavConfiguration.baseUrl().toString()) | ||
.responseTimeout(cardDavConfiguration.responseTimeout().orElse(RESPONSE_TIMEOUT_DEFAULT)); | ||
|
||
this.cardDavHandler = new CardDavHandler(cardDavConfiguration, client); | ||
this.calDavHandler = new CalDavHandler(); | ||
} | ||
|
||
@Override | ||
public Mono<Boolean> existsCollectedContact(String username, String userId, | ||
String collectedId) { | ||
return cardDavHandler.existsCollectedContact(username, userId, collectedId); | ||
} | ||
|
||
@Override | ||
public Mono<Void> createCollectedContact(String username, String userId, | ||
CardDavCreationObjectRequest creationObjectRequest) { | ||
return cardDavHandler.createCollectedContact(username, userId, creationObjectRequest); | ||
} | ||
|
||
@Override | ||
public Mono<PartStat> getUserParticipationStatus(String userId, String eventUuid) { | ||
return calDavHandler.getUserParticipationStatus(userId, eventUuid); | ||
} | ||
|
||
@Override | ||
public Mono<Void> setUserParticipationStatus(String userId, String eventUuid, | ||
PartStat partStat) { | ||
return calDavHandler.setUserParticipationStatus(userId, eventUuid, partStat); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...ail-third-party/openpaas/src/main/java/com/linagora/tmail/dav/calendar/CalDavHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/******************************************************************** | ||
* As a subpart of Twake Mail, this file is edited by Linagora. * | ||
* * | ||
* https://twake-mail.com/ * | ||
* https://linagora.com * | ||
* * | ||
* This file is subject to The Affero Gnu Public License * | ||
* version 3. * | ||
* * | ||
* https://www.gnu.org/licenses/agpl-3.0.en.html * | ||
* * | ||
* This program is distributed in the hope that it will be * | ||
* useful, but WITHOUT ANY WARRANTY; without even the implied * | ||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * | ||
* PURPOSE. See the GNU Affero General Public License for * | ||
* more details. * | ||
********************************************************************/ | ||
|
||
package com.linagora.tmail.dav.calendar; | ||
|
||
import net.fortuna.ical4j.model.parameter.PartStat; | ||
import reactor.core.publisher.Mono; | ||
|
||
public class CalDavHandler { | ||
|
||
public Mono<PartStat> getUserParticipationStatus(String userId, String eventUuid) { | ||
return null; | ||
} | ||
|
||
public Mono<Void> setUserParticipationStatus(String userId, String eventUuid, PartStat partStat) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.