private DistributionSetType findDistributionSetTypeWithExceptionIfNotFound(final Long distributionSetTypeId) { return distributionSetTypeManagement.get(distributionSetTypeId) .orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, distributionSetTypeId)); }
@Override public void saveOrUpdate() { final String name = distNameTextField.getValue(); final String version = distVersionTextField.getValue(); final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue(); final String desc = descTextArea.getValue(); final boolean isMigStepReq = reqMigStepCheckbox.getValue(); final DistributionSetType distributionSetType = distributionSetTypeManagement.get(distSetTypeId) .orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, distSetTypeId)); final DistributionSet newDist = distributionSetManagement .create(entityFactory.distributionSet().create().name(name).version(version).description(desc) .type(distributionSetType).requiredMigrationStep(isMigStepReq)); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist)); notificationMessage.displaySuccess(i18n.getMessage("message.new.dist.save.success", new Object[] { newDist.getName(), newDist.getVersion() })); distributionSetTable.setValue(Sets.newHashSet(newDist.getId())); }
@Override public void saveOrUpdate() { final String name = distNameTextField.getValue(); final String version = distVersionTextField.getValue(); final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue(); final String desc = descTextArea.getValue(); final boolean isMigStepReq = reqMigStepCheckbox.getValue(); final DistributionSetType distributionSetType = distributionSetTypeManagement.get(distSetTypeId) .orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, distSetTypeId)); final DistributionSet newDist = distributionSetManagement .create(entityFactory.distributionSet().create().name(name).version(version).description(desc) .type(distributionSetType).requiredMigrationStep(isMigStepReq)); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist)); notificationMessage.displaySuccess( i18n.getMessage("message.new.dist.save.success", newDist.getName(), newDist.getVersion())); distributionSetTable.setValue(Sets.newHashSet(newDist.getId())); }
@Override public void saveOrUpdate() { if (isDuplicate(editDistId)) { return; } final boolean isMigStepReq = reqMigStepCheckbox.getValue(); final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue(); distributionSetTypeManagement.get(distSetTypeId).ifPresent(type -> { final DistributionSet currentDS = distributionSetManagement.update(entityFactory.distributionSet() .update(editDistId).name(distNameTextField.getValue()).description(descTextArea.getValue()) .version(distVersionTextField.getValue()).requiredMigrationStep(isMigStepReq)); notificationMessage.displaySuccess(i18n.getMessage("message.new.dist.save.success", new Object[] { currentDS.getName(), currentDS.getVersion() })); // update table row+details layout eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.UPDATED_ENTITY, currentDS)); }); }
@Override public void saveOrUpdate() { if (isDuplicate(editDistId)) { return; } final boolean isMigStepReq = reqMigStepCheckbox.getValue(); final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue(); distributionSetTypeManagement.get(distSetTypeId).ifPresent(type -> { final DistributionSet currentDS = distributionSetManagement.update(entityFactory.distributionSet() .update(editDistId).name(distNameTextField.getValue()).description(descTextArea.getValue()) .version(distVersionTextField.getValue()).requiredMigrationStep(isMigStepReq)); notificationMessage.displaySuccess(i18n.getMessage("message.new.dist.save.success", new Object[] { currentDS.getName(), currentDS.getVersion() })); // update table row+details layout eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.UPDATED_ENTITY, currentDS)); }); }