Update dependencies.

pull/351/head
ruibaby 2019-10-19 20:02:28 +08:00
parent 0e1163ea66
commit 7b8fc49604
17 changed files with 149 additions and 131 deletions

View File

@ -1,7 +1,7 @@
plugins {
id 'org.springframework.boot' version '2.1.7.RELEASE'
id 'org.springframework.boot' version '2.2.0.RELEASE'
id "io.freefair.lombok" version "3.6.6"
// id 'war'
id 'war'
id 'java'
}

View File

@ -1,34 +1,34 @@
package run.halo.app.controller.admin.api;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.actuate.trace.http.HttpTrace;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import run.halo.app.service.TraceService;
import java.util.List;
/**
* Trace controller.
*
* @author johnniang
* @date 19-6-18
*/
@RestController
@RequestMapping("/api/admin/traces")
public class TraceController {
private final TraceService traceService;
public TraceController(TraceService traceService) {
this.traceService = traceService;
}
@GetMapping
@ApiOperation("Lists http traces")
public List<HttpTrace> listHttpTraces() {
return traceService.listHttpTraces();
}
}
//package run.halo.app.controller.admin.api;
//
//import io.swagger.annotations.ApiOperation;
//import org.springframework.boot.actuate.trace.http.HttpTrace;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import run.halo.app.service.TraceService;
//
//import java.util.List;
//
///**
// * Trace controller.
// *
// * @author johnniang
// * @date 19-6-18
// */
//@RestController
//@RequestMapping("/api/admin/traces")
//public class TraceController {
//
// private final TraceService traceService;
//
// public TraceController(TraceService traceService) {
// this.traceService = traceService;
// }
//
// @GetMapping
// @ApiOperation("Lists http traces")
// public List<HttpTrace> listHttpTraces() {
// return traceService.listHttpTraces();
// }
//
//}

View File

@ -48,6 +48,7 @@ public interface CategoryRepository extends BaseRepository<Category, Integer> {
/**
* List categories by parent id.
*
* @param id parent id.
* @return list of category
*/

View File

@ -7,22 +7,30 @@ import run.halo.app.model.projection.CommentChildrenCountProjection;
import run.halo.app.model.projection.CommentCountProjection;
import run.halo.app.repository.base.BaseCommentRepository;
import java.util.Collection;
import java.util.List;
/**
* Journal comment repository.
*
* @author johnniang
* @date 19-4-24
* @author ryanwang
* @date 2019-04-24
*/
public interface JournalCommentRepository extends BaseCommentRepository<JournalComment> {
/**
* Count the number of comments by post id.
*
* @param postIds post id collection must not be null
* @return a list of CommentCountProjection
*/
@Query("select new run.halo.app.model.projection.CommentCountProjection(count(comment.id), comment.postId) " +
"from JournalComment comment " +
"where comment.postId in ?1 group by comment.postId")
@NonNull
@Override
List<CommentCountProjection> countByPostIds(@NonNull Iterable<Integer> postIds);
List<CommentCountProjection> countByPostIds(@NonNull Collection<Integer> postIds);
@Query("select new run.halo.app.model.projection.CommentChildrenCountProjection(count(comment.id), comment.parentId) " +
"from JournalComment comment " +
@ -30,5 +38,5 @@ public interface JournalCommentRepository extends BaseCommentRepository<JournalC
"group by comment.parentId")
@NonNull
@Override
List<CommentChildrenCountProjection> findDirectChildrenCount(@NonNull Iterable<Long> commentIds);
List<CommentChildrenCountProjection> findDirectChildrenCount(@NonNull Collection<Long> commentIds);
}

View File

@ -7,6 +7,7 @@ import run.halo.app.model.enums.PostStatus;
import run.halo.app.model.projection.CategoryPostCountProjection;
import run.halo.app.repository.base.BaseRepository;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@ -58,7 +59,7 @@ public interface PostCategoryRepository extends BaseRepository<PostCategory, Int
* @return a list of post category
*/
@NonNull
List<PostCategory> findAllByPostIdIn(@NonNull Iterable<Integer> postIds);
List<PostCategory> findAllByPostIdIn(@NonNull Collection<Integer> postIds);
/**
* Finds all post categories by post id.

View File

@ -7,13 +7,15 @@ import run.halo.app.model.projection.CommentChildrenCountProjection;
import run.halo.app.model.projection.CommentCountProjection;
import run.halo.app.repository.base.BaseCommentRepository;
import java.util.Collection;
import java.util.List;
/**
* PostComment repository.
*
* @author johnniang
* @date 3/21/19
* @author ryanwang
* @date 2019-03-21
*/
public interface PostCommentRepository extends BaseCommentRepository<PostComment> {
@ -22,7 +24,7 @@ public interface PostCommentRepository extends BaseCommentRepository<PostComment
"where comment.postId in ?1 group by comment.postId")
@NonNull
@Override
List<CommentCountProjection> countByPostIds(@NonNull Iterable<Integer> postIds);
List<CommentCountProjection> countByPostIds(@NonNull Collection<Integer> postIds);
@Query("select new run.halo.app.model.projection.CommentChildrenCountProjection(count(comment.id), comment.parentId) " +
"from PostComment comment " +
@ -30,5 +32,5 @@ public interface PostCommentRepository extends BaseCommentRepository<PostComment
"group by comment.parentId")
@NonNull
@Override
List<CommentChildrenCountProjection> findDirectChildrenCount(@NonNull Iterable<Long> commentIds);
List<CommentChildrenCountProjection> findDirectChildrenCount(@NonNull Collection<Long> commentIds);
}

