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
@@ -24,9 +24,7 @@ import de.bstly.we.services.model.Service;
import de.bstly.we.services.repository.ServiceRepository;
/**
*
* @author _bastler@bstly.de
*
* The Class ServiceManager.
*/
@Component
public class ServiceManager {
@@ -41,27 +39,30 @@ public class ServiceManager {
private QService qService = QService.service;
/**
*
* @param name
* @return
* Gets the.
*
* @param name the name
* @return the service
*/
public Service get(String name) {
return serviceRepository.findById(name).orElse(null);
}
/**
*
* @param service
* @return
* Update.
*
* @param service the service
* @return the service
*/
public Service update(Service service) {
return serviceRepository.save(service);
}
/**
*
* @param target
* @return
* Gets the for target.
*
* @param target the target
* @return the for target
*/
public List<Service> getForTarget(Long target) {
List<Service> services = Lists.newArrayList();
@@ -116,20 +117,22 @@ public class ServiceManager {
}
/**
*
* @param name
* Delete.
*
* @param name the name
*/
public void delete(String name) {
serviceRepository.deleteById(name);
}
/**
*
* @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<Service> get(int page, int size, String sortBy, boolean descending) {
Sort sort = descending ? Sort.by(sortBy).descending() : Sort.by(sortBy).ascending();
@@ -15,8 +15,7 @@ import de.bstly.we.services.businesslogic.ServiceManager;
import de.bstly.we.services.model.Service;
/**
* @author _bastler@bstly.de
*
* The Class ServiceController.
*/
@RestController
@RequestMapping("/services")
@@ -26,8 +25,9 @@ public class ServiceController extends BaseController {
private ServiceManager serviceManager;
/**
*
* @return
* Gets the services.
*
* @return the services
*/
@GetMapping
public List<Service> getServices() {
@@ -23,8 +23,7 @@ import de.bstly.we.services.businesslogic.ServiceManager;
import de.bstly.we.services.model.Service;
/**
* @author _bastler@bstly.de
*
* The Class ServiceManagementController.
*/
@RestController
@RequestMapping("/services/manage")
@@ -34,10 +33,11 @@ public class ServiceManagementController extends BaseController {
private ServiceManager serviceManager;
/**
*
* @param pageParameter
* @param sizeParameter
* @return
* Gets the all services.
*
* @param pageParameter the page parameter
* @param sizeParameter the size parameter
* @return the all services
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@GetMapping
@@ -47,9 +47,10 @@ public class ServiceManagementController extends BaseController {
}
/**
*
* @param service
* @return
* Creates the or update service.
*
* @param service the service
* @return the service
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping
@@ -62,8 +63,9 @@ public class ServiceManagementController extends BaseController {
}
/**
*
* @param service
* Delete service.
*
* @param service the service
*/
@PreAuthorize("hasRole('ROLE_ADMIN')")
@DeleteMapping
@@ -10,9 +10,7 @@ import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
/**
*
* @author _bastler@bstly.de
*
* The Class Service.
*/
@Entity
@Table(name = "services", uniqueConstraints = @UniqueConstraint(columnNames = { "name" }))
@@ -33,15 +31,17 @@ public class Service {
private String category;
/**
*
* Instantiates a new service.
*/
public Service() {
super();
}
/**
* @param name
* @param url
* Instantiates a new service.
*
* @param name the name
* @param url the url
*/
public Service(String name, String url) {
super();
@@ -50,6 +50,8 @@ public class Service {
}
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
@@ -57,13 +59,17 @@ public class Service {
}
/**
* @param name the name to set
* Sets the name.
*
* @param name the new name
*/
public void setName(String name) {
this.name = name;
}
/**
* Gets the url.
*
* @return the url
*/
public String getUrl() {
@@ -71,41 +77,53 @@ public class Service {
}
/**
* @param url the url to set
* Sets the url.
*
* @param url the new url
*/
public void setUrl(String url) {
this.url = url;
}
/**
* @return the alwaysPermitted
* Checks if is always permitted.
*
* @return true, if is always permitted
*/
public boolean isAlwaysPermitted() {
return alwaysPermitted;
}
/**
* @param alwaysPermitted the alwaysPermitted to set
* Sets the always permitted.
*
* @param alwaysPermitted the new always permitted
*/
public void setAlwaysPermitted(boolean alwaysPermitted) {
this.alwaysPermitted = alwaysPermitted;
}
/**
* @return the sameSite
* Checks if is same site.
*
* @return true, if is same site
*/
public boolean isSameSite() {
return sameSite;
}
/**
* @param sameSite the sameSite to set
* Sets the same site.
*
* @param sameSite the new same site
*/
public void setSameSite(boolean sameSite) {
this.sameSite = sameSite;
}
/**
* Gets the permission.
*
* @return the permission
*/
public String getPermission() {
@@ -113,13 +131,17 @@ public class Service {
}
/**
* @param permission the permission to set
* Sets the permission.
*
* @param permission the new permission
*/
public void setPermission(String permission) {
this.permission = permission;
}
/**
* Gets the category.
*
* @return the category
*/
public String getCategory() {
@@ -127,7 +149,9 @@ public class Service {
}
/**
* @param category the category to set
* Sets the category.
*
* @param category the new category
*/
public void setCategory(String category) {
this.category = category;
@@ -10,9 +10,7 @@ import org.springframework.stereotype.Repository;
import de.bstly.we.services.model.Service;
/**
*
* @author _bastler@bstly.de
*
* The Interface ServiceRepository.
*/
@Repository
public interface ServiceRepository extends JpaRepository<Service, String>, QuerydslPredicateExecutor<Service> {