@Override protected GenericModel<ChangeDto> newInstance(Long id) { return new Change(id); }
@Override public int hashCode() { final int prime = 41; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + sequenceNumber; result = prime * result + Long.valueOf(lastModifyTime).hashCode(); result = prime * result + ((application == null) ? 0 : application.hashCode()); result = prime * result + ((change == null) ? 0 : change.hashCode()); return result; }
protected Change generateChange() { LOG.debug("Generate change..."); Change change = new Change(); change.setConfigurationId(RANDOM.nextLong()); change.setConfigurationVersion(RANDOM.nextInt(3000)); change = historyDao.save(change, Change.class); LOG.debug("Generated change {}", change); return change; }
@Override public ChangeDto toDto() { ChangeDto changeDto = createDto(); changeDto.setId(getStringId()); changeDto.setType(type); changeDto.setConfigurationId(ModelUtils.getStringId(configurationId)); changeDto.setCfVersion(configurationVersion); changeDto.setEndpointGroupId(ModelUtils.getStringId(groupId)); changeDto.setProfileFilterId(ModelUtils.getStringId(profileFilterId)); changeDto.setTopicId(ModelUtils.getStringId(topicId)); return changeDto; }
return false; } else if (!change.equals(other.change)) { return false;
@Override public HistoryDto toDto() { HistoryDto dto = createDto(); dto.setId(getStringId()); if (application != null) { dto.setApplicationId(application.getStringId()); } dto.setChange(change != null ? change.toDto() : null); dto.setSequenceNumber(sequenceNumber); dto.setLastModifyTime(lastModifyTime); return dto; }
/** * Create new instance of <code>History</code>. * @param dto data transfer object contain data that * assign on fields of new instance */ public History(HistoryDto dto) { if (dto != null) { this.id = getLongId(dto); this.sequenceNumber = dto.getSequenceNumber(); this.change = new Change(dto.getChange()); this.lastModifyTime = dto.getLastModifyTime(); Long applicationId = getLongId(dto.getApplicationId()); if (applicationId != null) { this.application = new Application(applicationId); } } }