Complete repository refactoring - method renaming (#575)

* Split Tag management

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Repo method naming schame applied.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* findAll returns slice instead of page.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Complete javadoc.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Allow null values again.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Readability improvements.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Forgot a method.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>

* Fixed broken completed filter.

Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2017-09-22 08:22:41 +02:00
committed by GitHub
parent 68523cd8de
commit edae83a1b5
211 changed files with 3796 additions and 4160 deletions

View File

@@ -16,7 +16,6 @@ import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
@@ -93,8 +92,7 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
@Autowired
UploadArtifactView(final UIEventBus eventBus, final SpPermissionChecker permChecker, final VaadinMessageSource i18n,
final UINotification uiNotification, final ArtifactUploadState artifactUploadState,
final TagManagement tagManagement, final EntityFactory entityFactory,
final SoftwareModuleManagement softwareModuleManagement,
final EntityFactory entityFactory, final SoftwareModuleManagement softwareModuleManagement,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final UploadViewClientCriterion uploadViewClientCriterion,
final MultipartConfigElement multipartConfigElement, final ArtifactManagement artifactManagement) {
@@ -104,9 +102,10 @@ public class UploadArtifactView extends VerticalLayout implements View, BrowserW
this.uiNotification = uiNotification;
this.artifactUploadState = artifactUploadState;
this.filterByTypeLayout = new SMTypeFilterLayout(artifactUploadState, i18n, permChecker, eventBus,
tagManagement, entityFactory, uiNotification, softwareModuleTypeManagement, uploadViewClientCriterion);
entityFactory, uiNotification, softwareModuleTypeManagement, uploadViewClientCriterion);
this.smTableLayout = new SoftwareModuleTableLayout(i18n, permChecker, artifactUploadState, uiNotification,
eventBus, softwareModuleManagement, softwareModuleTypeManagement, entityFactory, uploadViewClientCriterion);
eventBus, softwareModuleManagement, softwareModuleTypeManagement, entityFactory,
uploadViewClientCriterion);
this.artifactDetailsLayout = new ArtifactDetailsLayout(i18n, eventBus, artifactUploadState, uiNotification,
artifactManagement, softwareModuleManagement);
this.uploadLayout = new UploadLayout(i18n, uiNotification, eventBus, artifactUploadState,

View File

@@ -78,7 +78,7 @@ public class ArtifactBeanQuery extends AbstractBeanQuery<Artifact> {
artifactBeans = firstPagetArtifacts;
} else {
artifactBeans = getArtifactManagement()
.findArtifactBySoftwareModule(new OffsetBasedPageRequest(startIndex, count, sort), baseSwModuleId);
.findBySoftwareModule(new OffsetBasedPageRequest(startIndex, count, sort), baseSwModuleId);
}
return artifactBeans.getContent();
@@ -95,7 +95,7 @@ public class ArtifactBeanQuery extends AbstractBeanQuery<Artifact> {
long size = 0;
if (baseSwModuleId != null) {
firstPagetArtifacts = getArtifactManagement()
.findArtifactBySoftwareModule(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), baseSwModuleId);
.findBySoftwareModule(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), baseSwModuleId);
size = firstPagetArtifacts.getTotalElements();
}
if (size > Integer.MAX_VALUE) {

View File

@@ -155,7 +155,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
private Optional<SoftwareModule> findSelectedSoftwareModule() {
final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId();
if (selectedBaseSwModuleId.isPresent()) {
return softwareModuleManagement.findSoftwareModuleById(selectedBaseSwModuleId.get());
return softwareModuleManagement.get(selectedBaseSwModuleId.get());
}
return Optional.empty();
}
@@ -282,7 +282,7 @@ public class ArtifactDetailsLayout extends VerticalLayout {
i18n.getMessage("message.delete.artifact", new Object[] { fileName }), i18n.getMessage("button.ok"),
i18n.getMessage("button.cancel"), ok -> {
if (ok) {
artifactManagement.deleteArtifact(id);
artifactManagement.delete(id);
uINotification.displaySuccess(i18n.getMessage("message.artifact.deleted", fileName));
final Optional<SoftwareModule> softwareModule = findSelectedSoftwareModule();
if (softwareModule.isPresent()) {

View File

@@ -152,7 +152,7 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
private void deleteSMAll(final ConfirmationTab tab) {
final Set<Long> swmoduleIds = artifactUploadState.getDeleteSofwareModules().keySet();
softwareModuleManagement.deleteSoftwareModules(swmoduleIds);
softwareModuleManagement.delete(swmoduleIds);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.REMOVE_ENTITY, swmoduleIds));
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
@@ -250,8 +250,8 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
private void deleteSMtypeAll(final ConfirmationTab tab) {
final int deleteSWModuleTypeCount = artifactUploadState.getSelectedDeleteSWModuleTypes().size();
for (final String swModuleTypeName : artifactUploadState.getSelectedDeleteSWModuleTypes()) {
softwareModuleTypeManagement.findSoftwareModuleTypeByName(swModuleTypeName).map(SoftwareModuleType::getId)
.ifPresent(softwareModuleTypeManagement::deleteSoftwareModuleType);
softwareModuleTypeManagement.getByName(swModuleTypeName).map(SoftwareModuleType::getId)
.ifPresent(softwareModuleTypeManagement::delete);
}
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
+ i18n.getMessage("message.sw.module.type.delete", new Object[] { deleteSWModuleTypeCount }));

View File

@@ -77,11 +77,11 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
if (type == null && StringUtils.isEmpty(searchText)) {
swModuleBeans = getSoftwareManagementService()
.findSoftwareModulesAll(new OffsetBasedPageRequest(startIndex, count, sort));
.findAll(new OffsetBasedPageRequest(startIndex, count, sort));
} else {
swModuleBeans = getSoftwareManagementService()
.findSoftwareModuleByFilters(new OffsetBasedPageRequest(startIndex, count, sort), searchText, type);
.findByTextAndType(new OffsetBasedPageRequest(startIndex, count, sort), searchText, type);
}
return swModuleBeans.getContent().stream().map(this::getProxyBean).collect(Collectors.toList());
@@ -107,9 +107,9 @@ public class BaseSwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSoftwareMo
public int size() {
long size;
if (type == null && StringUtils.isEmpty(searchText)) {
size = getSoftwareManagementService().countSoftwareModulesAll();
size = getSoftwareManagementService().count();
} else {
size = getSoftwareManagementService().countSoftwareModuleByFilters(searchText, type);
size = getSoftwareManagementService().countByTextAndType(searchText, type);
}
if (size > Integer.MAX_VALUE) {

View File

@@ -140,12 +140,12 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
final SoftwareModuleType softwareModuleTypeByName = softwareModuleTypeManagement
.findSoftwareModuleTypeByName(type)
.getByName(type)
.orElseThrow(() -> new EntityNotFoundException(SoftwareModuleType.class, type));
final SoftwareModuleCreate softwareModule = entityFactory.softwareModule().create()
.type(softwareModuleTypeByName).name(name).version(version).description(description).vendor(vendor);
final SoftwareModule newSoftwareModule = softwareModuleManagement.createSoftwareModule(softwareModule);
final SoftwareModule newSoftwareModule = softwareModuleManagement.create(softwareModule);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.ADD_ENTITY, newSoftwareModule));
uiNotifcation.displaySuccess(i18n.getMessage("message.save.success",
new Object[] { newSoftwareModule.getName() + ":" + newSoftwareModule.getVersion() }));
@@ -157,10 +157,10 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
final String version = versionTextField.getValue();
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
final Optional<Long> moduleType = softwareModuleTypeManagement.findSoftwareModuleTypeByName(type)
final Optional<Long> moduleType = softwareModuleTypeManagement.getByName(type)
.map(SoftwareModuleType::getId);
if (moduleType.isPresent() && softwareModuleManagement
.findSoftwareModuleByNameAndVersion(name, version, moduleType.get()).isPresent()) {
.getByNameAndVersionAndType(name, version, moduleType.get()).isPresent()) {
uiNotifcation.displayValidationError(
i18n.getMessage("message.duplicate.softwaremodule", new Object[] { name, version }));
return true;
@@ -173,7 +173,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
*/
private void updateSwModule() {
final SoftwareModule newSWModule = softwareModuleManagement
.updateSoftwareModule(entityFactory.softwareModule().update(baseSwModuleId)
.update(entityFactory.softwareModule().update(baseSwModuleId)
.description(descTextArea.getValue()).vendor(vendorTextField.getValue()));
if (newSWModule != null) {
uiNotifcation.displaySuccess(i18n.getMessage("message.save.success",
@@ -289,7 +289,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent {
return;
}
editSwModule = Boolean.TRUE;
softwareModuleManagement.findSoftwareModuleById(baseSwModuleId).ifPresent(swModule -> {
softwareModuleManagement.get(baseSwModuleId).ifPresent(swModule -> {
nameTextField.setValue(swModule.getName());
versionTextField.setValue(swModule.getVersion());
vendorTextField.setValue(HawkbitCommonUtil.trimAndNullIfEmpty(swModule.getVendor()));

View File

@@ -146,7 +146,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
@Override
protected Optional<SoftwareModule> findEntityByTableValue(final Long entityTableId) {
return softwareModuleManagement.findSoftwareModuleById(entityTableId);
return softwareModuleManagement.get(entityTableId);
}
@Override
@@ -255,7 +255,7 @@ public class SoftwareModuleTable extends AbstractNamedVersionTable<SoftwareModul
}
private void showMetadataDetails(final Long itemId) {
softwareModuleManagement.findSoftwareModuleById(itemId)
softwareModuleManagement.get(itemId)
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
}

View File

@@ -14,7 +14,6 @@ import java.util.Optional;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
@@ -66,8 +65,6 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
*
* @param i18n
* I18N
* @param tagManagement
* TagManagement
* @param entityFactory
* EntityFactory
* @param eventBus
@@ -79,10 +76,10 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
* @param softwareModuleTypeManagement
* management for {@link SoftwareModuleType}s
*/
public CreateUpdateSoftwareTypeLayout(final VaadinMessageSource i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
public CreateUpdateSoftwareTypeLayout(final VaadinMessageSource i18n, final EntityFactory entityFactory,
final UIEventBus eventBus, final SpPermissionChecker permChecker, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
super(i18n, entityFactory, eventBus, permChecker, uiNotification);
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
}
@@ -120,7 +117,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
protected Color getColorForColorPicker() {
final Optional<SoftwareModuleType> typeSelected = softwareModuleTypeManagement
.findSoftwareModuleTypeByName(tagNameComboBox.getValue().toString());
.getByName(tagNameComboBox.getValue().toString());
if (typeSelected.isPresent()) {
return typeSelected.get().getColour() != null
? ColorPickerHelper.rgbToColorConverter(typeSelected.get().getColour())
@@ -197,7 +194,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
@Override
protected void setTagDetails(final String targetTagSelected) {
tagName.setValue(targetTagSelected);
softwareModuleTypeManagement.findSoftwareModuleTypeByName(targetTagSelected).ifPresent(selectedTypeTag -> {
softwareModuleTypeManagement.getByName(targetTagSelected).ifPresent(selectedTypeTag -> {
tagDesc.setValue(selectedTypeTag.getDescription());
typeKey.setValue(selectedTypeTag.getKey());
if (selectedTypeTag.getMaxAssignments() == 1) {
@@ -237,12 +234,12 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
@Override
protected Optional<SoftwareModuleType> findEntityByKey() {
return softwareModuleTypeManagement.findSoftwareModuleTypeByKey(typeKey.getValue());
return softwareModuleTypeManagement.getByKey(typeKey.getValue());
}
@Override
protected Optional<SoftwareModuleType> findEntityByName() {
return softwareModuleTypeManagement.findSoftwareModuleTypeByName(tagName.getValue());
return softwareModuleTypeManagement.getByName(tagName.getValue());
}
@Override
@@ -264,7 +261,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
}
if (typeNameValue != null && typeKeyValue != null) {
final SoftwareModuleType newSWType = softwareModuleTypeManagement.createSoftwareModuleType(
final SoftwareModuleType newSWType = softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key(typeKeyValue).name(typeNameValue)
.description(typeDescValue).colour(colorPicked).maxAssignments(assignNumber));
uiNotification
@@ -277,7 +274,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout<Softw
}
private void updateSWModuleType(final SoftwareModuleType existingType) {
softwareModuleTypeManagement.updateSoftwareModuleType(
softwareModuleTypeManagement.update(
entityFactory.softwareModuleType().update(existingType.getId()).description(tagDesc.getValue())
.colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview())));
uiNotification

View File

@@ -46,7 +46,7 @@ public class SMTypeFilterButtonClick extends AbstractFilterSingleButtonClick {
@Override
protected void filterClicked(final Button clickedButton) {
softwareModuleTypeManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString())
softwareModuleTypeManagement.getByName(clickedButton.getData().toString())
.ifPresent(softwareModuleType -> {
artifactUploadState.getSoftwareModuleFilters().setSoftwareModuleType(softwareModuleType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -37,13 +36,12 @@ public class SMTypeFilterHeader extends AbstractFilterHeader {
private final CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
SMTypeFilterHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final ArtifactUploadState artifactUploadState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuletypeManagement) {
final ArtifactUploadState artifactUploadState, final EntityFactory entityFactory,
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuletypeManagement) {
super(permChecker, eventBus, i18n);
this.artifactUploadState = artifactUploadState;
this.createUpdateSWTypeLayout = new CreateUpdateSoftwareTypeLayout(i18n, tagManagement, entityFactory, eventBus,
permChecker, uiNotification, softwareModuletypeManagement);
this.createUpdateSWTypeLayout = new CreateUpdateSoftwareTypeLayout(i18n, entityFactory, eventBus, permChecker,
uiNotification, softwareModuletypeManagement);
if (permChecker.hasCreateDistributionPermission() || permChecker.hasUpdateDistributionPermission()) {
createUpdateSWTypeLayout.init();

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -32,12 +31,11 @@ public class SMTypeFilterLayout extends AbstractFilterLayout {
private final ArtifactUploadState artifactUploadState;
public SMTypeFilterLayout(final ArtifactUploadState artifactUploadState, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final EntityFactory entityFactory,
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final UploadViewClientCriterion uploadViewClientCriterion) {
super(new SMTypeFilterHeader(i18n, permChecker, eventBus, artifactUploadState, tagManagement, entityFactory,
uiNotification, softwareModuleTypeManagement),
super(new SMTypeFilterHeader(i18n, permChecker, eventBus, artifactUploadState, entityFactory, uiNotification,
softwareModuleTypeManagement),
new SMTypeFilterButtons(eventBus, artifactUploadState, uploadViewClientCriterion,
softwareModuleTypeManagement));

View File

@@ -191,7 +191,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
final Item item = uploadDetailsTable.getItem(itemId);
if (HawkbitCommonUtil.trimAndNullIfEmpty(fileName) != null) {
final Long baseSwId = (Long) item.getItemProperty(BASE_SOFTWARE_ID).getValue();
final Optional<Artifact> artifact = artifactManagement.findByFilenameAndSoftwareModule(fileName, baseSwId);
final Optional<Artifact> artifact = artifactManagement.getByFilenameAndSoftwareModule(fileName, baseSwId);
if (artifact.isPresent()) {
warningIconLabel.setVisible(true);
if (isErrorIcon(warningIconLabel)) {
@@ -431,7 +431,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
final Label errorLabel, final String oldFileName, final Long currentSwId) {
if (warningLabel == null && (errorLabelCount > 1 || (duplicateCount == 1 && errorLabelCount == 1))) {
final Optional<Artifact> artifactList = artifactManagement.findByFilenameAndSoftwareModule(oldFileName,
final Optional<Artifact> artifactList = artifactManagement.getByFilenameAndSoftwareModule(oldFileName,
currentSwId);
if (errorLabel == null) {
return;
@@ -629,7 +629,7 @@ public class UploadConfirmationWindow implements Button.ClickListener {
try (FileInputStream fis = new FileInputStream(newFile)) {
artifactManagement.createArtifact(fis, baseSw.getId(), providedFileName,
artifactManagement.create(fis, baseSw.getId(), providedFileName,
HawkbitCommonUtil.trimAndNullIfEmpty(md5Checksum),
HawkbitCommonUtil.trimAndNullIfEmpty(sha1Checksum), true, customFile.getMimeType());
saveUploadStatus(providedFileName, swModuleNameVersion, SPUILabelDefinitions.SUCCESS, "");

View File

@@ -217,7 +217,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
final Optional<Long> selectedBaseSwModuleId = artifactUploadState.getSelectedBaseSwModuleId();
if (selectedBaseSwModuleId.isPresent()) {
selectedSwForUpload = softwareModuleManagement.findSoftwareModuleById(selectedBaseSwModuleId.get()).orElse(null);
selectedSwForUpload = softwareModuleManagement.get(selectedBaseSwModuleId.get()).orElse(null);
}
if (selectedSwForUpload != null && view.checkIfSoftwareModuleIsSelected()

View File

@@ -251,7 +251,7 @@ public class UploadLayout extends VerticalLayout {
artifactUploadState.getSelectedBaseSwModuleId().ifPresent(selectedSwId -> {
// reset the flag
hasDirectory = false;
final SoftwareModule softwareModule = softwareModuleManagement.findSoftwareModuleById(selectedSwId)
final SoftwareModule softwareModule = softwareModuleManagement.get(selectedSwId)
.orElse(null);
for (final Html5File file : files) {
processFile(file, softwareModule);
@@ -730,7 +730,7 @@ public class UploadLayout extends VerticalLayout {
}
void refreshArtifactDetailsLayout(final Long selectedBaseSoftwareModuleId) {
final SoftwareModule softwareModule = softwareModuleManagement.findSoftwareModuleById(selectedBaseSoftwareModuleId)
final SoftwareModule softwareModule = softwareModuleManagement.get(selectedBaseSoftwareModuleId)
.orElse(null);
eventBus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED, softwareModule));
}

View File

@@ -14,11 +14,9 @@ import java.util.Map;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
@@ -38,7 +36,6 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
private static final Logger LOG = LoggerFactory.getLogger(DistributionSetTypeBeanQuery.class);
private final Sort sort = new Sort(Direction.ASC, "name");
private transient Page<DistributionSetType> firstPageDistSetType;
private transient DistributionSetTypeManagement distributionSetTypeManagement;
/**
@@ -62,9 +59,7 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
@Override
public int size() {
firstPageDistSetType = getDistributionSetManagement()
.findDistributionSetTypesAll(new OffsetBasedPageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
long size = firstPageDistSetType.getTotalElements();
long size = getDistributionSetManagement().count();
if (size > Integer.MAX_VALUE) {
size = Integer.MAX_VALUE;
}
@@ -80,15 +75,7 @@ public class DistributionSetTypeBeanQuery extends AbstractBeanQuery<Distribution
@Override
protected List<DistributionSetType> loadBeans(final int startIndex, final int count) {
Page<DistributionSetType> typeBeans;
if (startIndex == 0 && firstPageDistSetType != null) {
typeBeans = firstPageDistSetType;
} else {
typeBeans = getDistributionSetManagement()
.findDistributionSetTypesAll(new OffsetBasedPageRequest(startIndex, count, sort));
}
return typeBeans.getContent();
return getDistributionSetManagement().findAll(new OffsetBasedPageRequest(startIndex, count, sort)).getContent();
}
@Override

View File

@@ -14,9 +14,7 @@ import java.util.Map;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
@@ -28,8 +26,8 @@ import org.vaadin.addons.lazyquerycontainer.QueryDefinition;
*/
public class SoftwareModuleTypeBeanQuery extends AbstractBeanQuery<SoftwareModuleType> {
private static final long serialVersionUID = 7824925429198339644L;
private final Sort sort = new Sort(Direction.ASC, "name");
private transient Page<SoftwareModuleType> firstPageSwModuleType;
private transient SoftwareModuleTypeManagement softwareModuleTypeManagement;
/**
@@ -47,9 +45,7 @@ public class SoftwareModuleTypeBeanQuery extends AbstractBeanQuery<SoftwareModul
@Override
public int size() {
firstPageSwModuleType = getSoftwareModuleTypeManagement()
.findSoftwareModuleTypesAll(new OffsetBasedPageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
long size = firstPageSwModuleType.getTotalElements();
long size = getSoftwareModuleTypeManagement().count();
if (size > Integer.MAX_VALUE) {
size = Integer.MAX_VALUE;
}
@@ -65,14 +61,9 @@ public class SoftwareModuleTypeBeanQuery extends AbstractBeanQuery<SoftwareModul
@Override
protected List<SoftwareModuleType> loadBeans(final int startIndex, final int count) {
Page<SoftwareModuleType> swModuleTypeBeans;
if (startIndex == 0 && firstPageSwModuleType != null) {
swModuleTypeBeans = firstPageSwModuleType;
} else {
swModuleTypeBeans = getSoftwareModuleTypeManagement()
.findSoftwareModuleTypesAll(new OffsetBasedPageRequest(startIndex, count, sort));
}
return swModuleTypeBeans.getContent();
return getSoftwareModuleTypeManagement().findAll(new OffsetBasedPageRequest(startIndex, count, sort))
.getContent();
}
@Override

View File

@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.common.detailslayout;
import java.util.Optional;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.tagdetails.DistributionTagToken;
@@ -64,7 +64,7 @@ public abstract class AbstractDistributionSetDetails
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout,
final DistributionSetManagement distributionSetManagement,
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory,
final UINotification uiNotification, final TagManagement tagManagement,
final UINotification uiNotification, final DistributionSetTagManagement distributionSetTagManagement,
final SoftwareModuleDetailsTable softwareModuleDetailsTable) {
super(i18n, eventBus, permissionChecker, managementUIState);
this.distributionAddUpdateWindowLayout = distributionAddUpdateWindowLayout;
@@ -72,7 +72,7 @@ public abstract class AbstractDistributionSetDetails
this.distributionSetManagement = distributionSetManagement;
this.dsMetadataPopupLayout = dsMetadataPopupLayout;
this.distributionTagToken = new DistributionTagToken(permissionChecker, i18n, uiNotification, eventBus,
managementUIState, tagManagement, distributionSetManagement);
managementUIState, distributionSetTagManagement, distributionSetManagement);
this.softwareModuleDetailsTable = softwareModuleDetailsTable;
dsMetadataTable = new DistributionSetMetadatadetailsLayout(i18n, permissionChecker, distributionSetManagement,
@@ -132,7 +132,7 @@ public abstract class AbstractDistributionSetDetails
@Override
protected void showMetadata(final ClickEvent event) {
final Optional<DistributionSet> ds = distributionSetManagement
.findDistributionSetById(getSelectedBaseEntityId());
.get(getSelectedBaseEntityId());
if (!ds.isPresent()) {
uiNotification.displayWarning(getI18n().getMessage("distributionset.not.exists"));
return;

View File

@@ -139,7 +139,7 @@ public abstract class AbstractSoftwareModuleDetails
@Override
protected void showMetadata(final ClickEvent event) {
softwareModuleManagement.findSoftwareModuleById(getSelectedBaseEntityId())
softwareModuleManagement.get(getSelectedBaseEntityId())
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
}

View File

@@ -85,7 +85,7 @@ public class DistributionSetMetadatadetailsLayout extends Table {
}
selectedDistSetId = distributionSet.getId();
final List<DistributionSetMetadata> dsMetadataList = distributionSetManagement
.findDistributionSetMetadataByDistributionSetId(selectedDistSetId, new PageRequest(0, 500))
.findMetaDataByDistributionSetId(new PageRequest(0, 500), selectedDistSetId)
.getContent();
if (null != dsMetadataList && !dsMetadataList.isEmpty()) {
dsMetadataList.forEach(dsMetadata -> setDSMetadataProperties(dsMetadata));
@@ -151,7 +151,7 @@ public class DistributionSetMetadatadetailsLayout extends Table {
}
private void showMetadataDetails(final Long selectedDistSetId, final String metadataKey) {
final Optional<DistributionSet> distSet = distributionSetManagement.findDistributionSetById(selectedDistSetId);
final Optional<DistributionSet> distSet = distributionSetManagement.get(selectedDistSetId);
if (!distSet.isPresent()) {
notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
return;

View File

@@ -185,7 +185,7 @@ public class SoftwareModuleDetailsTable extends Table {
private void unassignSW(final ClickEvent event, final DistributionSet distributionSet,
final Set<SoftwareModule> alreadyAssignedSwModules) {
final SoftwareModule unAssignedSw = getSoftwareModule(event.getButton().getId(), alreadyAssignedSwModules);
if (distributionSetManagement.isDistributionSetInUse(distributionSet.getId())) {
if (distributionSetManagement.isInUse(distributionSet.getId())) {
uiNotification.displayValidationError(i18n.getMessage("message.error.notification.ds.target.assigned",
distributionSet.getName(), distributionSet.getVersion()));
} else {

View File

@@ -97,8 +97,8 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
}
selectedSWModuleId = swModule.getId();
final List<SoftwareModuleMetadata> swMetadataList = softwareModuleManagement
.findSoftwareModuleMetadataBySoftwareModuleId(selectedSWModuleId,
new PageRequest(0, MAX_METADATA_QUERY))
.findMetaDataBySoftwareModuleId(new PageRequest(0, MAX_METADATA_QUERY),
selectedSWModuleId)
.getContent();
if (!CollectionUtils.isEmpty(swMetadataList)) {
swMetadataList.forEach(this::setSWMetadataProperties);
@@ -178,7 +178,7 @@ public class SoftwareModuleMetadatadetailslayout extends Table {
}
private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) {
softwareModuleManagement.findSoftwareModuleById(selectedSWModuleId).ifPresent(swmodule -> UI.getCurrent()
softwareModuleManagement.get(selectedSWModuleId).ifPresent(swmodule -> UI.getCurrent()
.addWindow(swMetadataPopupLayout.getWindow(swmodule, entityFactory.generateMetadata(metadataKey, ""))));
}

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.List;
import java.util.Objects;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagUpdatedEvent;
import org.eclipse.hawkbit.repository.model.BaseEntity;
@@ -37,11 +37,11 @@ public abstract class AbstractTargetTagToken<T extends BaseEntity> extends Abstr
private static final long serialVersionUID = 7772876588903171201L;
protected final transient TagManagement tagManagement;
protected final transient TargetTagManagement tagManagement;
protected AbstractTargetTagToken(final SpPermissionChecker checker, final VaadinMessageSource i18n,
final UINotification uinotification, final UIEventBus eventBus, final ManagementUIState managementUIState,
final TagManagement tagManagement) {
final TargetTagManagement tagManagement) {
super(checker, i18n, uinotification, eventBus, managementUIState);
this.tagManagement = tagManagement;
}

View File

@@ -13,7 +13,7 @@ import java.util.Objects;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpdatedEvent;
import org.eclipse.hawkbit.repository.model.DistributionSet;
@@ -45,7 +45,7 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
private static final long serialVersionUID = -8022738301736043396L;
private final transient TagManagement tagManagement;
private final transient DistributionSetTagManagement distributionSetTagManagement;
private final transient DistributionSetManagement distributionSetManagement;
@@ -54,9 +54,10 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
public DistributionTagToken(final SpPermissionChecker checker, final VaadinMessageSource i18n,
final UINotification uinotification, final UIEventBus eventBus, final ManagementUIState managementUIState,
final TagManagement tagManagement, final DistributionSetManagement distributionSetManagement) {
final DistributionSetTagManagement distributionSetTagManagement,
final DistributionSetManagement distributionSetManagement) {
super(checker, i18n, uinotification, eventBus, managementUIState);
this.tagManagement = tagManagement;
this.distributionSetTagManagement = distributionSetTagManagement;
this.distributionSetManagement = distributionSetManagement;
}
@@ -107,8 +108,8 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
public void displayAlreadyAssignedTags() {
removePreviouslyAddedTokens();
if (selectedEntity != null) {
tagManagement
.findDistributionSetTagsByDistributionSet(new PageRequest(0, MAX_TAG_QUERY), selectedEntity.getId())
distributionSetTagManagement
.findByDistributionSet(new PageRequest(0, MAX_TAG_QUERY), selectedEntity.getId())
.getContent().stream().forEach(tag -> addNewToken(tag.getId()));
}
}
@@ -117,7 +118,7 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
protected void populateContainer() {
container.removeAllItems();
tagDetails.clear();
tagManagement.findAllDistributionSetTags(new PageRequest(0, MAX_TAG_QUERY)).getContent().stream()
distributionSetTagManagement.findAll(new PageRequest(0, MAX_TAG_QUERY)).getContent().stream()
.forEach(tag -> setContainerPropertValues(tag.getId(), tag.getName(), tag.getColour()));
}
@@ -129,8 +130,7 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
@EventBusListenerMethod(scope = EventScope.UI)
void onDistributionSetTagCreatedBulkEvent(final DistributionSetTagCreatedEventContainer eventContainer) {
eventContainer.getEvents().stream().filter(Objects::nonNull)
.map(DistributionSetTagCreatedEvent::getEntity)
eventContainer.getEvents().stream().filter(Objects::nonNull).map(DistributionSetTagCreatedEvent::getEntity)
.forEach(distributionSetTag -> setContainerPropertValues(distributionSetTag.getId(),
distributionSetTag.getName(), distributionSetTag.getColour()));
}
@@ -143,8 +143,8 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
@EventBusListenerMethod(scope = EventScope.UI)
void onDistributionSetTagUpdateEvent(final DistributionSetTagUpdatedEventContainer eventContainer) {
eventContainer.getEvents().stream().filter(Objects::nonNull)
.map(DistributionSetTagUpdatedEvent::getEntity).forEach(entity -> {
eventContainer.getEvents().stream().filter(Objects::nonNull).map(DistributionSetTagUpdatedEvent::getEntity)
.forEach(entity -> {
final Item item = container.getItem(entity.getId());
if (item != null) {
updateItem(entity.getName(), entity.getColour(), item);

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.Arrays;
import java.util.Optional;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag;
@@ -46,7 +46,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
public TargetTagToken(final SpPermissionChecker checker, final VaadinMessageSource i18n,
final UINotification uinotification, final UIEventBus eventBus, final ManagementUIState managementUIState,
final TagManagement tagManagement, final TargetManagement targetManagement) {
final TargetTagManagement tagManagement, final TargetManagement targetManagement) {
super(checker, i18n, uinotification, eventBus, managementUIState, tagManagement);
this.targetManagement = targetManagement;
}
@@ -98,7 +98,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
protected void displayAlreadyAssignedTags() {
removePreviouslyAddedTokens();
if (selectedEntity != null) {
for (final TargetTag tag : tagManagement.findAllTargetTags(new PageRequest(0, MAX_TAGS),
for (final TargetTag tag : tagManagement.findByTarget(new PageRequest(0, MAX_TAGS),
selectedEntity.getControllerId())) {
addNewToken(tag.getId());
}
@@ -109,7 +109,7 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
protected void populateContainer() {
container.removeAllItems();
tagDetails.clear();
for (final TargetTag tag : tagManagement.findAllTargetTags(new PageRequest(0, MAX_TAGS))) {
for (final TargetTag tag : tagManagement.findAll(new PageRequest(0, MAX_TAGS))) {
setContainerPropertValues(tag.getId(), tag.getName(), tag.getColour());
}
}

View File

@@ -14,12 +14,12 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -100,7 +100,7 @@ public class DistributionsView extends AbstractNotificationView implements Brows
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement, final TargetManagement targetManagement,
final EntityFactory entityFactory, final TagManagement tagManagement,
final EntityFactory entityFactory, final DistributionSetTagManagement distributionSetTagManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final ArtifactUploadState artifactUploadState, final SystemManagement systemManagement,
final ArtifactManagement artifactManagement, final NotificationUnreadButton notificationUnreadButton,
@@ -110,17 +110,17 @@ public class DistributionsView extends AbstractNotificationView implements Brows
this.i18n = i18n;
this.uiNotification = uiNotification;
this.filterByDSTypeLayout = new DSTypeFilterLayout(manageDistUIState, i18n, permChecker, eventBus,
tagManagement, entityFactory, uiNotification, softwareModuleTypeManagement,
distributionSetTypeManagement, distributionsViewClientCriterion);
entityFactory, uiNotification, softwareModuleTypeManagement, distributionSetTypeManagement,
distributionSetManagement, distributionsViewClientCriterion);
this.distributionTableLayout = new DistributionSetTableLayout(i18n, eventBus, permChecker, manageDistUIState,
softwareModuleManagement, distributionSetManagement, distributionSetTypeManagement, targetManagement,
entityFactory, uiNotification, tagManagement, distributionsViewClientCriterion, systemManagement);
entityFactory, uiNotification, distributionSetTagManagement, distributionsViewClientCriterion,
systemManagement);
this.softwareModuleTableLayout = new SwModuleTableLayout(i18n, uiNotification, eventBus,
softwareModuleManagement, softwareModuleTypeManagement, entityFactory, manageDistUIState, permChecker,
distributionsViewClientCriterion, artifactUploadState, artifactManagement);
this.filterBySMTypeLayout = new DistSMTypeFilterLayout(eventBus, i18n, permChecker, manageDistUIState,
tagManagement, entityFactory, uiNotification, softwareModuleTypeManagement,
distributionsViewClientCriterion);
entityFactory, uiNotification, softwareModuleTypeManagement, distributionsViewClientCriterion);
this.deleteActionsLayout = new DSDeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
systemManagement, manageDistUIState, distributionsViewClientCriterion, distributionSetManagement,
distributionSetTypeManagement, softwareModuleManagement, softwareModuleTypeManagement);

View File

@@ -13,10 +13,10 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeUpdate;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
@@ -74,6 +74,8 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
private final transient DistributionSetTypeManagement distributionSetTypeManagement;
private final transient DistributionSetManagement distributionSetManagement;
private HorizontalLayout distTypeSelectLayout;
private Table sourceTable;
private Table selectedTable;
@@ -84,12 +86,10 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
private IndexedContainer originalSelectedTableContainer;
/**
* Constructor for CreateUpdateDistSetTypeLayout
* Constructor for {@link CreateUpdateDistSetTypeLayout}.
*
* @param i18n
* I18N
* @param tagManagement
* TagManagement
* @param entityFactory
* EntityFactory
* @param eventBus
@@ -101,15 +101,19 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
* @param softwareModuleTypeManagement
* management for {@link SoftwareModuleType}s
* @param distributionSetTypeManagement
* DistributionSetTypeManagement
* @param distributionSetManagement
* DistributionSetManagement
*/
public CreateUpdateDistSetTypeLayout(final VaadinMessageSource i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetTypeManagement distributionSetTypeManagement) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
public CreateUpdateDistSetTypeLayout(final VaadinMessageSource i18n, final EntityFactory entityFactory,
final UIEventBus eventBus, final SpPermissionChecker permChecker, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final DistributionSetManagement distributionSetManagement) {
super(i18n, entityFactory, eventBus, permChecker, uiNotification);
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
this.distributionSetTypeManagement = distributionSetTypeManagement;
this.distributionSetManagement = distributionSetManagement;
}
@Override
@@ -155,7 +159,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
@Override
protected Color getColorForColorPicker() {
final Optional<DistributionSetType> existedDistType = distributionSetTypeManagement
.findDistributionSetTypeByName(tagNameComboBox.getValue().toString());
.getByName(tagNameComboBox.getValue().toString());
if (existedDistType.isPresent()) {
return existedDistType.get().getColour() != null
? ColorPickerHelper.rgbToColorConverter(existedDistType.get().getColour())
@@ -194,7 +198,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
twinColumnLayout.setExpandRatio(sourceTable, 0.45F);
twinColumnLayout.setExpandRatio(selectButtonLayout, 0.07F);
twinColumnLayout.setExpandRatio(selectedTable, 0.48F);
sourceTable.setVisibleColumns(new Object[] { DIST_TYPE_NAME });
sourceTable.setVisibleColumns(DIST_TYPE_NAME);
return twinColumnLayout;
}
@@ -263,7 +267,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
sourceTableContainer.addContainerProperty(DIST_TYPE_DESCRIPTION, String.class, "");
sourceTable.setContainerDataSource(sourceTableContainer);
sourceTable.setVisibleColumns(new Object[] { DIST_TYPE_NAME });
sourceTable.setVisibleColumns(DIST_TYPE_NAME);
sourceTable.setColumnHeaders(i18n.getMessage("header.dist.twintable.available"));
sourceTable.setColumnExpandRatio(DIST_TYPE_NAME, 1.0F);
getSourceTableData();
@@ -317,7 +321,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
sourceTableContainer.removeAllItems();
final Iterable<SoftwareModuleType> moduleTypeBeans = softwareModuleTypeManagement
.findSoftwareModuleTypesAll(new PageRequest(0, 1_000));
.findAll(new PageRequest(0, 1_000));
Item saveTblitem;
for (final SoftwareModuleType swTypeTag : moduleTypeBeans) {
saveTblitem = sourceTableContainer.addItem(swTypeTag.getId());
@@ -398,11 +402,10 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
final List<Long> optional = itemIds.stream()
.filter(itemId -> isOptionalModuleType(selectedTable.getItem(itemId))).collect(Collectors.toList());
final DistributionSetType newDistType = distributionSetTypeManagement.createDistributionSetType(
entityFactory.distributionSetType().create().key(typeKeyValue).name(typeNameValue)
final DistributionSetType newDistType = distributionSetTypeManagement
.create(entityFactory.distributionSetType().create().key(typeKeyValue).name(typeNameValue)
.description(typeDescValue).colour(colorPicked).mandatory(mandatory).optional(optional));
uiNotification
.displaySuccess(i18n.getMessage("message.save.success", new Object[] { newDistType.getName() }));
uiNotification.displaySuccess(i18n.getMessage("message.save.success", newDistType.getName()));
eventBus.publish(this,
new DistributionSetTypeEvent(DistributionSetTypeEnum.ADD_DIST_SET_TYPE, newDistType));
} else {
@@ -430,8 +433,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
final DistributionSetTypeUpdate update = entityFactory.distributionSetType().update(existingType.getId())
.description(tagDesc.getValue())
.colour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview()));
if (distributionSetTypeManagement.countDistributionSetsByType(existingType.getId()) <= 0
&& !CollectionUtils.isEmpty(itemIds)) {
if (distributionSetManagement.countByTypeId(existingType.getId()) <= 0 && !CollectionUtils.isEmpty(itemIds)) {
update.mandatory(itemIds.stream().filter(itemId -> isMandatoryModuleType(selectedTable.getItem(itemId)))
.collect(Collectors.toList()))
@@ -439,10 +441,9 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
.collect(Collectors.toList()));
}
final DistributionSetType updateDistSetType = distributionSetTypeManagement.updateDistributionSetType(update);
final DistributionSetType updateDistSetType = distributionSetTypeManagement.update(update);
uiNotification.displaySuccess(
i18n.getMessage("message.update.success", new Object[] { updateDistSetType.getName() }));
uiNotification.displaySuccess(i18n.getMessage("message.update.success", updateDistSetType.getName()));
eventBus.publish(this,
new DistributionSetTypeEvent(DistributionSetTypeEnum.UPDATE_DIST_SET_TYPE, updateDistSetType));
@@ -529,10 +530,10 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
tagName.setValue(distSetTypeSelected);
getSourceTableData();
selectedTable.getContainerDataSource().removeAllItems();
distributionSetTypeManagement.findDistributionSetTypeByName(distSetTypeSelected).ifPresent(selectedTypeTag -> {
distributionSetTypeManagement.getByName(distSetTypeSelected).ifPresent(selectedTypeTag -> {
tagDesc.setValue(selectedTypeTag.getDescription());
typeKey.setValue(selectedTypeTag.getKey());
if (distributionSetTypeManagement.countDistributionSetsByType(selectedTypeTag.getId()) <= 0) {
if (distributionSetManagement.countByTypeId(selectedTypeTag.getId()) <= 0) {
distTypeSelectLayout.setEnabled(true);
selectedTable.setEnabled(true);
} else {
@@ -585,17 +586,17 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout<Distri
@Override
protected Optional<DistributionSetType> findEntityByKey() {
return distributionSetTypeManagement.findDistributionSetTypeByKey(typeKey.getValue());
return distributionSetTypeManagement.getByKey(typeKey.getValue());
}
@Override
protected Optional<DistributionSetType> findEntityByName() {
return distributionSetTypeManagement.findDistributionSetTypeByName(tagName.getValue());
return distributionSetTypeManagement.getByName(tagName.getValue());
}
@Override
protected String getDuplicateKeyErrorMessage(final DistributionSetType existingType) {
return i18n.getMessage("message.type.key.duplicate.check", new Object[] { existingType.getKey() });
return i18n.getMessage("message.type.key.duplicate.check", existingType.getKey());
}
@Override

View File

@@ -47,7 +47,7 @@ public class DSTypeFilterButtonClick extends AbstractFilterSingleButtonClick imp
@Override
protected void filterClicked(final Button clickedButton) {
distributionSetTypeManagement.findDistributionSetTypeByName(clickedButton.getData().toString())
distributionSetTypeManagement.getByName(clickedButton.getData().toString())
.ifPresent(manageDistUIState.getManageDistFilters()::setClickedDistSetType);
eventBus.publish(this, new RefreshDistributionTableByFilterEvent());
}

View File

@@ -8,10 +8,10 @@
*/
package org.eclipse.hawkbit.ui.distributions.disttype;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
@@ -38,14 +38,15 @@ public class DSTypeFilterHeader extends AbstractFilterHeader {
private final CreateUpdateDistSetTypeLayout createUpdateDistSetTypeLayout;
DSTypeFilterHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetTypeManagement distributionSetTypeManagement) {
final ManageDistUIState manageDistUIState, final EntityFactory entityFactory,
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final DistributionSetManagement distributionSetManagement) {
super(permChecker, eventBus, i18n);
this.manageDistUIState = manageDistUIState;
this.createUpdateDistSetTypeLayout = new CreateUpdateDistSetTypeLayout(i18n, tagManagement, entityFactory,
eventBus, permChecker, uiNotification, softwareModuleTypeManagement, distributionSetTypeManagement);
this.createUpdateDistSetTypeLayout = new CreateUpdateDistSetTypeLayout(i18n, entityFactory, eventBus,
permChecker, uiNotification, softwareModuleTypeManagement, distributionSetTypeManagement,
distributionSetManagement);
if (hasCreateUpdatePermission()) {
createUpdateDistSetTypeLayout.init();
}

View File

@@ -8,10 +8,10 @@
*/
package org.eclipse.hawkbit.ui.distributions.disttype;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterLayout;
import org.eclipse.hawkbit.ui.dd.criteria.DistributionsViewClientCriterion;
@@ -33,13 +33,13 @@ public class DSTypeFilterLayout extends AbstractFilterLayout {
private final ManageDistUIState manageDistUIState;
public DSTypeFilterLayout(final ManageDistUIState manageDistUIState, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final EntityFactory entityFactory,
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final DistributionSetManagement distributionSetManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion) {
super(new DSTypeFilterHeader(i18n, permChecker, eventBus, manageDistUIState, tagManagement, entityFactory,
uiNotification, softwareModuleTypeManagement, distributionSetTypeManagement),
super(new DSTypeFilterHeader(i18n, permChecker, eventBus, manageDistUIState, entityFactory, uiNotification,
softwareModuleTypeManagement, distributionSetTypeManagement, distributionSetManagement),
new DSTypeFilterButtons(eventBus, manageDistUIState, distributionsViewClientCriterion,
distributionSetTypeManagement));
this.manageDistUIState = manageDistUIState;

View File

@@ -13,9 +13,9 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -69,14 +69,15 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
final ManagementUIState managementUIState,
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout,
final SoftwareModuleManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final TargetManagement targetManagement, final EntityFactory entityFactory,
final UINotification uiNotification, final TagManagement tagManagement,
final SoftwareModuleManagement softwareManagement,
final DistributionSetManagement distributionSetManagement, final TargetManagement targetManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final DistributionSetTagManagement distributionSetTagManagement,
final DsMetadataPopupLayout dsMetadataPopupLayout) {
super(i18n, eventBus, permissionChecker, managementUIState, distributionAddUpdateWindowLayout,
distributionSetManagement, dsMetadataPopupLayout, entityFactory, uiNotification, tagManagement,
createSoftwareModuleDetailsTable(i18n, permissionChecker, distributionSetManagement, eventBus,
manageDistUIState, uiNotification));
distributionSetManagement, dsMetadataPopupLayout, entityFactory, uiNotification,
distributionSetTagManagement, createSoftwareModuleDetailsTable(i18n, permissionChecker,
distributionSetManagement, eventBus, manageDistUIState, uiNotification));
this.manageDistUIState = manageDistUIState;
this.softwareModuleManagement = softwareManagement;
this.targetManagement = targetManagement;
@@ -127,7 +128,7 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
}
softwareModuleIdNameList.stream().map(SoftwareModuleIdName::getId)
.map(softwareModuleManagement::findSoftwareModuleById)
.map(softwareModuleManagement::get)
.forEach(found -> found.ifPresent(softwareModule -> {
if (assignedSWModule.containsKey(softwareModule.getType().getName())) {
@@ -157,7 +158,7 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
private Button assignSoftModuleButton(final String softwareModuleName) {
if (getPermissionChecker().hasUpdateDistributionPermission() && manageDistUIState.getLastSelectedDistribution()
.map(selected -> targetManagement.countTargetByAssignedDistributionSet(selected) <= 0).orElse(false)) {
.map(selected -> targetManagement.countByAssignedDistributionSet(selected) <= 0).orElse(false)) {
final Button reassignSoftModule = SPUIComponentProvider.getButton(softwareModuleName, "", "", "", true,
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
@@ -254,7 +255,7 @@ public class DistributionSetDetails extends AbstractDistributionSetDetails {
assignedSWModule.clear();
}
getDistributionSetManagement().findDistributionSetByIdWithDetails(getSelectedBaseEntityId())
getDistributionSetManagement().getWithDetails(getSelectedBaseEntityId())
.ifPresent(set -> {
setSelectedBaseEntity(set);
UI.getCurrent().access(this::populateModule);

View File

@@ -182,7 +182,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
@Override
protected Optional<DistributionSet> findEntityByTableValue(final Long entityTableId) {
return distributionSetManagement.findDistributionSetByIdWithDetails(entityTableId);
return distributionSetManagement.getWithDetails(entityTableId);
}
@Override
@@ -239,7 +239,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
private void handleDropEvent(final Table source, final Set<Long> softwareModulesIdList, final Object distId) {
final Optional<DistributionSet> distributionSet = distributionSetManagement
.findDistributionSetById((Long) distId);
.get((Long) distId);
if (!distributionSet.isPresent()) {
notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
@@ -262,7 +262,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
final String swVersion = (String) softwareItem.getItemProperty(SPUILabelDefinitions.VAR_VERSION).getValue();
final Optional<SoftwareModule> softwareModule = softwareModuleManagement
.findSoftwareModuleById(softwareModuleId);
.get(softwareModuleId);
if (softwareModule.isPresent() && validSoftwareModule((Long) distId, softwareModule.get())) {
final SoftwareModuleIdName softwareModuleIdName = new SoftwareModuleIdName(softwareModuleId,
@@ -321,12 +321,12 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
if (!isSoftwareModuleDragged(distId, sm)) {
return false;
}
final Optional<DistributionSet> ds = distributionSetManagement.findDistributionSetByIdWithDetails(distId);
final Optional<DistributionSet> ds = distributionSetManagement.getWithDetails(distId);
if (!ds.isPresent() || !validateSoftwareModule(sm, ds.get())) {
return false;
}
if (distributionSetManagement.isDistributionSetInUse(ds.get().getId())) {
if (distributionSetManagement.isInUse(ds.get().getId())) {
notification.displayValidationError(i18n.getMessage("message.error.notification.ds.target.assigned",
ds.get().getName(), ds.get().getVersion()));
return false;
@@ -335,7 +335,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
}
private boolean validateSoftwareModule(final SoftwareModule sm, final DistributionSet ds) {
if (targetManagement.countTargetByFilters(null, null, null, ds.getId(), Boolean.FALSE, new String[] {}) > 0) {
if (targetManagement.countByFilters(null, null, null, ds.getId(), Boolean.FALSE, new String[] {}) > 0) {
/* Distribution is already assigned */
notification.displayValidationError(i18n.getMessage("message.dist.inuse",
HawkbitCommonUtil.concatStrings(":", ds.getName(), ds.getVersion())));
@@ -479,7 +479,7 @@ public class DistributionSetTable extends AbstractNamedVersionTable<Distribution
}
private void showMetadataDetails(final Long itemId) {
distributionSetManagement.findDistributionSetByIdWithDetails(itemId)
distributionSetManagement.getWithDetails(itemId)
.ifPresent(ds -> UI.getCurrent().addWindow(dsMetadataPopupLayout.getWindow(ds, null)));
}

View File

@@ -9,11 +9,11 @@
package org.eclipse.hawkbit.ui.distributions.dstable;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
@@ -35,9 +35,11 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
public DistributionSetTableLayout(final VaadinMessageSource i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManageDistUIState manageDistUIState,
final SoftwareModuleManagement softwareManagement, final DistributionSetManagement distributionSetManagement,
final SoftwareModuleManagement softwareManagement,
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement, final TargetManagement targetManagement,
final EntityFactory entityFactory, final UINotification uiNotification, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final DistributionSetTagManagement distributionSetTagManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion,
final SystemManagement systemManagement) {
@@ -58,7 +60,7 @@ public class DistributionSetTableLayout extends AbstractTableLayout<Distribution
distributionSetTable,
new DistributionSetDetails(i18n, eventBus, permissionChecker, manageDistUIState, null,
distributionAddUpdateWindowLayout, softwareManagement, distributionSetManagement,
targetManagement, entityFactory, uiNotification, tagManagement, popupLayout));
targetManagement, entityFactory, uiNotification, distributionSetTagManagement, popupLayout));
}
public DistributionSetTable getDistributionSetTable() {

View File

@@ -45,13 +45,13 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
@Override
protected boolean checkForDuplicate(final DistributionSet entity, final String value) {
return distributionSetManagement.findDistributionSetMetadata(entity.getId(), value).isPresent();
return distributionSetManagement.getMetaDataByDistributionSetId(entity.getId(), value).isPresent();
}
@Override
protected DistributionSetMetadata createMetadata(final DistributionSet entity, final String key,
final String value) {
final DistributionSetMetadata dsMetaData = distributionSetManagement.createDistributionSetMetadata(
final DistributionSetMetadata dsMetaData = distributionSetManagement.createMetaData(
entity.getId(), Arrays.asList(entityFactory.generateMetadata(key, value))).get(0);
setSelectedEntity(dsMetaData.getDistributionSet());
return dsMetaData;
@@ -61,7 +61,7 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
protected DistributionSetMetadata updateMetadata(final DistributionSet entity, final String key,
final String value) {
final DistributionSetMetadata dsMetaData = distributionSetManagement
.updateDistributionSetMetadata(entity.getId(), entityFactory.generateMetadata(key, value));
.updateMetaData(entity.getId(), entityFactory.generateMetadata(key, value));
setSelectedEntity(dsMetaData.getDistributionSet());
return dsMetaData;
}
@@ -69,13 +69,13 @@ public class DsMetadataPopupLayout extends AbstractMetadataPopupLayout<Distribut
@Override
protected List<MetaData> getMetadataList() {
return Collections.unmodifiableList(distributionSetManagement
.findDistributionSetMetadataByDistributionSetId(getSelectedEntity().getId(), new PageRequest(0, 500))
.findMetaDataByDistributionSetId(new PageRequest(0, 500), getSelectedEntity().getId())
.getContent());
}
@Override
protected void deleteMetadata(final DistributionSet entity, final String key, final String value) {
distributionSetManagement.deleteDistributionSetMetadata(entity.getId(), key);
distributionSetManagement.deleteMetaData(entity.getId(), key);
}
@Override

View File

@@ -72,7 +72,7 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
}
}
if (sortStates!= null && sortStates.length > 0) {
if (sortStates != null && sortStates.length > 0) {
// Initialize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort
@@ -96,13 +96,13 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
distBeans = firstPageDistributionSets;
} else if (StringUtils.isEmpty(searchText)) {
// if no search filters available
distBeans = getDistributionSetManagement().findDistributionSetsByDeletedAndOrCompleted(
new OffsetBasedPageRequest(startIndex, count, sort), false, dsComplete);
distBeans = getDistributionSetManagement()
.findByCompleted(new OffsetBasedPageRequest(startIndex, count, sort), dsComplete);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(dsComplete).setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE)
.setType(distributionSetType).build();
distBeans = getDistributionSetManagement().findDistributionSetsByFilters(
distBeans = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(startIndex / count, count, sort), distributionSetFilter);
}
@@ -122,13 +122,13 @@ public class ManageDistBeanQuery extends AbstractBeanQuery<ProxyDistribution> {
public int size() {
if (StringUtils.isEmpty(searchText) && null == distributionSetType) {
// if no search filters available
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsByDeletedAndOrCompleted(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), false, dsComplete);
firstPageDistributionSets = getDistributionSetManagement()
.findByCompleted(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), dsComplete);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(dsComplete).setSearchText(searchText).setSelectDSWithNoTag(Boolean.FALSE)
.setType(distributionSetType).build();
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsByFilters(
firstPageDistributionSets = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
}
final long size = firstPageDistributionSets.getTotalElements();

View File

@@ -191,7 +191,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
final AbstractTable<?> table = (AbstractTable<?>) sourceTable;
final Set<Long> ids = table.getDeletedEntityByTransferable(transferable);
final List<DistributionSet> findDistributionSetAllById = distributionSetManagement
.findDistributionSetsById(ids);
.get(ids);
if (findDistributionSetAllById.isEmpty()) {
notification.displayWarning(i18n.getMessage("distributionsets.not.exists"));

View File

@@ -176,7 +176,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
removeAssignedSoftwareModules();
}
softwareModuleManagement.deleteSoftwareModules(swmoduleIds);
softwareModuleManagement.delete(swmoduleIds);
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.REMOVE_ENTITY, swmoduleIds));
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
@@ -292,8 +292,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
final int deleteSWModuleTypeCount = manageDistUIState.getSelectedDeleteSWModuleTypes().size();
for (final String swModuleTypeName : manageDistUIState.getSelectedDeleteSWModuleTypes()) {
softwareModuleTypeManagement.findSoftwareModuleTypeByName(swModuleTypeName).map(SoftwareModuleType::getId)
.ifPresent(softwareModuleTypeManagement::deleteSoftwareModuleType);
softwareModuleTypeManagement.getByName(swModuleTypeName).map(SoftwareModuleType::getId)
.ifPresent(softwareModuleTypeManagement::delete);
}
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
+ i18n.getMessage("message.sw.module.type.delete", new Object[] { deleteSWModuleTypeCount }));
@@ -383,7 +383,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
});
}
distributionSetManagement.deleteDistributionSet(Arrays.asList(deletedIds));
distributionSetManagement.delete(Arrays.asList(deletedIds));
eventBus.publish(this,
new DistributionTableEvent(BaseEntityEventType.REMOVE_ENTITY, Arrays.asList(deletedIds)));
@@ -474,8 +474,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
final int deleteDistTypeCount = manageDistUIState.getSelectedDeleteDistSetTypes().size();
manageDistUIState.getSelectedDeleteDistSetTypes().stream()
.map(deleteDistTypeName -> distributionSetTypeManagement
.findDistributionSetTypeByName(deleteDistTypeName).get().getId())
.forEach(distributionSetTypeManagement::deleteDistributionSetType);
.getByName(deleteDistTypeName).get().getId())
.forEach(distributionSetTypeManagement::delete);
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
+ i18n.getMessage("message.dist.type.delete", new Object[] { deleteDistTypeCount }));

View File

@@ -37,8 +37,8 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
private final transient EntityFactory entityFactory;
public SwMetadataPopupLayout(final VaadinMessageSource i18n, final UINotification uiNotification,
final UIEventBus eventBus, final SoftwareModuleManagement softwareManagement, final EntityFactory entityFactory,
final SpPermissionChecker permChecker) {
final UIEventBus eventBus, final SoftwareModuleManagement softwareManagement,
final EntityFactory entityFactory, final SpPermissionChecker permChecker) {
super(i18n, uiNotification, eventBus, permChecker);
this.softwareModuleManagement = softwareManagement;
this.entityFactory = entityFactory;
@@ -46,7 +46,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
@Override
protected boolean checkForDuplicate(final SoftwareModule entity, final String value) {
return softwareModuleManagement.findSoftwareModuleMetadata(entity.getId(), value).isPresent();
return softwareModuleManagement.getMetaDataBySoftwareModuleId(entity.getId(), value).isPresent();
}
/**
@@ -54,7 +54,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
*/
@Override
protected SoftwareModuleMetadata createMetadata(final SoftwareModule entity, final String key, final String value) {
final SoftwareModuleMetadata swMetadata = softwareModuleManagement.createSoftwareModuleMetadata(entity.getId(),
final SoftwareModuleMetadata swMetadata = softwareModuleManagement.createMetaData(entity.getId(),
entityFactory.generateMetadata(key, value));
setSelectedEntity(swMetadata.getSoftwareModule());
eventBus.publish(this, new MetadataEvent(MetadataUIEvent.CREATE_SOFTWARE_MODULE_METADATA, swMetadata, entity));
@@ -66,7 +66,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
*/
@Override
protected SoftwareModuleMetadata updateMetadata(final SoftwareModule entity, final String key, final String value) {
final SoftwareModuleMetadata swMetadata = softwareModuleManagement.updateSoftwareModuleMetadata(entity.getId(),
final SoftwareModuleMetadata swMetadata = softwareModuleManagement.updateMetaData(entity.getId(),
entityFactory.generateMetadata(key, value));
setSelectedEntity(swMetadata.getSoftwareModule());
return swMetadata;
@@ -74,8 +74,8 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
@Override
protected List<MetaData> getMetadataList() {
return Collections.unmodifiableList(softwareModuleManagement.findSoftwareModuleMetadataBySoftwareModuleId(
new PageRequest(0, MAX_METADATA_QUERY), getSelectedEntity().getId()).getContent());
return Collections.unmodifiableList(softwareModuleManagement
.findMetaDataBySoftwareModuleId(new PageRequest(0, MAX_METADATA_QUERY), getSelectedEntity().getId()).getContent());
}
/**
@@ -83,7 +83,7 @@ public class SwMetadataPopupLayout extends AbstractMetadataPopupLayout<SoftwareM
*/
@Override
protected void deleteMetadata(final SoftwareModule entity, final String key, final String value) {
softwareModuleManagement.deleteSoftwareModuleMetadata(entity.getId(), key);
softwareModuleManagement.deleteMetaData(entity.getId(), key);
eventBus.publish(this, new MetadataEvent(MetadataUIEvent.DELETE_SOFTWARE_MODULE_METADATA,
entityFactory.generateMetadata(key, value), entity));
}

View File

@@ -81,7 +81,7 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
@Override
protected List<ProxyBaseSwModuleItem> loadBeans(final int startIndex, final int count) {
return getSoftwareModuleManagement()
.findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
.findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
new OffsetBasedPageRequest(startIndex, count), orderByDistId, searchText, type)
.getContent().stream().map(SwModuleBeanQuery::getProxyBean).collect(Collectors.toList());
}
@@ -110,9 +110,9 @@ public class SwModuleBeanQuery extends AbstractBeanQuery<ProxyBaseSwModuleItem>
public int size() {
long size;
if (type == null && StringUtils.isEmpty(searchText)) {
size = getSoftwareModuleManagement().countSoftwareModulesAll();
size = getSoftwareModuleManagement().count();
} else {
size = getSoftwareModuleManagement().countSoftwareModuleByFilters(searchText, type);
size = getSoftwareModuleManagement().countByTextAndType(searchText, type);
}
if (size > Integer.MAX_VALUE) {

View File

@@ -255,7 +255,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
@Override
protected Optional<SoftwareModule> findEntityByTableValue(final Long lastSelectedId) {
return softwareModuleManagement.findSoftwareModuleById(lastSelectedId);
return softwareModuleManagement.get(lastSelectedId);
}
@Override
@@ -417,7 +417,7 @@ public class SwModuleTable extends AbstractNamedVersionTable<SoftwareModule> {
}
private void showMetadataDetails(final Long itemId) {
softwareModuleManagement.findSoftwareModuleById(itemId)
softwareModuleManagement.get(itemId)
.ifPresent(swmodule -> UI.getCurrent().addWindow(swMetadataPopupLayout.getWindow(swmodule, null)));
}

View File

@@ -45,7 +45,7 @@ public class DistSMTypeFilterButtonClick extends AbstractFilterSingleButtonClick
@Override
protected void filterClicked(final Button clickedButton) {
softwareModuleTypeManagement.findSoftwareModuleTypeByName(clickedButton.getData().toString())
softwareModuleTypeManagement.getByName(clickedButton.getData().toString())
.ifPresent(smType -> {
manageDistUIState.getSoftwareModuleFilters().setSoftwareModuleType(smType);
eventBus.publish(this, new RefreshSoftwareModuleByFilterEvent());

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.distributions.smtype;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.artifacts.smtype.CreateUpdateSoftwareTypeLayout;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
@@ -37,13 +36,12 @@ public class DistSMTypeFilterHeader extends AbstractFilterHeader {
private final CreateUpdateSoftwareTypeLayout createUpdateSWTypeLayout;
DistSMTypeFilterHeader(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
final UIEventBus eventBus, final ManageDistUIState manageDistUIState, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
final UIEventBus eventBus, final ManageDistUIState manageDistUIState, final EntityFactory entityFactory,
final UINotification uiNotification, final SoftwareModuleTypeManagement softwareModuleTypeManagement) {
super(permChecker, eventBus, i18n);
this.manageDistUIState = manageDistUIState;
this.createUpdateSWTypeLayout = new CreateUpdateSoftwareTypeLayout(i18n, tagManagement, entityFactory, eventBus,
permChecker, uiNotification, softwareModuleTypeManagement);
this.createUpdateSWTypeLayout = new CreateUpdateSoftwareTypeLayout(i18n, entityFactory, eventBus, permChecker,
uiNotification, softwareModuleTypeManagement);
if (hasCreateUpdatePermission()) {
createUpdateSWTypeLayout.init();

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.ui.distributions.smtype;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterLayout;
import org.eclipse.hawkbit.ui.dd.criteria.DistributionsViewClientCriterion;
@@ -33,11 +32,11 @@ public class DistSMTypeFilterLayout extends AbstractFilterLayout {
public DistSMTypeFilterLayout(final UIEventBus eventBus, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker, final ManageDistUIState manageDistUIState,
final TagManagement tagManagement, final EntityFactory entityFactory, final UINotification uiNotification,
final EntityFactory entityFactory, final UINotification uiNotification,
final SoftwareModuleTypeManagement softwareModuleTypeManagement,
final DistributionsViewClientCriterion distributionsViewClientCriterion) {
super(new DistSMTypeFilterHeader(i18n, permChecker, eventBus, manageDistUIState, tagManagement, entityFactory,
uiNotification, softwareModuleTypeManagement),
super(new DistSMTypeFilterHeader(i18n, permChecker, eventBus, manageDistUIState, entityFactory, uiNotification,
softwareModuleTypeManagement),
new DistSMTypeFilterButtons(eventBus, manageDistUIState, distributionsViewClientCriterion,
softwareModuleTypeManagement));
this.manageDistUIState = manageDistUIState;

View File

@@ -368,7 +368,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
}
private void createTargetFilterQuery() {
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement.createTargetFilterQuery(entityFactory
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement.create(entityFactory
.targetFilterQuery().create().name(nameTextField.getValue()).query(queryTextField.getValue()));
notification.displaySuccess(
i18n.getMessage("message.create.filter.success", new Object[] { targetFilterQuery.getName() }));
@@ -382,7 +382,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
}
final TargetFilterQuery targetFilterQuery = tfQuery.get();
final TargetFilterQuery updatedTargetFilter = targetFilterQueryManagement
.updateTargetFilterQuery(entityFactory.targetFilterQuery().update(targetFilterQuery.getId())
.update(entityFactory.targetFilterQuery().update(targetFilterQuery.getId())
.name(nameTextField.getValue()).query(queryTextField.getValue()));
filterManagementUIState.setTfQuery(updatedTargetFilter);
oldFilterName = nameTextField.getValue();
@@ -400,7 +400,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
}
private boolean doesAlreadyExists() {
if (targetFilterQueryManagement.findTargetFilterQueryByName(nameTextField.getValue()).isPresent()) {
if (targetFilterQueryManagement.getByName(nameTextField.getValue()).isPresent()) {
notification.displayValidationError(
i18n.getMessage("message.target.filter.duplicate", nameTextField.getValue()));
return true;

View File

@@ -89,10 +89,10 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
Slice<Target> targetBeans;
final List<ProxyTarget> proxyTargetBeans = new ArrayList<>();
if (!StringUtils.isEmpty(filterQuery)) {
targetBeans = targetManagement.findTargetsAll(filterQuery,
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
targetBeans = targetManagement.findByRsql(new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
filterQuery);
} else {
targetBeans = targetManagement.findTargetsAll(
targetBeans = targetManagement.findAll(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
}
@@ -129,7 +129,7 @@ public class CustomTargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
public int size() {
long size = 0;
if (!StringUtils.isEmpty(filterQuery)) {
size = getTargetManagement().countTargetByTargetFilterQuery(filterQuery);
size = getTargetManagement().countByRsql(filterQuery);
}
getFilterManagementUIState().setTargetsCountAll(size);
if (size > SPUIDefinitions.MAX_TABLE_ENTRIES) {

View File

@@ -105,7 +105,7 @@ public class DistributionSetSelectWindow
*/
public void showForTargetFilter(final Long tfqId) {
this.tfqId = tfqId;
final TargetFilterQuery tfq = targetFilterQueryManagement.findTargetFilterQueryById(tfqId)
final TargetFilterQuery tfq = targetFilterQueryManagement.get(tfqId)
.orElseThrow(() -> new EntityNotFoundException(TargetFilterQuery.class, tfqId));
initLocal();
@@ -164,13 +164,13 @@ public class DistributionSetSelectWindow
}
private void updateTargetFilterQueryDS(final Long targetFilterQueryId, final Long dsId) {
final TargetFilterQuery tfq = targetFilterQueryManagement.findTargetFilterQueryById(targetFilterQueryId)
final TargetFilterQuery tfq = targetFilterQueryManagement.get(targetFilterQueryId)
.orElseThrow(() -> new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId));
if (dsId != null) {
confirmWithConsequencesDialog(tfq, dsId);
} else {
targetFilterQueryManagement.updateTargetFilterQueryAutoAssignDS(targetFilterQueryId, null);
targetFilterQueryManagement.updateAutoAssignDS(targetFilterQueryId, null);
eventBus.publish(this, CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY);
}
@@ -182,7 +182,7 @@ public class DistributionSetSelectWindow
@Override
public void onConfirmResult(final boolean accepted) {
if (accepted) {
targetFilterQueryManagement.updateTargetFilterQueryAutoAssignDS(tfq.getId(), dsId);
targetFilterQueryManagement.updateAutoAssignDS(tfq.getId(), dsId);
eventBus.publish(this, CustomFilterUIEvent.UPDATED_TARGET_FILTER_QUERY);
}
}
@@ -232,7 +232,7 @@ public class DistributionSetSelectWindow
layout.setMargin(true);
setContent(layout);
final Long targetsCount = targetManagement.countTargetsByTargetFilterQueryAndNonDS(distributionSetId,
final Long targetsCount = targetManagement.countByRsqlAndNonDS(distributionSetId,
targetFilterQuery.getQuery());
Label mainTextLabel;
if (targetsCount == 0) {

View File

@@ -84,10 +84,10 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
targetFilterQuery = firstPageTargetFilter;
} else if (StringUtils.isEmpty(searchText)) {
// if no search filters available
targetFilterQuery = getTargetFilterQueryManagement().findAllTargetFilterQuery(
targetFilterQuery = getTargetFilterQueryManagement().findAll(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
} else {
targetFilterQuery = getTargetFilterQueryManagement().findTargetFilterQueryByName(
targetFilterQuery = getTargetFilterQueryManagement().findByName(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
searchText);
}
@@ -121,10 +121,10 @@ public class TargetFilterBeanQuery extends AbstractBeanQuery<ProxyTargetFilter>
public int size() {
if (StringUtils.isEmpty(searchText)) {
firstPageTargetFilter = getTargetFilterQueryManagement()
.findAllTargetFilterQuery(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
.findAll(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
} else {
firstPageTargetFilter = getTargetFilterQueryManagement()
.findTargetFilterQueryByName(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), searchText);
.findByName(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), searchText);
}
final long size = firstPageTargetFilter.getTotalElements();

View File

@@ -179,9 +179,9 @@ public class TargetFilterTable extends Table {
i18n.getMessage("message.delete.filter.confirm"), i18n.getMessage("button.ok"), i18n.getMessage("button.cancel"), ok -> {
if (ok) {
final Long rowId = (Long) ((Button) event.getComponent()).getData();
final String deletedFilterName = targetFilterQueryManagement.findTargetFilterQueryById(rowId)
final String deletedFilterName = targetFilterQueryManagement.get(rowId)
.get().getName();
targetFilterQueryManagement.deleteTargetFilterQuery(rowId);
targetFilterQueryManagement.delete(rowId);
/*
* Refresh the custom filter table to show latest change
@@ -252,7 +252,7 @@ public class TargetFilterTable extends Table {
private void onClickOfDetailButton(final ClickEvent event) {
final String targetFilterName = (String) ((Button) event.getComponent()).getData();
targetFilterQueryManagement.findTargetFilterQueryByName(targetFilterName).ifPresent(targetFilterQuery -> {
targetFilterQueryManagement.getByName(targetFilterName).ifPresent(targetFilterQuery -> {
filterManagementUIState.setFilterQueryValue(targetFilterQuery.getQuery());
filterManagementUIState.setTfQuery(targetFilterQuery);
filterManagementUIState.setEditViewDisplayed(true);

View File

@@ -8,16 +8,10 @@
*/
package org.eclipse.hawkbit.ui.layouts;
import java.util.Objects;
import java.util.Optional;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.builder.TagUpdate;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
@@ -28,10 +22,7 @@ import org.eclipse.hawkbit.ui.common.builder.LabelBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
import org.eclipse.hawkbit.ui.common.builder.TextFieldBuilder;
import org.eclipse.hawkbit.ui.common.builder.WindowBuilder;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.management.event.DistributionSetTagTableEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTagTableEvent;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
@@ -80,8 +71,6 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
protected VaadinMessageSource i18n;
protected transient TagManagement tagManagement;
protected transient EntityFactory entityFactory;
protected transient EventBus.UIEventBus eventBus;
@@ -131,11 +120,9 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
* @param uiNotification
* UINotification
*/
public AbstractCreateUpdateTagLayout(final VaadinMessageSource i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification) {
public AbstractCreateUpdateTagLayout(final VaadinMessageSource i18n, final EntityFactory entityFactory,
final UIEventBus eventBus, final SpPermissionChecker permChecker, final UINotification uiNotification) {
this.i18n = i18n;
this.tagManagement = tagManagement;
this.entityFactory = entityFactory;
this.eventBus = eventBus;
this.permChecker = permChecker;
@@ -295,22 +282,7 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
colorPickerLayout.setVisible(tagPreviewBtnClicked);
}
/**
* @return the color which should be selected in the color-picker component.
*/
protected Color getColorForColorPicker() {
final Optional<TargetTag> targetTagSelected = tagManagement
.findTargetTag(tagNameComboBox.getValue().toString());
if (targetTagSelected.isPresent()) {
return ColorPickerHelper.rgbToColorConverter(targetTagSelected.map(TargetTag::getColour)
.filter(Objects::nonNull).orElse(ColorPickerConstants.DEFAULT_COLOR));
}
return ColorPickerHelper.rgbToColorConverter(tagManagement
.findDistributionSetTag(tagNameComboBox.getValue().toString()).map(DistributionSetTag::getColour)
.filter(Objects::nonNull).orElse(ColorPickerConstants.DEFAULT_COLOR));
}
protected abstract Color getColorForColorPicker();
private void tagNameChosen(final ValueChangeEvent event) {
final String tagSelected = (String) event.getProperty().getValue();
@@ -573,25 +545,6 @@ public abstract class AbstractCreateUpdateTagLayout<E extends NamedEntity> exten
tagDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagDesc.getValue());
}
/**
* update tag.
*/
protected void updateExistingTag(final Tag targetObj) {
final TagUpdate update = entityFactory.tag().update(targetObj.getId()).name(tagName.getValue())
.description(tagDesc.getValue())
.colour(ColorPickerHelper.getColorPickedString(colorPickerLayout.getSelPreview()));
if (targetObj instanceof TargetTag) {
tagManagement.updateTargetTag(update);
eventBus.publish(this, new TargetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY, (TargetTag) targetObj));
} else if (targetObj instanceof DistributionSetTag) {
tagManagement.updateDistributionSetTag(update);
eventBus.publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY,
(DistributionSetTag) targetObj));
}
uiNotification.displaySuccess(i18n.getMessage("message.update.success", new Object[] { targetObj.getName() }));
}
protected void displaySuccess(final String tagName) {
uiNotification.displaySuccess(i18n.getMessage("message.save.success", new Object[] { tagName }));
}

View File

@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.ui.layouts;
import java.util.Optional;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
@@ -47,9 +46,9 @@ public abstract class CreateUpdateTypeLayout<E extends NamedEntity> extends Abst
private static final String TYPE_NAME_DYNAMIC_STYLE = "new-tag-name";
private static final String TYPE_DESC_DYNAMIC_STYLE = "new-tag-desc";
public CreateUpdateTypeLayout(final VaadinMessageSource i18n, final TagManagement tagManagement, final EntityFactory entityFactory,
public CreateUpdateTypeLayout(final VaadinMessageSource i18n, final EntityFactory entityFactory,
final UIEventBus eventBus, final SpPermissionChecker permChecker, final UINotification uiNotification) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
super(i18n, entityFactory, eventBus, permChecker, uiNotification);
}
@Override
@@ -67,8 +66,8 @@ public abstract class CreateUpdateTypeLayout<E extends NamedEntity> extends Abst
colorLabel = new LabelBuilder().name(i18n.getMessage("label.choose.type.color")).buildLabel();
colorLabel.addStyleName(SPUIDefinitions.COLOR_LABEL_STYLE);
tagNameComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("label.combobox.type"), "", null, null, false, "",
i18n.getMessage("label.combobox.type"));
tagNameComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("label.combobox.type"), "", null, null,
false, "", i18n.getMessage("label.combobox.type"));
tagNameComboBox.setId(SPUIDefinitions.NEW_DISTRIBUTION_SET_TYPE_NAME_COMBO);
tagNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
tagNameComboBox.setImmediate(true);

View File

@@ -15,12 +15,13 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.ui.HawkbitUI;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.UiProperties;
@@ -124,7 +125,9 @@ public class DeploymentView extends AbstractNotificationView implements BrowserW
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement, final TargetManagement targetManagement,
final EntityFactory entityFactory, final UiProperties uiproperties,
final ManagementViewClientCriterion managementViewClientCriterion, final TagManagement tagManagement,
final ManagementViewClientCriterion managementViewClientCriterion,
final TargetTagManagement targetTagManagement,
final DistributionSetTagManagement distributionSetTagManagement,
final TargetFilterQueryManagement targetFilterQueryManagement, final SystemManagement systemManagement,
final NotificationUnreadButton notificationUnreadButton,
final DeploymentViewMenuItem deploymentViewMenuItem, @Qualifier("uiExecutor") final Executor uiExecutor) {
@@ -138,27 +141,28 @@ public class DeploymentView extends AbstractNotificationView implements BrowserW
this.actionStatusLayout = new ActionStatusLayout(i18n, eventBus, managementUIState);
this.actionStatusMsgLayout = new ActionStatusMsgLayout(i18n, eventBus, managementUIState);
final CreateUpdateTargetTagLayoutWindow createUpdateTargetTagLayout = new CreateUpdateTargetTagLayoutWindow(
i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
i18n, targetTagManagement, entityFactory, eventBus, permChecker, uiNotification);
this.targetTagFilterLayout = new TargetTagFilterLayout(i18n, createUpdateTargetTagLayout, managementUIState,
managementViewClientCriterion, permChecker, eventBus, uiNotification, entityFactory,
targetFilterQueryManagement);
final TargetTable targetTable = new TargetTable(eventBus, i18n, uiNotification, targetManagement,
managementUIState, permChecker, managementViewClientCriterion, distributionSetManagement,
tagManagement);
targetTagManagement);
this.targetTableLayout = new TargetTableLayout(eventbus, targetTable, targetManagement, entityFactory, i18n,
eventBus, uiNotification, managementUIState, managementViewClientCriterion, deploymentManagement,
uiproperties, permChecker, uiNotification, tagManagement, distributionSetManagement, uiExecutor);
uiproperties, permChecker, uiNotification, targetTagManagement, distributionSetManagement, uiExecutor);
this.distributionTagLayout = new DistributionTagLayout(eventbus, managementUIState, i18n, permChecker, eventBus,
tagManagement, entityFactory, uiNotification, distFilterParameters, distributionSetManagement,
managementViewClientCriterion);
distributionSetTagManagement, entityFactory, uiNotification, distFilterParameters,
distributionSetManagement, managementViewClientCriterion);
this.distributionTableLayout = new DistributionTableLayout(i18n, eventBus, permChecker, managementUIState,
distributionSetManagement, distributionSetTypeManagement, managementViewClientCriterion, entityFactory,
uiNotification, tagManagement, systemManagement, targetManagement, deploymentManagement);
uiNotification, distributionSetTagManagement, targetTagManagement, systemManagement, targetManagement,
deploymentManagement);
this.deleteAndActionsLayout = new DeleteActionsLayout(i18n, permChecker, eventBus, uiNotification,
tagManagement, managementViewClientCriterion, managementUIState, targetManagement, targetTable,
deploymentManagement, distributionSetManagement);
targetTagManagement, distributionSetTagManagement, managementViewClientCriterion, managementUIState,
targetManagement, targetTable, deploymentManagement, distributionSetManagement);
this.deploymentViewMenuItem = deploymentViewMenuItem;

View File

@@ -141,8 +141,8 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
final Long distSetTypeId = (Long) distsetTypeNameComboBox.getValue();
distributionSetTypeManagement.findDistributionSetTypeById(distSetTypeId).ifPresent(type -> {
final DistributionSet currentDS = distributionSetManagement.updateDistributionSet(
distributionSetTypeManagement.get(distSetTypeId).ifPresent(type -> {
final DistributionSet currentDS = distributionSetManagement.update(
entityFactory.distributionSet().update(editDistId).name(distNameTextField.getValue())
.description(descTextArea.getValue()).version(distVersionTextField.getValue())
.requiredMigrationStep(isMigStepReq).type(type));
@@ -166,10 +166,10 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
final DistributionSetType distributionSetType = distributionSetTypeManagement
.findDistributionSetTypeById(distSetTypeId)
.get(distSetTypeId)
.orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, distSetTypeId));
final DistributionSet newDist = distributionSetManagement
.createDistributionSet(entityFactory.distributionSet().create().name(name).version(version)
.create(entityFactory.distributionSet().create().name(name).version(version)
.description(desc).type(distributionSetType).requiredMigrationStep(isMigStepReq));
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.ADD_ENTITY, newDist));
@@ -183,7 +183,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
final String version = distVersionTextField.getValue();
final Optional<DistributionSet> existingDs = distributionSetManagement
.findDistributionSetByNameAndVersion(name, version);
.getByNameAndVersion(name, version);
/*
* Distribution should not exists with the same name & version.
* Display error message, when the "existingDs" is not null and it
@@ -297,7 +297,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
}
final Optional<DistributionSet> distSet = distributionSetManagement
.findDistributionSetByIdWithDetails(editDistId);
.getWithDetails(editDistId);
if (!distSet.isPresent()) {
return;
}

View File

@@ -75,7 +75,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
}
}
if (sortStates!= null && sortStates.length > 0) {
if (sortStates != null && sortStates.length > 0) {
// Initalize sort
sort = new Sort(sortStates[0] ? Direction.ASC : Direction.DESC, (String) sortPropertyIds[0]);
// Add sort
@@ -105,18 +105,18 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
.setIsDeleted(false).setIsComplete(true).setSearchText(searchText)
.setSelectDSWithNoTag(noTagClicked).setTagNames(distributionTags);
distBeans = getDistributionSetManagement().findDistributionSetsAllOrderedByLinkTarget(
distBeans = getDistributionSetManagement().findByFilterAndAssignedInstalledDsOrderedByLinkTarget(
new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilterBuilder,
pinnedTarget.getControllerId());
} else if (distributionTags.isEmpty() && StringUtils.isEmpty(searchText) && !noTagClicked) {
// if no search filters available
distBeans = getDistributionSetManagement().findDistributionSetsByDeletedAndOrCompleted(
new OffsetBasedPageRequest(startIndex, count, sort), false, true);
distBeans = getDistributionSetManagement()
.findByCompleted(new OffsetBasedPageRequest(startIndex, count, sort), true);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
.setTagNames(distributionTags).build();
distBeans = getDistributionSetManagement().findDistributionSetsByFilters(
distBeans = getDistributionSetManagement().findByDistributionSetFilter(
new OffsetBasedPageRequest(startIndex, count, sort), distributionSetFilter);
}
@@ -146,19 +146,20 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
.setIsDeleted(false).setIsComplete(true).setSearchText(searchText)
.setSelectDSWithNoTag(noTagClicked).setTagNames(distributionTags);
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsAllOrderedByLinkTarget(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilterBuilder,
pinnedTarget.getControllerId());
firstPageDistributionSets = getDistributionSetManagement()
.findByFilterAndAssignedInstalledDsOrderedByLinkTarget(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilterBuilder,
pinnedTarget.getControllerId());
} else if (distributionTags.isEmpty() && StringUtils.isEmpty(searchText) && !noTagClicked) {
// if no search filters available
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsByDeletedAndOrCompleted(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), false, true);
firstPageDistributionSets = getDistributionSetManagement()
.findByCompleted(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), true);
} else {
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(true).setSearchText(searchText).setSelectDSWithNoTag(noTagClicked)
.setTagNames(distributionTags).build();
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsByFilters(
firstPageDistributionSets = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
}

View File

@@ -9,8 +9,8 @@
package org.eclipse.hawkbit.ui.management.dstable;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.detailslayout.AbstractDistributionSetDetails;
import org.eclipse.hawkbit.ui.common.detailslayout.SoftwareModuleDetailsTable;
@@ -31,10 +31,11 @@ public class DistributionDetails extends AbstractDistributionSetDetails {
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
final DistributionSetManagement distributionSetManagement,
final DsMetadataPopupLayout dsMetadataPopupLayout, final EntityFactory entityFactory,
final UINotification uiNotification, final TagManagement tagManagement,
final UINotification uiNotification, final DistributionSetTagManagement distributionSetTagManagement,
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout) {
super(i18n, eventBus, permissionChecker, managementUIState, distributionAddUpdateWindowLayout,
distributionSetManagement, dsMetadataPopupLayout, entityFactory, uiNotification, tagManagement,
distributionSetManagement, dsMetadataPopupLayout, entityFactory, uiNotification,
distributionSetTagManagement,
createSoftwareModuleDetailsTable(i18n, permissionChecker, uiNotification));
restoreState();
}

View File

@@ -20,8 +20,8 @@ import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetUpdatedEvent;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
@@ -89,7 +89,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
private final transient TargetManagement targetManagement;
private final transient TagManagement tagManagement;
private final transient TargetTagManagement targetTagManagement;
private final DsMetadataPopupLayout dsMetadataPopupLayout;
@@ -109,13 +109,13 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
final ManagementViewClientCriterion managementViewClientCriterion, final TargetManagement targetManagement,
final DsMetadataPopupLayout dsMetadataPopupLayout,
final DistributionSetManagement distributionSetManagement, final DeploymentManagement deploymentManagement,
final TagManagement tagManagement) {
final TargetTagManagement targetTagManagement) {
super(eventBus, i18n, notification);
this.permissionChecker = permissionChecker;
this.managementUIState = managementUIState;
this.managementViewClientCriterion = managementViewClientCriterion;
this.targetManagement = targetManagement;
this.tagManagement = tagManagement;
this.targetTagManagement = targetTagManagement;
this.dsMetadataPopupLayout = dsMetadataPopupLayout;
this.distributionSetManagement = distributionSetManagement;
this.deploymentManagement = deploymentManagement;
@@ -306,7 +306,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
@Override
protected Optional<DistributionSet> findEntityByTableValue(final Long lastSelectedId) {
return distributionSetManagement.findDistributionSetByIdWithDetails(lastSelectedId);
return distributionSetManagement.getWithDetails(lastSelectedId);
}
@Override
@@ -394,12 +394,12 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
// get all the targets assigned to the tag
// assign dist to those targets
tagManagement.findTargetTag(targetTagName).ifPresent(tag -> {
targetTagManagement.getByName(targetTagName).ifPresent(tag -> {
Pageable query = new PageRequest(0, 500);
Page<Target> assignedTargets;
boolean assigned = false;
do {
assignedTargets = targetManagement.findTargetsByTag(query, tag.getId());
assignedTargets = targetManagement.findByTag(query, tag.getId());
if (assignedTargets.hasContent()) {
assignTargetToDs(getItem(distItemId), assignedTargets.getContent());
@@ -422,7 +422,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
final Object distItemId = dropData.getItemIdOver();
assignTargetToDs(getItem(distItemId), targetManagement.findTargetsById(targetIdSet));
assignTargetToDs(getItem(distItemId), targetManagement.get(targetIdSet));
}
@@ -437,8 +437,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
}
final Long distId = (Long) item.getItemProperty("id").getValue();
final Optional<DistributionSet> findDistributionSetById = distributionSetManagement
.findDistributionSetById(distId);
final Optional<DistributionSet> findDistributionSetById = distributionSetManagement.get(distId);
if (!findDistributionSetById.isPresent()) {
notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
return;
@@ -721,7 +720,7 @@ public class DistributionTable extends AbstractNamedVersionTable<DistributionSet
}
private void showMetadataDetails(final Object itemId) {
final Optional<DistributionSet> ds = distributionSetManagement.findDistributionSetById((Long) itemId);
final Optional<DistributionSet> ds = distributionSetManagement.get((Long) itemId);
if (!ds.isPresent()) {
notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
return;

View File

@@ -10,11 +10,12 @@ package org.eclipse.hawkbit.ui.management.dstable;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
import org.eclipse.hawkbit.ui.dd.criteria.ManagementViewClientCriterion;
@@ -38,9 +39,9 @@ public class DistributionTableLayout extends AbstractTableLayout<DistributionTab
final DistributionSetManagement distributionSetManagement,
final DistributionSetTypeManagement distributionSetTypeManagement,
final ManagementViewClientCriterion managementViewClientCriterion, final EntityFactory entityFactory,
final UINotification notification, final TagManagement tagManagement,
final SystemManagement systemManagement, final TargetManagement targetManagement,
final DeploymentManagement deploymentManagement) {
final UINotification notification, final DistributionSetTagManagement distributionSetTagManagement,
final TargetTagManagement targetTagManagement, final SystemManagement systemManagement,
final TargetManagement targetManagement, final DeploymentManagement deploymentManagement) {
final DistributionAddUpdateWindowLayout distributionAddUpdateWindowLayout = new DistributionAddUpdateWindowLayout(
i18n, notification, eventBus, distributionSetManagement, distributionSetTypeManagement,
@@ -51,11 +52,11 @@ public class DistributionTableLayout extends AbstractTableLayout<DistributionTab
this.distributionTable = new DistributionTable(eventBus, i18n, permissionChecker, notification,
managementUIState, managementViewClientCriterion, targetManagement, dsMetadataPopupLayout,
distributionSetManagement, deploymentManagement, tagManagement);
distributionSetManagement, deploymentManagement, targetTagManagement);
super.init(new DistributionTableHeader(i18n, permissionChecker, eventBus, managementUIState), distributionTable,
new DistributionDetails(i18n, eventBus, permissionChecker, managementUIState, distributionSetManagement,
dsMetadataPopupLayout, entityFactory, notification, tagManagement,
dsMetadataPopupLayout, entityFactory, notification, distributionSetTagManagement,
distributionAddUpdateWindowLayout));
}

View File

@@ -9,12 +9,15 @@
package org.eclipse.hawkbit.ui.management.dstag;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.builder.TagUpdate;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
@@ -31,6 +34,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.util.StringUtils;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.ui.UI;
/**
@@ -39,15 +43,43 @@ import com.vaadin.ui.UI;
public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdateTagLayout<DistributionSetTag>
implements RefreshableContainer {
private static final long serialVersionUID = 444276149954167545L;
private static final long serialVersionUID = 1L;
private static final String TARGET_TAG_NAME_DYNAMIC_STYLE = "new-target-tag-name";
private static final String MSG_TEXTFIELD_NAME = "textfield.name";
CreateUpdateDistributionTagLayoutWindow(final VaadinMessageSource i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
private final transient DistributionSetTagManagement distributionSetTagManagement;
CreateUpdateDistributionTagLayoutWindow(final VaadinMessageSource i18n,
final DistributionSetTagManagement distributionSetTagManagement, final EntityFactory entityFactory,
final UIEventBus eventBus, final SpPermissionChecker permChecker, final UINotification uiNotification) {
super(i18n, entityFactory, eventBus, permChecker, uiNotification);
this.distributionSetTagManagement = distributionSetTagManagement;
}
/**
* @return the color which should be selected in the color-picker component.
*/
@Override
protected Color getColorForColorPicker() {
return ColorPickerHelper.rgbToColorConverter(distributionSetTagManagement
.getByName(tagNameComboBox.getValue().toString()).map(DistributionSetTag::getColour)
.filter(Objects::nonNull).orElse(ColorPickerConstants.DEFAULT_COLOR));
}
/**
* update tag.
*/
protected void updateExistingTag(final Tag targetObj) {
final TagUpdate update = entityFactory.tag().update(targetObj.getId()).name(tagName.getValue())
.description(tagDesc.getValue());
distributionSetTagManagement.update(update);
eventBus.publish(this,
new DistributionSetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY, (DistributionSetTag) targetObj));
uiNotification.displaySuccess(i18n.getMessage("message.update.success", new Object[] { targetObj.getName() }));
}
@Override
@@ -57,8 +89,8 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
}
tagNameComboBox.removeAllItems();
final List<DistributionSetTag> distTagNameList = tagManagement
.findAllDistributionSetTags(new PageRequest(0, MAX_TAGS)).getContent();
final List<DistributionSetTag> distTagNameList = distributionSetTagManagement
.findAll(new PageRequest(0, MAX_TAGS)).getContent();
distTagNameList.forEach(value -> tagNameComboBox.addItem(value.getName()));
}
@@ -82,7 +114,7 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
@Override
protected Optional<DistributionSetTag> findEntityByName() {
return tagManagement.findDistributionSetTag(tagName.getValue());
return distributionSetTagManagement.getByName(tagName.getValue());
}
/**
@@ -100,8 +132,8 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
colour = getColorPicked();
}
final DistributionSetTag newDistTag = tagManagement.createDistributionSetTag(entityFactory.tag().create()
.name(tagNameValueTrimmed).description(tagDescriptionTrimmed).colour(colour));
final DistributionSetTag newDistTag = distributionSetTagManagement.create(entityFactory
.tag().create().name(tagNameValueTrimmed).description(tagDescriptionTrimmed).colour(colour));
eventBus.publish(this, new DistributionSetTagTableEvent(BaseEntityEventType.ADD_ENTITY, newDistTag));
displaySuccess(newDistTag.getName());
resetDistTagValues();
@@ -143,7 +175,8 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
@Override
public void setTagDetails(final String distTagSelected) {
tagName.setValue(distTagSelected);
final Optional<DistributionSetTag> selectedDistTag = tagManagement.findDistributionSetTag(distTagSelected);
final Optional<DistributionSetTag> selectedDistTag = distributionSetTagManagement
.getByName(distTagSelected);
if (selectedDistTag.isPresent()) {
tagDesc.setValue(selectedDistTag.get().getDescription());
if (null == selectedDistTag.get().getColour()) {

View File

@@ -8,18 +8,17 @@
*/
package org.eclipse.hawkbit.ui.management.dstag;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.ui.management.tag.ProxyTag;
import org.eclipse.hawkbit.ui.management.tag.TagIdName;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Slice;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.vaadin.addons.lazyquerycontainer.AbstractBeanQuery;
@@ -33,8 +32,8 @@ public class DistributionTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
private static final long serialVersionUID = -4791426170440663033L;
private final Sort sort = new Sort(Direction.ASC, "name");
private transient Page<DistributionSetTag> firstPageDsTag = null;
private transient TagManagement tagManagementService;
private transient DistributionSetTagManagement distributionSetTagManagement;
/**
* Parametric Constructor.
@@ -56,33 +55,26 @@ public class DistributionTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
@Override
public int size() {
firstPageDsTag = getTagManagement()
.findAllDistributionSetTags(new OffsetBasedPageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
long size = firstPageDsTag.getTotalElements();
long size = getTagManagement().count();
if (size > Integer.MAX_VALUE) {
size = Integer.MAX_VALUE;
}
return (int) size;
}
private TagManagement getTagManagement() {
if (tagManagementService == null) {
tagManagementService = SpringContextHelper.getBean(TagManagement.class);
private DistributionSetTagManagement getTagManagement() {
if (distributionSetTagManagement == null) {
distributionSetTagManagement = SpringContextHelper.getBean(DistributionSetTagManagement.class);
}
return tagManagementService;
return distributionSetTagManagement;
}
@Override
protected List<ProxyTag> loadBeans(final int startIndex, final int count) {
Page<DistributionSetTag> dsTagBeans;
final List<ProxyTag> tagList = new ArrayList<>();
if (startIndex == 0 && firstPageDsTag != null) {
dsTagBeans = firstPageDsTag;
} else {
dsTagBeans = getTagManagement()
.findAllDistributionSetTags(new OffsetBasedPageRequest(startIndex, count, sort));
}
for (final DistributionSetTag tag : dsTagBeans) {
final Slice<DistributionSetTag> dsTagBeans = getTagManagement()
.findAll(new OffsetBasedPageRequest(startIndex, count, sort));
return dsTagBeans.getContent().stream().map(tag -> {
final ProxyTag proxyTargetTag = new ProxyTag();
proxyTargetTag.setColour(tag.getColour());
proxyTargetTag.setDescription(tag.getDescription());
@@ -90,9 +82,10 @@ public class DistributionTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
proxyTargetTag.setId(tag.getId());
final TagIdName tagIdName = new TagIdName(tag.getName(), tag.getId());
proxyTargetTag.setTagIdName(tagIdName);
tagList.add(proxyTargetTag);
}
return tagList;
return proxyTargetTag;
}).collect(Collectors.toList());
}
@Override

View File

@@ -8,8 +8,8 @@
*/
package org.eclipse.hawkbit.ui.management.dstag;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
import org.eclipse.hawkbit.ui.components.RefreshableContainer;
@@ -36,12 +36,13 @@ public class DistributionTagHeader extends AbstractFilterHeader implements Refre
private final CreateUpdateDistributionTagLayoutWindow createORUpdateDistributionTagLayout;
DistributionTagHeader(final VaadinMessageSource i18n, final ManagementUIState managementUIState,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification) {
final SpPermissionChecker permChecker, final UIEventBus eventBus,
final DistributionSetTagManagement distributionSetTagManagement, final EntityFactory entityFactory,
final UINotification uiNotification) {
super(permChecker, eventBus, i18n);
this.managementUIState = managementUIState;
this.createORUpdateDistributionTagLayout = new CreateUpdateDistributionTagLayoutWindow(i18n, tagManagement,
entityFactory, eventBus, permChecker, uiNotification);
this.createORUpdateDistributionTagLayout = new CreateUpdateDistributionTagLayoutWindow(i18n,
distributionSetTagManagement, entityFactory, eventBus, permChecker, uiNotification);
if (hasCreateUpdatePermission()) {
createORUpdateDistributionTagLayout.init();
}

View File

@@ -9,8 +9,8 @@
package org.eclipse.hawkbit.ui.management.dstag;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterHeader;
@@ -38,15 +38,15 @@ public class DistributionTagLayout extends AbstractFilterLayout implements Refre
private final ManagementUIState managementUIState;
public DistributionTagLayout(final UIEventBus eventbus, final ManagementUIState managementUIState, final VaadinMessageSource i18n,
final SpPermissionChecker permChecker, final UIEventBus eventBus, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uiNotification,
final DistributionTableFilters distFilterParameters,
public DistributionTagLayout(final UIEventBus eventbus, final ManagementUIState managementUIState,
final VaadinMessageSource i18n, final SpPermissionChecker permChecker, final UIEventBus eventBus,
final DistributionSetTagManagement distributionSetTagManagement, final EntityFactory entityFactory,
final UINotification uiNotification, final DistributionTableFilters distFilterParameters,
final DistributionSetManagement distributionSetManagement,
final ManagementViewClientCriterion managementViewClientCriterion) {
super(new DistributionTagHeader(i18n, managementUIState, permChecker, eventBus, tagManagement, entityFactory,
uiNotification),
super(new DistributionTagHeader(i18n, managementUIState, permChecker, eventBus, distributionSetTagManagement,
entityFactory, uiNotification),
new DistributionTagButtons(eventBus, managementUIState, entityFactory, i18n, uiNotification,
permChecker, distFilterParameters, distributionSetManagement, managementViewClientCriterion));
this.managementUIState = managementUIState;

View File

@@ -193,8 +193,8 @@ public class CountMessageLabel extends Label {
* as dist ID
*/
private void displayCountLabel(final Long distId) {
final Long targetsWithAssigedDsCount = targetManagement.countTargetByAssignedDistributionSet(distId);
final Long targetsWithInstalledDsCount = targetManagement.countTargetByInstalledDistributionSet(distId);
final Long targetsWithAssigedDsCount = targetManagement.countByAssignedDistributionSet(distId);
final Long targetsWithInstalledDsCount = targetManagement.countByInstalledDistributionSet(distId);
final StringBuilder message = new StringBuilder(i18n.getMessage("label.target.count"));
message.append("<span class=\"assigned-count-message\">");
message.append(i18n.getMessage("label.assigned.count", new Object[] { targetsWithAssigedDsCount }));

View File

@@ -17,8 +17,9 @@ import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -62,7 +63,9 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
private static final long serialVersionUID = 1L;
private final transient TagManagement tagManagementService;
private final transient DistributionSetTagManagement distributionSetTagManagement;
private final transient TargetTagManagement targetTagManagement;
private final ManagementViewClientCriterion managementViewClientCriterion;
@@ -77,13 +80,15 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
private final transient DistributionSetManagement distributionSetManagement;
public DeleteActionsLayout(final VaadinMessageSource i18n, final SpPermissionChecker permChecker,
final UIEventBus eventBus, final UINotification notification, final TagManagement tagManagementService,
final UIEventBus eventBus, final UINotification notification, final TargetTagManagement targetTagManagement,
final DistributionSetTagManagement distributionSetTagManagement,
final ManagementViewClientCriterion managementViewClientCriterion,
final ManagementUIState managementUIState, final TargetManagement targetManagement,
final TargetTable targetTable, final DeploymentManagement deploymentManagement,
final DistributionSetManagement distributionSetManagement) {
super(i18n, permChecker, eventBus, notification);
this.tagManagementService = tagManagementService;
this.distributionSetTagManagement = distributionSetTagManagement;
this.targetTagManagement = targetTagManagement;
this.managementViewClientCriterion = managementViewClientCriterion;
this.managementUIState = managementUIState;
this.manangementConfirmationWindowLayout = new ManangementConfirmationWindowLayout(i18n, eventBus,
@@ -244,7 +249,7 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
if (managementUIState.getDistributionTableFilters().getDistSetTags().contains(tagName)) {
notification.displayValidationError(i18n.getMessage("message.tag.delete", new Object[] { tagName }));
} else {
tagManagementService.deleteDistributionSetTag(tagName);
distributionSetTagManagement.delete(tagName);
if (source instanceof DragAndDropWrapper) {
final Long id = DeleteActionsLayoutHelper.getDistributionTagId((DragAndDropWrapper) source);
@@ -261,7 +266,7 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
if (managementUIState.getTargetTableFilters().getClickedTargetTags().contains(tagName)) {
notification.displayValidationError(i18n.getMessage("message.tag.delete", new Object[] { tagName }));
} else {
tagManagementService.deleteTargetTag(tagName);
targetTagManagement.delete(tagName);
if (source instanceof DragAndDropWrapper) {
final Long id = DeleteActionsLayoutHelper.getTargetTagId((DragAndDropWrapper) source);
@@ -285,8 +290,7 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
return;
}
final List<DistributionSet> findDistributionSetAllById = distributionSetManagement
.findDistributionSetsById(ids);
final List<DistributionSet> findDistributionSetAllById = distributionSetManagement.get(ids);
if (findDistributionSetAllById.isEmpty()) {
notification.displayWarning(i18n.getMessage("distributionsets.not.exists"));
@@ -329,8 +333,7 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
private boolean isDsInUseInBulkUpload(final Set<Long> distributionIdNameSet, final Long dsInBulkUpload) {
if (distributionIdNameSet.contains(dsInBulkUpload)) {
final Optional<DistributionSet> distributionSet = distributionSetManagement
.findDistributionSetById(dsInBulkUpload);
final Optional<DistributionSet> distributionSet = distributionSetManagement.get(dsInBulkUpload);
if (!distributionSet.isPresent()) {
notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
return true;
@@ -345,7 +348,7 @@ public class DeleteActionsLayout extends AbstractDeleteActionsLayout {
private void addInDeleteTargetList(final Table sourceTable, final TableTransferable transferable) {
final TargetTable targetTable = (TargetTable) sourceTable;
final Set<Long> targetIdSet = targetTable.getDeletedEntityByTransferable(transferable);
final Collection<Target> findTargetAllById = targetManagement.findTargetsById(targetIdSet);
final Collection<Target> findTargetAllById = targetManagement.get(targetIdSet);
if (findTargetAllById.isEmpty()) {
notification.displayWarning(i18n.getMessage("targets.not.exists"));
return;

View File

@@ -373,7 +373,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
final Collection<Long> deletedIds = managementUIState.getDeletedDistributionList().stream()
.map(DistributionSetIdName::getId).collect(Collectors.toList());
distributionSetManagement.deleteDistributionSet(deletedIds);
distributionSetManagement.delete(deletedIds);
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.REMOVE_ENTITY, deletedIds));
addToConsolitatedMsg(FontAwesome.TRASH_O.getHtml() + SPUILabelDefinitions.HTML_SPACE
@@ -463,7 +463,7 @@ public class ManangementConfirmationWindowLayout extends AbstractConfirmationWin
final Set<Long> targetIds = targetIdNames.stream().map(TargetIdName::getTargetId).collect(Collectors.toSet());
targetManagement.deleteTargets(targetIds);
targetManagement.delete(targetIds);
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.REMOVE_ENTITY, targetIds));

View File

@@ -29,7 +29,7 @@ import java.util.concurrent.Executor;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
@@ -81,7 +81,7 @@ public class BulkUploadHandler extends CustomComponent
private static final Splitter SPLITTER = Splitter.on(',').omitEmptyStrings().trimResults();
private final transient TargetManagement targetManagement;
private final transient TagManagement tagManagement;
private final transient TargetTagManagement tagManagement;
private final ComboBox comboBox;
private final TextArea descTextArea;
@@ -106,7 +106,7 @@ public class BulkUploadHandler extends CustomComponent
private final UI uiInstance;
BulkUploadHandler(final TargetBulkUpdateWindowLayout targetBulkUpdateWindowLayout,
final TargetManagement targetManagement, final TagManagement tagManagement,
final TargetManagement targetManagement, final TargetTagManagement tagManagement,
final EntityFactory entityFactory, final DistributionSetManagement distributionSetManagement,
final ManagementUIState managementUIState, final DeploymentManagement deploymentManagement, final VaadinMessageSource i18n,
final UI uiInstance, final Executor uiExecutor) {
@@ -304,7 +304,7 @@ public class BulkUploadHandler extends CustomComponent
final TargetBulkUpload targetBulkUpload = managementUIState.getTargetTableFilters().getBulkUpload();
final List<String> targetsList = targetBulkUpload.getTargetsCreated();
final Long dsSelected = (Long) comboBox.getValue();
if (!distributionSetManagement.findDistributionSetById(dsSelected).isPresent()) {
if (!distributionSetManagement.get(dsSelected).isPresent()) {
return i18n.getMessage("message.bulk.upload.assignment.failed");
}
deploymentManagement.assignDistributionSet(targetBulkUpload.getDsNameAndVersion(), actionType,
@@ -316,7 +316,7 @@ public class BulkUploadHandler extends CustomComponent
final Map<Long, TagData> tokensSelected = targetBulkTokenTags.getTokensAdded();
final List<String> deletedTags = new ArrayList<>();
for (final TagData tagData : tokensSelected.values()) {
if (!tagManagement.findTargetTagById(tagData.getId()).isPresent()) {
if (!tagManagement.get(tagData.getId()).isPresent()) {
deletedTags.add(tagData.getName());
} else {
targetManagement.toggleTagAssignment(
@@ -368,7 +368,7 @@ public class BulkUploadHandler extends CustomComponent
final String description = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
try {
targetManagement.createTarget(entityFactory.target().create().controllerId(newControllerId).name(name)
targetManagement.create(entityFactory.target().create().controllerId(newControllerId).name(name)
.description(description));
managementUIState.getTargetTableFilters().getBulkUpload().getTargetsCreated().add(newControllerId);

View File

@@ -131,7 +131,7 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
*/
public void updateTarget() {
/* save updated entity */
final Target target = targetManagement.updateTarget(entityFactory.target().update(controllerId)
final Target target = targetManagement.update(entityFactory.target().update(controllerId)
.name(nameTextField.getValue()).description(descTextArea.getValue()));
/* display success msg */
uINotification.displaySuccess(i18n.getMessage("message.update.success", new Object[] { target.getName() }));
@@ -144,7 +144,7 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
final String newName = HawkbitCommonUtil.trimAndNullIfEmpty(nameTextField.getValue());
final String newDesc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
final Target newTarget = targetManagement.createTarget(
final Target newTarget = targetManagement.create(
entityFactory.target().create().controllerId(newControllerId).name(newName).description(newDesc));
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.ADD_ENTITY, newTarget));
@@ -169,9 +169,9 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
* @return window or {@code null} if target is not exists.
*/
public Window getWindow(final String controllerId) {
final Optional<Target> target = targetManagement.findTargetByControllerID(controllerId);
final Optional<Target> target = targetManagement.getByControllerID(controllerId);
if (!target.isPresent()) {
uINotification.displayWarning(i18n.getMessage("target.not.exists", new Object[] { controllerId }));
uINotification.displayWarning(i18n.getMessage("target.not.exists", controllerId));
return null;
}
populateValuesOfTarget(target.get());
@@ -195,10 +195,9 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
private boolean isDuplicate() {
final String newControlllerId = controllerIDTextField.getValue();
final Optional<Target> existingTarget = targetManagement.findTargetByControllerID(newControlllerId.trim());
final Optional<Target> existingTarget = targetManagement.getByControllerID(newControlllerId.trim());
if (existingTarget.isPresent()) {
uINotification.displayValidationError(
i18n.getMessage("message.target.duplicate.check", new Object[] { newControlllerId }));
uINotification.displayValidationError(i18n.getMessage("message.target.duplicate.check", newControlllerId));
return true;
} else {
return false;

View File

@@ -109,19 +109,20 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
Slice<Target> targetBeans;
final List<ProxyTarget> proxyTargetBeans = new ArrayList<>();
if (pinnedDistId != null) {
targetBeans = getTargetManagement().findTargetsAllOrderByLinkedDistributionSet(
targetBeans = getTargetManagement().findByFilterOrderByLinkedDistributionSet(
new OffsetBasedPageRequest(startIndex, SPUIDefinitions.PAGE_SIZE, sort), pinnedDistId,
new FilterParams(distributionId, status, overdueState, searchText, noTagClicked, targetTags));
new FilterParams(status, overdueState, searchText, distributionId, noTagClicked, targetTags));
} else if (null != targetFilterQueryId) {
targetBeans = getTargetManagement().findTargetsByTargetFilterQuery(targetFilterQueryId,
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
targetBeans = getTargetManagement().findByTargetFilterQuery(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
targetFilterQueryId);
} else if (!isAnyFilterSelected()) {
targetBeans = getTargetManagement().findTargetsAll(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
targetBeans = getTargetManagement()
.findAll(new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort));
} else {
targetBeans = getTargetManagement().findTargetByFilters(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort), status,
overdueState, searchText, distributionId, noTagClicked, targetTags);
targetBeans = getTargetManagement().findByFilters(
new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE, SPUIDefinitions.PAGE_SIZE, sort),
new FilterParams(status, overdueState, searchText, distributionId, noTagClicked, targetTags));
}
for (final Target targ : targetBeans) {
final ProxyTarget prxyTarget = new ProxyTarget();
@@ -176,15 +177,15 @@ public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
@Override
public int size() {
final long totSize = getTargetManagement().countTargetsAll();
final long totSize = getTargetManagement().count();
long size;
if (null != targetFilterQueryId) {
size = getTargetManagement().countTargetByTargetFilterQuery(targetFilterQueryId);
size = getTargetManagement().countByTargetFilterQuery(targetFilterQueryId);
} else if (!isAnyFilterSelected()) {
size = totSize;
} else {
size = getTargetManagement().countTargetByFilters(status, overdueState, searchText, distributionId,
noTagClicked, targetTags);
size = getTargetManagement().countByFilters(status, overdueState, searchText, distributionId, noTagClicked,
targetTags);
}
final ManagementUIState tmpManagementUIState = getManagementUIState();

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.management.targettable;
import java.util.Map;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.common.tagdetails.AbstractTargetTagToken;
@@ -30,7 +30,7 @@ public class TargetBulkTokenTags extends AbstractTargetTagToken {
private static final int MAX_TAGS = 500;
TargetBulkTokenTags(final SpPermissionChecker checker, final VaadinMessageSource i18n, final UINotification uinotification,
final UIEventBus eventBus, final ManagementUIState managementUIState, final TagManagement tagManagement) {
final UIEventBus eventBus, final ManagementUIState managementUIState, final TargetTagManagement tagManagement) {
super(checker, i18n, uinotification, eventBus, managementUIState, tagManagement);
}
@@ -68,7 +68,7 @@ public class TargetBulkTokenTags extends AbstractTargetTagToken {
protected void addAlreadySelectedTags() {
for (final String tagName : managementUIState.getTargetTableFilters().getBulkUpload().getAssignedTagNames()) {
tagManagement.findTargetTag(tagName).map(TargetTag::getId).ifPresent(this::addNewToken);
tagManagement.getByName(tagName).map(TargetTag::getId).ifPresent(this::addNewToken);
}
}
@@ -76,7 +76,7 @@ public class TargetBulkTokenTags extends AbstractTargetTagToken {
protected void populateContainer() {
container.removeAllItems();
tagDetails.clear();
for (final TargetTag tag : tagManagement.findAllTargetTags(new PageRequest(0, MAX_TAGS))) {
for (final TargetTag tag : tagManagement.findAll(new PageRequest(0, MAX_TAGS))) {
setContainerPropertValues(tag.getId(), tag.getName(), tag.getColour());
}

View File

@@ -14,7 +14,7 @@ import java.util.concurrent.Executor;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.UiProperties;
@@ -65,7 +65,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
private final transient TargetManagement targetManagement;
private final transient DistributionSetManagement distributionSetManagement;
private final transient TagManagement tagManagement;
private final transient TargetTagManagement tagManagement;
private final transient EntityFactory entityFactory;
@@ -98,7 +98,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
TargetBulkUpdateWindowLayout(final VaadinMessageSource i18n, final TargetManagement targetManagement,
final UIEventBus eventBus, final ManagementUIState managementUIState,
final DeploymentManagement deploymentManagement, final UiProperties uiproperties,
final SpPermissionChecker checker, final UINotification uinotification, final TagManagement tagManagement,
final SpPermissionChecker checker, final UINotification uinotification, final TargetTagManagement tagManagement,
final DistributionSetManagement distributionSetManagement, final EntityFactory entityFactory,
final Executor uiExecutor) {
this.i18n = i18n;

View File

@@ -12,7 +12,7 @@ import java.net.URI;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -65,7 +65,7 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
TargetDetails(final VaadinMessageSource i18n, final UIEventBus eventBus,
final SpPermissionChecker permissionChecker, final ManagementUIState managementUIState,
final UINotification uiNotification, final TagManagement tagManagement,
final UINotification uiNotification, final TargetTagManagement tagManagement,
final TargetManagement targetManagement, final DeploymentManagement deploymentManagement,
final EntityFactory entityFactory, final TargetTable targetTable) {
super(i18n, eventBus, permissionChecker, managementUIState);

View File

@@ -21,8 +21,8 @@ import java.util.stream.Stream;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.FilterParams;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.event.remote.entity.RemoteEntityEvent;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Tag;
@@ -104,7 +104,7 @@ public class TargetTable extends AbstractTable<Target> {
private final transient DistributionSetManagement distributionSetManagement;
private final transient TagManagement tagManagement;
private final transient TargetTagManagement tagManagement;
private final SpPermissionChecker permChecker;
@@ -119,7 +119,7 @@ public class TargetTable extends AbstractTable<Target> {
public TargetTable(final UIEventBus eventBus, final VaadinMessageSource i18n, final UINotification notification,
final TargetManagement targetManagement, final ManagementUIState managementUIState,
final SpPermissionChecker permChecker, final ManagementViewClientCriterion managementViewClientCriterion,
final DistributionSetManagement distributionSetManagement, final TagManagement tagManagement) {
final DistributionSetManagement distributionSetManagement, final TargetTagManagement tagManagement) {
super(eventBus, i18n, notification);
this.targetManagement = targetManagement;
this.permChecker = permChecker;
@@ -152,16 +152,15 @@ public class TargetTable extends AbstractTable<Target> {
refreshTargets();
} else {
eventContainer.getEvents().stream().filter(event -> visibleItemIds.contains(event.getEntityId()))
.filter(Objects::nonNull)
.forEach(event -> updateVisibleItemOnEvent(event.getEntity()));
.filter(Objects::nonNull).forEach(event -> updateVisibleItemOnEvent(event.getEntity()));
}
publishTargetSelectedEntityForRefresh(eventContainer.getEvents().stream());
}
private void publishTargetSelectedEntityForRefresh(
final Stream<? extends RemoteEntityEvent<Target>> targetEntityEventStream) {
targetEntityEventStream.filter(event -> isLastSelectedTarget(event.getEntityId()))
.filter(Objects::nonNull).findAny().ifPresent(event -> eventBus.publish(this,
targetEntityEventStream.filter(event -> isLastSelectedTarget(event.getEntityId())).filter(Objects::nonNull)
.findAny().ifPresent(event -> eventBus.publish(this,
new TargetTableEvent(BaseEntityEventType.SELECTED_ENTITY, event.getEntity())));
}
@@ -299,7 +298,7 @@ public class TargetTable extends AbstractTable<Target> {
@Override
protected Optional<Target> findEntityByTableValue(final Long lastSelectedId) {
return targetManagement.findTargetById(lastSelectedId);
return targetManagement.get(lastSelectedId);
}
@Override
@@ -519,15 +518,15 @@ public class TargetTable extends AbstractTable<Target> {
* @return TagAssigmentResult with all meta data of the assignment outcome.
*/
public TargetTagAssignmentResult toggleTagAssignment(final Collection<Long> targetIds, final String targTagName) {
final List<String> controllerIds = targetManagement.findTargetsById(targetIds).stream()
.map(Target::getControllerId).collect(Collectors.toList());
final List<String> controllerIds = targetManagement.get(targetIds).stream().map(Target::getControllerId)
.collect(Collectors.toList());
if (controllerIds.isEmpty()) {
notification.displayWarning(i18n.getMessage("targets.not.exists"));
return new TargetTagAssignmentResult(0, 0, 0, Lists.newArrayListWithCapacity(0),
Lists.newArrayListWithCapacity(0), null);
}
final Optional<TargetTag> tag = tagManagement.findTargetTag(targTagName);
final Optional<TargetTag> tag = tagManagement.getByName(targTagName);
if (!tag.isPresent()) {
notification.displayWarning(i18n.getMessage("targettag.not.exists", new Object[] { targTagName }));
return new TargetTagAssignmentResult(0, 0, 0, Lists.newArrayListWithCapacity(0),
@@ -580,15 +579,14 @@ public class TargetTable extends AbstractTable<Target> {
return;
}
final Long targetId = (Long) targetItemId;
final Optional<Target> target = targetManagement.findTargetById(targetId);
final Optional<Target> target = targetManagement.get(targetId);
if (!target.isPresent()) {
getNotification().displayWarning(i18n.getMessage("target.not.exists", new Object[] { "" }));
return;
}
final TargetIdName createTargetIdName = new TargetIdName(target.get());
final List<DistributionSet> findDistributionSetAllById = distributionSetManagement
.findDistributionSetsById(ids);
final List<DistributionSet> findDistributionSetAllById = distributionSetManagement.get(ids);
if (findDistributionSetAllById.isEmpty()) {
notification.displayWarning(i18n.getMessage("distributionsets.not.exists"));
@@ -848,7 +846,7 @@ public class TargetTable extends AbstractTable<Target> {
}
final long size = getTargetsCountWithFilter(totalTargetsCount, pinnedDistId,
new FilterParams(distributionId, status, overdueState, searchText, noTagClicked, targetTags));
new FilterParams(status, overdueState, searchText, distributionId, noTagClicked, targetTags));
if (size > SPUIDefinitions.MAX_TABLE_ENTRIES) {
managementUIState.setTargetsTruncated(size - SPUIDefinitions.MAX_TABLE_ENTRIES);
@@ -861,16 +859,15 @@ public class TargetTable extends AbstractTable<Target> {
final long size;
if (query.isPresent()) {
size = targetManagement.countTargetByTargetFilterQuery(query.get());
size = targetManagement.countByTargetFilterQuery(query.get());
} else if (noFilterSelected(filterParams.getFilterByStatus(), pinnedDistId,
filterParams.getSelectTargetWithNoTag(), filterParams.getFilterByTagNames(),
filterParams.getFilterBySearchText())) {
size = totalTargetsCount;
} else {
size = targetManagement.countTargetByFilters(filterParams.getFilterByStatus(),
filterParams.getOverdueState(), filterParams.getFilterBySearchText(),
filterParams.getFilterByDistributionId(), filterParams.getSelectTargetWithNoTag(),
filterParams.getFilterByTagNames());
size = targetManagement.countByFilters(filterParams.getFilterByStatus(), filterParams.getOverdueState(),
filterParams.getFilterBySearchText(), filterParams.getFilterByDistributionId(),
filterParams.getSelectTargetWithNoTag(), filterParams.getFilterByTagNames());
}
return size;
}
@@ -886,7 +883,7 @@ public class TargetTable extends AbstractTable<Target> {
}
private long getTotalTargetsCount() {
return targetManagement.countTargetsAll();
return targetManagement.count();
}
private boolean isFilteredByStatus() {

View File

@@ -15,7 +15,7 @@ import java.util.concurrent.Executor;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
@@ -81,7 +81,7 @@ public class TargetTableHeader extends AbstractTableHeader {
final UINotification notification, final ManagementUIState managementUIState,
final ManagementViewClientCriterion managementViewClientCriterion, final TargetManagement targetManagement,
final DeploymentManagement deploymentManagement, final UiProperties uiproperties, final UIEventBus eventBus,
final EntityFactory entityFactory, final UINotification uinotification, final TagManagement tagManagement,
final EntityFactory entityFactory, final UINotification uinotification, final TargetTagManagement tagManagement,
final DistributionSetManagement distributionSetManagement, final Executor uiExecutor,
final TargetTable targetTable) {
super(i18n, permChecker, eventbus, managementUIState, null, null);
@@ -336,7 +336,7 @@ public class TargetTableHeader extends AbstractTableHeader {
}
final Long distributionSetId = distributionIdSet.iterator().next();
final Optional<DistributionSet> distributionSet = distributionSetManagement
.findDistributionSetById(distributionSetId);
.get(distributionSetId);
if (!distributionSet.isPresent()) {
notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
return;

View File

@@ -13,7 +13,7 @@ import java.util.concurrent.Executor;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.UiProperties;
@@ -46,7 +46,7 @@ public class TargetTableLayout extends AbstractTableLayout<TargetTable> {
final ManagementViewClientCriterion managementViewClientCriterion,
final DeploymentManagement deploymentManagement, final UiProperties uiproperties,
final SpPermissionChecker permissionChecker, final UINotification uinotification,
final TagManagement tagManagement, final DistributionSetManagement distributionSetManagement,
final TargetTagManagement tagManagement, final DistributionSetManagement distributionSetManagement,
final Executor uiExecutor) {
this.eventBus = eventBus;
this.targetDetails = new TargetDetails(i18n, eventbus, permissionChecker, managementUIState, uinotification,

View File

@@ -8,10 +8,13 @@
*/
package org.eclipse.hawkbit.ui.management.targettag;
import java.util.Objects;
import java.util.Optional;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.builder.TagUpdate;
import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.ui.SpPermissionChecker;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
@@ -27,21 +30,25 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.util.StringUtils;
import org.vaadin.spring.events.EventBus.UIEventBus;
import com.vaadin.shared.ui.colorpicker.Color;
/**
* Class for Create / Update Tag Layout of target
*/
public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLayout<TargetTag>
implements RefreshableContainer {
private static final long serialVersionUID = 2446682350481560235L;
private static final long serialVersionUID = 1L;
private final transient TargetTagManagement targetTagManagement;
/**
* Constructor for CreateUpdateTargetTagLayoutWindow
*
* @param i18n
* I18N
* @param tagManagement
* TagManagement
* @param targetTagManagement
* TargetTagManagement
* @param entityFactory
* EntityFactory
* @param eventBus
@@ -51,10 +58,11 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
* @param uiNotification
* UINotification
*/
public CreateUpdateTargetTagLayoutWindow(final VaadinMessageSource i18n, final TagManagement tagManagement,
final EntityFactory entityFactory, final UIEventBus eventBus, final SpPermissionChecker permChecker,
final UINotification uiNotification) {
super(i18n, tagManagement, entityFactory, eventBus, permChecker, uiNotification);
public CreateUpdateTargetTagLayoutWindow(final VaadinMessageSource i18n,
final TargetTagManagement targetTagManagement, final EntityFactory entityFactory, final UIEventBus eventBus,
final SpPermissionChecker permChecker, final UINotification uiNotification) {
super(i18n, entityFactory, eventBus, permChecker, uiNotification);
this.targetTagManagement = targetTagManagement;
}
@Override
@@ -69,10 +77,20 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
@Override
public void populateTagNameCombo() {
tagNameComboBox.removeAllItems();
tagManagement.findAllTargetTags(new PageRequest(0, MAX_TAGS))
targetTagManagement.findAll(new PageRequest(0, MAX_TAGS))
.forEach(value -> tagNameComboBox.addItem(value.getName()));
}
/**
* @return the color which should be selected in the color-picker component.
*/
@Override
protected Color getColorForColorPicker() {
return ColorPickerHelper
.rgbToColorConverter(targetTagManagement.getByName(tagNameComboBox.getValue().toString())
.map(TargetTag::getColour).filter(Objects::nonNull).orElse(ColorPickerConstants.DEFAULT_COLOR));
}
/**
* Select tag & set tag name & tag desc values corresponding to selected
* tag.
@@ -83,7 +101,7 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
@Override
public void setTagDetails(final String targetTagSelected) {
tagName.setValue(targetTagSelected);
final Optional<TargetTag> selectedTargetTag = tagManagement.findTargetTag(targetTagSelected);
final Optional<TargetTag> selectedTargetTag = targetTagManagement.getByName(targetTagSelected);
if (selectedTargetTag.isPresent()) {
tagDesc.setValue(selectedTargetTag.get().getDescription());
if (null == selectedTargetTag.get().getColour()) {
@@ -107,7 +125,7 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
@Override
protected Optional<TargetTag> findEntityByName() {
return tagManagement.findTargetTag(tagName.getValue());
return targetTagManagement.getByName(tagName.getValue());
}
/**
@@ -124,7 +142,7 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
colour = getColorPicked();
}
final TargetTag newTargetTag = tagManagement.createTargetTag(entityFactory.tag().create()
final TargetTag newTargetTag = targetTagManagement.create(entityFactory.tag().create()
.name(tagNameTrimmed).description(tagDescriptionTrimmed).colour(colour));
eventBus.publish(this, new TargetTagTableEvent(BaseEntityEventType.ADD_ENTITY, newTargetTag));
displaySuccess(newTargetTag.getName());
@@ -133,6 +151,21 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
}
}
/**
* update tag.
*/
protected void updateExistingTag(final Tag targetObj) {
final TagUpdate update = entityFactory.tag().update(targetObj.getId()).name(tagName.getValue())
.description(tagDesc.getValue())
.colour(ColorPickerHelper.getColorPickedString(colorPickerLayout.getSelPreview()));
targetTagManagement.update(update);
eventBus.publish(this, new TargetTagTableEvent(BaseEntityEventType.UPDATED_ENTITY, (TargetTag) targetObj));
uiNotification.displaySuccess(i18n.getMessage("message.update.success", new Object[] { targetObj.getName() }));
}
@Override
protected void createRequiredComponents() {
super.createRequiredComponents();

View File

@@ -50,7 +50,7 @@ public class CustomTargetTagFilterButtonClick extends AbstractFilterSingleButton
@Override
protected void filterClicked(final Button clickedButton) {
targetFilterQueryManagement.findTargetFilterQueryById((Long) clickedButton.getData())
targetFilterQueryManagement.get((Long) clickedButton.getData())
.ifPresent(targetFilterQuery -> {
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery.getId());
this.eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);

View File

@@ -13,7 +13,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetTagManagement;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.ui.management.tag.ProxyTag;
import org.eclipse.hawkbit.ui.management.tag.TagIdName;
@@ -34,7 +34,7 @@ public class TargetTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
private static final long serialVersionUID = -4791426170440663033L;
private final Sort sort = new Sort(Direction.ASC, "name");
private transient Page<TargetTag> firstPageTargetTag = null;
private transient TagManagement tagManagementService;
private transient TargetTagManagement tagManagementService;
/**
* Parametric constructor.
@@ -57,7 +57,7 @@ public class TargetTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
@Override
public int size() {
firstPageTargetTag = getTagManagement()
.findAllTargetTags(new OffsetBasedPageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
.findAll(new OffsetBasedPageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
long size = firstPageTargetTag.getTotalElements();
if (size > Integer.MAX_VALUE) {
size = Integer.MAX_VALUE;
@@ -65,9 +65,9 @@ public class TargetTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
return (int) size;
}
private TagManagement getTagManagement() {
private TargetTagManagement getTagManagement() {
if (tagManagementService == null) {
tagManagementService = SpringContextHelper.getBean(TagManagement.class);
tagManagementService = SpringContextHelper.getBean(TargetTagManagement.class);
}
return tagManagementService;
}
@@ -79,7 +79,7 @@ public class TargetTagBeanQuery extends AbstractBeanQuery<ProxyTag> {
if (startIndex == 0 && firstPageTargetTag != null) {
targetTagBeans = firstPageTargetTag;
} else {
targetTagBeans = getTagManagement().findAllTargetTags(new OffsetBasedPageRequest(startIndex, count, sort));
targetTagBeans = getTagManagement().findAll(new OffsetBasedPageRequest(startIndex, count, sort));
}
for (final TargetTag tag : targetTagBeans.getContent()) {
final ProxyTag proxyTargetTag = new ProxyTag();

View File

@@ -172,7 +172,7 @@ public class RolloutView extends VerticalLayout implements View {
return true;
}
final Optional<Rollout> rollout = rolloutManagement.findRolloutById(rolloutIdInState.get());
final Optional<Rollout> rollout = rolloutManagement.get(rolloutIdInState.get());
return !rollout.isPresent() || rollout.get().isDeleted();
}

View File

@@ -224,7 +224,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private boolean duplicateCheck() {
if (rolloutManagement.findRolloutByName(getRolloutName()).isPresent()) {
if (rolloutManagement.getByName(getRolloutName()).isPresent()) {
uiNotification
.displayValidationError(i18n.getMessage("message.rollout.duplicate.check", getRolloutName()));
return false;
@@ -252,7 +252,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
Rollout updatedRollout;
try {
updatedRollout = rolloutManagement.updateRollout(rolloutUpdate);
updatedRollout = rolloutManagement.update(rolloutUpdate);
} catch (final EntityNotFoundException | EntityReadOnlyException e) {
LOGGER.warn("Rollout was deleted. Redirect to Rollouts overview.", e);
uiNotification.displayWarning(
@@ -268,7 +268,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private boolean duplicateCheckForEdit() {
final String rolloutNameVal = getRolloutName();
if (!rollout.getName().equals(rolloutNameVal)
&& rolloutManagement.findRolloutByName(rolloutNameVal).isPresent()) {
&& rolloutManagement.getByName(rolloutNameVal).isPresent()) {
uiNotification
.displayValidationError(i18n.getMessage("message.rollout.duplicate.check", rolloutNameVal));
return false;
@@ -304,10 +304,10 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
if (isNumberOfGroups()) {
return rolloutManagement.createRollout(rolloutCreate, amountGroup, conditions);
return rolloutManagement.create(rolloutCreate, amountGroup, conditions);
} else if (isGroupsDefinition()) {
final List<RolloutGroupCreate> groups = defineGroupsLayout.getSavedRolloutGroups();
return rolloutManagement.createRollout(rolloutCreate, groups, conditions);
return rolloutManagement.create(rolloutCreate, groups, conditions);
}
throw new IllegalStateException("Either of the Tabs must be selected");
@@ -717,7 +717,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
groupsLegendLayout.populateTotalTargets(null);
defineGroupsLayout.setTargetFilter(null);
} else {
totalTargetsCount = targetManagement.countTargetByTargetFilterQuery(filterQueryString);
totalTargetsCount = targetManagement.countByRsql(filterQueryString);
groupsLegendLayout.populateTotalTargets(totalTargetsCount);
defineGroupsLayout.setTargetFilter(filterQueryString);
}
@@ -735,7 +735,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private void populateTargetFilterQuery(final Rollout rollout) {
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement
.findTargetFilterQueryByQuery(new PageRequest(0, 1), rollout.getTargetFilterQuery());
.findByQuery(new PageRequest(0, 1), rollout.getTargetFilterQuery());
if (filterQueries.getTotalElements() > 0) {
final TargetFilterQuery filterQuery = filterQueries.getContent().get(0);
targetFilterQueryCombo.setValue(filterQuery.getName());
@@ -897,7 +897,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
return;
}
final Optional<Rollout> rolloutFound = rolloutManagement.findRolloutById(rolloutId);
final Optional<Rollout> rolloutFound = rolloutManagement.get(rolloutId);
if (!rolloutFound.isPresent()) {
return;
}
@@ -937,12 +937,12 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
window.setOrginaleValues();
updateGroupsChart(
rolloutGroupManagement.findRolloutGroupsByRolloutId(rollout.getId(),
new PageRequest(0, quotaManagement.getMaxRolloutGroupsPerRollout())).getContent(),
rolloutGroupManagement.findByRollout(new PageRequest(0, quotaManagement.getMaxRolloutGroupsPerRollout()),
rollout.getId()).getContent(),
rollout.getTotalTargets());
}
totalTargetsCount = targetManagement.countTargetByTargetFilterQuery(rollout.getTargetFilterQuery());
totalTargetsCount = targetManagement.countByRsql(rollout.getTargetFilterQuery());
groupsLegendLayout.populateTotalTargets(totalTargetsCount);
}

View File

@@ -238,8 +238,8 @@ public class DefineGroupsLayout extends GridLayout {
removeAllRows();
final List<RolloutGroup> groups = rolloutGroupManagement.findRolloutGroupsByRolloutId(rollout.getId(),
new PageRequest(0, quotaManagement.getMaxRolloutGroupsPerRollout())).getContent();
final List<RolloutGroup> groups = rolloutGroupManagement.findByRollout(new PageRequest(0, quotaManagement.getMaxRolloutGroupsPerRollout()),
rollout.getId()).getContent();
for (final RolloutGroup group : groups) {
final GroupRow groupRow = addGroupRow();
groupRow.populateByGroup(group);
@@ -493,7 +493,7 @@ public class DefineGroupsLayout extends GridLayout {
targetFilterQueryCombo.setValue(null);
} else {
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement
.findTargetFilterQueryByQuery(new PageRequest(0, 1), group.getTargetFilterQuery());
.findByQuery(new PageRequest(0, 1), group.getTargetFilterQuery());
if (filterQueries.getTotalElements() > 0) {
final TargetFilterQuery filterQuery = filterQueries.getContent().get(0);
targetFilterQueryCombo.setValue(filterQuery.getName());

View File

@@ -82,7 +82,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
if (startIndex == 0 && firstPageDistributionSets != null) {
distBeans = firstPageDistributionSets;
} else {
distBeans = getDistributionSetManagement().findDistributionSetsByFilters(
distBeans = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(startIndex / count, count, sort), distributionSetFilter);
}
return createProxyDistributions(distBeans);
@@ -119,7 +119,7 @@ public class DistributionBeanQuery extends AbstractBeanQuery<ProxyDistribution>
final DistributionSetFilter distributionSetFilter = new DistributionSetFilterBuilder().setIsDeleted(false)
.setIsComplete(true).build();
firstPageDistributionSets = getDistributionSetManagement().findDistributionSetsByFilters(
firstPageDistributionSets = getDistributionSetManagement().findByDistributionSetFilter(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), distributionSetFilter);
final long size = firstPageDistributionSets.getTotalElements();
if (size > Integer.MAX_VALUE) {

View File

@@ -92,9 +92,9 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
final PageRequest pageRequest = new PageRequest(startIndex / SPUIDefinitions.PAGE_SIZE,
SPUIDefinitions.PAGE_SIZE, sort);
if (StringUtils.isEmpty(searchText)) {
rolloutBeans = getRolloutManagement().findAllRolloutsWithDetailedStatus(pageRequest, false);
rolloutBeans = getRolloutManagement().findAllWithDetailedStatus(pageRequest, false);
} else {
rolloutBeans = getRolloutManagement().findRolloutWithDetailedStatusByFilters(pageRequest, searchText,
rolloutBeans = getRolloutManagement().findByFiltersWithDetailedStatus(pageRequest, searchText,
false);
}
return getProxyRolloutList(rolloutBeans);
@@ -137,11 +137,11 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
@Override
public int size() {
int size = getRolloutManagement().countRolloutsAll().intValue();
long size = getRolloutManagement().count();
if (!StringUtils.isEmpty(searchText)) {
size = getRolloutManagement().countRolloutsAllByFilters(searchText).intValue();
size = getRolloutManagement().countByFilters(searchText);
}
return size;
return (int) size;
}
private RolloutManagement getRolloutManagement() {

View File

@@ -183,7 +183,7 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
return;
}
final Optional<Rollout> rollout = rolloutManagement
.findRolloutWithDetailedStatus(rolloutChangeEvent.getRolloutId());
.getWithDetailedStatus(rolloutChangeEvent.getRolloutId());
if (!rollout.isPresent()) {
return;
@@ -472,7 +472,7 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
if (RolloutStatus.READY.equals(rolloutStatus)) {
rolloutManagement.startRollout(rolloutId);
rolloutManagement.start(rolloutId);
uiNotification.displaySuccess(i18n.getMessage("message.rollout.started", rolloutName));
return;
}
@@ -499,7 +499,7 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
}
private void deleteRollout(final Long rolloutId) {
final Optional<Rollout> rollout = rolloutManagement.findRolloutWithDetailedStatus(rolloutId);
final Optional<Rollout> rollout = rolloutManagement.getWithDetailedStatus(rolloutId);
if (!rollout.isPresent()) {
return;
@@ -514,7 +514,7 @@ public class RolloutListGrid extends AbstractGrid<LazyQueryContainer> {
}
final Item row = getContainerDataSource().getItem(rolloutId);
final String rolloutName = (String) row.getItemProperty(SPUILabelDefinitions.VAR_NAME).getValue();
rolloutManagement.deleteRollout(rolloutId);
rolloutManagement.delete(rolloutId);
uiNotification.displaySuccess(i18n.getMessage("message.rollout.deleted", rolloutName));
}, UIComponentIdProvider.ROLLOUT_DELETE_CONFIRMATION_DIALOG);
UI.getCurrent().addWindow(confirmationDialog.getWindow());

View File

@@ -105,7 +105,7 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
proxyRolloutGroupsList = firstPageRolloutGroupSets.getContent();
} else {
proxyRolloutGroupsList = getRolloutGroupManagement()
.findAllRolloutGroupsWithDetailedStatus(rolloutId, new PageRequest(startIndex / count, count))
.findByRolloutWithDetailedStatus(new PageRequest(startIndex / count, count), rolloutId)
.getContent();
}
}
@@ -156,8 +156,8 @@ public class RolloutGroupBeanQuery extends AbstractBeanQuery<ProxyRolloutGroup>
long size = 0;
if (rolloutId != null) {
try {
firstPageRolloutGroupSets = getRolloutGroupManagement().findAllRolloutGroupsWithDetailedStatus(
rolloutId, new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort));
firstPageRolloutGroupSets = getRolloutGroupManagement().findByRolloutWithDetailedStatus(
new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), rolloutId);
size = firstPageRolloutGroupSets.getTotalElements();
} catch (final EntityNotFoundException e) {
LOG.error("Rollout does not exists. Redirect to Rollouts overview", e);

View File

@@ -306,7 +306,7 @@ public class RolloutGroupListGrid extends AbstractGrid<LazyQueryContainer> {
@Override
public void click(final RendererClickEvent event) {
final Optional<RolloutGroup> group = rolloutGroupManagement
.findRolloutGroupWithDetailedStatus((Long) event.getItemId());
.getWithDetailedStatus((Long) event.getItemId());
if (!group.isPresent()) {
eventBus.publish(this, RolloutEvent.SHOW_ROLLOUTS);
return;

View File

@@ -88,7 +88,7 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
}
return rolloutGroup.map(group -> getProxyRolloutGroupTargetsList(getRolloutGroupManagement()
.findAllTargetsWithActionStatus(new PageRequest(startIndex / count, count), group.getId())
.findAllTargetsOfRolloutGroupWithActionStatus(new PageRequest(startIndex / count, count), group.getId())
.getContent())).orElse(Collections.emptyList());
}
@@ -134,7 +134,7 @@ public class RolloutGroupTargetsBeanQuery extends AbstractBeanQuery<ProxyTarget>
try {
firstPageTargetSets = rolloutGroup.map(group -> getRolloutGroupManagement()
.findAllTargetsWithActionStatus(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), group.getId()))
.findAllTargetsOfRolloutGroupWithActionStatus(new PageRequest(0, SPUIDefinitions.PAGE_SIZE, sort), group.getId()))
.orElse(null);
size = firstPageTargetSets == null ? 0 : firstPageTargetSets.getTotalElements();

View File

@@ -80,7 +80,7 @@ public class DefaultDistributionSetTypeLayout extends BaseConfigurationView {
hlayout.setComponentAlignment(configurationLabel, Alignment.MIDDLE_LEFT);
final Iterable<DistributionSetType> distributionSetTypeCollection = distributionSetTypeManagement
.findDistributionSetTypesAll(new PageRequest(0, 100));
.findAll(new PageRequest(0, 100));
combobox.setId(UIComponentIdProvider.SYSTEM_CONFIGURATION_DEFAULTDIS_COMBOBOX);
combobox.setNullSelectionAllowed(false);