@Override protected String getDeletedEntityName(final Long entityId) { final Optional<DistributionSet> distribution = distributionSetManagement.get(entityId); if (distribution.isPresent()) { return distribution.get().getName(); } return ""; }
@Override protected String getDeletedEntityName(final Long entityId) { final Optional<DistributionSet> distribution = distributionSetManagement.get(entityId); if (distribution.isPresent()) { return distribution.get().getName(); } return ""; }
@Override protected String getDeletedEntityName(final Long entityId) { final Optional<DistributionSet> distribution = distributionSetManagement.get(entityId); if (distribution.isPresent()) { return distribution.get().getName(); } return ""; }
@Override protected String getDeletedEntityName(final Long entityId) { final Optional<DistributionSet> distribution = distributionSetManagement.get(entityId); if (distribution.isPresent()) { return distribution.get().getName(); } return ""; }
/** * Constructor. * * @param distributionSet * the distributionSet */ public DistributionSetIdName(final DistributionSet distributionSet) { this(distributionSet.getId(), distributionSet.getName(), distributionSet.getVersion()); }
/** * Constructor. * * @param distributionSet * the distributionSet */ public DistributionSetIdName(final DistributionSet distributionSet) { this(distributionSet.getId(), distributionSet.getName(), distributionSet.getVersion()); }
private void handleSmToDsAssignment(final Set<Long> softwareModulesIdList, final long distId) { final Optional<DistributionSet> distributionSet = distributionSetManagement.get(distId); if (!distributionSet.isPresent()) { getNotification().displayWarning(getI18n().getMessage("distributionset.not.exists")); return; } distributionSet.ifPresent(ds -> { selectDroppedEntities(ds.getId()); final Set<SoftwareModule> softwareModules = getAssignableSoftwareModules(softwareModulesIdList, ds); if (softwareModules.isEmpty()) { return; } assignSoftwareModulesToDs(softwareModules, ds); openConfirmationWindowForAssignment(ds.getName(), softwareModules.stream().map(SoftwareModuleIdName::new) .toArray(size -> new SoftwareModuleIdName[size])); }); }
private void handleSmToDsAssignment(final Set<Long> softwareModulesIdList, final long distId) { final Optional<DistributionSet> distributionSet = distributionSetManagement.get(distId); if (!distributionSet.isPresent()) { getNotification().displayWarning(getI18n().getMessage("distributionset.not.exists")); return; } distributionSet.ifPresent(ds -> { selectDroppedEntities(ds.getId()); final Set<SoftwareModule> softwareModules = getAssignableSoftwareModules(softwareModulesIdList, ds); if (softwareModules.isEmpty()) { return; } assignSoftwareModulesToDs(softwareModules, ds); openConfirmationWindowForAssignment(ds.getName(), softwareModules.stream().map(SoftwareModuleIdName::new) .toArray(size -> new SoftwareModuleIdName[size])); }); }
public static String distributionSetUpdateValidFieldsOnly(final DistributionSet set) throws JSONException { set.getModules().stream().map(module -> { try { return new JSONObject().put("id", module.getId()); } catch (final JSONException e) { e.printStackTrace(); return null; } }).collect(Collectors.toList()); return new JSONObject().put("name", set.getName()).put("description", set.getDescription()) .put("version", set.getVersion()).put("requiredMigrationStep", set.isRequiredMigrationStep()) .toString(); }
private void populateValuesOfDistribution(final Long editDistId) { final Optional<DistributionSet> distSet = distributionSetManagement.getWithDetails(editDistId); if (!distSet.isPresent()) { return; } distNameTextField.setValue(distSet.get().getName()); distVersionTextField.setValue(distSet.get().getVersion()); if (distSet.get().getType().isDeleted()) { distsetTypeNameComboBox.addItem(distSet.get().getType().getId()); } distsetTypeNameComboBox.setValue(distSet.get().getType().getId()); distsetTypeNameComboBox.setEnabled(false); reqMigStepCheckbox.setValue(distSet.get().isRequiredMigrationStep()); descTextArea.setValue(distSet.get().getDescription()); }
private void populateValuesOfDistribution(final Long editDistId) { final Optional<DistributionSet> distSet = distributionSetManagement.getWithDetails(editDistId); if (!distSet.isPresent()) { return; } distNameTextField.setValue(distSet.get().getName()); distVersionTextField.setValue(distSet.get().getVersion()); if (distSet.get().getType().isDeleted()) { distsetTypeNameComboBox.addItem(distSet.get().getType().getId()); } distsetTypeNameComboBox.setValue(distSet.get().getType().getId()); distsetTypeNameComboBox.setEnabled(false); reqMigStepCheckbox.setValue(distSet.get().isRequiredMigrationStep()); descTextArea.setValue(distSet.get().getDescription()); }
public static JSONObject distributionSetCreateValidFieldsOnly(final DistributionSet set) throws JSONException { final List<JSONObject> modules = set.getModules().stream().map(module -> { try { return new JSONObject().put("id", module.getId()); } catch (final JSONException e) { e.printStackTrace(); return null; } }).collect(Collectors.toList()); return new JSONObject().put("name", set.getName()).put("description", set.getDescription()) .put("type", set.getType() == null ? null : set.getType().getKey()).put("version", set.getVersion()) .put("requiredMigrationStep", set.isRequiredMigrationStep()).put("modules", new JSONArray(modules)); }
public static JSONObject distributionSet(final DistributionSet set) throws JSONException { final List<JSONObject> modules = set.getModules().stream().map(module -> { try { return new JSONObject().put("id", module.getId()); } catch (final JSONException e) { e.printStackTrace(); return null; } }).collect(Collectors.toList()); return new JSONObject().put("name", set.getName()).put("description", set.getDescription()) .put("type", set.getType() == null ? null : set.getType().getKey()).put("id", Long.MAX_VALUE) .put("version", set.getVersion()).put("createdAt", "0").put("updatedAt", "0") .put("createdBy", "fghdfkjghdfkjh").put("updatedBy", "fghdfkjghdfkjh") .put("requiredMigrationStep", set.isRequiredMigrationStep()).put("modules", new JSONArray(modules)); }
private void assignTargetToDs(final Item item, final List<Target> targetDetailsList) { if (item == null || item.getItemProperty("id") == null) { return; } if (targetDetailsList.isEmpty()) { getNotification().displayWarning(getI18n().getMessage(TARGETS_NOT_EXISTS)); return; } final Long distId = (Long) item.getItemProperty("id").getValue(); selectDroppedEntities(distId); final Optional<DistributionSet> findDistributionSetById = distributionSetManagement.get(distId); if (!findDistributionSetById.isPresent()) { getNotification().displayWarning(getI18n().getMessage(DISTRIBUTIONSET_NOT_EXISTS)); return; } addNewDistributionToAssignmentList(targetDetailsList, findDistributionSetById.get()); openConfirmationWindowForAssignment(findDistributionSetById.get().getName(), targetDetailsList); }
private void populateDistributionDtls(final VerticalLayout layout, final DistributionSet distributionSet) { layout.removeAllComponents(); layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.name"), distributionSet == null ? "" : distributionSet.getName())); layout.addComponent( SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.version"), distributionSet == null ? "" : distributionSet.getVersion())); if (distributionSet == null) { return; } distributionSet.getModules() .forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module))); }
private void populateDistributionDtls(final VerticalLayout layout, final DistributionSet distributionSet) { layout.removeAllComponents(); layout.addComponent(SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.name"), distributionSet == null ? "" : distributionSet.getName())); layout.addComponent( SPUIComponentProvider.createNameValueLabel(getI18n().getMessage("label.dist.details.version"), distributionSet == null ? "" : distributionSet.getVersion())); if (distributionSet == null) { return; } distributionSet.getModules() .forEach(module -> layout.addComponent(getSWModlabel(module.getType().getName(), module))); }
@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() { 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)); }); }
private void unassignSW(final ClickEvent event, final DistributionSet distributionSet, final Set<SoftwareModule> alreadyAssignedSwModules) { final SoftwareModule unAssignedSw = getSoftwareModule(event.getButton().getId(), alreadyAssignedSwModules); if (distributionSetManagement.isInUse(distributionSet.getId())) { uiNotification.displayValidationError(i18n.getMessage("message.error.notification.ds.target.assigned", distributionSet.getName(), distributionSet.getVersion())); } else { final DistributionSet newDistributionSet = distributionSetManagement .unassignSoftwareModule(distributionSet.getId(), unAssignedSw.getId()); manageDistUIState.setLastSelectedEntityId(newDistributionSet.getId()); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet)); eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION); uiNotification.displaySuccess(i18n.getMessage("message.sw.unassigned", unAssignedSw.getName())); } }
private void unassignSW(final ClickEvent event, final DistributionSet distributionSet, final Set<SoftwareModule> alreadyAssignedSwModules) { final SoftwareModule unAssignedSw = getSoftwareModule(event.getButton().getId(), alreadyAssignedSwModules); if (distributionSetManagement.isInUse(distributionSet.getId())) { uiNotification.displayValidationError(i18n.getMessage("message.error.notification.ds.target.assigned", distributionSet.getName(), distributionSet.getVersion())); } else { final DistributionSet newDistributionSet = distributionSetManagement .unassignSoftwareModule(distributionSet.getId(), unAssignedSw.getId()); manageDistUIState.setLastSelectedEntityId(newDistributionSet.getId()); eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.SELECTED_ENTITY, newDistributionSet)); eventBus.publish(this, DistributionsUIEvent.ORDER_BY_DISTRIBUTION); uiNotification.displaySuccess(i18n.getMessage("message.sw.unassigned", unAssignedSw.getName())); } }