improve code quality
Signed-off-by: Michael Hirsch <michael.hirsch@bosch-si.com>
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
@@ -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.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
|
} else if (event
|
||||||
|
.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() + "."
|
|
||||||
+ selectedBaseEntity.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void showMetadata(ClickEvent event) {
|
|
||||||
SoftwareModule swmodule = softwareManagement.findSoftwareModuleWithDetails(getSelectedBaseEntityId());
|
|
||||||
/* display the window */
|
/* display the window */
|
||||||
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule,null));
|
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,6 +255,14 @@ 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) {
|
||||||
|
handleOkDeleteMetadata(event, key, value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
UI.getCurrent().addWindow(confirmDialog.getWindow());
|
||||||
|
confirmDialog.getWindow().bringToFront();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleOkDeleteMetadata(final RendererClickEvent event, final String key, final String value) {
|
||||||
deleteMetadata(getSelectedEntity(), key, value);
|
deleteMetadata(getSelectedEntity(), key, value);
|
||||||
uiNotification.displaySuccess(i18n.get("message.metadata.deleted.successfully", key));
|
uiNotification.displaySuccess(i18n.get("message.metadata.deleted.successfully", key));
|
||||||
final Object selectedRow = metaDataGrid.getSelectedRow();
|
final Object selectedRow = metaDataGrid.getSelectedRow();
|
||||||
@@ -272,6 +278,11 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
clearTextFields();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearTextFields() {
|
||||||
keyTextField.clear();
|
keyTextField.clear();
|
||||||
valueTextArea.clear();
|
valueTextArea.clear();
|
||||||
metaDataGrid.select(null);
|
metaDataGrid.select(null);
|
||||||
@@ -281,26 +292,19 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
|
|||||||
addIcon.setEnabled(false);
|
addIcon.setEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
UI.getCurrent().addWindow(confirmDialog.getWindow());
|
|
||||||
confirmDialog.getWindow().bringToFront();
|
|
||||||
}
|
|
||||||
|
|
||||||
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()));
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -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);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
|
|||||||
|
|
||||||
private SpPermissionChecker permissionChecker;
|
private SpPermissionChecker permissionChecker;
|
||||||
|
|
||||||
private SoftwareManagement softwareManagement;
|
private transient SoftwareManagement softwareManagement;
|
||||||
|
|
||||||
private SwMetadataPopupLayout swMetadataPopupLayout;
|
private SwMetadataPopupLayout swMetadataPopupLayout;
|
||||||
|
|
||||||
@@ -57,6 +57,20 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
|
|||||||
|
|
||||||
private transient EntityFactory entityFactory;
|
private transient EntityFactory entityFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the layout.
|
||||||
|
*
|
||||||
|
* @param i18n
|
||||||
|
* the i18n service
|
||||||
|
* @param permissionChecker
|
||||||
|
* the permission checker service
|
||||||
|
* @param softwareManagement
|
||||||
|
* the software management service
|
||||||
|
* @param swMetadataPopupLayout
|
||||||
|
* the software module metadata popup layout
|
||||||
|
* @param entityFactory
|
||||||
|
* the entity factory service
|
||||||
|
*/
|
||||||
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
|
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
|
||||||
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
|
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
|
||||||
final EntityFactory entityFactory) {
|
final EntityFactory entityFactory) {
|
||||||
@@ -118,8 +132,8 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
|
|||||||
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() {
|
||||||
@@ -133,7 +147,6 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
|
|||||||
setColumnHeader(METADATA_KEY, i18n.get("header.key"));
|
setColumnHeader(METADATA_KEY, i18n.get("header.key"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void setSWMetadataProperties(final SoftwareModuleMetadata swMetadata) {
|
private void setSWMetadataProperties(final SoftwareModuleMetadata swMetadata) {
|
||||||
final Item item = getContainerDataSource().addItem(swMetadata.getKey());
|
final Item item = getContainerDataSource().addItem(swMetadata.getKey());
|
||||||
item.getItemProperty(METADATA_KEY).setValue(swMetadata.getKey());
|
item.getItemProperty(METADATA_KEY).setValue(swMetadata.getKey());
|
||||||
@@ -144,8 +157,8 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Button customMetadataDetailButton(final String metadataKey) {
|
private Button customMetadataDetailButton(final String metadataKey) {
|
||||||
final Button viewLink = SPUIComponentProvider.getButton(getDetailLinkId(metadataKey), metadataKey, "View"
|
final Button viewLink = SPUIComponentProvider.getButton(getDetailLinkId(metadataKey), metadataKey,
|
||||||
+ metadataKey + " Metadata details", null, false, null, SPUIButtonStyleSmallNoBorder.class);
|
"View" + metadataKey + " Metadata details", null, false, null, SPUIButtonStyleSmallNoBorder.class);
|
||||||
viewLink.setData(metadataKey);
|
viewLink.setData(metadataKey);
|
||||||
if (permissionChecker.hasUpdateDistributionPermission()) {
|
if (permissionChecker.hasUpdateDistributionPermission()) {
|
||||||
viewLink.addStyleName(ValoTheme.BUTTON_TINY + " " + ValoTheme.BUTTON_LINK + " " + "on-focus-no-border link"
|
viewLink.addStyleName(ValoTheme.BUTTON_TINY + " " + ValoTheme.BUTTON_LINK + " " + "on-focus-no-border link"
|
||||||
@@ -160,10 +173,9 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) {
|
private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) {
|
||||||
SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(selectedSWModuleId);
|
final SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(selectedSWModuleId);
|
||||||
/* display the window */
|
/* display the window */
|
||||||
UI.getCurrent().addWindow(
|
UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule,
|
||||||
swMetadataPopupLayout.getWindow(swmodule,
|
|
||||||
entityFactory.generateSoftwareModuleMetadata(swmodule, metadataKey, "")));
|
entityFactory.generateSoftwareModuleMetadata(swmodule, metadataKey, "")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_DISTRIBUTION_SET_METADATA) {
|
} else if (event
|
||||||
|
.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,7 +271,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateMetadataDetails(){
|
protected void populateMetadataDetails() {
|
||||||
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
|
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ 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;
|
||||||
|
|
||||||
@@ -67,7 +67,8 @@ public class SwModuleDetails extends AbstractNamedVersionedEntityTableDetailsLay
|
|||||||
@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,14 +81,14 @@ 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.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
|
} else if (event
|
||||||
|
.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA) {
|
||||||
swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey());
|
swmMetadataTable.deleteMetadata(event.getSoftwareModuleMetadata().getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
|
|||||||
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.getMetadataUIEvent() == MetadataEvent.MetadataUIEvent.DELETE_DISTRIBUTION_SET_METADATA) {
|
} else if (event
|
||||||
|
.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,9 +156,8 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void populateMetadataDetails(){
|
protected void populateMetadataDetails() {
|
||||||
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
|
dsMetadataTable.populateDSMetadata(getSelectedBaseEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user