diff --git a/src/main/java/cc/ryanc/halo/service/base/AbstractCrudService.java b/src/main/java/cc/ryanc/halo/service/base/AbstractCrudService.java index 7a5f8866b..42076339e 100644 --- a/src/main/java/cc/ryanc/halo/service/base/AbstractCrudService.java +++ b/src/main/java/cc/ryanc/halo/service/base/AbstractCrudService.java @@ -96,7 +96,7 @@ public abstract class AbstractCrudService implements CrudService domain type * @param id type - * * @author johnniang */ public interface CrudService { @@ -33,7 +33,6 @@ public interface CrudService { * List all by sort * * @param sort sort - * * @return List */ @NonNull @@ -43,7 +42,6 @@ public interface CrudService { * List all by pageable * * @param pageable pageable - * * @return Page */ @NonNull @@ -53,7 +51,6 @@ public interface CrudService { * List all by ids * * @param ids ids - * * @return List */ @NonNull @@ -64,7 +61,6 @@ public interface CrudService { * * @param ids ids * @param sort sort - * * @return List */ @NonNull @@ -74,7 +70,6 @@ public interface CrudService { * Fetch by id * * @param id id - * * @return Optional */ @NonNull @@ -84,33 +79,34 @@ public interface CrudService { * Get by id * * @param id id - * * @return DOMAIN + * @throws NotFoundException If the specified id does not exist */ @NonNull DOMAIN getById(@NonNull ID id); /** - * Get nullable by id + * Gets domain of nullable by id. * * @param id id - * * @return DOMAIN */ @Nullable - DOMAIN getNullableById(@NonNull ID id); + DOMAIN getByIdOfNullable(@NonNull ID id); /** - * @param id id + * Exists by id. * + * @param id id * @return boolean */ boolean existsById(@NonNull ID id); /** - * exist by id + * Must exist by id, or throw NotFoundException. * * @param id id + * @throws NotFoundException If the specified id does not exist */ void mustExistById(@NonNull ID id); @@ -125,7 +121,6 @@ public interface CrudService { * save by domain * * @param domain domain - * * @return DOMAIN */ @NonNull @@ -135,47 +130,43 @@ public interface CrudService { * save by domains * * @param domains domains - * * @return List */ @NonNull List createInBatch(@NonNull Collection domains); /** - * Update by domain + * Updates by domain * * @param domain domain - * * @return DOMAIN */ @NonNull DOMAIN update(@NonNull DOMAIN domain); /** - * Update by domains + * Updates by domains * * @param domains domains - * * @return List */ @NonNull List updateInBatch(@NonNull Collection domains); /** - * Remove by id + * Removes by id * * @param id id - * * @return DOMAIN + * @throws NotFoundException If the specified id does not exist */ @NonNull DOMAIN removeById(@NonNull ID id); /** - * Remove by id + * Removes by id if present. * * @param id id - * * @return DOMAIN */ @Nullable diff --git a/src/main/java/cc/ryanc/halo/service/impl/OptionsServiceImpl.java b/src/main/java/cc/ryanc/halo/service/impl/OptionsServiceImpl.java index 1276232e9..041ca933c 100755 --- a/src/main/java/cc/ryanc/halo/service/impl/OptionsServiceImpl.java +++ b/src/main/java/cc/ryanc/halo/service/impl/OptionsServiceImpl.java @@ -117,7 +117,7 @@ public class OptionsServiceImpl extends AbstractCrudService imp */ @Override public String findOneOption(String key) { -// final Options options = getNullableById(key); +// final Options options = getByIdOfNullable(key); // if (null != options) { // return options.getOptionValue(); // } diff --git a/src/main/java/cc/ryanc/halo/task/PostSyncTask.java b/src/main/java/cc/ryanc/halo/task/PostSyncTask.java index 16e7da299..ac6e52cc9 100644 --- a/src/main/java/cc/ryanc/halo/task/PostSyncTask.java +++ b/src/main/java/cc/ryanc/halo/task/PostSyncTask.java @@ -21,7 +21,7 @@ public class PostSyncTask { final PostService postService = SpringUtil.getBean(PostService.class); int count = 0; for (Long key : POSTS_VIEWS.keySet()) { - Post post = postService.getNullableById(key); + Post post = postService.getByIdOfNullable(key); if (null != post) { post.setPostViews(post.getPostViews() + POSTS_VIEWS.get(key)); postService.create(post);