@Override public int compareTo(VersionDto versionDto) { if (versionDto != null) { return version - versionDto.getVersion(); } else { return 1; } }
@Override public String render(VersionDto object) { return object != null && object.getVersion() > -1 ? object.getVersion() + "" : ""; }
public SchemaInfoDto(VersionDto versionDto) { this.id = versionDto.getId(); this.version = versionDto.getVersion(); }
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; }
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 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()); }
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); }
@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); }
@Test public void findProfileSchemaVersionsByAppIdTest() { String applicationId = generateApplicationDto(null).getId(); List<VersionDto> versions = profileService.findProfileSchemaVersionsByAppId(applicationId); Assert.assertNotNull(versions); Assert.assertFalse(versions.isEmpty()); Assert.assertEquals(1, versions.size()); Assert.assertSame(0, versions.get(0).getVersion()); }
@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); } }); }
LOG.debug("Processing version {}", version); cacheService.resetFilters(new AppProfileVersionsKey( appDto.getApplicationToken(), version.getVersion(), null));
@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); } }); }