improve code quality

Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
Michael Hirsch
2016-07-25 16:01:32 +02:00
parent b7ca552c2f
commit 2ad6f6946f
13 changed files with 335 additions and 354 deletions

View File

@@ -9,6 +9,7 @@
package org.eclipse.hawkbit.amqp; package org.eclipse.hawkbit.amqp;
import java.net.URI; import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.UUID; import java.util.UUID;
import org.eclipse.hawkbit.util.IpUtil; import org.eclipse.hawkbit.util.IpUtil;
@@ -46,7 +47,7 @@ public class DefaultAmqpSenderService implements AmqpSenderService {
final String correlationId = UUID.randomUUID().toString(); final String correlationId = UUID.randomUUID().toString();
final String exchange = extractExchange(replyTo); final String exchange = extractExchange(replyTo);
message.getMessageProperties().setCorrelationId(correlationId.getBytes()); message.getMessageProperties().setCorrelationId(correlationId.getBytes(StandardCharsets.UTF_8));
if (LOGGER.isTraceEnabled()) { if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Sending message {} to exchange {} with correlationId {}", message, exchange, correlationId); LOGGER.trace("Sending message {} to exchange {} with correlationId {}", message, exchange, correlationId);

View File

@@ -58,7 +58,7 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
private SwMetadataPopupLayout swMetadataPopupLayout; private SwMetadataPopupLayout swMetadataPopupLayout;
@Autowired @Autowired
private EntityFactory entityFactory; private transient EntityFactory entityFactory;
private SoftwareModuleMetadatadetailslayout swmMetadataTable; private SoftwareModuleMetadatadetailslayout swmMetadataTable;
@@ -68,27 +68,27 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
@Override @Override
protected void init() { protected void init() {
swmMetadataTable = new SoftwareModuleMetadatadetailslayout(); swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
swmMetadataTable.init(getI18n(), getPermissionChecker(),softwareManagement,swMetadataPopupLayout,entityFactory); swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
entityFactory);
super.init(); super.init();
} }
@EventBusListenerMethod(scope = EventScope.SESSION) @EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final MetadataEvent event) { void onEvent(final MetadataEvent event) {
UI.getCurrent() UI.getCurrent().access(() -> {
.access(() -> { final SoftwareModuleMetadata softwareModuleMetadata = event.getSoftwareModuleMetadata();
SoftwareModuleMetadata softwareModuleMetadata = event.getSoftwareModuleMetadata(); if (softwareModuleMetadata != null
if (softwareModuleMetadata != null && isSoftwareModuleSelected(softwareModuleMetadata.getSoftwareModule())) {
&& isSoftwareModuleSelected(softwareModuleMetadata.getSoftwareModule())) { if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) { swmMetadataTable.createMetadata(event.getSoftwareModuleMetadata().getKey());
swmMetadataTable.createMetadata(event.getSoftwareModuleMetadata().getKey()); } else if (event
} else if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) { .getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey()); swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey());
} }
} }
}); });
} }
@Override @Override
protected String getEditButtonId() { protected String getEditButtonId() {
return SPUIComponentIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON; return SPUIComponentIdProvider.UPLOAD_SW_MODULE_EDIT_BUTTON;
@@ -189,15 +189,14 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
return SPUIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID; return SPUIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
} }
@Override @Override
protected void populateMetadataDetails(){ protected void populateMetadataDetails() {
swmMetadataTable.populateSMMetadata(getSelectedBaseEntity()); swmMetadataTable.populateSMMetadata(getSelectedBaseEntity());
} }
private boolean isSoftwareModuleSelected(SoftwareModule softwareModule) { private boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
final SoftwareModule selectedUploadSWModule = artifactUploadState.getSelectedBaseSoftwareModule().isPresent() ? artifactUploadState final SoftwareModule selectedUploadSWModule = artifactUploadState.getSelectedBaseSoftwareModule().isPresent()
.getSelectedBaseSoftwareModule().get() : null; ? artifactUploadState.getSelectedBaseSoftwareModule().get() : null;
return softwareModule != null && selectedUploadSWModule != null return softwareModule != null && selectedUploadSWModule != null
&& selectedUploadSWModule.getName().equals(softwareModule.getName()) && selectedUploadSWModule.getName().equals(softwareModule.getName())
&& selectedUploadSWModule.getVersion().equals(softwareModule.getVersion()); && selectedUploadSWModule.getVersion().equals(softwareModule.getVersion());
@@ -209,17 +208,10 @@ public class SoftwareModuleDetails extends AbstractNamedVersionedEntityTableDeta
} }
@Override @Override
protected String getShowMetadataButtonId() { protected void showMetadata(final ClickEvent event) {
SoftwareModule selectedBaseEntity = getSelectedBaseEntity(); final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
return SPUIComponentIdProvider.SW_TABLE_MANAGE_METADATA_ID + "." + selectedBaseEntity.getName() + "." /* display the window */
+ selectedBaseEntity.getVersion(); UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
}
@Override
protected void showMetadata(ClickEvent event) {
SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
/* display the window */
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule,null));
} }
} }

View File

