/** * Return instance that contains only schema id and version. * */ public VersionDto toVersionDto() { VersionDto dto = new VersionDto(); dto.setId(getStringId()); dto.setVersion(version); return dto; } }
public SchemaInfoDto(VersionDto versionDto) { this.id = versionDto.getId(); this.version = versionDto.getVersion(); }
@Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((applicationId == null) ? 0 : applicationId.hashCode()); result = prime * result + (int) (createdTime ^ (createdTime >>> 32)); result = prime * result + ((createdUsername == null) ? 0 : createdUsername.hashCode()); result = prime * result + ((ctlSchemaId == null) ? 0 : ctlSchemaId.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; }
private List<VersionDto> extractEndpointProfileVersions(VersionDto serverProfileVersion) { Set<VersionDto> endpointProfileVersions = new HashSet<>(); if (profileVersionPairs != null) { for (ProfileVersionPairDto profileVersionPair : profileVersionPairs) { if (serverProfileVersion == null || profileVersionPair.getServerProfileSchemaVersion() == null || profileVersionPair.getServerProfileSchemaVersion().intValue() == serverProfileVersion.getVersion()) { String schemaId = profileVersionPair.getEndpointProfileSchemaid(); int version = profileVersionPair.getEndpointProfileSchemaVersion() != null ? profileVersionPair.getEndpointProfileSchemaVersion().intValue() : -1; VersionDto endpointProfileVersion = new VersionDto(schemaId, version); endpointProfileVersions.add(endpointProfileVersion); } } } List<VersionDto> endpointProfileVersionsList = new ArrayList<>(endpointProfileVersions); Collections.sort(endpointProfileVersionsList); return endpointProfileVersionsList; }
@Override public int compareTo(VersionDto versionDto) { if (versionDto != null) { return version - versionDto.getVersion(); } else { return 1; } }
private List<SchemaInfoDto> toConfigurationSchemaInfos(List<VersionDto> schemas, EndpointGroupDto endpointGroup) throws KaaAdminServiceException, IOException { List<SchemaInfoDto> schemaInfos = new ArrayList<>(); for (VersionDto schemaDto : schemas) { ConfigurationSchemaDto configSchema = this.getConfigurationSchema(schemaDto.getId()); String rawSchema = endpointGroup.getWeight() == 0 ? configSchema.getBaseSchema() : configSchema.getOverrideSchema(); Schema schema = new Schema.Parser().parse(rawSchema); SchemaInfoDto schemaInfo = new SchemaInfoDto(schemaDto); RecordField schemaForm = FormAvroConverter.createRecordFieldFromSchema(schema); schemaInfo.setSchemaForm(schemaForm); schemaInfos.add(schemaInfo); } return schemaInfos; } }
public VersionDto toVersionDto() { return new VersionDto(id, version); }
return true; if (!super.equals(obj)) { return false;
private List<VersionDto> extractServerProfileVersions(VersionDto endpointProfileVersion) { Set<VersionDto> serverProfileVersions = new HashSet<>(); if (profileVersionPairs != null) { for (ProfileVersionPairDto profileVersionPair : profileVersionPairs) { if (endpointProfileVersion == null || profileVersionPair.getEndpointProfileSchemaVersion() == null || profileVersionPair.getEndpointProfileSchemaVersion().intValue() == endpointProfileVersion.getVersion()) { String schemaId = profileVersionPair.getServerProfileSchemaid(); int version = profileVersionPair.getServerProfileSchemaVersion() != null ? profileVersionPair.getServerProfileSchemaVersion().intValue() : -1; VersionDto serverProfileVersion = new VersionDto(schemaId, version); serverProfileVersions.add(serverProfileVersion); } } } List<VersionDto> serverProfileVersionsList = new ArrayList<>(serverProfileVersions); Collections.sort(serverProfileVersionsList); return serverProfileVersionsList; }
@Override public String render(VersionDto object) { return object != null && object.getVersion() > -1 ? object.getVersion() + "" : ""; }
@Override public void onClick(ClickEvent clickEvent) { ServerProfileSchemaPlace serverProfSchemaPlace = new ServerProfileSchemaPlace( place.getApplicationId(), entity.getServerProfileSchemaVersion().getId()); serverProfSchemaPlace.setPreviousPlace(place); goTo(serverProfSchemaPlace); } }));
@Override protected void doSave(final EventBus eventBus) { ProfileFilterDto inactiveStruct = record.getInactiveStructureDto(); if (create) { endpointProfileSchemaId = recordView.getEndpointProfileSchema().getValue().getId(); serverProfileSchemaId = recordView.getServerProfileSchema().getValue().getId(); inactiveStruct.setEndpointProfileSchemaId(endpointProfileSchemaId); inactiveStruct.setServerProfileSchemaId(serverProfileSchemaId); Integer versionEnd = recordView.getEndpointProfileSchema().getValue().getVersion(); int versionSer = recordView.getServerProfileSchema().getValue().getVersion(); Integer endpointProfileSchemaVersion = versionEnd > -1 ? new Integer(versionEnd) : null; Integer serverProfileSchemaVersion = versionSer > -1 ? new Integer(versionSer) : null; inactiveStruct.setEndpointProfileSchemaVersion(endpointProfileSchemaVersion); inactiveStruct.setServerProfileSchemaVersion(serverProfileSchemaVersion); } inactiveStruct.setDescription(recordView.getRecordPanel().getDescription().getValue()); inactiveStruct.setBody(recordView.getRecordPanel().getBody().getValue()); editProfileFilter(inactiveStruct, new BusyAsyncCallback<ProfileFilterDto>() { public void onSuccessImpl(ProfileFilterDto result) { goTo(getRecordPlace(applicationId, endpointGroupId, false, false, Math.random())); } public void onFailureImpl(Throwable caught) { Utils.handleException(caught, recordView, ProfileFilterActivity.this); } }); }
@Override protected void onSave() { entity.setName(detailsView.getName().getValue()); entity.setConfigurationSchemaVersion(detailsView.getConfigurationSchemaVersion() .getValue().getVersion()); entity.setProfileSchemaVersion(detailsView.getProfileSchemaVersion() .getValue().getVersion()); entity.setNotificationSchemaVersion(detailsView.getNotificationSchemaVersion() .getValue().getVersion()); entity.setLogSchemaVersion(detailsView.getLogSchemaVersion() .getValue().getVersion()); }
/** * Return <code>VersionDto</code> instance that contain id and version of schema. * * @return dto */ public VersionDto toVersionDto() { VersionDto dto = new VersionDto(); dto.setId(getStringId()); dto.setVersion(version); return dto; } }
@Override public void onClick(ClickEvent clickEvent) { ProfileSchemaPlace endpointProfSchemaPlace = new ProfileSchemaPlace( place.getApplicationId(), entity.getProfileSchemaVersion().getId()); endpointProfSchemaPlace.setPreviousPlace(place); goTo(endpointProfSchemaPlace); } }));
@Override protected void doSave(final EventBus eventBus) { ConfigurationRecordFormDto inactiveStruct = record.getInactiveStructureDto(); if (create) { schemaId = recordView.getSchema().getValue().getId(); inactiveStruct.setSchemaId(schemaId); inactiveStruct.setSchemaVersion(recordView.getSchema().getValue().getVersion()); } inactiveStruct.setDescription(recordView.getRecordPanel().getDescription().getValue()); inactiveStruct.setConfigurationRecord(recordView.getRecordPanel().getBody().getValue()); editConfiguration(inactiveStruct, new BusyAsyncCallback<ConfigurationRecordFormDto>() { public void onSuccessImpl(ConfigurationRecordFormDto result) { goTo(getRecordPlace(applicationId, endpointGroupId, false, false, Math.random())); } public void onFailureImpl(Throwable caught) { Utils.handleException(caught, recordView, ConfigurationActivity.this); } }); }
private void onSchemaVersionsRetrieved(List<VersionDto> result) { Collections.sort(result); List<Integer> versions = new ArrayList<>(result.size()); for (VersionDto schema : result) { versions.add(schema.getVersion()); } if (!create) { detailsView.getMinSchemaVersion().setValue(entity.getMinLogSchemaVersion()); detailsView.getMaxSchemaVersion().setValue(entity.getMaxLogSchemaVersion()); detailsView.getConfirmDelivery().setValue(entity.isConfirmDelivery()); detailsView.setMetadataListBox(entity.getHeaderStructure()); } detailsView.setSchemaVersions(versions); }
@Override public Collection<ConfigurationRecordDto> findAllConfigurationRecordsByEndpointGroupId( String endpointGroupId, boolean includeDeprecated) { Collection<ConfigurationDto> configurations = convertDtoList( configurationDao.findActualByEndpointGroupId(endpointGroupId)); List<ConfigurationRecordDto> records = ConfigurationRecordDto.convertToConfigurationRecords(configurations); if (includeDeprecated) { List<VersionDto> schemas = findVacantSchemasByEndpointGroupId(endpointGroupId); for (VersionDto schema : schemas) { ConfigurationDto deprecatedConfiguration = getDto( configurationDao.findLatestDeprecated(schema.getId(), endpointGroupId)); if (deprecatedConfiguration != null) { ConfigurationRecordDto record = new ConfigurationRecordDto(); record.setActiveStructureDto(deprecatedConfiguration); records.add(record); } } } Collections.sort(records); return records; }
@Test public void findConfigurationSchemaVersionsByAppIdTest() { ConfigurationSchemaDto schemaDto = generateConfSchemaDto(null, null, 1).get(0); List<VersionDto> versions = configurationService.findConfigurationSchemaVersionsByAppId(schemaDto.getApplicationId()); Assert.assertFalse(versions.isEmpty()); Assert.assertEquals(2, versions.size()); Assert.assertEquals(versions.get(0).getVersion(), 1); Assert.assertEquals(versions.get(1).getVersion(), 2); }
public void onClick(ClickEvent event) { String profileSchemaId; String serverProfileSchemaId; if (create) { profileSchemaId = recordView.getEndpointProfileSchema().getValue().getId(); serverProfileSchemaId = recordView.getServerProfileSchema().getValue().getId(); } else { profileSchemaId = record.getEndpointProfileSchemaId(); serverProfileSchemaId = record.getServerProfileSchemaId(); } String filterBody = recordView.getRecordPanel().getBody().getValue(); TestProfileFilterDialog.showTestProfileFilterDialog( new TestProfileFilterDialog.TestProfileFilterDialogListener() { @Override public void onClose(String filterBody) { recordView.getRecordPanel().getBody().setValue(filterBody, true); } }, profileSchemaId, serverProfileSchemaId, filterBody); } }));