pull request comments
This commit is contained in:
parent
955369a7f1
commit
df31723f58
@ -17,15 +17,19 @@ package org.thingsboard.server.common.data.alarm;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@ApiModel
|
@ApiModel
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class AlarmCommentInfo extends AlarmComment {
|
public class AlarmCommentInfo extends AlarmComment {
|
||||||
private static final long serialVersionUID = 2807343093519543377L;
|
private static final long serialVersionUID = 2807343093519543377L;
|
||||||
|
|
||||||
@ApiModelProperty(position = 19, value = "User name", example = "John")
|
@ApiModelProperty(position = 19, value = "User first name", example = "John")
|
||||||
private String firstName;
|
private String firstName;
|
||||||
|
|
||||||
@ApiModelProperty(position = 19, value = "User name", example = "Brown")
|
@ApiModelProperty(position = 19, value = "User last name", example = "Brown")
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
public AlarmCommentInfo() {
|
public AlarmCommentInfo() {
|
||||||
@ -41,52 +45,4 @@ public class AlarmCommentInfo extends AlarmComment {
|
|||||||
this.firstName = firstName;
|
this.firstName = firstName;
|
||||||
this.lastName = lastName;
|
this.lastName = lastName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFirstName() {
|
|
||||||
return firstName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFirstName(String firstName) {
|
|
||||||
this.firstName = firstName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastName() {
|
|
||||||
return lastName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastName(String lastName) {
|
|
||||||
this.lastName = lastName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
if (!super.equals(o)) return false;
|
|
||||||
|
|
||||||
AlarmCommentInfo alarmCommentInfo = (AlarmCommentInfo) o;
|
|
||||||
|
|
||||||
if (firstName == null) {
|
|
||||||
if (alarmCommentInfo.firstName != null)
|
|
||||||
return false;
|
|
||||||
} else if (!firstName.equals(alarmCommentInfo.firstName))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (lastName == null) {
|
|
||||||
if (alarmCommentInfo.lastName != null)
|
|
||||||
return false;
|
|
||||||
} else if (!lastName.equals(alarmCommentInfo.lastName))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int result = super.hashCode();
|
|
||||||
result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
|
|
||||||
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import java.util.UUID;
|
|||||||
@ApiModel
|
@ApiModel
|
||||||
public class AlarmCommentId extends UUIDBased implements EntityId{
|
public class AlarmCommentId extends UUIDBased implements EntityId{
|
||||||
|
|
||||||
private static final long serialVersionUID = 2L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public AlarmCommentId(@JsonProperty("id") UUID id) {
|
public AlarmCommentId(@JsonProperty("id") UUID id) {
|
||||||
|
|||||||
@ -63,7 +63,6 @@ public class BaseAlarmCommentService extends AbstractEntityService implements Al
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
|
||||||
public AlarmCommentOperationResult deleteAlarmComment(TenantId tenantId, AlarmCommentId alarmCommentId) {
|
public AlarmCommentOperationResult deleteAlarmComment(TenantId tenantId, AlarmCommentId alarmCommentId) {
|
||||||
log.debug("Deleting Alarm Comment with id: {}", alarmCommentId);
|
log.debug("Deleting Alarm Comment with id: {}", alarmCommentId);
|
||||||
AlarmCommentOperationResult result = new AlarmCommentOperationResult(new AlarmComment(), true);
|
AlarmCommentOperationResult result = new AlarmCommentOperationResult(new AlarmComment(), true);
|
||||||
@ -73,13 +72,14 @@ public class BaseAlarmCommentService extends AbstractEntityService implements Al
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<AlarmCommentInfo> findAlarmComments(TenantId tenantId, AlarmId alarmId, PageLink pageLink) {
|
public PageData<AlarmCommentInfo> findAlarmComments(TenantId tenantId, AlarmId alarmId, PageLink pageLink) {
|
||||||
|
log.trace("Executing findAlarmComments by alarmId [{}]", alarmId);
|
||||||
return alarmCommentDao.findAlarmComments(tenantId, alarmId, pageLink);
|
return alarmCommentDao.findAlarmComments(tenantId, alarmId, pageLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<AlarmComment> findAlarmCommentByIdAsync(TenantId tenantId, AlarmCommentId alarmCommentId) {
|
public ListenableFuture<AlarmComment> findAlarmCommentByIdAsync(TenantId tenantId, AlarmCommentId alarmCommentId) {
|
||||||
log.trace("Executing findAlarmCommentByIdAsync [{}]", alarmCommentId);
|
log.trace("Executing findAlarmCommentByIdAsync by alarmCommentId [{}]", alarmCommentId);
|
||||||
validateId(alarmCommentId, "Incorrect alarmId " + alarmCommentId);
|
validateId(alarmCommentId, "Incorrect alarmCommentId " + alarmCommentId);
|
||||||
return alarmCommentDao.findAlarmCommentByIdAsync(tenantId, alarmCommentId.getId());
|
return alarmCommentDao.findAlarmCommentByIdAsync(tenantId, alarmCommentId.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -69,18 +69,20 @@ public class JpaAlarmCommentDao extends JpaAbstractDao<AlarmCommentEntity, Alarm
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<AlarmCommentInfo> findAlarmComments(TenantId tenantId, AlarmId id, PageLink pageLink){
|
public PageData<AlarmCommentInfo> findAlarmComments(TenantId tenantId, AlarmId id, PageLink pageLink){
|
||||||
log.trace("Try to find alarm comments by alard id using [{}]", id);
|
log.trace("Try to find alarm comments by alarm id using [{}]", id);
|
||||||
return DaoUtil.toPageData(
|
return DaoUtil.toPageData(
|
||||||
alarmCommentRepository.findAllByAlarmId(id.getId(), DaoUtil.toPageable(pageLink)));
|
alarmCommentRepository.findAllByAlarmId(id.getId(), DaoUtil.toPageable(pageLink)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlarmComment findAlarmCommentById(TenantId tenantId, UUID key) {
|
public AlarmComment findAlarmCommentById(TenantId tenantId, UUID key) {
|
||||||
|
log.trace("Try to find alarm comment by id using [{}]", key);
|
||||||
return DaoUtil.getData(alarmCommentRepository.findById(key));
|
return DaoUtil.getData(alarmCommentRepository.findById(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ListenableFuture<AlarmComment> findAlarmCommentByIdAsync(TenantId tenantId, UUID key) {
|
public ListenableFuture<AlarmComment> findAlarmCommentByIdAsync(TenantId tenantId, UUID key) {
|
||||||
|
log.trace("Try to find alarm comment by id using [{}]", key);
|
||||||
return findByIdAsync(tenantId, key);
|
return findByIdAsync(tenantId, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user