new voucher system + jdoc

This commit is contained in:
2021-10-06 15:25:13 +02:00
parent 456332f24e
commit 442bdb4996
234 changed files with 4793 additions and 2737 deletions
@@ -4,8 +4,7 @@
package de.bstly.we.jitsi.businesslogic;
/**
* @author _bastler@bstly.de
*
* The Interface JitsiPermissions.
*/
public interface JitsiPermissions {
@@ -4,8 +4,7 @@
package de.bstly.we.jitsi.businesslogic;
/**
* @author _bastler@bstly.de
*
* The Interface JitsiQuotas.
*/
public interface JitsiQuotas {
@@ -45,8 +45,7 @@ import de.bstly.we.urlshortener.model.ShortenedUrl;
import de.bstly.we.urlshortener.repository.ShortenedUrlRepository;
/**
* @author _bastler@bstly.de
*
* The Class JitsiRoomManager.
*/
@Component
public class JitsiRoomManager implements SmartInitializingSingleton, UserDataProvider {
@@ -75,9 +74,9 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
@Value("${jitsi.urlFormat:%s/jwt?%s}")
private String urlFormat;
/*
* @see org.springframework.beans.factory.SmartInitializingSingleton#
* afterSingletonsInstantiated()
* @see org.springframework.beans.factory.SmartInitializingSingleton#afterSingletonsInstantiated()
*/
@Override
public void afterSingletonsInstantiated() {
@@ -89,29 +88,33 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
/**
* @param id
* @return
* Gets the.
*
* @param id the id
* @return the jitsi room
*/
public JitsiRoom get(Long id) {
return jitsiRoomRepository.findById(id).orElse(null);
}
/**
*
* @param owner
* @return
* Gets the all by owner.
*
* @param owner the owner
* @return the all by owner
*/
public List<JitsiRoom> getAllByOwner(Long owner) {
return Lists.newArrayList(jitsiRoomRepository.findAll(qJitsiRoom.owner.eq(owner)));
}
/**
*
* @param page
* @param size
* @param sortBy
* @param descending
* @return
* Gets the.
*
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @return the page
*/
public Page<JitsiRoom> get(int page, int size, String sortBy, boolean descending) {
return jitsiRoomRepository.findAll(PageRequest.of(page, size,
@@ -119,9 +122,14 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
/**
*
* @param userId
* @return
* Gets the for user id.
*
* @param userId the user id
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param descending the descending
* @return the for user id
*/
public Page<JitsiRoom> getForUserId(Long userId, int page, int size, String sortBy,
boolean descending) {
@@ -134,13 +142,15 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
/**
*
* @param owner
* @param room
* @param starts
* @param expires
* @return
* @throws JOSEException
* Creates the.
*
* @param owner the owner
* @param room the room
* @param starts the starts
* @param moderationStarts the moderation starts
* @param expires the expires
* @return the jitsi room
* @throws JOSEException the JOSE exception
*/
public JitsiRoom create(Long owner, String room, Instant starts, Instant moderationStarts,
Instant expires) throws JOSEException {
@@ -155,10 +165,11 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
/**
*
* @param jitsiRoom
* @return
* @throws JOSEException
* Save.
*
* @param jitsiRoom the jitsi room
* @return the jitsi room
* @throws JOSEException the JOSE exception
*/
public JitsiRoom save(JitsiRoom jitsiRoom) throws JOSEException {
Assert.notNull(jitsiRoom.getRoom(), "No domain defined!");
@@ -216,9 +227,10 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
/**
*
* @param jitsiRoom
* @return
* Creates the shortened url.
*
* @param jitsiRoom the jitsi room
* @return the jitsi room
*/
public JitsiRoom createShortenedUrl(JitsiRoom jitsiRoom) {
ShortenedUrl shortenedUrl = shortenedUrlManager.create(jitsiRoom.getOwner(),
@@ -231,8 +243,10 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
/**
*
* @param id
* Delete.
*
* @param jitsiRoom the jitsi room
* @param quota the quota
*/
public void delete(JitsiRoom jitsiRoom, boolean quota) {
if (quota) {
@@ -271,9 +285,10 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
/**
*
* @param owner
* @param quota
* Delete all.
*
* @param owner the owner
* @param quota the quota
*/
public void deleteAll(Long owner, boolean quota) {
List<JitsiRoom> jitsiRooms = Lists
@@ -284,6 +299,7 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getId()
*/
@@ -292,6 +308,7 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
return "jitsiRooms";
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#getUserData(java.lang.Long)
*/
@@ -304,6 +321,7 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
return result;
}
/*
* @see de.bstly.we.businesslogic.UserDataProvider#purgeUserData(java.lang.Long)
*/
@@ -315,7 +333,7 @@ public class JitsiRoomManager implements SmartInitializingSingleton, UserDataPro
}
/**
*
* Clear expired rooms.
*/
@Scheduled(cron = "0 */5 * * * *")
protected void clearExpiredRooms() {
@@ -16,8 +16,7 @@ import de.bstly.we.jitsi.repository.JitsiRoomRepository;
import de.bstly.we.urlshortener.model.ShortenedUrl;
/**
* @author Lurkars
*
* The Class UrlShortenerSync.
*/
@Component
public class UrlShortenerSync implements ApplicationListener<AbstractModelEvent> {
@@ -26,9 +25,9 @@ public class UrlShortenerSync implements ApplicationListener<AbstractModelEvent>
private JitsiRoomRepository jitsiRoomRepository;
private QJitsiRoom qJitsiRoom = QJitsiRoom.jitsiRoom;
/*
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.
* springframework.context.ApplicationEvent)
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
@Override
public void onApplicationEvent(AbstractModelEvent event) {
@@ -38,8 +38,7 @@ import de.bstly.we.urlshortener.businesslogic.ShortenedUrlPermissions;
import de.bstly.we.urlshortener.businesslogic.ShortenedUrlQuotas;
/**
* @author _bastler@bstly.de
*
* The Class JitsiRoomController.
*/
@RestController
@RequestMapping("/jitsi/rooms")
@@ -55,10 +54,13 @@ public class JitsiRoomController extends BaseController {
private QuotaManager quotaManager;
/**
*
* @param pageParameter
* @param sizeParameter
* @return
* Gets the jitsi rooms.
*
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @param sortParameter the sort parameter
* @param descParameter the desc parameter
* @return the jitsi rooms
*/
@PreAuthorize("isAuthenticated()")
@GetMapping
@@ -76,9 +78,10 @@ public class JitsiRoomController extends BaseController {
}
/**
*
* @param jitsiRoom
* @return
* Creates the jitsi room.
*
* @param jitsiRoom the jitsi room
* @return the jitsi room
*/
@PreAuthorize("isAuthenticated()")
@PostMapping
@@ -122,9 +125,10 @@ public class JitsiRoomController extends BaseController {
}
/**
*
* @param jitsiRoom
* @return
* Update jitsi room.
*
* @param jitsiRoom the jitsi room
* @return the jitsi room
*/
@PreAuthorize("isAuthenticated()")
@PatchMapping
@@ -164,6 +168,12 @@ public class JitsiRoomController extends BaseController {
}
}
/**
* Creates the shortened url.
*
* @param id the id
* @return the jitsi room
*/
@PreAuthorize("isAuthenticated()")
@PatchMapping("/{id}")
public JitsiRoom createShortenedUrl(@PathVariable("id") Long id) {
@@ -189,8 +199,9 @@ public class JitsiRoomController extends BaseController {
}
/**
*
* @param id
* Delete jitsi room.
*
* @param id the id
*/
@PreAuthorize("isAuthenticated()")
@DeleteMapping("/{id}")
@@ -29,8 +29,7 @@ import de.bstly.we.jitsi.controller.validation.JitsiRoomValidator;
import de.bstly.we.jitsi.model.JitsiRoom;
/**
* @author _bastler@bstly.de
*
* The Class JitsiRoomManagementController.
*/
@RestController
@RequestMapping("/jitsi/rooms/manage")
@@ -42,8 +41,11 @@ public class JitsiRoomManagementController extends BaseController {
private JitsiRoomValidator jitsiRoomValidator;
/**
*
* @return
* Gets the jitsi rooms.
*
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @return the jitsi rooms
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@GetMapping
@@ -53,9 +55,10 @@ public class JitsiRoomManagementController extends BaseController {
}
/**
*
* @param jitsiRoom
* @return
* Creates the or update jitsi room.
*
* @param jitsiRoom the jitsi room
* @return the jitsi room
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping
@@ -75,8 +78,10 @@ public class JitsiRoomManagementController extends BaseController {
}
/**
*
* @param id
* Delete jitsi room.
*
* @param id the id
* @param quota the quota
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@DeleteMapping("/{id}")
@@ -92,8 +97,10 @@ public class JitsiRoomManagementController extends BaseController {
}
/**
*
* @param owner
* Delete all.
*
* @param owner the owner
* @param quota the quota
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@DeleteMapping("/all/{owner}")
@@ -18,8 +18,7 @@ import de.bstly.we.jitsi.model.QJitsiRoom;
import de.bstly.we.jitsi.repository.JitsiRoomRepository;
/**
* @author _bastler@bstly.de
*
* The Class JitsiRoomValidator.
*/
@Component
public class JitsiRoomValidator implements Validator {
@@ -35,6 +34,7 @@ public class JitsiRoomValidator implements Validator {
private JitsiRoomRepository jitsiRoomRepository;
private QJitsiRoom qJitsiRoom = QJitsiRoom.jitsiRoom;
/*
* @see org.springframework.validation.Validator#supports(java.lang.Class)
*/
@@ -43,9 +43,9 @@ public class JitsiRoomValidator implements Validator {
return clazz.isAssignableFrom(JitsiRoom.class);
}
/*
* @see org.springframework.validation.Validator#validate(java.lang.Object,
* org.springframework.validation.Errors)
* @see org.springframework.validation.Validator#validate(java.lang.Object, org.springframework.validation.Errors)
*/
@Override
public void validate(Object target, Errors errors) {
@@ -64,10 +64,11 @@ public class JitsiRoomValidator implements Validator {
}
/**
*
* @param roomName
* @param field
* @param errors
* Validate.
*
* @param owner the owner
* @param roomName the room name
* @param errors the errors
*/
public void validate(Long owner, String roomName, Errors errors) {
if (owner == null) {
@@ -92,10 +93,10 @@ public class JitsiRoomValidator implements Validator {
}
/**
*
* @param owner
* @param roomName
* @param errors
* Validate room.
*
* @param roomName the room name
* @param errors the errors
*/
public void validateRoom(String roomName, Errors errors) {
for (String systemRoomName : systemPropertyManager.get(RESERVED_JITSI_ROOMS, "")
@@ -110,9 +111,10 @@ public class JitsiRoomValidator implements Validator {
}
/**
*
* @param jitsiRoom
* @param errors
* Validate expiry.
*
* @param jitsiRoom the jitsi room
* @param errors the errors
*/
public void validateExpiry(JitsiRoom jitsiRoom, Errors errors) {
@@ -20,8 +20,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import de.bstly.we.model.UserData;
/**
* @author _bastler@bstly.de
*
* The Class JitsiRoom.
*/
@Entity
@Table(name = "jitsi_rooms")
@@ -52,6 +51,8 @@ public class JitsiRoom implements UserData {
private String orgUrl;
/**
* Gets the id.
*
* @return the id
*/
public Long getId() {
@@ -59,13 +60,17 @@ public class JitsiRoom implements UserData {
}
/**
* @param id the id to set
* Sets the id.
*
* @param id the new id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Gets the owner.
*
* @return the owner
*/
public Long getOwner() {
@@ -73,13 +78,17 @@ public class JitsiRoom implements UserData {
}
/**
* @param owner the owner to set
* Sets the owner.
*
* @param owner the new owner
*/
public void setOwner(Long owner) {
this.owner = owner;
}
/**
* Gets the room.
*
* @return the room
*/
public String getRoom() {
@@ -87,13 +96,17 @@ public class JitsiRoom implements UserData {
}
/**
* @param room the room to set
* Sets the room.
*
* @param room the new room
*/
public void setRoom(String room) {
this.room = room;
}
/**
* Gets the starts.
*
* @return the starts
*/
public Instant getStarts() {
@@ -101,27 +114,35 @@ public class JitsiRoom implements UserData {
}
/**
* @param starts the starts to set
* Sets the starts.
*
* @param starts the new starts
*/
public void setStarts(Instant starts) {
this.starts = starts;
}
/**
* @return the moderationStarts
* Gets the moderation starts.
*
* @return the moderation starts
*/
public Instant getModerationStarts() {
return moderationStarts;
}
/**
* @param moderationStarts the moderationStarts to set
* Sets the moderation starts.
*
* @param moderationStarts the new moderation starts
*/
public void setModerationStarts(Instant moderationStarts) {
this.moderationStarts = moderationStarts;
}
/**
* Gets the expires.
*
* @return the expires
*/
public Instant getExpires() {
@@ -129,13 +150,17 @@ public class JitsiRoom implements UserData {
}
/**
* @param expires the expires to set
* Sets the expires.
*
* @param expires the new expires
*/
public void setExpires(Instant expires) {
this.expires = expires;
}
/**
* Gets the token.
*
* @return the token
*/
public String getToken() {
@@ -143,27 +168,35 @@ public class JitsiRoom implements UserData {
}
/**
* @param token the token to set
* Sets the token.
*
* @param token the new token
*/
public void setToken(String token) {
this.token = token;
}
/**
* @return the moderationToken
* Gets the moderation token.
*
* @return the moderation token
*/
public String getModerationToken() {
return moderationToken;
}
/**
* @param moderationToken the moderationToken to set
* Sets the moderation token.
*
* @param moderationToken the new moderation token
*/
public void setModerationToken(String moderationToken) {
this.moderationToken = moderationToken;
}
/**
* Gets the url.
*
* @return the url
*/
public String getUrl() {
@@ -171,27 +204,35 @@ public class JitsiRoom implements UserData {
}
/**
* @param url the url to set
* Sets the url.
*
* @param url the new url
*/
public void setUrl(String url) {
this.url = url;
}
/**
* @return the moderationUrl
* Gets the moderation url.
*
* @return the moderation url
*/
public String getModerationUrl() {
return moderationUrl;
}
/**
* @param moderationUrl the moderationUrl to set
* Sets the moderation url.
*
* @param moderationUrl the new moderation url
*/
public void setModerationUrl(String moderationUrl) {
this.moderationUrl = moderationUrl;
}
/**
* Gets the code.
*
* @return the code
*/
public String getCode() {
@@ -199,21 +240,27 @@ public class JitsiRoom implements UserData {
}
/**
* @param code the code to set
* Sets the code.
*
* @param code the new code
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return the orgUrl
* Gets the org url.
*
* @return the org url
*/
public String getOrgUrl() {
return orgUrl;
}
/**
* @param orgUrl the orgUrl to set
* Sets the org url.
*
* @param orgUrl the new org url
*/
public void setOrgUrl(String orgUrl) {
this.orgUrl = orgUrl;
@@ -10,9 +10,7 @@ import org.springframework.stereotype.Repository;
import de.bstly.we.jitsi.model.JitsiRoom;
/**
*
* @author _bastler@bstly.de
*
* The Interface JitsiRoomRepository.
*/
@Repository
public interface JitsiRoomRepository