@@ -38,7 +38,6 @@ import com.vaadin.server.FontAwesome;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode; import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.Alignment; import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button; import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomComponent; import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Grid; import com.vaadin.ui.Grid;
import com.vaadin.ui.Grid.SelectionMode; import com.vaadin.ui.Grid.SelectionMode;
@@ -98,7 +97,7 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
private HorizontalLayout mainLayout; private HorizontalLayout mainLayout;
@PostConstruct @PostConstruct
private void init() { void init() {
createComponents(); createComponents();
buildLayout(); buildLayout();
@@ -171,7 +170,6 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
} }
headerLayout.setExpandRatio(headerCaption, 1.0F); headerLayout.setExpandRatio(headerCaption, 1.0F);
final HorizontalLayout headerWrapperLayout = new HorizontalLayout(); final HorizontalLayout headerWrapperLayout = new HorizontalLayout();
headerWrapperLayout.addStyleName("bordered-layout" + " " + "no-border-bottom" + " " + "metadata-table-margin"); headerWrapperLayout.addStyleName("bordered-layout" + " " + "no-border-bottom" + " " + "metadata-table-margin");
headerWrapperLayout.addComponent(headerLayout); headerWrapperLayout.addComponent(headerLayout);
@@ -257,50 +255,56 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
i18n.get("caption.metadata.delete.action.confirmbox"), i18n.get("message.confirm.delete.metadata", key), i18n.get("caption.metadata.delete.action.confirmbox"), i18n.get("message.confirm.delete.metadata", key),
i18n.get("button.ok"), i18n.get("button.cancel"), ok -> { i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
if (ok) { if (ok) {
deleteMetadata(getSelectedEntity(), key, value); handleOkDeleteMetadata(event, key, value);
uiNotification.displaySuccess(i18n.get("message.metadata.deleted.successfully", key));
final Object selectedRow = metaDataGrid.getSelectedRow();
metaDataGrid.getContainerDataSource().removeItem(event.getItemId());
// force grid to refresh
metaDataGrid.clearSortOrder();
if (!metaDataGrid.getContainerDataSource().getItemIds().isEmpty()) {
if (selectedRow != null) {
if (selectedRow.equals(event.getItemId())) {
metaDataGrid.select(metaDataGrid.getContainerDataSource().getIdByIndex(0));
} else {
metaDataGrid.select(selectedRow);
}
}
} else {
keyTextField.clear();
valueTextArea.clear();
metaDataGrid.select(null);
if (hasCreatePermission()) {
keyTextField.setEnabled(true);
valueTextArea.setEnabled(true);
addIcon.setEnabled(false);
}
}
} }
}); });
UI.getCurrent().addWindow(confirmDialog.getWindow()); UI.getCurrent().addWindow(confirmDialog.getWindow());
confirmDialog.getWindow().bringToFront(); confirmDialog.getWindow().bringToFront();
} }
private void handleOkDeleteMetadata(final RendererClickEvent event, final String key, final String value) {
deleteMetadata(getSelectedEntity(), key, value);
uiNotification.displaySuccess(i18n.get("message.metadata.deleted.successfully", key));
final Object selectedRow = metaDataGrid.getSelectedRow();
metaDataGrid.getContainerDataSource().removeItem(event.getItemId());
// force grid to refresh
metaDataGrid.clearSortOrder();
if (!metaDataGrid.getContainerDataSource().getItemIds().isEmpty()) {
if (selectedRow != null) {
if (selectedRow.equals(event.getItemId())) {
metaDataGrid.select(metaDataGrid.getContainerDataSource().getIdByIndex(0));
} else {
metaDataGrid.select(selectedRow);
}
}
} else {
clearTextFields();
}
}
private void clearTextFields() {
keyTextField.clear();
valueTextArea.clear();
metaDataGrid.select(null);
if (hasCreatePermission()) {
keyTextField.setEnabled(true);
valueTextArea.setEnabled(true);
addIcon.setEnabled(false);
}
}
private Button createAddIcon() { private Button createAddIcon() {
addIcon = SPUIComponentProvider.getButton(SPUIComponentIdProvider.METADTA_ADD_ICON_ID, i18n.get("button.save"), addIcon = SPUIComponentProvider.getButton(SPUIComponentIdProvider.METADTA_ADD_ICON_ID, i18n.get("button.save"),
null, null, false, FontAwesome.PLUS, SPUIButtonStyleSmallNoBorder.class); null, null, false, FontAwesome.PLUS, SPUIButtonStyleSmallNoBorder.class);
addIcon.addClickListener(event -> onAdd(event)); addIcon.addClickListener(event -> onAdd());
return addIcon; return addIcon;
} }
private Label createHeaderCaption() { private Label createHeaderCaption() {
final Label captionLabel = SPUIComponentProvider.getLabel(i18n.get("caption.metadata"), return SPUIComponentProvider.getLabel(i18n.get("caption.metadata"), SPUILabelDefinitions.SP_WIDGET_CAPTION);
SPUILabelDefinitions.SP_WIDGET_CAPTION);
return captionLabel;
} }
private IndexedContainer getMetadataContainer() { private static IndexedContainer getMetadataContainer() {
final IndexedContainer swcontactContainer = new IndexedContainer(); final IndexedContainer swcontactContainer = new IndexedContainer();
swcontactContainer.addContainerProperty(KEY, String.class, ""); swcontactContainer.addContainerProperty(KEY, String.class, "");
swcontactContainer.addContainerProperty(VALUE, String.class, ""); swcontactContainer.addContainerProperty(VALUE, String.class, "");
@@ -340,7 +344,7 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
item.getItemProperty(VALUE).setValue(valueTextArea.getValue()); item.getItemProperty(VALUE).setValue(valueTextArea.getValue());
} }
private void onAdd(final ClickEvent event) { private void onAdd() {
metaDataGrid.deselect(metaDataGrid.getSelectedRow()); metaDataGrid.deselect(metaDataGrid.getSelectedRow());
valueTextArea.clear(); valueTextArea.clear();
keyTextField.clear(); keyTextField.clear();
@@ -393,7 +397,8 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
private boolean duplicateCheck(final E entity) { private boolean duplicateCheck(final E entity) {
try { try {
checkForDuplicate(entity, keyTextField.getValue()); checkForDuplicate(entity, keyTextField.getValue());
} catch (final EntityNotFoundException exception) { // we do not want to log the exception here, does not make sense
} catch (@SuppressWarnings("squid:S1166") final EntityNotFoundException exception) {
return false; return false;
} }
uiNotification.displayValidationError(i18n.get("message.metadata.duplicate.check", keyTextField.getValue())); uiNotification.displayValidationError(i18n.get("message.metadata.duplicate.check", keyTextField.getValue()));

View File

@@ -94,7 +94,7 @@ public class CommonDialogWindow extends Window implements Serializable {
private final ClickListener cancelButtonClickListener; private final ClickListener cancelButtonClickListener;
private final ClickListener close = event -> close(); private final ClickListener closeClickListener = event -> close();
private final transient Map<Component, Object> orginalValues; private final transient Map<Component, Object> orginalValues;
@@ -115,6 +115,10 @@ public class CommonDialogWindow extends Window implements Serializable {
* the saveButtonClickListener * the saveButtonClickListener
* @param cancelButtonClickListener * @param cancelButtonClickListener
* the cancelButtonClickListener * the cancelButtonClickListener
* @param layout
* the abstract layout
* @param i18n
* the i18n service
*/ */
public CommonDialogWindow(final String caption, final Component content, final String helpLink, public CommonDialogWindow(final String caption, final Component content, final String helpLink,
final ClickListener saveButtonClickListener, final ClickListener cancelButtonClickListener, final ClickListener saveButtonClickListener, final ClickListener cancelButtonClickListener,
@@ -233,11 +237,11 @@ public class CommonDialogWindow extends Window implements Serializable {
} }
protected void addCloseListenerForSaveButton() { protected void addCloseListenerForSaveButton() {
saveButton.addClickListener(close); saveButton.addClickListener(closeClickListener);
} }
protected void addCloseListenerForCancelButton() { protected void addCloseListenerForCancelButton() {
cancelButton.addClickListener(close); cancelButton.addClickListener(closeClickListener);
} }
protected void addComponenetListeners() { protected void addComponenetListeners() {
@@ -275,7 +279,8 @@ public class CommonDialogWindow extends Window implements Serializable {
return false; return false;
} }
private boolean isValueEquals(final AbstractField<?> field, final Object orginalValue, final Object currentValue) { private static boolean isValueEquals(final AbstractField<?> field, final Object orginalValue,
final Object currentValue) {
if (Set.class.equals(field.getType())) { if (Set.class.equals(field.getType())) {
return CollectionUtils.isEqualCollection(CollectionUtils.emptyIfNull((Collection<?>) orginalValue), return CollectionUtils.isEqualCollection(CollectionUtils.emptyIfNull((Collection<?>) orginalValue),
CollectionUtils.emptyIfNull((Collection<?>) currentValue)); CollectionUtils.emptyIfNull((Collection<?>) currentValue));
@@ -289,7 +294,7 @@ public class CommonDialogWindow extends Window implements Serializable {
return Objects.equals(orginalValue, currentValue); return Objects.equals(orginalValue, currentValue);
} }
private Object getCurrentVaue(final Component currentChangedComponent, final Object newValue, private static Object getCurrentVaue(final Component currentChangedComponent, final Object newValue,
final AbstractField<?> field) { final AbstractField<?> field) {
Object currentValue = field.getValue(); Object currentValue = field.getValue();
if (field instanceof Table) { if (field instanceof Table) {
@@ -365,7 +370,7 @@ public class CommonDialogWindow extends Window implements Serializable {
return false; return false;
} }
private List<AbstractField<?>> getAllComponents(final AbstractLayout abstractLayout) { private static List<AbstractField<?>> getAllComponents(final AbstractLayout abstractLayout) {
final List<AbstractField<?>> components = new ArrayList<>(); final List<AbstractField<?>> components = new ArrayList<>();
final Iterator<Component> iterate = abstractLayout.iterator(); final Iterator<Component> iterate = abstractLayout.iterator();
@@ -464,6 +469,7 @@ public class CommonDialogWindow extends Window implements Serializable {
private class ChangeListener implements ValueChangeListener, TextChangeListener, ItemSetChangeListener { private class ChangeListener implements ValueChangeListener, TextChangeListener, ItemSetChangeListener {
private static final long serialVersionUID = 1L;
private final Field<?> field; private final Field<?> field;
public ChangeListener(final Field<?> field) { public ChangeListener(final Field<?> field) {

View File

@@ -140,8 +140,8 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
editButton.addClickListener(this::onEdit); editButton.addClickListener(this::onEdit);
editButton.setEnabled(false); editButton.setEnabled(false);
manageMetadataBtn = SPUIComponentProvider.getButton("", "", "", null, false, manageMetadataBtn = SPUIComponentProvider.getButton("", "", "", null, false, FontAwesome.LIST_ALT,
FontAwesome.LIST_ALT, SPUIButtonStyleSmallNoBorder.class); SPUIButtonStyleSmallNoBorder.class);
manageMetadataBtn.setId(getEditButtonId()); manageMetadataBtn.setId(getEditButtonId());
manageMetadataBtn.setDescription(i18n.get("tooltip.metadata.icon")); manageMetadataBtn.setDescription(i18n.get("tooltip.metadata.icon"));
manageMetadataBtn.addClickListener(this::showMetadata); manageMetadataBtn.addClickListener(this::showMetadata);
@@ -296,7 +296,7 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
return descriptionLayout; return descriptionLayout;
} }
/** /**
* Default caption of header to be displayed when no data row selected in * Default caption of header to be displayed when no data row selected in
* table. * table.
* *
@@ -352,8 +352,6 @@ public abstract class AbstractTableDetailsLayout<T extends NamedEntity> extends
protected abstract String getName(); protected abstract String getName();
protected abstract String getShowMetadataButtonId();
protected abstract Boolean isMetadataIconToBeDisplayed(); protected abstract Boolean isMetadataIconToBeDisplayed();
protected abstract void showMetadata(Button.ClickEvent event); protected abstract void showMetadata(Button.ClickEvent event);

View File

@@ -41,130 +41,142 @@ import com.vaadin.ui.themes.ValoTheme;
@ViewScope @ViewScope
public class SoftwareModuleMetadatadetailslayout extends Table { public class SoftwareModuleMetadatadetailslayout extends Table {
private static final long serialVersionUID = 2913758299611838818L; private static final long serialVersionUID = 2913758299611838818L;
private static final String METADATA_KEY = "Key"; private static final String METADATA_KEY = "Key";
private SpPermissionChecker permissionChecker; private SpPermissionChecker permissionChecker;
private SoftwareManagement softwareManagement; private transient SoftwareManagement softwareManagement;
private SwMetadataPopupLayout swMetadataPopupLayout; private SwMetadataPopupLayout swMetadataPopupLayout;
private I18N i18n; private I18N i18n;
private Long selectedSWModuleId; private Long selectedSWModuleId;
private transient EntityFactory entityFactory; private transient EntityFactory entityFactory;
public void init(final I18N i18n, final SpPermissionChecker permissionChecker, /**
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout, * Initialize the layout.
final EntityFactory entityFactory) { *
this.i18n = i18n; * @param i18n
this.permissionChecker = permissionChecker; * the i18n service
this.softwareManagement = softwareManagement; * @param permissionChecker
this.swMetadataPopupLayout = swMetadataPopupLayout; * the permission checker service
this.entityFactory = entityFactory; * @param softwareManagement
createSWMMetadataTable(); * the software management service
addCustomGeneratedColumns(); * @param swMetadataPopupLayout
} * the software module metadata popup layout
* @param entityFactory
* the entity factory service
*/
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final EntityFactory entityFactory) {
this.i18n = i18n;
this.permissionChecker = permissionChecker;
this.softwareManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
this.entityFactory = entityFactory;
createSWMMetadataTable();
addCustomGeneratedColumns();
}
/** /**
* Populate software module metadata table. * Populate software module metadata table.
* *
* @param swModule * @param swModule
*/ */
public void populateSMMetadata(final SoftwareModule swModule) { public void populateSMMetadata(final SoftwareModule swModule) {
removeAllItems(); removeAllItems();
if (null == swModule) { if (null == swModule) {
return; return;
} }
selectedSWModuleId = swModule.getId(); selectedSWModuleId = swModule.getId();
final List<SoftwareModuleMetadata> swMetadataList = swModule.getMetadata(); final List<SoftwareModuleMetadata> swMetadataList = swModule.getMetadata();
if (null != swMetadataList && !swMetadataList.isEmpty()) { if (null != swMetadataList && !swMetadataList.isEmpty()) {
swMetadataList.forEach(swMetadata -> setSWMetadataProperties(swMetadata)); swMetadataList.forEach(swMetadata -> setSWMetadataProperties(swMetadata));
} }
} }
/** /**
* Create metadata. * Create metadata.
* *
* @param metadataKeyName * @param metadataKeyName
*/ */
public void createMetadata(final String metadataKeyName) { public void createMetadata(final String metadataKeyName) {
final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource(); final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource();
final Item item = metadataContainer.addItem(metadataKeyName); final Item item = metadataContainer.addItem(metadataKeyName);
item.getItemProperty(METADATA_KEY).setValue(metadataKeyName); item.getItemProperty(METADATA_KEY).setValue(metadataKeyName);
} }
/** /**
* Delete metadata. * Delete metadata.
* *
* @param metadataKeyName * @param metadataKeyName
*/ */
public void deleteMetadata(final String metadataKeyName) { public void deleteMetadata(final String metadataKeyName) {
final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource(); final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource();
metadataContainer.removeItem(metadataKeyName); metadataContainer.removeItem(metadataKeyName);
} }
private void createSWMMetadataTable() { private void createSWMMetadataTable() {
addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
addStyleName(ValoTheme.TABLE_NO_STRIPES); addStyleName(ValoTheme.TABLE_NO_STRIPES);
addStyleName(SPUIStyleDefinitions.SW_MODULE_TABLE); addStyleName(SPUIStyleDefinitions.SW_MODULE_TABLE);
setSelectable(false); setSelectable(false);
setImmediate(true); setImmediate(true);
setContainerDataSource(getSwModuleMetadataContainer()); setContainerDataSource(getSwModuleMetadataContainer());
setColumnHeaderMode(ColumnHeaderMode.EXPLICIT); setColumnHeaderMode(ColumnHeaderMode.EXPLICIT);
addSMMetadataTableHeader(); addSMMetadataTableHeader();
setSizeFull(); setSizeFull();
//same as height of other tabs in details tabsheet // same as height of other tabs in details tabsheet
setHeight(116,Unit.PIXELS); setHeight(116, Unit.PIXELS);
} }
private IndexedContainer getSwModuleMetadataContainer() { private IndexedContainer getSwModuleMetadataContainer() {
final IndexedContainer container = new IndexedContainer(); final IndexedContainer container = new IndexedContainer();
container.addContainerProperty(METADATA_KEY, String.class, ""); container.addContainerProperty(METADATA_KEY, String.class, "");
setColumnAlignment(METADATA_KEY, Align.LEFT); setColumnAlignment(METADATA_KEY, Align.LEFT);
return container; return container;
} }
private void addSMMetadataTableHeader() { private void addSMMetadataTableHeader() {
setColumnHeader(METADATA_KEY, i18n.get("header.key")); setColumnHeader(METADATA_KEY, i18n.get("header.key"));
} }
private void setSWMetadataProperties(final SoftwareModuleMetadata swMetadata) {
final Item item = getContainerDataSource().addItem(swMetadata.getKey());
item.getItemProperty(METADATA_KEY).setValue(swMetadata.getKey());
}
private void setSWMetadataProperties(final SoftwareModuleMetadata swMetadata) { private void addCustomGeneratedColumns() {
final Item item = getContainerDataSource().addItem(swMetadata.getKey()); addGeneratedColumn(METADATA_KEY, (source, itemId, columnId) -> customMetadataDetailButton((String) itemId));
item.getItemProperty(METADATA_KEY).setValue(swMetadata.getKey()); }
}
private void addCustomGeneratedColumns() { private Button customMetadataDetailButton(final String metadataKey) {
addGeneratedColumn(METADATA_KEY, (source, itemId, columnId) -> customMetadataDetailButton((String) itemId)); final Button viewLink = SPUIComponentProvider.getButton(getDetailLinkId(metadataKey), metadataKey,
} "View" + metadataKey + " Metadata details", null, false, null, SPUIButtonStyleSmallNoBorder.class);
viewLink.setData(metadataKey);
if (permissionChecker.hasUpdateDistributionPermission()) {
viewLink.addStyleName(ValoTheme.BUTTON_TINY + " " + ValoTheme.BUTTON_LINK + " " + "on-focus-no-border link"
+ " " + "text-style");
viewLink.addClickListener(event -> showMetadataDetails(selectedSWModuleId, metadataKey));
}
return viewLink;
}
private Button customMetadataDetailButton(final String metadataKey) { private static String getDetailLinkId(final String name) {
final Button viewLink = SPUIComponentProvider.getButton(getDetailLinkId(metadataKey), metadataKey, "View" return new StringBuilder(SPUIComponentIdProvider.SW_METADATA_DETAIL_LINK).append('.').append(name).toString();
+ metadataKey + " Metadata details", null, false, null, SPUIButtonStyleSmallNoBorder.class); }
viewLink.setData(metadataKey);
if (permissionChecker.hasUpdateDistributionPermission()) {
viewLink.addStyleName(ValoTheme.BUTTON_TINY + " " + ValoTheme.BUTTON_LINK + " " + "on-focus-no-border link"
+ " " + "text-style");
viewLink.addClickListener(event -> showMetadataDetails(selectedSWModuleId, metadataKey));
}
return viewLink;
}
private static String getDetailLinkId(final String name) { private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) {
return new StringBuilder(SPUIComponentIdProvider.SW_METADATA_DETAIL_LINK).append('.').append(name).toString(); final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(selectedSWModuleId);
} /* display the window */
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule,
private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) { entityFactory.generateSoftwareModuleMetadata(swmodule, metadataKey, "")));
SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(selectedSWModuleId); }
/* display the window */
UI.getCurrent().addWindow(
swMetadataPopupLayout.getWindow(swmodule,
entityFactory.generateSoftwareModuleMetadata(swmodule, metadataKey, "")));
}
} }

View File

@@ -88,7 +88,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
private DsMetadataPopupLayout dsMetadataPopupLayout; private DsMetadataPopupLayout dsMetadataPopupLayout;
@Autowired @Autowired
private EntityFactory entityFactory; private transient EntityFactory entityFactory;
private SoftwareModuleDetailsTable softwareModuleTable; private SoftwareModuleDetailsTable softwareModuleTable;
@@ -98,23 +98,21 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
private final Map<String, StringBuilder> assignedSWModule = new HashMap<>(); private final Map<String, StringBuilder> assignedSWModule = new HashMap<>();
@EventBusListenerMethod(scope = EventScope.SESSION) @EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final MetadataEvent event) { void onEvent(final MetadataEvent event) {
UI.getCurrent() UI.getCurrent().access(() -> {
.access(() -> { final DistributionSetMetadata dsMetadata = event.getDistributionSetMetadata();
DistributionSetMetadata dsMetadata = event.getDistributionSetMetadata(); if (dsMetadata != null && isDistributionSetSelected(dsMetadata.getDistributionSet())) {
if (dsMetadata != null && isDistributionSetSelected(dsMetadata.getDistributionSet())) { if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_DISTRIBUTION_SET_METADATA) {
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_DISTRIBUTION_SET_METADATA) { dsMetadataTable.createMetadata(event.getDistributionSetMetadata().getKey());
dsMetadataTable.createMetadata(event.getDistributionSetMetadata().getKey()); } else if (event
} else if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_DISTRIBUTION_SET_METADATA) { .getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_DISTRIBUTION_SET_METADATA) {
dsMetadataTable.deleteMetadata(event.getDistributionSetMetadata().getKey()); dsMetadataTable.deleteMetadata(event.getDistributionSetMetadata().getKey());
} }
} }
}); });
} }
/** /**
* softwareLayout Initialize the component. * softwareLayout Initialize the component.
*/ */
@@ -124,8 +122,8 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
softwareModuleTable.init(getI18n(), true, getPermissionChecker(), distributionSetManagement, getEventBus(), softwareModuleTable.init(getI18n(), true, getPermissionChecker(), distributionSetManagement, getEventBus(),
manageDistUIState); manageDistUIState);
dsMetadataTable = new DistributionSetMetadatadetailslayout(); dsMetadataTable = new DistributionSetMetadatadetailslayout();
dsMetadataTable.init(getI18n(), getPermissionChecker(),distributionSetManagement, dsMetadataTable.init(getI18n(), getPermissionChecker(), distributionSetManagement, dsMetadataPopupLayout,
dsMetadataPopupLayout,entityFactory); entityFactory);
super.init(); super.init();
} }
@@ -273,9 +271,9 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
} }
@Override @Override
protected void populateMetadataDetails(){ protected void populateMetadataDetails() {
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity()); dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
} }
private void updateDistributionSetDetailsLayout(final String type, final Boolean isMigrationRequired) { private void updateDistributionSetDetailsLayout(final String type, final Boolean isMigrationRequired) {
final VerticalLayout detailsTabLayout = getDetailsLayout(); final VerticalLayout detailsTabLayout = getDetailsLayout();
@@ -404,25 +402,17 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
return true; return true;
} }
@Override private boolean isDistributionSetSelected(final DistributionSet ds) {
protected String getShowMetadataButtonId() { final DistributionSetIdName lastselectedDistDS = manageDistUIState.getLastSelectedDistribution().isPresent()
DistributionSetIdName lastselectedDistDS = manageDistUIState.getLastSelectedDistribution().isPresent() ? manageDistUIState ? manageDistUIState.getLastSelectedDistribution().get() : null;
.getLastSelectedDistribution().get() : null;
return SPUIComponentIdProvider.DS_TABLE_MANAGE_METADATA_ID + "." + lastselectedDistDS.getName() + "."
+ lastselectedDistDS.getVersion();
}
private boolean isDistributionSetSelected(DistributionSet ds) {
DistributionSetIdName lastselectedDistDS = manageDistUIState.getLastSelectedDistribution().isPresent() ? manageDistUIState
.getLastSelectedDistribution().get() : null;
return ds != null && lastselectedDistDS != null && lastselectedDistDS.getName().equals(ds.getName()) return ds != null && lastselectedDistDS != null && lastselectedDistDS.getName().equals(ds.getName())
&& lastselectedDistDS.getVersion().endsWith(ds.getVersion()); && lastselectedDistDS.getVersion().endsWith(ds.getVersion());
} }
@Override @Override
protected void showMetadata(ClickEvent event) { protected void showMetadata(final ClickEvent event) {
DistributionSet ds = distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()); final DistributionSet ds = distributionSetManagement
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds,null)); .findDistributionSetByIdWithDetails(getSelectedBaseEntityId());
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null));
} }
} }

