change userpages to views

This commit is contained in:
_Bastler 2021-12-04 00:16:52 +01:00
parent 7dab139268
commit 7555063580
102 changed files with 248 additions and 254 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Comment/_58.cfe Normal file

Binary file not shown.

BIN
Comment/_58.cfs Normal file

Binary file not shown.

BIN
Comment/_58.si Normal file

Binary file not shown.

BIN
Comment/_59.cfe Normal file

Binary file not shown.

BIN
Comment/_59.cfs Normal file

Binary file not shown.

BIN
Comment/_59.si Normal file

Binary file not shown.

BIN
Comment/_5a.cfe Normal file

Binary file not shown.

BIN
Comment/_5a.cfs Normal file

Binary file not shown.

BIN
Comment/_5a.si Normal file

Binary file not shown.

BIN
Comment/_5b.cfe Normal file

Binary file not shown.

BIN
Comment/_5b.cfs Normal file

Binary file not shown.

BIN
Comment/_5b.si Normal file

Binary file not shown.

BIN
Comment/_5c.cfe Normal file

Binary file not shown.

BIN
Comment/_5c.cfs Normal file

Binary file not shown.

BIN
Comment/_5c.si Normal file

Binary file not shown.

BIN
Comment/_5d.cfe Normal file

Binary file not shown.

BIN
Comment/_5d.cfs Normal file

Binary file not shown.

BIN
Comment/_5d.si Normal file

Binary file not shown.

BIN
Comment/_5e.cfe Normal file

Binary file not shown.

BIN
Comment/_5e.cfs Normal file

Binary file not shown.

BIN
Comment/_5e.si Normal file

Binary file not shown.

BIN
Comment/_5f.cfe Normal file

Binary file not shown.

BIN
Comment/_5f.cfs Normal file

Binary file not shown.

BIN
Comment/_5f.si Normal file

Binary file not shown.

Binary file not shown.

BIN
Comment/segments_1h Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Entry/_4t.cfe Normal file

Binary file not shown.

BIN
Entry/_4t.cfs Normal file

Binary file not shown.

BIN
Entry/_4t.si Normal file

Binary file not shown.

BIN
Entry/_4u.cfe Normal file

Binary file not shown.

BIN
Entry/_4u.cfs Normal file

Binary file not shown.

Binary file not shown.

BIN
Entry/_4v.cfe Normal file

Binary file not shown.

BIN
Entry/_4v.cfs Normal file

Binary file not shown.

Binary file not shown.

BIN
Entry/_4w.cfe Normal file

Binary file not shown.

BIN
Entry/_4w.cfs Normal file

Binary file not shown.

BIN
Entry/_4w.si Normal file

Binary file not shown.

BIN
Entry/_4x.cfe Normal file

Binary file not shown.

BIN
Entry/_4x.cfs Normal file

Binary file not shown.

BIN
Entry/_4x.si Normal file

Binary file not shown.

BIN
Entry/_4y.cfe Normal file

Binary file not shown.

BIN
Entry/_4y.cfs Normal file

Binary file not shown.

Binary file not shown.

BIN
Entry/_4z.cfe Normal file

Binary file not shown.

BIN
Entry/_4z.cfs Normal file

Binary file not shown.

BIN
Entry/_4z.si Normal file

Binary file not shown.

BIN
Entry/_50.cfe Normal file

Binary file not shown.

BIN
Entry/_50.cfs Normal file

Binary file not shown.

BIN
Entry/_50.si Normal file

Binary file not shown.

Binary file not shown.

BIN
Entry/segments_1d Normal file

Binary file not shown.

View File

