/** * Update fields <code>tenant</code> and <code>application</code>, * create new instances by using ids in parameters. * @param tenantId is tenant id * @param applicationId is application id */ public void updateScope(String tenantId, String applicationId) { Long tenId = getLongId(tenantId); this.tenant = tenId != null ? new Tenant(tenId) : null; Long appId = getLongId(applicationId); this.application = appId != null ? new Application(appId) : null; }
/** * Get string id. * * @param hasId the object that has id * @return id */ public static String getStringId(GenericModel<?> hasId) { String stringId = null; if (hasId != null) { Long id = hasId.getId(); stringId = getStringId(id); } return stringId; }
/** * Get version of endpoint profile schema. * @return version */ public Integer getEndpointProfileSchemaVersion() { Integer version = null; if (endpointProfileSchema != null) { version = endpointProfileSchema.getVersion(); } return version; }
@Override public ConfigurationDto toDto() { ConfigurationDto dto = super.toDto(); dto.setBody(binaryToString(configurationBody)); dto.setSchemaId(ModelUtils.getStringId(configurationSchema.getId())); dto.setSchemaVersion(schemaVersion); dto.setProtocolSchema(configurationSchema != null ? configurationSchema.getProtocolSchema() : null); return dto; }
@Override public CtlSchemaMetaInfoDto toDto() { CtlSchemaMetaInfoDto ctlSchemaMetaInfoDto = createDto(); ctlSchemaMetaInfoDto.setId(getStringId()); ctlSchemaMetaInfoDto.setFqn(fqn); ctlSchemaMetaInfoDto.setApplicationId(application != null ? application.getStringId() : null); ctlSchemaMetaInfoDto.setTenantId(tenant != null ? tenant.getStringId() : null); return ctlSchemaMetaInfoDto; }
@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; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((ecfv == null) ? 0 : ecfv.hashCode()); result = prime * result + ((fqn == null) ? 0 : fqn.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((getCtlSchema() == null) ? 0 : getCtlSchema().hashCode()); result = prime * result + ((tenant == null) ? 0 : tenant.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; }
@Override public ApplicationEventMapDto toDto() { ApplicationEventMapDto dto = createDto(); dto.setId(getStringId()); if (eventClass != null) { dto.setEventClassId(eventClass.getStringId()); } dto.setFqn(fqn); dto.setAction(action); return dto; }
/** * Create instance of <code>CtlSchema</code>. * * @param dto data transfer object */ public CtlSchema(CTLSchemaDto dto) { this.id = getLongId(dto.getId()); this.metaInfo = new CtlSchemaMetaInfo(dto.getMetaInfo()); this.version = dto.getVersion(); this.createdUsername = dto.getCreatedUsername(); this.createdTime = dto.getCreatedTime(); update(dto); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (body != null ? body.hashCode() : 0); result = 31 * result + (endpointProfileSchema != null ? endpointProfileSchema.hashCode() : 0); result = 31 * result + (serverProfileSchema != null ? serverProfileSchema.hashCode() : 0); return result; }
@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; }
@Override public UserDto toDto() { UserDto dto = createDto(); dto.setId(getStringId()); dto.setUsername(username); dto.setExternalUid(externalUid); dto.setTenantId(ModelUtils.getStringId(tenant)); dto.setAuthority(authority); return dto; }
@Override protected GenericModel<EndpointProfileSchemaDto> newInstance(Long id) { return new EndpointProfileSchema(id); } }
@Override protected GenericModel<ServerProfileSchemaDto> newInstance(Long id) { return new ServerProfileSchema(id); } }
/** * Get id of server profile schema. * @return id */ public String getServerProfileSchemaId() { String id = null; if (serverProfileSchema != null) { id = serverProfileSchema.getStringId(); } return id; }
/** * Get id of endpoint profile schema. * @return id */ public String getEndpointProfileSchemaId() { String id = null; if (endpointProfileSchema != null) { id = endpointProfileSchema.getStringId(); } return 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; }
@Override public String toString() { return "EventClass [ecfv=" + ecfv + ", fqn=" + fqn + ", type=" + type + ", ctlSchema=" + getCtlSchema() + ", id=" + id + "]"; }
/** * Get version of server profile schema. * @return version */ public Integer getServerProfileSchemaVersion() { Integer version = null; if (serverProfileSchema != null) { version = serverProfileSchema.getVersion(); } return version; }
@Override public String toString() { return "Configuration [sequenceNumber=" + sequenceNumber + ", schemaVersion=" + schemaVersion + ", description=" + description + ", createdTime=" + createdTime + ", lastModifyTime=" + lastModifyTime + ", activatedTime=" + activatedTime + ", deactivatedTime=" + deactivatedTime + ", createdUsername=" + createdUsername + ", modifiedUsername=" + modifiedUsername + ", activatedUsername=" + activatedUsername + ", deactivatedUsername=" + deactivatedUsername + ", endpointCount=" + endpointCount + ", status=" + status + ", id=" + id + ", version=" + getVersion() + "]"; }