View File

@@ -36,13 +36,13 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
private transient DistributionSetManagement distributionSetManagement; private transient DistributionSetManagement distributionSetManagement;
@Autowired @Autowired
private EntityFactory entityFactory; private transient EntityFactory entityFactory;
@Autowired @Autowired
protected SpPermissionChecker permChecker; protected SpPermissionChecker permChecker;
@Override @Override
protected void checkForDuplicate(DistributionSet entity, String value) { protected void checkForDuplicate(final DistributionSet entity, final String value) {
distributionSetManagement.findOne(entity, value); distributionSetManagement.findOne(entity, value);
} }
@@ -50,9 +50,10 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
* Create metadata for DistributionSet. * Create metadata for DistributionSet.
*/ */
@Override @Override
protected DistributionSetMetadata createMetadata(DistributionSet entity, String key, String value) { protected DistributionSetMetadata createMetadata(final DistributionSet entity, final String key,
DistributionSetMetadata dsMetaData = distributionSetManagement.createDistributionSetMetadata(entityFactory final String value) {
.generateDistributionSetMetadata(entity, key, value)); final DistributionSetMetadata dsMetaData = distributionSetManagement
.createDistributionSetMetadata(entityFactory.generateDistributionSetMetadata(entity, key, value));
setSelectedEntity(dsMetaData.getDistributionSet()); setSelectedEntity(dsMetaData.getDistributionSet());
eventBus.publish(this, new MetadataEvent(MetadataUIEvent.CREATE_DISTRIBUTION_SET_METADATA, dsMetaData)); eventBus.publish(this, new MetadataEvent(MetadataUIEvent.CREATE_DISTRIBUTION_SET_METADATA, dsMetaData));
return dsMetaData; return dsMetaData;
@@ -62,9 +63,10 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
* Update metadata for DistributionSet. * Update metadata for DistributionSet.
*/ */
@Override @Override
protected DistributionSetMetadata updateMetadata(DistributionSet entity, String key, String value) { protected DistributionSetMetadata updateMetadata(final DistributionSet entity, final String key,
DistributionSetMetadata dsMetaData = distributionSetManagement.updateDistributionSetMetadata(entityFactory final String value) {
.generateDistributionSetMetadata(entity, key, value)); final DistributionSetMetadata dsMetaData = distributionSetManagement
.updateDistributionSetMetadata(entityFactory.generateDistributionSetMetadata(entity, key, value));
setSelectedEntity(dsMetaData.getDistributionSet()); setSelectedEntity(dsMetaData.getDistributionSet());
return dsMetaData; return dsMetaData;
} }
@@ -79,8 +81,8 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
*/ */
@Override @Override
protected void deleteMetadata(DistributionSet entity, String key, String value) { protected void deleteMetadata(final DistributionSet entity, final String key, final String value) {
DistributionSetMetadata dsMetaData = entityFactory.generateDistributionSetMetadata(entity, key, value); final DistributionSetMetadata dsMetaData = entityFactory.generateDistributionSetMetadata(entity, key, value);
distributionSetManagement.deleteDistributionSetMetadata(entity, key); distributionSetManagement.deleteDistributionSetMetadata(entity, key);
eventBus.publish(this, new MetadataEvent(MetadataUIEvent.DELETE_DISTRIBUTION_SET_METADATA, dsMetaData)); eventBus.publish(this, new MetadataEvent(MetadataUIEvent.DELETE_DISTRIBUTION_SET_METADATA, dsMetaData));
} }

View File

@@ -57,17 +57,18 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
private SwMetadataPopupLayout swMetadataPopupLayout; private SwMetadataPopupLayout swMetadataPopupLayout;
@Autowired @Autowired
private EntityFactory entityFactory; private transient EntityFactory entityFactory;
private SoftwareModuleMetadatadetailslayout swmMetadataTable; private SoftwareModuleMetadatadetailslayout swmMetadataTable;
/** /**
* softwareLayout Initialize the component. * softwareLayout Initialize the component.
*/ */
@Override @Override
protected void init() { protected void init() {
swmMetadataTable = new SoftwareModuleMetadatadetailslayout(); swmMetadataTable = new SoftwareModuleMetadatadetailslayout();
swmMetadataTable.init(getI18n(), getPermissionChecker(),softwareManagement,swMetadataPopupLayout,entityFactory); swmMetadataTable.init(getI18n(), getPermissionChecker(), softwareManagement, swMetadataPopupLayout,
entityFactory);
super.init(); super.init();
} }
@@ -80,18 +81,18 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
@EventBusListenerMethod(scope = EventScope.SESSION) @EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final MetadataEvent event) { void onEvent(final MetadataEvent event) {
UI.getCurrent() UI.getCurrent().access(() -> {
.access(() -> { final SoftwareModuleMetadata softwareModuleMetadata = event.getSoftwareModuleMetadata();
SoftwareModuleMetadata softwareModuleMetadata = event.getSoftwareModuleMetadata(); if (softwareModuleMetadata != null
if (softwareModuleMetadata != null && isSoftwareModuleSelected(softwareModuleMetadata.getSoftwareModule())) {
&& isSoftwareModuleSelected(softwareModuleMetadata.getSoftwareModule())) { if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) {
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA) { swmMetadataTable.createMetadata(event.getSoftwareModuleMetadata().getKey());
swmMetadataTable.createMetadata(event.getSoftwareModuleMetadata().getKey()); } else if (event
} else if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) { .getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey()); swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey());
} }
} }
}); });
} }
@EventBusListenerMethod(scope = EventScope.SESSION) @EventBusListenerMethod(scope = EventScope.SESSION)
@@ -119,7 +120,7 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
detailsTab.addTab(createDescriptionLayout(), getI18n().get("caption.tab.description"), null); detailsTab.addTab(createDescriptionLayout(), getI18n().get("caption.tab.description"), null);
detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null); detailsTab.addTab(createLogLayout(), getI18n().get("caption.logs.tab"), null);
detailsTab.addTab(swmMetadataTable, getI18n().get("caption.metadata"), null); detailsTab.addTab(swmMetadataTable, getI18n().get("caption.metadata"), null);
} }
@Override @Override
protected String getDefaultCaption() { protected String getDefaultCaption() {
@@ -202,9 +203,9 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
swmMetadataTable.populateSMMetadata(getSelectedBaseEntity()); swmMetadataTable.populateSMMetadata(getSelectedBaseEntity());
} }
private boolean isSoftwareModuleSelected(SoftwareModule softwareModule) { private boolean isSoftwareModuleSelected(final SoftwareModule softwareModule) {
final Long selectedDistSWModuleId = manageDistUIState.getSelectedBaseSwModuleId().isPresent() ? manageDistUIState final Long selectedDistSWModuleId = manageDistUIState.getSelectedBaseSwModuleId().isPresent()
.getSelectedBaseSwModuleId().get() : null; ? manageDistUIState.getSelectedBaseSwModuleId().get() : null;
return softwareModule != null && selectedDistSWModuleId != null return softwareModule != null && selectedDistSWModuleId != null
&& selectedDistSWModuleId.equals(softwareModule.getId()); && selectedDistSWModuleId.equals(softwareModule.getId());
} }
@@ -215,15 +216,8 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
} }
@Override @Override
protected String getShowMetadataButtonId() { protected void showMetadata(final ClickEvent event) {
SoftwareModule selectedBaseEntity = getSelectedBaseEntity(); final SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
return SPUIComponentIdProvider.SW_TABLE_MANAGE_METADATA_ID + "." + selectedBaseEntity.getName() + "."
+ selectedBaseEntity.getVersion();
}
@Override
protected void showMetadata(ClickEvent event) {
SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)); UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
} }
} }

