Package com.bytedesk.core.topic
Class TopicRestService
java.lang.Object
com.bytedesk.core.base.BaseRestService<TopicEntity,TopicRequest,TopicResponse>
com.bytedesk.core.topic.TopicRestService
@Service
public class TopicRestService
extends BaseRestService<TopicEntity,TopicRequest,TopicResponse>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AuthServiceprivate final org.modelmapper.ModelMapperprivate final TopicRepositoryprivate final UidUtils -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientId(String clientId) convertToResponse(TopicEntity entity) create(TopicRequest request) voidprotected org.springframework.data.jpa.domain.Specification<TopicEntity>createSpecification(TopicRequest request) 创建Specification对象,子类必须实现 用于queryByOrg的通用实现voiddelete(TopicRequest request) voiddeleteByUid(String uid) protected TopicEntitydoSave(TopicEntity entity) 子类实现具体的保存逻辑protected org.springframework.data.domain.Page<TopicEntity>executePageQuery(org.springframework.data.jpa.domain.Specification<TopicEntity> spec, org.springframework.data.domain.Pageable pageable) 执行分页查询,子类必须实现 用于queryByOrg的通用实现existsByUid(String uid) findAll()查询所有的 TopicEntityfindByClientId(String clientId) findByTopic(String topic) findByUserUid(String userUid) handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, TopicEntity entity) isSubscribed(TopicRequest request) voidremove(TopicRequest topicRequest) voidvoidremoveClientId(String clientId) subscribe(TopicRequest request) voidunsubscribe(TopicRequest request) voidunsubscribe(String topic, String clientId) update(TopicRequest request) Methods inherited from class com.bytedesk.core.base.BaseRestService
deleteByOrgUid, findByOrgUid, getUidFromRequest, queryByOrg, queryByUid, queryByUser, recover, save, setUserUidToRequest
-
Field Details
-
topicRepository
-
modelMapper
private final org.modelmapper.ModelMapper modelMapper -
uidUtils
-
authService
-
-
Constructor Details
-
TopicRestService
public TopicRestService()
-
-
Method Details
-
createSpecification
protected org.springframework.data.jpa.domain.Specification<TopicEntity> createSpecification(TopicRequest request) Description copied from class:BaseRestService创建Specification对象,子类必须实现 用于queryByOrg的通用实现- Specified by:
createSpecificationin classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
executePageQuery
protected org.springframework.data.domain.Page<TopicEntity> executePageQuery(org.springframework.data.jpa.domain.Specification<TopicEntity> spec, org.springframework.data.domain.Pageable pageable) Description copied from class:BaseRestService执行分页查询,子类必须实现 用于queryByOrg的通用实现- Specified by:
executePageQueryin classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
findByClientId
@Cacheable(value="topic", key="#clientId", unless="#result == null") public Optional<TopicEntity> findByClientId(String clientId) -
findByUid
@Cacheable(value="topic", key="#uid", unless="#result==null") public Optional<TopicEntity> findByUid(String uid) - Specified by:
findByUidin classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
findByUserUid
@Cacheable(value="topic", key="#userUid", unless="#result==null") public Optional<TopicEntity> findByUserUid(String userUid) -
findByTopic
@Cacheable(value="topic", key="#topic", unless="#result==null") public Set<TopicEntity> findByTopic(String topic) -
existsByUid
-
create
-
create
- Specified by:
createin classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
update
- Specified by:
updatein classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
doSave
Description copied from class:BaseRestService子类实现具体的保存逻辑- Specified by:
doSavein classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
handleOptimisticLockingFailureException
public TopicEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, TopicEntity entity) - Specified by:
handleOptimisticLockingFailureExceptionin classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
deleteByUid
- Specified by:
deleteByUidin classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
delete
- Specified by:
deletein classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
convertToResponse
- Specified by:
convertToResponsein classBaseRestService<TopicEntity,TopicRequest, TopicResponse>
-
isSubscribed
-
remove
-
remove
-
subscribe
-
subscribe
-
unsubscribe
-
unsubscribe
-
addClientId
-
removeClientId
-
findAll
查询所有的 TopicEntity- Returns:
- 所有的 TopicEntity 列表
-