View File

@ -7,6 +7,7 @@ import run.halo.app.model.enums.PostStatus;
import run.halo.app.model.projection.TagPostPostCountProjection;
import run.halo.app.repository.base.BaseRepository;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@ -76,7 +77,7 @@ public interface PostTagRepository extends BaseRepository<PostTag, Integer> {
* @return a list of post tags
*/
@NonNull
List<PostTag> findAllByPostIdIn(@NonNull Iterable<Integer> postIds);
List<PostTag> findAllByPostIdIn(@NonNull Collection<Integer> postIds);
/**
* Deletes post tags by post id.
@ -104,7 +105,7 @@ public interface PostTagRepository extends BaseRepository<PostTag, Integer> {
*/
@Query("select new run.halo.app.model.projection.TagPostPostCountProjection(count(pt.postId), pt.tagId) from PostTag pt where pt.tagId in ?1 group by pt.tagId")
@NonNull
List<TagPostPostCountProjection> findPostCountByTagIds(@NonNull Iterable<Integer> tagIds);
List<TagPostPostCountProjection> findPostCountByTagIds(@NonNull Collection<Integer> tagIds);
/**
* Finds post count of tag.

View File

@ -7,13 +7,15 @@ import run.halo.app.model.projection.CommentChildrenCountProjection;
import run.halo.app.model.projection.CommentCountProjection;
import run.halo.app.repository.base.BaseCommentRepository;
import java.util.Collection;
import java.util.List;
/**
* Sheet comment repository.
*
* @author johnniang
* @date 19-4-24
* @author ryanwang
* @date 2019-04-24
*/
public interface SheetCommentRepository extends BaseCommentRepository<SheetComment> {
@ -22,7 +24,7 @@ public interface SheetCommentRepository extends BaseCommentRepository<SheetComme
"where comment.postId in ?1 group by comment.postId")
@NonNull
@Override
List<CommentCountProjection> countByPostIds(@NonNull Iterable<Integer> postIds);
List<CommentCountProjection> countByPostIds(@NonNull Collection<Integer> postIds);
@Query("select new run.halo.app.model.projection.CommentChildrenCountProjection(count(comment.id), comment.parentId) " +
"from SheetComment comment " +
@ -30,5 +32,5 @@ public interface SheetCommentRepository extends BaseCommentRepository<SheetComme
"group by comment.parentId")
@NonNull
@Override
List<CommentChildrenCountProjection> findDirectChildrenCount(@NonNull Iterable<Long> commentIds);
List<CommentChildrenCountProjection> findDirectChildrenCount(@NonNull Collection<Long> commentIds);
}