View File

@@ -60,8 +60,7 @@ import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme; import com.vaadin.ui.themes.ValoTheme;
/** /**
* * A Vaadin layout for create or update the target filter.
*
*/ */
@SpringComponent @SpringComponent
@ViewScope @ViewScope
@@ -494,11 +493,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
if (filterManagementUIState.isCreateFilterViewDisplayed() && !doesAlreadyExists()) { if (filterManagementUIState.isCreateFilterViewDisplayed() && !doesAlreadyExists()) {
createTargetFilterQuery(); createTargetFilterQuery();
} else { } else {
if (!nameTextField.getValue().equals(oldFilterName) && !doesAlreadyExists()) { updateCustomFilter();
updateCustomFilter();
} else {
updateCustomFilter();
}
} }
} }
} }

View File

@@ -55,13 +55,13 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
private DistributionTagToken distributionTagToken; private DistributionTagToken distributionTagToken;
@Autowired @Autowired
private transient DistributionSetManagement distributionSetManagement; private transient DistributionSetManagement distributionSetManagement;
@Autowired @Autowired
private DsMetadataPopupLayout dsMetadataPopupLayout; private DsMetadataPopupLayout dsMetadataPopupLayout;
@Autowired @Autowired
private EntityFactory entityFactory; private transient EntityFactory entityFactory;
private SoftwareModuleDetailsTable softwareModuleTable; private SoftwareModuleDetailsTable softwareModuleTable;
@@ -73,28 +73,27 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
softwareModuleTable.init(getI18n(), false, getPermissionChecker(), null, null, null); softwareModuleTable.init(getI18n(), false, getPermissionChecker(), null, null, null);
dsMetadataTable = new DistributionSetMetadatadetailslayout(); dsMetadataTable = new DistributionSetMetadatadetailslayout();
dsMetadataTable.init(getI18n(), getPermissionChecker(),distributionSetManagement, dsMetadataTable.init(getI18n(), getPermissionChecker(), distributionSetManagement, dsMetadataPopupLayout,
dsMetadataPopupLayout,entityFactory); entityFactory);
super.init(); super.init();
} }
@EventBusListenerMethod(scope = EventScope.SESSION) @EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final MetadataEvent event) { void onEvent(final MetadataEvent event) {
UI.getCurrent() UI.getCurrent().access(() -> {
.access(() -> { final DistributionSetMetadata dsMetadata = event.getDistributionSetMetadata();
DistributionSetMetadata dsMetadata = event.getDistributionSetMetadata(); if (dsMetadata != null && isDistributionSetSelected(dsMetadata.getDistributionSet())) {
if (dsMetadata != null && isDistributionSetSelected(dsMetadata.getDistributionSet())) { if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_DISTRIBUTION_SET_METADATA) {
if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.CREATE_DISTRIBUTION_SET_METADATA) { dsMetadataTable.createMetadata(event.getDistributionSetMetadata().getKey());
dsMetadataTable.createMetadata(event.getDistributionSetMetadata().getKey()); } else if (event
} else if (event.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_DISTRIBUTION_SET_METADATA) { .getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_DISTRIBUTION_SET_METADATA) {
dsMetadataTable.deleteMetadata(event.getDistributionSetMetadata().getKey()); dsMetadataTable.deleteMetadata(event.getDistributionSetMetadata().getKey());
} }
} }
}); });
} }
@EventBusListenerMethod(scope = EventScope.SESSION) @EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final DistributionTableEvent distributionTableEvent) { void onEvent(final DistributionTableEvent distributionTableEvent) {
onBaseEntityEvent(distributionTableEvent); onBaseEntityEvent(distributionTableEvent);
@@ -157,11 +156,10 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
} }
@Override @Override
protected void populateMetadataDetails(){ protected void populateMetadataDetails() {
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity()); dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
} }
private void populateDetails(final DistributionSet ds) { private void populateDetails(final DistributionSet ds) {
if (ds != null) { if (ds != null) {
@@ -212,24 +210,18 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
return true; return true;
} }
@Override private boolean isDistributionSetSelected(final DistributionSet ds) {
protected String getShowMetadataButtonId() { final DistributionSetIdName lastselectedManageDS = managementUIState.getLastSelectedDistribution().isPresent()
DistributionSetIdName lastselectedDistDS = managementUIState.getLastSelectedDistribution().isPresent() ? managementUIState ? managementUIState.getLastSelectedDistribution().get() : null;
.getLastSelectedDistribution().get() : null; return ds != null && lastselectedManageDS != null && lastselectedManageDS.getName().equals(ds.getName())
return SPUIComponentIdProvider.DS_TABLE_MANAGE_METADATA_ID + "." + lastselectedDistDS.getName() + "."
+ lastselectedDistDS.getVersion();
}
private boolean isDistributionSetSelected(DistributionSet ds) {
DistributionSetIdName lastselectedManageDS = managementUIState.getLastSelectedDistribution().isPresent() ? managementUIState
.getLastSelectedDistribution().get() : null;
return ds!=null && lastselectedManageDS != null && lastselectedManageDS.getName().equals(ds.getName())
&& lastselectedManageDS.getVersion().endsWith(ds.getVersion()); && lastselectedManageDS.getVersion().endsWith(ds.getVersion());
} }
@Override @Override
protected void showMetadata(ClickEvent event) { protected void showMetadata(final ClickEvent event) {
DistributionSet ds = distributionSetManagement.findDistributionSetByIdWithDetails(getSelectedBaseEntityId()); final DistributionSet ds = distributionSetManagement
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds,null)); .findDistributionSetByIdWithDetails(getSelectedBaseEntityId());
UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null));
} }
} }

