@Override public String getValue(EndpointGroupDto item) { return item.getWeight() + ""; } }, 40);
boolean isGroupAll(EndpointGroupDto groupDto) { boolean result = false; if (groupDto != null && groupDto.getWeight() == 0) { result = true; } return result; }
@Override protected boolean canDelete(EndpointGroupDto value) { return value.getWeight() > 0; }
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; } }
private void populateListBoxAndGrid(List<EndpointGroupDto> result) { for (EndpointGroupDto endGroup : result) { if (endGroup.getWeight() == 0) { groupAll = endGroup; listView.getEndpointGroupsInfo().setValue(groupAll, true); } } listView.getEndpointGroupsInfo().setAcceptableValues(result); }
private ConfigurationRecordFormDto toConfigurationRecordFormDto(ConfigurationDto configuration) throws KaaAdminServiceException, IOException { ConfigurationSchemaDto schemaDto = this.getConfigurationSchema(configuration.getSchemaId()); EndpointGroupDto endpointGroup = groupService.getEndpointGroup( configuration.getEndpointGroupId()); String rawSchema = endpointGroup.getWeight() == 0 ? schemaDto.getBaseSchema() : schemaDto.getOverrideSchema(); Schema schema = new Schema.Parser().parse(rawSchema); return toConfigurationRecordFormDto(configuration, schema); }
@Override protected void onEntityRetrieved() { detailsView.getName().setValue(entity.getName()); if (!create) { detailsView.getWeight().setValue(entity.getWeight()); detailsView.setProfileFiltersVisible(entity.getWeight() > 0); } detailsView.getDescription().setValue(entity.getDescription()); detailsView.getCreatedUsername().setValue(entity.getCreatedUsername()); detailsView .getCreatedDateTime() .setValue(Utils.millisecondsToDateTimeString(entity.getCreatedTime())); if (entity.getWeight() == 0 && !create) { detailsView.setReadOnly(); } }
for (ConfigurationDto configuration : configurations) { if (configuration.getEndpointGroupId().equals(endpointGroup.getId())) { if (endpointGroup.getWeight() != 0) { overrideConfigs.add(new OverrideData(overrideSchema, configuration.getBody())); } else {
private ConfigurationRecordViewDto toConfigurationRecordView(ConfigurationRecordDto record) throws KaaAdminServiceException, IOException { ConfigurationSchemaDto schemaDto = this.getConfigurationSchema(record.getSchemaId()); EndpointGroupDto endpointGroup = groupService.getEndpointGroup(record.getEndpointGroupId()); String rawSchema = endpointGroup.getWeight() == 0 ? schemaDto.getBaseSchema() : schemaDto.getOverrideSchema(); Schema schema = new Schema.Parser().parse(rawSchema); ConfigurationRecordFormDto activeConfig = null; ConfigurationRecordFormDto inactiveConfig = null; if (record.getActiveStructureDto() != null) { activeConfig = toConfigurationRecordFormDto(record.getActiveStructureDto(), schema); } if (record.getInactiveStructureDto() != null) { inactiveConfig = toConfigurationRecordFormDto(record.getInactiveStructureDto(), schema); } ConfigurationRecordViewDto result = new ConfigurationRecordViewDto( activeConfig, inactiveConfig); return result; }
@Test(expected = IncorrectParameterException.class) public void saveEndpointGroupWithExistingNameTest() { ApplicationDto app = generateApplicationDto(); List<EndpointGroupDto> groups = endpointService.findEndpointGroupsByAppId(app.getId()); Assert.assertFalse(groups.isEmpty()); EndpointGroupDto group = groups.get(0); group.setId(null); group.setWeight(group.getWeight() + 1); endpointService.saveEndpointGroup(group); }
String id = endpointGroupDto.getId(); EndpointGroup groupWithSameWeight = endpointGroupDao.findByAppIdAndWeight(appId, endpointGroupDto.getWeight()); EndpointGroup groupWithSameName = endpointGroupDao.findByAppIdAndName(appId, endpointGroupDto.getName()); != savedGroup.getWeight()) { addHistory(savedGroup, ChangeType.UPDATE_WEIGHT);
/** * Create instance of <code>EndpointGroup</code>. * * @param dto data transfer object */ public EndpointGroup(EndpointGroupDto dto) { if (dto != null) { this.id = getLongId(dto); this.name = dto.getName(); this.sequenceNumber = dto.getSequenceNumber(); this.weight = dto.getWeight(); this.description = dto.getDescription(); this.createdUsername = dto.getCreatedUsername(); this.createdTime = dto.getCreatedTime(); Long appId = getLongId(dto.getApplicationId()); this.application = appId != null ? new Application(appId) : null; this.topics = getTopic(dto.getTopics()); } }
@Test(expected = IncorrectParameterException.class) public void saveEndpointGroupWithSameNameTest() { EndpointGroupDto group = generateEndpointGroupDto(null); EndpointGroupDto found = endpointService.findEndpointGroupById(group.getId()); found.setId(null); found.setWeight(found.getWeight() + 1); endpointService.saveEndpointGroup(found); }
@Override public EndpointGroupDto editEndpointGroup(EndpointGroupDto endpointGroup) throws KaaAdminServiceException { checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER); try { checkEndpointGroupWeight(endpointGroup.getWeight()); if (isEmpty(endpointGroup.getId())) { endpointGroup.setCreatedUsername(getCurrentUser().getUsername()); checkApplicationId(endpointGroup.getApplicationId()); } else { checkEndpointGroupId(endpointGroup.getId()); } return controlService.editEndpointGroup(endpointGroup); } catch (Exception ex) { throw Utils.handleException(ex); } }
if (endpointGroup.getWeight() == 0) { recordView.getRecordPanel().setReadOnly();
if (endpointGroup.getWeight() == 0) { recordView.getRecordPanel().setReadOnly();