use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordDto in project entando-core by entando.
the class ActivityStreamService method getActivityStream.
@Override
public PagedMetadata<ActionLogRecordDto> getActivityStream(RestListRequest requestList, UserDetails userDetails) {
try {
ActionLogRecordSearchBean searchBean = this.buildSearchBean(requestList, userDetails);
SearcherDaoPaginatedResult<ActionLogRecord> pagedResult = getActionLogManager().getPaginatedActionRecords(searchBean);
List<ActionLogRecordDto> dtoList = this.getDtoBuilder().convert(pagedResult.getList(), this.getSocialActivityStreamManager());
PagedMetadata<ActionLogRecordDto> pagedMetadata = new PagedMetadata<>(requestList, pagedResult);
pagedMetadata.setBody(dtoList);
return pagedMetadata;
} catch (Throwable t) {
logger.error("error searching actionLog ", t);
throw new RestServerError("error searching actionLog ", t);
}
}
use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordDto in project entando-core by entando.
the class ActivityStreamService method removeLike.
@Override
public ActionLogRecordDto removeLike(int recordId, UserDetails userDetails) {
try {
this.getSocialActivityStreamManager().editActionLikeRecord(recordId, userDetails.getUsername(), false);
ActionLogRecordDto dto = getFullDto(recordId);
return dto;
} catch (Throwable t) {
logger.error("error in remove like for id {}", recordId, t);
throw new RestServerError("error in remove like ", t);
}
}
use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordDto in project entando-core by entando.
the class ActivityStreamController method addLike.
@RestAccessControl(permission = Permission.ENTER_BACKEND)
@RequestMapping(value = "/{recordId}/like", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SimpleRestResponse<ActionLogRecordDto>> addLike(@PathVariable int recordId, HttpServletRequest request) throws JsonProcessingException {
ActionLogRecordDto result = this.getActivityStreamService().addLike(recordId, (UserDetails) request.getSession().getAttribute("user"));
logger.debug("adding like to activity stream record", result);
return new ResponseEntity<>(new SimpleRestResponse<>(result), HttpStatus.OK);
}
use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordDto in project entando-core by entando.
the class ActivityStreamService method addComment.
@Override
public ActionLogRecordDto addComment(ActivityStreamCommentRequest commentRequest, UserDetails attribute) {
try {
int recordId = commentRequest.getRecordId();
if (null == this.getActionLogManager().getActionRecord(recordId)) {
logger.warn("no record found with id {}", recordId);
throw new ResourceNotFoundException(ActivityStreamValidator.ERRCODE_RECORD_NOT_FOUND, "actionLogRecord", String.valueOf(recordId));
}
this.getSocialActivityStreamManager().addActionCommentRecord(attribute.getUsername(), commentRequest.getComment(), recordId);
ActionLogRecordDto dto = this.getDtoBuilder().toDto(this.getActionLogManager().getActionRecord(recordId), this.getSocialActivityStreamManager().getActionLikeRecords(recordId), this.getSocialActivityStreamManager().getActionCommentRecords(recordId));
return dto;
} catch (ApsSystemException t) {
logger.error("error in add comment for id {}", commentRequest.getRecordId(), t);
throw new RestServerError("error in add comment", t);
}
}
use of org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordDto in project entando-core by entando.
the class ActivityStreamService method addLike.
@Override
public ActionLogRecordDto addLike(int recordId, UserDetails userDetails) {
try {
if (null == this.getActionLogManager().getActionRecord(recordId)) {
logger.warn("no record found with id {}", recordId);
throw new ResourceNotFoundException(ActivityStreamValidator.ERRCODE_RECORD_NOT_FOUND, "actionLogRecord", String.valueOf(recordId));
}
this.getSocialActivityStreamManager().editActionLikeRecord(recordId, userDetails.getUsername(), true);
ActionLogRecordDto dto = getFullDto(recordId);
return dto;
} catch (ApsSystemException t) {
logger.error("error add add like for id {}", recordId, t);
throw new RestServerError("error in add like ", t);
}
}
Aggregations