View File

@@ -107,7 +107,6 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
return; return;
} }
targetAddUpdateWindowLayout.getWindow(getSelectedBaseEntity().getControllerId()); targetAddUpdateWindowLayout.getWindow(getSelectedBaseEntity().getControllerId());
// targetAddUpdateWindowLayout.populateValuesOfTarget(getSelectedBaseEntity().getControllerId());
openWindow(); openWindow();
} }
@@ -229,7 +228,7 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
* as Module (JVM|OS|AH) * as Module (JVM|OS|AH)
* @return Label as UI * @return Label as UI
*/ */
private Label getSWModlabel(final String labelName, final SoftwareModule swModule) { private static Label getSWModlabel(final String labelName, final SoftwareModule swModule) {
return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion()); return SPUIComponentProvider.createNameValueLabel(labelName + " : ", swModule.getName(), swModule.getVersion());
} }
@@ -253,24 +252,19 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
return SPUIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID; return SPUIComponentIdProvider.TARGET_DETAILS_HEADER_LABEL_ID;
} }
@Override
protected String getShowMetadataButtonId() {
return null;
}
@Override @Override
protected Boolean isMetadataIconToBeDisplayed() { protected Boolean isMetadataIconToBeDisplayed() {
return false; return false;
} }
@Override @Override
protected void showMetadata(ClickEvent event) { protected void showMetadata(final ClickEvent event) {
//No implementation required // No implementation required
} }
@Override @Override
protected void populateMetadataDetails() { protected void populateMetadataDetails() {
//No implementation required // No implementation required
} }
} }

View File

@@ -443,7 +443,7 @@ public class RolloutListGrid extends AbstractGrid {
return null; return null;
} }
private String getDSDetails(final Item rolloutItem) { private static String getDSDetails(final Item rolloutItem) {
final StringBuilder swModuleNames = new StringBuilder(); final StringBuilder swModuleNames = new StringBuilder();
final StringBuilder swModuleVendors = new StringBuilder(); final StringBuilder swModuleVendors = new StringBuilder();
final Set<SoftwareModule> swModules = (Set<SoftwareModule>) rolloutItem.getItemProperty(SW_MODULES).getValue(); final Set<SoftwareModule> swModules = (Set<SoftwareModule>) rolloutItem.getItemProperty(SW_MODULES).getValue();