Skip to content

Commit

Permalink
fix #67, author repository is the example
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Gregorio committed Jan 15, 2020
1 parent 515eed8 commit 65ae63a
Show file tree
Hide file tree
Showing 17 changed files with 511 additions and 247 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public LazyModel(LazyDataProvider<T> provider) {
@Override
public List<T> load(int first, int pageSize, List<SortMeta> multiSortMeta, Map<String, Object> filters) {
final Page<T> page = this.provider.load(first, pageSize, multiSortMeta);
this.setRowCount(page.getTotalPages());
this.setRowCount(Long.valueOf(page.getTotalPages()).intValue());
return page.getContent();
}

Expand All @@ -61,7 +61,7 @@ public List<T> load(int first, int pageSize, List<SortMeta> multiSortMeta, Map<S
@Override
public List<T> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, Object> filters) {
final Page<T> page = this.provider.load(first, pageSize, sortField, sortOrder);
this.setRowCount(page.getTotalPages());
this.setRowCount(Long.valueOf(page.getTotalPages()).intValue());
return page.getContent();
}

Expand Down Expand Up @@ -89,4 +89,4 @@ public T getRowData(String rowKey) {
.findFirst()
.orElse(null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ public final class Page<T extends PersistentEntity> {
@Getter
public final List<T> content;
@Getter
public final int totalPages;
public final long totalPages;

/**
* Create a new page
*
* @param content the content
* @param totalPages the total of possible pages
*/
private Page(List<T> content, int totalPages) {
private Page(List<T> content, long totalPages) {
this.content = Objects.requireNonNull(content);
this.totalPages = totalPages;
}
Expand All @@ -54,7 +54,7 @@ public static <V extends PersistentEntity> Page<V> empty() {
* @param totalPages the total count of pages
* @return the page with the given content
*/
public static <V extends PersistentEntity> Page<V> of(List<V> content, int totalPages) {
public static <V extends PersistentEntity> Page<V> of(List<V> content, long totalPages) {
return new Page<>(content, totalPages);
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package br.eti.arthurgregorio.library.domain.repositories.configuration;

import br.eti.arthurgregorio.library.domain.entities.configuration.Authorization;
import br.eti.arthurgregorio.library.domain.repositories.LazyDefaultRepository;
import br.eti.arthurgregorio.library.infrastructure.deltaspike.repositories.DeltaSpikeRepository;
import org.apache.deltaspike.data.api.Repository;

import java.util.Optional;
Expand All @@ -15,7 +15,7 @@
* @since 1.0.0, 28/12/2017
*/
@Repository
public interface AuthorizationRepository extends LazyDefaultRepository<Authorization> {
public interface AuthorizationRepository extends DeltaSpikeRepository<Authorization> {

/**
* Find an {@link Authorization} by the functionality and the permission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import br.eti.arthurgregorio.library.domain.entities.configuration.Grant;
import br.eti.arthurgregorio.library.domain.entities.configuration.Group;
import br.eti.arthurgregorio.library.domain.repositories.LazyDefaultRepository;
import br.eti.arthurgregorio.library.infrastructure.deltaspike.repositories.DeltaSpikeRepository;
import org.apache.deltaspike.data.api.Repository;

import java.util.List;
Expand All @@ -16,7 +16,7 @@
* @since 1.0.0, 28/12/2017
*/
@Repository
public interface GrantRepository extends LazyDefaultRepository<Grant> {
public interface GrantRepository extends DeltaSpikeRepository<Grant> {

/**
* Find a list o {@link Grant} from a given {@link Group}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import br.eti.arthurgregorio.library.domain.entities.configuration.Group;
import br.eti.arthurgregorio.library.domain.entities.configuration.Group_;
import br.eti.arthurgregorio.library.domain.repositories.LazyDefaultRepository;
import br.eti.arthurgregorio.library.infrastructure.deltaspike.repositories.DeltaSpikeRepository;
import org.apache.deltaspike.data.api.Repository;
import org.apache.deltaspike.data.api.criteria.Criteria;

Expand All @@ -20,7 +20,7 @@
* @since 1.0.0, 28/12/2017
*/
@Repository
public interface GroupRepository extends LazyDefaultRepository<Group> {
public interface GroupRepository extends DeltaSpikeRepository<Group> {

/**
* Find a {@link Group} by the name
Expand Down Expand Up @@ -65,7 +65,7 @@ default SingularAttribute<Group, Boolean> getEntityStateProperty() {
* @param criteria
*/
@Override
default void setOrder(Criteria<Group, Group> criteria) {
default void applyOrder(Criteria<Group, Group> criteria) {
criteria.orderAsc(Group_.name);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package br.eti.arthurgregorio.library.domain.repositories.configuration;

import br.eti.arthurgregorio.library.domain.entities.configuration.Profile;
import br.eti.arthurgregorio.library.domain.repositories.LazyDefaultRepository;
import br.eti.arthurgregorio.library.infrastructure.deltaspike.repositories.DeltaSpikeRepository;
import org.apache.deltaspike.data.api.Repository;

/**
Expand All @@ -13,4 +13,4 @@
* @since 2.0.0, 23/10/2018
*/
@Repository
public interface ProfileRepository extends LazyDefaultRepository<Profile> { }
public interface ProfileRepository extends DeltaSpikeRepository<Profile> { }
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import br.eti.arthurgregorio.library.domain.entities.configuration.StoreType;
import br.eti.arthurgregorio.library.domain.entities.configuration.User;
import br.eti.arthurgregorio.library.domain.entities.configuration.User_;
import br.eti.arthurgregorio.library.domain.repositories.LazyDefaultRepository;
import br.eti.arthurgregorio.library.infrastructure.deltaspike.repositories.DeltaSpikeRepository;
import org.apache.deltaspike.data.api.Repository;
import org.apache.deltaspike.data.api.criteria.Criteria;

Expand All @@ -21,7 +21,7 @@
* @since 1.0.0, 28/12/2017
*/
@Repository
public interface UserRepository extends LazyDefaultRepository<User> {
public interface UserRepository extends DeltaSpikeRepository<User> {

/**
* Find an {@link User} by the email address
Expand Down
Loading

0 comments on commit 65ae63a

Please sign in to comment.