View File

@ -32,6 +32,7 @@ public interface TagRepository extends BaseRepository<Tag, Integer> {
/**
* Get tag by name
*
* @param name name
* @return Tag
*/

View File

@ -12,13 +12,15 @@ import run.halo.app.model.enums.CommentStatus;
import run.halo.app.model.projection.CommentChildrenCountProjection;
import run.halo.app.model.projection.CommentCountProjection;
import java.util.Collection;
import java.util.List;
/**
* Base comment repository.
*
* @author johnniang
* @date 19-4-24
* @author ryanwang
* @date 2019-04-24
*/
@NoRepositoryBean
public interface BaseCommentRepository<COMMENT extends BaseComment> extends BaseRepository<COMMENT, Long>, JpaSpecificationExecutor<COMMENT> {
@ -41,7 +43,7 @@ public interface BaseCommentRepository<COMMENT extends BaseComment> extends Base
* @return a list of comment
*/
@NonNull
List<COMMENT> findAllByPostIdIn(@NonNull Iterable<Integer> postIds);
List<COMMENT> findAllByPostIdIn(@NonNull Collection<Integer> postIds);
/**
* Finds all comments by post id.
@ -63,7 +65,7 @@ public interface BaseCommentRepository<COMMENT extends BaseComment> extends Base
"where comment.postId in ?1 " +
"group by comment.postId")
@NonNull
List<CommentCountProjection> countByPostIds(@NonNull Iterable<Integer> postIds);
List<CommentCountProjection> countByPostIds(@NonNull Collection<Integer> postIds);
/**
* Counts by comment status.
@ -113,7 +115,7 @@ public interface BaseCommentRepository<COMMENT extends BaseComment> extends Base
* @return a list of comment
*/
@NonNull
List<COMMENT> findAllByStatusAndParentIdIn(@NonNull CommentStatus status, @NonNull Iterable<Long> parentIds);
List<COMMENT> findAllByStatusAndParentIdIn(@NonNull CommentStatus status, @NonNull Collection<Long> parentIds);
/**
* Finds comments by post id, comment status and parent id.
@ -133,5 +135,5 @@ public interface BaseCommentRepository<COMMENT extends BaseComment> extends Base
"where comment.parentId in ?1 " +
"group by comment.parentId")
@NonNull
List<CommentChildrenCountProjection> findDirectChildrenCount(@NonNull Iterable<Long> commentIds);
List<CommentChildrenCountProjection> findDirectChildrenCount(@NonNull Collection<Long> commentIds);
}

View File

@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.lang.NonNull;
import java.util.Collection;
import java.util.List;
/**
@ -15,6 +16,8 @@ import java.util.List;
* @param <DOMAIN> doamin type
* @param <ID> id type
* @author johnniang
* @author ryanwang
* @date 2019-03-15
*/
@NoRepositoryBean
public interface BaseRepository<DOMAIN, ID> extends JpaRepository<DOMAIN, ID> {
@ -27,7 +30,7 @@ public interface BaseRepository<DOMAIN, ID> extends JpaRepository<DOMAIN, ID> {
* @return a list of domains
*/
@NonNull
List<DOMAIN> findAllByIdIn(@NonNull Iterable<ID> ids, @NonNull Sort sort);
List<DOMAIN> findAllByIdIn(@NonNull Collection<ID> ids, @NonNull Sort sort);
/**
* Finds all domain by domain id list.
@ -37,7 +40,7 @@ public interface BaseRepository<DOMAIN, ID> extends JpaRepository<DOMAIN, ID> {
* @return a list of domains
*/
@NonNull
Page<DOMAIN> findAllByIdIn(@NonNull Iterable<ID> ids, @NonNull Pageable pageable);
Page<DOMAIN> findAllByIdIn(@NonNull Collection<ID> ids, @NonNull Pageable pageable);
/**
* Deletes by id list.
@ -45,6 +48,6 @@ public interface BaseRepository<DOMAIN, ID> extends JpaRepository<DOMAIN, ID> {
* @param ids id list of domain must not be null
* @return number of rows affected
*/
long deleteByIdIn(@NonNull Iterable<ID> ids);
long deleteByIdIn(@NonNull Collection<ID> ids);
}

View File

@ -17,6 +17,7 @@ import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -26,6 +27,8 @@ import java.util.List;
* @param <DOMAIN> domain type
* @param <ID> id type
* @author johnniang
* @author ryanwang
* @date 2019-03-15
*/
@Slf4j
public class BaseRepositoryImpl<DOMAIN, ID> extends SimpleJpaRepository<DOMAIN, ID> implements BaseRepository<DOMAIN, ID> {
@ -68,8 +71,8 @@ public class BaseRepositoryImpl<DOMAIN, ID> extends SimpleJpaRepository<DOMAIN,
* @return a list of domains
*/
@Override
public List<DOMAIN> findAllByIdIn(Iterable<ID> ids, Sort sort) {
Assert.notNull(ids, "The given Iterable of Id's must not be null!");
public List<DOMAIN> findAllByIdIn(Collection<ID> ids, Sort sort) {
Assert.notNull(ids, "The given Collection of Id's must not be null!");
Assert.notNull(sort, "Sort info must nto be null");
log.debug("Customized findAllById method was invoked");
@ -90,8 +93,8 @@ public class BaseRepositoryImpl<DOMAIN, ID> extends SimpleJpaRepository<DOMAIN,
}
@Override
public Page<DOMAIN> findAllByIdIn(Iterable<ID> ids, Pageable pageable) {
Assert.notNull(ids, "The given Iterable of Id's must not be null!");
public Page<DOMAIN> findAllByIdIn(Collection<ID> ids, Pageable pageable) {
Assert.notNull(ids, "The given Collection of Id's must not be null!");
Assert.notNull(pageable, "Page info must nto be null");
if (!ids.iterator().hasNext()) {
@ -119,7 +122,7 @@ public class BaseRepositoryImpl<DOMAIN, ID> extends SimpleJpaRepository<DOMAIN,
*/
@Override
@Transactional
public long deleteByIdIn(Iterable<ID> ids) {
public long deleteByIdIn(Collection<ID> ids) {
log.debug("Customized deleteByIdIn method was invoked");
// Find all domains
@ -147,7 +150,7 @@ public class BaseRepositoryImpl<DOMAIN, ID> extends SimpleJpaRepository<DOMAIN,
private static final long serialVersionUID = 1L;
private final JpaEntityInformation<T, ?> entityInformation;
@Nullable
ParameterExpression<Iterable> parameter;
ParameterExpression<Collection> parameter;
ByIdsSpecification(JpaEntityInformation<T, ?> entityInformation) {
this.entityInformation = entityInformation;
@ -156,7 +159,7 @@ public class BaseRepositoryImpl<DOMAIN, ID> extends SimpleJpaRepository<DOMAIN,
@Override
public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
Path<?> path = root.get(this.entityInformation.getIdAttribute());
this.parameter = cb.parameter(Iterable.class);
this.parameter = cb.parameter(Collection.class);
return path.in(this.parameter);
}
}

View File

@ -1,24 +1,24 @@
package run.halo.app.service;
import org.springframework.boot.actuate.trace.http.HttpTrace;
import org.springframework.lang.NonNull;
import java.util.List;
/**
* Trace service interface.
*
* @author johnniang
* @date 2019-06-18
*/
public interface TraceService {
/**
* Gets all http traces.
*
* @return
*/
@NonNull
List<HttpTrace> listHttpTraces();
}
//package run.halo.app.service;
//
//import org.springframework.boot.actuate.trace.http.HttpTrace;
//import org.springframework.lang.NonNull;
//
//import java.util.List;
//
///**
// * Trace service interface.
// *
// * @author johnniang
// * @date 2019-06-18
// */
//public interface TraceService {
//
// /**
// * Gets all http traces.
// *
// * @return
// */
// @NonNull
// List<HttpTrace> listHttpTraces();
//
//}

View File

@ -1,29 +1,29 @@
package run.halo.app.service.impl;
import org.springframework.boot.actuate.trace.http.HttpTrace;
import org.springframework.boot.actuate.trace.http.HttpTraceRepository;
import org.springframework.stereotype.Service;
import run.halo.app.service.TraceService;
import java.util.List;
/**
* TraceService implementation class.
*
* @author johnniang
* @date 2019-06-18
*/
@Service
public class TraceServiceImpl implements TraceService {
private final HttpTraceRepository httpTraceRepository;
public TraceServiceImpl(HttpTraceRepository httpTraceRepository) {
this.httpTraceRepository = httpTraceRepository;
}
@Override
public List<HttpTrace> listHttpTraces() {
return httpTraceRepository.findAll();
}
}
//package run.halo.app.service.impl;
//
//import org.springframework.boot.actuate.trace.http.HttpTrace;
//import org.springframework.boot.actuate.trace.http.HttpTraceRepository;
//import org.springframework.stereotype.Service;
//import run.halo.app.service.TraceService;
//
//import java.util.List;
//
///**
// * TraceService implementation class.
// *
// * @author johnniang
// * @date 2019-06-18
// */
//@Service
//public class TraceServiceImpl implements TraceService {
//
// private final HttpTraceRepository httpTraceRepository;
//
// public TraceServiceImpl(HttpTraceRepository httpTraceRepository) {
// this.httpTraceRepository = httpTraceRepository;
// }
//
// @Override
// public List<HttpTrace> listHttpTraces() {
// return httpTraceRepository.findAll();
// }
//}

View File

@ -1,6 +1,6 @@
server:
port: 8090
use-forward-headers: true
forward-headers-strategy: native
compression:
enabled: false
mime-types: application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
@ -40,9 +40,6 @@ spring:
multipart:
max-file-size: 10240MB
max-request-size: 10240MB
mvc:
favicon:
enabled: false
cache:
type: none
logging:
@ -51,6 +48,7 @@ logging:
org.hibernate: INFO
org.hibernate.type.descriptor.sql.BasicBinder: INFO
org.hibernate.type.descriptor.sql.BasicExtractor: INFO
file:
path: ${user.home}/halo-dev/logs
halo:

View File

@ -1,6 +1,6 @@
server:
port: 8090
use-forward-headers: true
forward-headers-strategy: native
compression:
enabled: false
mime-types: application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
@ -39,15 +39,13 @@ spring:
multipart:
max-file-size: 10MB
max-request-size: 10MB
mvc:
favicon:
enabled: false
cache:
type: none
logging:
level:
run.halo.app: DEBUG
org.hibernate: ERROR
file:
path: ${user.home}/halo-test/logs
halo:

View File

@ -1,6 +1,6 @@
server:
port: 8090
use-forward-headers: true
forward-headers-strategy: native
compression:
enabled: false
mime-types: application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain
@ -42,10 +42,8 @@ spring:
multipart:
max-file-size: 10240MB
max-request-size: 10240MB
mvc:
favicon:
enabled: false
logging:
level:
run.halo.app: INFO
file:
path: ${user.home}/.halo/logs