private boolean isDefaultDsType(final String dsTypeName) { return getCurrentDistributionSetType() != null && getCurrentDistributionSetType().getName().equals(dsTypeName); }
private boolean isDefaultDsType(final String dsTypeName) { return getCurrentDistributionSetType() != null && getCurrentDistributionSetType().getName().equals(dsTypeName); }
stringBuilder.append(HTML_LI_CLOSE_TAG); stringBuilder.append(HTML_LI_OPEN_TAG); stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName()); stringBuilder.append(HTML_LI_CLOSE_TAG); stringBuilder.append(HTML_LI_OPEN_TAG);
stringBuilder.append(HTML_LI_CLOSE_TAG); stringBuilder.append(HTML_LI_OPEN_TAG); stringBuilder.append(" DistributionSet Type : ").append((distributionSet.getType()).getName()); stringBuilder.append(HTML_LI_CLOSE_TAG); stringBuilder.append(HTML_LI_OPEN_TAG);
@Override protected boolean isClickedByDefault(final String typeName) { return manageDistUIState.getManageDistFilters().getClickedDistSetType() != null && manageDistUIState.getManageDistFilters().getClickedDistSetType().getName().equals(typeName); }
@Override protected boolean isClickedByDefault(final String typeName) { return manageDistUIState.getManageDistFilters().getClickedDistSetType() != null && manageDistUIState.getManageDistFilters().getClickedDistSetType().getName().equals(typeName); }
public static String distributionSetTypes(final List<DistributionSetType> types) throws JSONException { final JSONArray result = new JSONArray(); for (final DistributionSetType type : types) { final JSONArray osmTypes = new JSONArray(); type.getOptionalModuleTypes().forEach(smt -> { try { osmTypes.put(new JSONObject().put("id", smt.getId())); } catch (final JSONException e1) { e1.printStackTrace(); } }); final JSONArray msmTypes = new JSONArray(); type.getMandatoryModuleTypes().forEach(smt -> { try { msmTypes.put(new JSONObject().put("id", smt.getId())); } catch (final JSONException e) { e.printStackTrace(); } }); result.put(new JSONObject().put("name", type.getName()).put("description", type.getDescription()) .put("id", Long.MAX_VALUE).put("key", type.getKey()).put("createdAt", "0").put("updatedAt", "0") .put("createdBy", "fghdfkjghdfkjh").put("optionalmodules", osmTypes) .put("mandatorymodules", msmTypes).put("updatedBy", "fghdfkjghdfkjh")); } return result.toString(); }
public static String distributionSetTypesCreateValidFieldsOnly(final List<DistributionSetType> types) { final JSONArray result = new JSONArray(); for (final DistributionSetType module : types) { try { final JSONArray osmTypes = new JSONArray(); module.getOptionalModuleTypes().forEach(smt -> { try { osmTypes.put(new JSONObject().put("id", smt.getId())); } catch (final JSONException e) { e.printStackTrace(); } }); final JSONArray msmTypes = new JSONArray(); module.getMandatoryModuleTypes().forEach(smt -> { try { msmTypes.put(new JSONObject().put("id", smt.getId())); } catch (final JSONException e) { e.printStackTrace(); } }); result.put(new JSONObject().put("name", module.getName()).put("description", module.getDescription()) .put("key", module.getKey()).put("optionalmodules", osmTypes) .put("mandatorymodules", msmTypes)); } catch (final JSONException e) { e.printStackTrace(); } } return result.toString(); }
protected void populateDetails() { if (getSelectedBaseEntity() != null) { updateDistributionSetDetailsLayout(getSelectedBaseEntity().getType().getName(), getSelectedBaseEntity().isRequiredMigrationStep()); } else { updateDistributionSetDetailsLayout(null, null); } }
protected void populateDetails() { if (getSelectedBaseEntity() != null) { updateDistributionSetDetailsLayout(getSelectedBaseEntity().getType().getName(), getSelectedBaseEntity().isRequiredMigrationStep()); } else { updateDistributionSetDetailsLayout(null, null); } }
@SuppressWarnings("unchecked") private void updateDistributionSetType(final DistributionSetType existingType) { final List<Long> itemIds = (List<Long>) getTwinTables().getSelectedTable().getItemIds(); final DistributionSetTypeUpdate update = getEntityFactory().distributionSetType().update(existingType.getId()) .description(getTagDesc().getValue()) .colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); if (distributionSetManagement.countByTypeId(existingType.getId()) <= 0 && !CollectionUtils.isEmpty(itemIds)) { update.mandatory(itemIds.stream() .filter(itemId -> DistributionSetTypeSoftwareModuleSelectLayout .isMandatoryModuleType(getTwinTables().getSelectedTable().getItem(itemId))) .collect(Collectors.toList())) .optional(itemIds.stream() .filter(itemId -> DistributionSetTypeSoftwareModuleSelectLayout .isOptionalModuleType(getTwinTables().getSelectedTable().getItem(itemId))) .collect(Collectors.toList())); } final DistributionSetType updateDistSetType = getDistributionSetTypeManagement().update(update); getUiNotification().displaySuccess(getI18n().getMessage("message.update.success", updateDistSetType.getName())); getEventBus().publish(this, new DistributionSetTypeEvent(DistributionSetTypeEnum.UPDATE_DIST_SET_TYPE, updateDistSetType)); }
@SuppressWarnings("unchecked") private void updateDistributionSetType(final DistributionSetType existingType) { final List<Long> itemIds = (List<Long>) getTwinTables().getSelectedTable().getItemIds(); final DistributionSetTypeUpdate update = getEntityFactory().distributionSetType().update(existingType.getId()) .description(getTagDesc().getValue()) .colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())); if (distributionSetManagement.countByTypeId(existingType.getId()) <= 0 && !CollectionUtils.isEmpty(itemIds)) { update.mandatory(itemIds.stream() .filter(itemId -> DistributionSetTypeSoftwareModuleSelectLayout .isMandatoryModuleType(getTwinTables().getSelectedTable().getItem(itemId))) .collect(Collectors.toList())) .optional(itemIds.stream() .filter(itemId -> DistributionSetTypeSoftwareModuleSelectLayout .isOptionalModuleType(getTwinTables().getSelectedTable().getItem(itemId))) .collect(Collectors.toList())); } final DistributionSetType updateDistSetType = getDistributionSetTypeManagement().update(update); getUiNotification().displaySuccess(getI18n().getMessage("message.update.success", updateDistSetType.getName())); getEventBus().publish(this, new DistributionSetTypeEvent(DistributionSetTypeEnum.UPDATE_DIST_SET_TYPE, updateDistSetType)); }
@SuppressWarnings("unchecked") private void createNewDistributionSetType() { final String colorPicked = ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview()); final String typeNameValue = getTagName().getValue(); final String typeKeyValue = getTypeKey().getValue(); final String typeDescValue = getTagDesc().getValue(); final List<Long> itemIds = (List<Long>) getTwinTables().getSelectedTable().getItemIds(); if (typeNameValue != null && typeKeyValue != null && !CollectionUtils.isEmpty(itemIds)) { final List<Long> mandatory = itemIds.stream() .filter(itemId -> DistributionSetTypeSoftwareModuleSelectLayout .isMandatoryModuleType(getTwinTables().getSelectedTable().getItem(itemId))) .collect(Collectors.toList()); final List<Long> optional = itemIds.stream() .filter(itemId -> DistributionSetTypeSoftwareModuleSelectLayout .isOptionalModuleType(getTwinTables().getSelectedTable().getItem(itemId))) .collect(Collectors.toList()); final DistributionSetType newDistType = getDistributionSetTypeManagement() .create(getEntityFactory().distributionSetType().create().key(typeKeyValue).name(typeNameValue) .description(typeDescValue).colour(colorPicked).mandatory(mandatory).optional(optional)); getUiNotification().displaySuccess(getI18n().getMessage("message.save.success", newDistType.getName())); getEventBus().publish(this, new DistributionSetTypeEvent(DistributionSetTypeEnum.ADD_DIST_SET_TYPE, newDistType)); } else { getUiNotification().displayValidationError(getI18n().getMessage("message.error.missing.typenameorkey")); } }
@SuppressWarnings("unchecked") private void createNewDistributionSetType() { final String colorPicked = ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview()); final String typeNameValue = getTagName().getValue(); final String typeKeyValue = getTypeKey().getValue(); final String typeDescValue = getTagDesc().getValue(); final List<Long> itemIds = (List<Long>) getTwinTables().getSelectedTable().getItemIds(); if (typeNameValue != null && typeKeyValue != null && !CollectionUtils.isEmpty(itemIds)) { final List<Long> mandatory = itemIds.stream() .filter(itemId -> DistributionSetTypeSoftwareModuleSelectLayout .isMandatoryModuleType(getTwinTables().getSelectedTable().getItem(itemId))) .collect(Collectors.toList()); final List<Long> optional = itemIds.stream() .filter(itemId -> DistributionSetTypeSoftwareModuleSelectLayout .isOptionalModuleType(getTwinTables().getSelectedTable().getItem(itemId))) .collect(Collectors.toList()); final DistributionSetType newDistType = getDistributionSetTypeManagement() .create(getEntityFactory().distributionSetType().create().key(typeKeyValue).name(typeNameValue) .description(typeDescValue).colour(colorPicked).mandatory(mandatory).optional(optional)); getUiNotification().displaySuccess(getI18n().getMessage("message.save.success", newDistType.getName())); getEventBus().publish(this, new DistributionSetTypeEvent(DistributionSetTypeEnum.ADD_DIST_SET_TYPE, newDistType)); } else { getUiNotification().displayValidationError(getI18n().getMessage("message.error.missing.typenameorkey")); } }
@Override public void setTagDetails(final String selectedEntity) { getTwinTables().createSourceTableData(); getTwinTables().getSelectedTable().getContainerDataSource().removeAllItems(); final Optional<DistributionSetType> selectedDistSetType = getDistributionSetTypeManagement() .getByName(selectedEntity); selectedDistSetType.ifPresent(selectedType -> { getTagName().setValue(selectedType.getName()); getTagDesc().setValue(selectedType.getDescription()); getTypeKey().setValue(selectedType.getKey()); if (distributionSetManagement.countByTypeId(selectedType.getId()) <= 0) { getTwinTables().getDistTypeSelectLayout().setEnabled(true); getTwinTables().getSelectedTable().setEnabled(true); } else { getUiNotification().displayValidationError( selectedType.getName() + " " + getI18n().getMessage("message.error.dist.set.type.update")); getTwinTables().getDistTypeSelectLayout().setEnabled(false); getTwinTables().getSelectedTable().setEnabled(false); } createOriginalSelectedTableContainer(); selectedType.getOptionalModuleTypes().forEach(swModuleType -> addTargetTableForUpdate(swModuleType, false)); selectedType.getMandatoryModuleTypes().forEach(swModuleType -> addTargetTableForUpdate(swModuleType, true)); setColorPickerComponentsColor(selectedType.getColour()); }); disableFields(); getWindow().setOrginaleValues(); }
@Override public void setTagDetails(final String selectedEntity) { getTwinTables().createSourceTableData(); getTwinTables().getSelectedTable().getContainerDataSource().removeAllItems(); final Optional<DistributionSetType> selectedDistSetType = getDistributionSetTypeManagement() .getByName(selectedEntity); selectedDistSetType.ifPresent(selectedType -> { getTagName().setValue(selectedType.getName()); getTagDesc().setValue(selectedType.getDescription()); getTypeKey().setValue(selectedType.getKey()); if (distributionSetManagement.countByTypeId(selectedType.getId()) <= 0) { getTwinTables().getDistTypeSelectLayout().setEnabled(true); getTwinTables().getSelectedTable().setEnabled(true); } else { getUiNotification().displayValidationError( selectedType.getName() + " " + getI18n().getMessage("message.error.dist.set.type.update")); getTwinTables().getDistTypeSelectLayout().setEnabled(false); getTwinTables().getSelectedTable().setEnabled(false); } createOriginalSelectedTableContainer(); selectedType.getOptionalModuleTypes().forEach(swModuleType -> addTargetTableForUpdate(swModuleType, false)); selectedType.getMandatoryModuleTypes().forEach(swModuleType -> addTargetTableForUpdate(swModuleType, true)); setColorPickerComponentsColor(selectedType.getColour()); }); disableFields(); getWindow().setOrginaleValues(); }
combobox.addItem(distributionSetType.getId()); combobox.setItemCaption(distributionSetType.getId(), distributionSetType.getKey() + " (" + distributionSetType.getName() + ")");
combobox.addItem(distributionSetType.getId()); combobox.setItemCaption(distributionSetType.getId(), distributionSetType.getKey() + " (" + distributionSetType.getName() + ")");