@ -26,8 +26,8 @@ public class SettingsManager {
private long FLAG_THRESH;
@Value("${bstly.board.maxTags:3}")
private int MAX_TAGS;
@Value("${bstly.board.maxUserPage:10}")
private long MAX_USER_PAGES;
@Value("${bstly.board.maxViews:10}")
private long MAX_VIEWS;
/**
* Gets the gravity.
@ -97,7 +97,7 @@ public class SettingsManager {
*
* @return the max user pages
*/
public long getMaxUserPages() {
return MAX_USER_PAGES;
public long getMaxViews() {
return MAX_VIEWS;
}
}

View File

@ -1,164 +0,0 @@
/**
*
*/
package de.bstly.board.businesslogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import de.bstly.board.model.QUserPage;
import de.bstly.board.model.UserPage;
import de.bstly.board.model.support.UserPageSorting;
import de.bstly.board.repository.UserPageRepository;
/**
* The Class UserPageManager.
*/
@Component
public class UserPageManager {
@Autowired
private UserPageRepository userPageRepository;
private QUserPage qUserPage = QUserPage.userPage;
/**
* Exists.
*
* @param username the username
* @param name the name
* @return true, if successful
*/
public boolean exists(String username, String name) {
return userPageRepository
.exists(qUserPage.username.equalsIgnoreCase(username).and(qUserPage.name.eq(name)));
}
/**
* Gets the.
*
* @param id the id
* @return the user page
*/
public UserPage get(Long id) {
return userPageRepository.findById(id).orElse(null);
}
/**
* Gets the.
*
* @param username the username
* @param name the name
* @return the user page
*/
public UserPage get(String username, String name) {
return userPageRepository
.findOne(qUserPage.username.equalsIgnoreCase(username).and(qUserPage.name.eq(name)))
.orElse(null);
}
/**
* Save.
*
* @param userPage the user page
* @return the user page
*/
public UserPage save(UserPage userPage) {
return userPageRepository.save(userPage);
}
/**
* Gets the by user.
*
* @param username the username
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param desc the desc
* @return the by user
*/
public Page<UserPage> getByUser(String username, int page, int size, boolean desc) {
return userPageRepository.findAll(qUserPage.username.equalsIgnoreCase(username),
PageRequest.of(page, size, desc ? Sort.by(Order.desc("index"), Order.desc("name"))
: Sort.by(Order.asc("index"), Order.asc("name"))));
}
/**
* Count by user.
*
* @param username the username
* @return the long
*/
public long countByUser(String username) {
return userPageRepository.count(qUserPage.username.equalsIgnoreCase(username));
}
/**
* Gets the public.
*
* @param username the username
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param desc the desc
* @return the public
*/
public Page<UserPage> getPublic(String username, int page, int size, String sortBy,
boolean desc) {
return userPageRepository.findAll(
qUserPage.username.notEqualsIgnoreCase(username).and(qUserPage.publicPage.isTrue()),
PageRequest.of(page, size, Sort.by(desc ? Direction.DESC : Direction.ASC, sortBy)));
}
/**
* Delete.
*
* @param username the username
* @param name the name
*/
public void delete(String username, String name) {
Assert.isTrue(exists(username, name), "UserPage not found!");
userPageRepository.delete(get(username, name));
}
public void createDefault(String username) {
if (!exists(username, "TOP")) {
UserPage userPageTop = new UserPage();
userPageTop.setName("TOP");
userPageTop.setUsername(username);
userPageTop.setSorting(UserPageSorting.TOP);
userPageTop.setIndex(20);
save(userPageTop);
}
if (!exists(username, "NEW")) {
UserPage userPageNew = new UserPage();
userPageNew.setName("NEW");
userPageNew.setUsername(username);
userPageNew.setSorting(UserPageSorting.NEW);
userPageNew.setIndex(40);
save(userPageNew);
}
if (!exists(username, "HOT")) {
UserPage userPageHot = new UserPage();
userPageHot.setName("HOT");
userPageHot.setUsername(username);
userPageHot.setSorting(UserPageSorting.HOT);
userPageHot.setIndex(60);
userPageHot.setDivider(true);
save(userPageHot);
}
if (!exists(username, "LAST")) {
UserPage userPageLast = new UserPage();
userPageLast.setName("LAST");
userPageLast.setUsername(username);
userPageLast.setSorting(UserPageSorting.LAST);
userPageLast.setIndex(80);
save(userPageLast);
}
}
}

View File

@ -0,0 +1,163 @@
/**
*
*/
package de.bstly.board.businesslogic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import de.bstly.board.model.QView;
import de.bstly.board.model.View;
import de.bstly.board.model.support.ViewSorting;
import de.bstly.board.repository.ViewRepository;
/**
* The Class ViewManager.
*/
@Component
public class ViewManager {
@Autowired
private ViewRepository viewRepository;
private QView qView = QView.view;
/**
* Exists.
*
* @param username the username
* @param name the name
* @return true, if successful
*/
public boolean exists(String username, String name) {
return viewRepository
.exists(qView.username.equalsIgnoreCase(username).and(qView.name.eq(name)));
}
/**
* Gets the.
*
* @param id the id
* @return the user page
*/
public View get(Long id) {
return viewRepository.findById(id).orElse(null);
}
/**
* Gets the.
*
* @param username the username
* @param name the name
* @return the user page
*/
public View get(String username, String name) {
return viewRepository
.findOne(qView.username.equalsIgnoreCase(username).and(qView.name.eq(name)))
.orElse(null);
}
/**
* Save.
*
* @param view the user page
* @return the user page
*/
public View save(View view) {
return viewRepository.save(view);
}
/**
* Gets the by user.
*
* @param username the username
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param desc the desc
* @return the by user
*/
public Page<View> getByUser(String username, int page, int size, boolean desc) {
return viewRepository.findAll(qView.username.equalsIgnoreCase(username),
PageRequest.of(page, size, desc ? Sort.by(Order.desc("index"), Order.desc("name"))
: Sort.by(Order.asc("index"), Order.asc("name"))));
}
/**
* Count by user.
*
* @param username the username
* @return the long
*/
public long countByUser(String username) {
return viewRepository.count(qView.username.equalsIgnoreCase(username));
}
/**
* Gets the public.
*
* @param username the username
* @param page the page
* @param size the size
* @param sortBy the sort by
* @param desc the desc
* @return the public
*/
public Page<View> getPublic(String username, int page, int size, String sortBy, boolean desc) {
return viewRepository.findAll(
qView.username.notEqualsIgnoreCase(username).and(qView.publicView.isTrue()),
PageRequest.of(page, size, Sort.by(desc ? Direction.DESC : Direction.ASC, sortBy)));
}
/**
* Delete.
*
* @param username the username
* @param name the name
*/
public void delete(String username, String name) {
Assert.isTrue(exists(username, name), "View not found!");
viewRepository.delete(get(username, name));
}
public void createDefault(String username) {
if (!exists(username, "TOP")) {
View viewTop = new View();
viewTop.setName("TOP");
viewTop.setUsername(username);
viewTop.setSorting(ViewSorting.TOP);
viewTop.setIndex(20);
save(viewTop);
}
if (!exists(username, "NEW")) {
View viewNew = new View();
viewNew.setName("NEW");
viewNew.setUsername(username);
viewNew.setSorting(ViewSorting.NEW);
viewNew.setIndex(40);
save(viewNew);
}
if (!exists(username, "HOT")) {
View viewHot = new View();
viewHot.setName("HOT");
viewHot.setUsername(username);
viewHot.setSorting(ViewSorting.HOT);
viewHot.setIndex(60);
viewHot.setDivider(true);
save(viewHot);
}
if (!exists(username, "LAST")) {
View viewLast = new View();
viewLast.setName("LAST");
viewLast.setUsername(username);
viewLast.setSorting(ViewSorting.LAST);
viewLast.setIndex(80);
save(viewLast);
}
}
}

View File

@ -32,14 +32,14 @@ import com.google.common.collect.Lists;
import de.bstly.board.businesslogic.EntryManager;
import de.bstly.board.businesslogic.SettingsManager;
import de.bstly.board.businesslogic.UserManager;
import de.bstly.board.businesslogic.UserPageManager;
import de.bstly.board.businesslogic.ViewManager;
import de.bstly.board.businesslogic.VoteManager;
import de.bstly.board.controller.model.EntryFilter;
import de.bstly.board.controller.support.EntityResponseStatusException;
import de.bstly.board.controller.support.RequestBodyErrors;
import de.bstly.board.controller.validation.EntryValidator;
import de.bstly.board.model.Entry;
import de.bstly.board.model.UserPage;
import de.bstly.board.model.View;
import de.bstly.board.model.Vote;
import de.bstly.board.model.support.EntryStatus;
import de.bstly.board.model.support.EntryType;
@ -65,7 +65,7 @@ public class EntryController extends BaseController {
@Autowired
private SettingsManager settingsManager;
@Autowired
private UserPageManager userPageManager;
private ViewManager viewManager;
/**
* Fetch by user page.
@ -80,7 +80,7 @@ public class EntryController extends BaseController {
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/{name}")
public Page<Entry> fetchByUserPage(@PathVariable("name") String name,
public Page<Entry> fetchByView(@PathVariable("name") String name,
@RequestParam("user") Optional<String> usernameParameter,
@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@ -92,10 +92,10 @@ public class EntryController extends BaseController {
@RequestParam("asc") Optional<Boolean> ascParameter,
@RequestParam("ignore") Optional<List<String>> ignoreParameter) {
UserPage userPage = userPageManager.get(usernameParameter.orElse(getCurrentUsername()),
View view = viewManager.get(usernameParameter.orElse(getCurrentUsername()),
name);
if (userPage == null || usernameParameter.isPresent() && !userPage.isPublicPage()) {
if (view == null || usernameParameter.isPresent() && !view.isPublicView()) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
}
@ -107,12 +107,12 @@ public class EntryController extends BaseController {
tagsParameter.orElse(null), excludedTagsParameter.orElse(null),
typeParameter.orElse(null));
filter.setFixedTags(userPage.getTags());
filter.setFixedExcludedTags(userPage.getExcludedTags());
filter.setFixedTags(view.getTags());
filter.setFixedExcludedTags(view.getExcludedTags());
Page<Entry> entries = null;
switch (userPage.getSorting()) {
switch (view.getSorting()) {
case TOP:
entries = entryManager.fetchByRanking(getCurrentUsername(), filter, getGravity(),
pageParameter.orElse(0), sizeParameter.orElse(settingsManager.getPageSize()),

View File

@ -37,7 +37,7 @@ public class SettingsController extends BaseController {
settings.put("entryDelay", getEntryDelay());
settings.put("commentDelay", getCommentDelay());
settings.put("maxTags", settingsManager.getMaxTags());
settings.put("maxUserPages", settingsManager.getMaxUserPages());
settings.put("maxViews", settingsManager.getMaxViews());
settings.put("defaultGravity", settingsManager.getGravity());
settings.put("defaultPageSize", settingsManager.getPageSize());
settings.put("defaultEntryDelay", settingsManager.getEntryDelay());

View File

@ -19,25 +19,25 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import de.bstly.board.businesslogic.SettingsManager;
import de.bstly.board.businesslogic.UserPageManager;
import de.bstly.board.businesslogic.ViewManager;
import de.bstly.board.controller.support.EntityResponseStatusException;
import de.bstly.board.controller.support.RequestBodyErrors;
import de.bstly.board.controller.validation.UserPageValidator;
import de.bstly.board.model.UserPage;
import de.bstly.board.controller.validation.ViewValidator;
import de.bstly.board.model.View;
/**
* The Class UserPageController.
* The Class ViewController.
*/
@RestController
@RequestMapping("/userpages")
public class UserPageController extends BaseController {
@RequestMapping("/views")
public class ViewController extends BaseController {
@Autowired
private UserPageManager userPageManager;
private ViewManager viewManager;
@Autowired
private SettingsManager settingsManager;
@Autowired
private UserPageValidator userPageValidator;
private ViewValidator viewValidator;
/**
* Gets the user pages.
@ -49,15 +49,15 @@ public class UserPageController extends BaseController {
*/
@PreAuthorize("isAuthenticated()")
@GetMapping()
public Page<UserPage> getUserPages(@RequestParam("page") Optional<Integer> pageParameter,
public Page<View> getViews(@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("desc") Optional<Boolean> descParameter) {
if (userPageManager.countByUser(getCurrentUsername()) == 0L) {
userPageManager.createDefault(getCurrentUsername());
if (viewManager.countByUser(getCurrentUsername()) == 0L) {
viewManager.createDefault(getCurrentUsername());
}
return userPageManager.getByUser(getCurrentUsername(), pageParameter.orElse(0),
return viewManager.getByUser(getCurrentUsername(), pageParameter.orElse(0),
sizeParameter.orElse(settingsManager.getPageSize()), descParameter.orElse(false));
}
@ -71,10 +71,10 @@ public class UserPageController extends BaseController {
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/public")
public Page<UserPage> getPublicUserPages(@RequestParam("page") Optional<Integer> pageParameter,
public Page<View> getPublicViews(@RequestParam("page") Optional<Integer> pageParameter,
@RequestParam("size") Optional<Integer> sizeParameter,
@RequestParam("desc") Optional<Boolean> descParameter) {
return userPageManager.getPublic(getCurrentUsername(), pageParameter.orElse(0),
return viewManager.getPublic(getCurrentUsername(), pageParameter.orElse(0),
sizeParameter.orElse(settingsManager.getPageSize()), "name",
descParameter.orElse(false));
}
@ -86,44 +86,43 @@ public class UserPageController extends BaseController {
* @return the user page
*/
@PreAuthorize("isAuthenticated()")
@GetMapping("/userpage/{name}")
public UserPage getUserPage(@PathVariable("name") String name,
@GetMapping("/view/{name}")
public View getView(@PathVariable("name") String name,
@RequestParam("user") Optional<String> usernameParameter) {
UserPage userPage = userPageManager.get(usernameParameter.orElse(getCurrentUsername()),
name);
View view = viewManager.get(usernameParameter.orElse(getCurrentUsername()), name);
if (userPage == null || usernameParameter.isPresent() && !userPage.isPublicPage()) {
if (view == null || usernameParameter.isPresent() && !view.isPublicView()) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
}
return userPage;
return view;
}
/**
* Creates the or update.
*
* @param userPage the user page
* @param view the user page
* @return the user page
*/
@PreAuthorize("isAuthenticated()")
@PostMapping("/userpage")
public UserPage createOrUpdate(@RequestBody UserPage userPage) {
userPage.setUsername(getCurrentUsername());
@PostMapping("/view")
public View createOrUpdate(@RequestBody View view) {
view.setUsername(getCurrentUsername());
RequestBodyErrors bindingResult = new RequestBodyErrors(userPage);
userPageValidator.validate(userPage, bindingResult);
RequestBodyErrors bindingResult = new RequestBodyErrors(view);
viewValidator.validate(view, bindingResult);
if (bindingResult.hasErrors()) {
throw new EntityResponseStatusException(bindingResult.getAllErrors(),
HttpStatus.UNPROCESSABLE_ENTITY);
}
if (!userPageManager.exists(getCurrentUsername(), userPage.getName()) && userPageManager
.countByUser(getCurrentUsername()) >= settingsManager.getMaxUserPages()) {
if (!viewManager.exists(getCurrentUsername(), view.getName())
&& viewManager.countByUser(getCurrentUsername()) >= settingsManager.getMaxViews()) {
throw new EntityResponseStatusException(HttpStatus.UNPROCESSABLE_ENTITY);
}
return userPageManager.save(userPage);
return viewManager.save(view);
}
/**
@ -132,13 +131,13 @@ public class UserPageController extends BaseController {
* @param name the name
*/
@PreAuthorize("isAuthenticated()")
@DeleteMapping("/userpage/{name}")
public void deleteUserPage(@PathVariable("name") String name) {
if (!userPageManager.exists(getCurrentUsername(), name)) {
@DeleteMapping("/view/{name}")
public void deleteView(@PathVariable("name") String name) {
if (!viewManager.exists(getCurrentUsername(), name)) {
throw new EntityResponseStatusException(HttpStatus.FORBIDDEN);
}
userPageManager.delete(getCurrentUsername(), name);
viewManager.delete(getCurrentUsername(), name);
}
}

View File

@ -10,25 +10,25 @@ import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import de.bstly.board.businesslogic.UserPageManager;
import de.bstly.board.businesslogic.ViewManager;
import de.bstly.board.controller.support.EntityResponseStatusException;
import de.bstly.board.model.UserPage;
import de.bstly.board.model.View;
/**
* The Class UserPageValidator.
* The Class ViewValidator.
*/
@Component
public class UserPageValidator implements Validator {
public class ViewValidator implements Validator {
@Autowired
private UserPageManager userPageManager;
private ViewManager viewManager;
/*
* @see org.springframework.validation.Validator#supports(java.lang.Class)
*/
@Override
public boolean supports(Class<?> clazz) {
return clazz.isAssignableFrom(UserPage.class);
return clazz.isAssignableFrom(View.class);
}
/*
@ -37,34 +37,34 @@ public class UserPageValidator implements Validator {
*/
@Override
public void validate(Object target, Errors errors) {
UserPage userPage = (UserPage) target;
View view = (View) target;
if (!StringUtils.hasText(userPage.getName())) {
if (!StringUtils.hasText(view.getName())) {
errors.rejectValue("name", "required");
}
if ((userPage.getId() == null || userPage.getId().equals(0L))
&& userPageManager.exists(userPage.getUsername(), userPage.getName())) {
if ((view.getId() == null || view.getId().equals(0L))
&& viewManager.exists(view.getUsername(), view.getName())) {
errors.rejectValue("name", "ALREADY_EXISTS");
}
if (userPage.getId() != null) {
UserPage origUserPage = userPageManager.get(userPage.getId());
if (origUserPage == null) {
if (view.getId() != null) {
View origView = viewManager.get(view.getId());
if (origView == null) {
errors.rejectValue("id", "INVALID");
}
if (!origUserPage.getUsername().equals(userPage.getUsername())) {
if (!origView.getUsername().equals(view.getUsername())) {
throw new EntityResponseStatusException(HttpStatus.FORBIDDEN);
}
UserPage other = userPageManager.get(userPage.getUsername(), userPage.getName());
if (other != null && !other.getId().equals(userPage.getId())) {
View other = viewManager.get(view.getUsername(), view.getName());
if (other != null && !other.getId().equals(view.getId())) {
errors.rejectValue("name", "ALREADY_EXISTS");
}
}
if (userPage.getSorting() == null) {
if (view.getSorting() == null) {
errors.rejectValue("sorting", "REQUIRED");
}

View File

@ -22,15 +22,15 @@ import org.hibernate.annotations.LazyCollectionOption;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import de.bstly.board.model.support.EntryType;
import de.bstly.board.model.support.UserPageSorting;
import de.bstly.board.model.support.ViewSorting;
/**
* The Class UserPage.
* The Class View.
*/
@Entity
@Table(name = "user_pages")
@Table(name = "views")
@EntityListeners({ AuditingEntityListener.class })
public class UserPage {
public class View {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@ -42,21 +42,21 @@ public class UserPage {
private String username;
@Enumerated(EnumType.STRING)
@Column(name = "sorting", nullable = false)
private UserPageSorting sorting;
private ViewSorting sorting;
@Column(name = "indexNumber")
private int index = 99;
@ElementCollection
@LazyCollection(LazyCollectionOption.FALSE)
@CollectionTable(name = "user_pages_tags")
@CollectionTable(name = "views_tags")
private List<String> tags;
@ElementCollection
@LazyCollection(LazyCollectionOption.FALSE)
@CollectionTable(name = "user_pages_excluded_tags")
@CollectionTable(name = "views_excluded_tags")
private List<String> excludedTags;
@Column(name = "entry_type", nullable = true)
private EntryType entryType;
@Column(name = "public", columnDefinition = "boolean default false")
private boolean publicPage;
private boolean publicView;
@Column(name = "divider", columnDefinition = "boolean default false")
private boolean divider;
@ -119,7 +119,7 @@ public class UserPage {
*
* @return the sorting
*/
public UserPageSorting getSorting() {
public ViewSorting getSorting() {
return sorting;
}
@ -128,7 +128,7 @@ public class UserPage {
*
* @param sorting the new sorting
*/
public void setSorting(UserPageSorting sorting) {
public void setSorting(ViewSorting sorting) {
this.sorting = sorting;
}
@ -201,21 +201,17 @@ public class UserPage {
}
/**
* Checks if is public page.
*
* @return true, if is public page
* @return the publicView
*/
public boolean isPublicPage() {
return publicPage;
public boolean isPublicView() {
return publicView;
}
/**
* Sets the public page.
*
* @param publicPage the new public page
* @param publicView the publicView to set
*/
public void setPublicPage(boolean publicPage) {
this.publicPage = publicPage;
public void setPublicView(boolean publicView) {
this.publicView = publicView;
}
/**

Some files were not shown because too many files have changed in this diff Show More