@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.simulator;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater.UpdaterCallback;
|
||||
import org.eclipse.hawkbit.simulator.http.ControllerResource;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -82,28 +81,27 @@ public class DDISimulatedDevice extends AbstractSimulatedDevice {
|
||||
final String deploymentJson = controllerResource.getDeployment(getTenant(), getId(), actionId);
|
||||
final String swVersion = JsonPath.parse(deploymentJson).read("deployment.chunks[0].version");
|
||||
currentActionId = actionId;
|
||||
deviceUpdater.startUpdate(getTenant(), getId(), actionId, swVersion, new UpdaterCallback() {
|
||||
@Override
|
||||
public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) {
|
||||
switch (device.getResponseStatus()) {
|
||||
case SUCCESSFUL:
|
||||
controllerResource.postSuccessFeedback(getTenant(), getId(), actionId);
|
||||
break;
|
||||
case ERROR:
|
||||
controllerResource.postErrorFeedback(getTenant(), getId(), actionId);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException("simulated device has an unknown response status + "
|
||||
+ device.getResponseStatus());
|
||||
}
|
||||
currentActionId = null;
|
||||
deviceUpdater.startUpdate(getTenant(), getId(), actionId, swVersion, (device, actionId1) -> {
|
||||
switch (device.getResponseStatus()) {
|
||||
case SUCCESSFUL:
|
||||
controllerResource.postSuccessFeedback(getTenant(), getId(),
|
||||
actionId1);
|
||||
break;
|
||||
case ERROR:
|
||||
controllerResource.postErrorFeedback(getTenant(), getId(),
|
||||
actionId1);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException(
|
||||
"simulated device has an unknown response status + " + device.getResponseStatus());
|
||||
}
|
||||
currentActionId = null;
|
||||
});
|
||||
}
|
||||
} catch (final PathNotFoundException e) {
|
||||
// href might not be in the json response, so ignore
|
||||
// exception here.
|
||||
LOGGER.trace("Response does not contain a deploymentbase href link, ignoring.");
|
||||
LOGGER.trace("Response does not contain a deploymentbase href link, ignoring.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.simulator;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@@ -41,7 +42,7 @@ public class DeviceSimulatorUpdater {
|
||||
|
||||
/**
|
||||
* Starting an simulated update process of an simulated device.
|
||||
*
|
||||
*
|
||||
* @param tenant
|
||||
* the tenant of the device
|
||||
* @param id
|
||||
@@ -66,7 +67,7 @@ public class DeviceSimulatorUpdater {
|
||||
}
|
||||
|
||||
private static final class DeviceSimulatorUpdateThread implements Runnable {
|
||||
private static final Random rndSleep = new Random();
|
||||
private static final Random rndSleep = new SecureRandom();
|
||||
|
||||
private final AbstractSimulatedDevice device;
|
||||
private final SpSenderService spSenderService;
|
||||
@@ -74,9 +75,8 @@ public class DeviceSimulatorUpdater {
|
||||
private final EventBus eventbus;
|
||||
private final UpdaterCallback callback;
|
||||
|
||||
private DeviceSimulatorUpdateThread(final AbstractSimulatedDevice device,
|
||||
final SpSenderService spSenderService, final long actionId, final EventBus eventbus,
|
||||
final UpdaterCallback callback) {
|
||||
private DeviceSimulatorUpdateThread(final AbstractSimulatedDevice device, final SpSenderService spSenderService,
|
||||
final long actionId, final EventBus eventbus, final UpdaterCallback callback) {
|
||||
this.device = device;
|
||||
this.spSenderService = spSenderService;
|
||||
this.actionId = actionId;
|
||||
@@ -89,8 +89,9 @@ public class DeviceSimulatorUpdater {
|
||||
final double newProgress = device.getProgress() + 0.2;
|
||||
device.setProgress(newProgress);
|
||||
if (newProgress < 1.0) {
|
||||
threadPool.schedule(new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus,
|
||||
callback), rndSleep.nextInt(3000), TimeUnit.MILLISECONDS);
|
||||
threadPool.schedule(
|
||||
new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
|
||||
rndSleep.nextInt(3000), TimeUnit.MILLISECONDS);
|
||||
} else {
|
||||
callback.updateFinished(device, actionId);
|
||||
}
|
||||
@@ -102,7 +103,7 @@ public class DeviceSimulatorUpdater {
|
||||
* Callback interface which is called when the simulated update process has
|
||||
* been finished and the caller of starting the simulated update process can
|
||||
* send the result to the hawkbit update server back.
|
||||
*
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
@@ -111,7 +112,7 @@ public class DeviceSimulatorUpdater {
|
||||
/**
|
||||
* Callback method to indicate that the simulated update process has
|
||||
* been finished.
|
||||
*
|
||||
*
|
||||
* @param device
|
||||
* the device which has been updated
|
||||
* @param actionId
|
||||
|
||||
@@ -16,6 +16,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.simulator.event.NextPollCounterUpdate;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -24,13 +26,15 @@ import com.google.common.eventbus.EventBus;
|
||||
/**
|
||||
* Poll time trigger which executes the {@link DDISimulatedDevice#poll()} every
|
||||
* second.
|
||||
*
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class NextPollTimeController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(NextPollTimeController.class);
|
||||
|
||||
private static final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
|
||||
private static final ExecutorService pollService = Executors.newFixedThreadPool(1);
|
||||
|
||||
@@ -58,14 +62,9 @@ public class NextPollTimeController {
|
||||
if (nextCounter < 0) {
|
||||
if (device instanceof DDISimulatedDevice) {
|
||||
try {
|
||||
pollService.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((DDISimulatedDevice) device).poll();
|
||||
}
|
||||
});
|
||||
} catch (final Exception e) {
|
||||
|
||||
pollService.submit(() -> ((DDISimulatedDevice) device).poll());
|
||||
} catch (final IllegalStateException e) {
|
||||
LOGGER.trace("Device could not be polled", e);
|
||||
}
|
||||
nextCounter = ((DDISimulatedDevice) device).getPollDelaySec();
|
||||
}
|
||||
|
||||
@@ -8,19 +8,22 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.report.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* A data report series which contains a list of {@link DataReportSeriesItem}.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param <T>
|
||||
* the type of the report series item
|
||||
*/
|
||||
public class DataReportSeries<T extends Object> extends AbstractReportSeries {
|
||||
public class DataReportSeries<T extends Serializable> extends AbstractReportSeries {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final List<DataReportSeriesItem<T>> data = new ArrayList<>();
|
||||
|
||||
@@ -46,7 +49,7 @@ public class DataReportSeries<T extends Object> extends AbstractReportSeries {
|
||||
}
|
||||
|
||||
private void setData(final List<DataReportSeriesItem<T>> values) {
|
||||
this.data.clear();
|
||||
data.clear();
|
||||
data.addAll(values);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.report.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* An data report series item which contains a type and a value.
|
||||
*
|
||||
@@ -16,8 +18,9 @@ package org.eclipse.hawkbit.report.model;
|
||||
* @param <T>
|
||||
* the type of the report series item
|
||||
*/
|
||||
public class DataReportSeriesItem<T extends Object> {
|
||||
public class DataReportSeriesItem<T extends Serializable> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private final T type;
|
||||
private final Number data;
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.report.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* A double data series which contains an inner and an outer series ideal for
|
||||
* showing donut charts.
|
||||
@@ -17,7 +19,7 @@ package org.eclipse.hawkbit.report.model;
|
||||
* @param <T>
|
||||
* The type parameter for the report series data
|
||||
*/
|
||||
public class InnerOuterDataReportSeries<T> {
|
||||
public class InnerOuterDataReportSeries<T extends Serializable> {
|
||||
|
||||
private final DataReportSeries<T> innerSeries;
|
||||
private final DataReportSeries<T> outerSeries;
|
||||
|
||||
@@ -22,10 +22,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.criteria.CriteriaBuilder;
|
||||
import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagAssigmentResultEvent;
|
||||
@@ -53,13 +49,13 @@ import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.specifications.DistributionSetSpecification;
|
||||
import org.eclipse.hawkbit.repository.specifications.DistributionSetTypeSpecification;
|
||||
import org.eclipse.hawkbit.repository.specifications.SpecificationsBuilder;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -203,7 +199,8 @@ public class DistributionSetManagement {
|
||||
}
|
||||
|
||||
final DistributionSetTagAssigmentResult resultAssignment = result;
|
||||
afterCommit.afterCommit(() -> eventBus.post(new DistributionSetTagAssigmentResultEvent(resultAssignment)));
|
||||
afterCommit
|
||||
.afterCommit(() -> eventBus.post(new DistributionSetTagAssigmentResultEvent(resultAssignment)));
|
||||
|
||||
// no reason to persist the tag
|
||||
entityManager.detach(myTag);
|
||||
@@ -263,7 +260,7 @@ public class DistributionSetManagement {
|
||||
@Transactional
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
public void deleteDistributionSet(@NotNull final DistributionSet set) {
|
||||
this.deleteDistributionSet(set.getId());
|
||||
deleteDistributionSet(set.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,14 +318,10 @@ public class DistributionSetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
public DistributionSet createDistributionSet(@NotNull final DistributionSet dSet) {
|
||||
prepareDsSave(dSet);
|
||||
|
||||
if (dSet.getType() == null) {
|
||||
dSet.setType(systemManagement.getTenantMetadata().getDefaultDsType());
|
||||
}
|
||||
|
||||
final DistributionSet result = distributionSetRepository.save(dSet);
|
||||
|
||||
return result;
|
||||
return distributionSetRepository.save(dSet);
|
||||
}
|
||||
|
||||
private void prepareDsSave(final DistributionSet dSet) {
|
||||
@@ -400,7 +393,7 @@ public class DistributionSetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
public DistributionSet unassignSoftwareModule(@NotNull final DistributionSet ds,
|
||||
final SoftwareModule softwareModule) {
|
||||
final Set<SoftwareModule> softwareModules = new HashSet<SoftwareModule>();
|
||||
final Set<SoftwareModule> softwareModules = new HashSet<>();
|
||||
softwareModules.add(softwareModule);
|
||||
ds.removeModule(softwareModule);
|
||||
checkDistributionSetSoftwareModulesIsAllowedToModify(ds, softwareModules);
|
||||
@@ -491,20 +484,11 @@ public class DistributionSetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
private DistributionSet findDistributionSetsByFiltersAndInstalledOrAssignedTarget(
|
||||
final DistributionSetFilter distributionSetFilter) {
|
||||
|
||||
final List<Specification<DistributionSet>> specList = buildDistributionSetSpecifications(distributionSetFilter);
|
||||
|
||||
Specifications<DistributionSet> specs = null;
|
||||
if (!specList.isEmpty()) {
|
||||
specs = Specifications.where(specList.get(0));
|
||||
if (specList == null || specList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
if (specList.size() > 1) {
|
||||
specList.remove(0);
|
||||
for (final Specification<DistributionSet> s : specList) {
|
||||
specs = specs.and(s);
|
||||
}
|
||||
}
|
||||
return distributionSetRepository.findOne(specs);
|
||||
return distributionSetRepository.findOne(SpecificationsBuilder.combineWithAnd(specList));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -531,7 +515,7 @@ public class DistributionSetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
public Page<DistributionSet> findDistributionSetsAll(@NotNull final Pageable pageReq, final Boolean deleted,
|
||||
final Boolean complete) {
|
||||
final List<Specification<DistributionSet>> specList = new ArrayList<Specification<DistributionSet>>();
|
||||
final List<Specification<DistributionSet>> specList = new ArrayList<>();
|
||||
|
||||
if (deleted != null) {
|
||||
final Specification<DistributionSet> spec = DistributionSetSpecification.isDeleted(deleted);
|
||||
@@ -563,7 +547,7 @@ public class DistributionSetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
public Page<DistributionSet> findDistributionSetsAll(@NotNull final Specification<DistributionSet> spec,
|
||||
@NotNull final Pageable pageReq, final Boolean deleted) {
|
||||
final List<Specification<DistributionSet>> specList = new ArrayList<Specification<DistributionSet>>();
|
||||
final List<Specification<DistributionSet>> specList = new ArrayList<>();
|
||||
if (deleted != null) {
|
||||
specList.add(DistributionSetSpecification.isDeleted(deleted));
|
||||
}
|
||||
@@ -635,17 +619,6 @@ public class DistributionSetManagement {
|
||||
return new PageImpl<>(resultSet, pageable, findDistributionSetsByFilters.getTotalElements());
|
||||
}
|
||||
|
||||
private Long countDistributionSetByCriteriaAPI(@NotEmpty final List<Specification<DistributionSet>> specList) {
|
||||
Specifications<DistributionSet> specs = Specifications.where(specList.get(0));
|
||||
if (specList.size() > 1) {
|
||||
for (final Specification<DistributionSet> s : specList.subList(1, specList.size())) {
|
||||
specs = specs.and(s);
|
||||
}
|
||||
}
|
||||
|
||||
return distributionSetRepository.count(specs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find distribution set by name and version.
|
||||
*
|
||||
@@ -689,12 +662,12 @@ public class DistributionSetManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
public Long countDistributionSetsAll() {
|
||||
|
||||
final List<Specification<DistributionSet>> specList = new ArrayList<Specification<DistributionSet>>();
|
||||
final List<Specification<DistributionSet>> specList = new ArrayList<>();
|
||||
|
||||
final Specification<DistributionSet> spec = DistributionSetSpecification.isDeleted(Boolean.FALSE);
|
||||
specList.add(spec);
|
||||
|
||||
return countDistributionSetByCriteriaAPI(specList);
|
||||
return distributionSetRepository.count(SpecificationsBuilder.combineWithAnd(specList));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -869,17 +842,10 @@ public class DistributionSetManagement {
|
||||
public Page<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(
|
||||
@NotNull final Long distributionSetId, @NotNull final Pageable pageable) {
|
||||
|
||||
return distributionSetMetadataRepository.findAll(new Specification<DistributionSetMetadata>() {
|
||||
@Override
|
||||
public Predicate toPredicate(final Root<DistributionSetMetadata> root, final CriteriaQuery<?> query,
|
||||
final CriteriaBuilder cb) {
|
||||
|
||||
final Predicate predicate = cb.equal(
|
||||
root.get(DistributionSetMetadata_.distributionSet).get(DistributionSet_.id), distributionSetId);
|
||||
|
||||
return predicate;
|
||||
}
|
||||
}, pageable);
|
||||
return distributionSetMetadataRepository.findAll(
|
||||
(Specification<DistributionSetMetadata>) (root, query, cb) -> cb.equal(
|
||||
root.get(DistributionSetMetadata_.distributionSet).get(DistributionSet_.id), distributionSetId),
|
||||
pageable);
|
||||
|
||||
}
|
||||
|
||||
@@ -899,14 +865,14 @@ public class DistributionSetManagement {
|
||||
public Page<DistributionSetMetadata> findDistributionSetMetadataByDistributionSetId(
|
||||
@NotNull final Long distributionSetId, @NotNull final Specification<DistributionSetMetadata> spec,
|
||||
@NotNull final Pageable pageable) {
|
||||
return distributionSetMetadataRepository.findAll(new Specification<DistributionSetMetadata>() {
|
||||
@Override
|
||||
public Predicate toPredicate(final Root<DistributionSetMetadata> root, final CriteriaQuery<?> query,
|
||||
final CriteriaBuilder cb) {
|
||||
return cb.and(cb.equal(root.get(DistributionSetMetadata_.distributionSet).get(DistributionSet_.id),
|
||||
distributionSetId), spec.toPredicate(root, query, cb));
|
||||
}
|
||||
}, pageable);
|
||||
return distributionSetMetadataRepository
|
||||
.findAll(
|
||||
(Specification<DistributionSetMetadata>) (root, query,
|
||||
cb) -> cb.and(
|
||||
cb.equal(root.get(DistributionSetMetadata_.distributionSet)
|
||||
.get(DistributionSet_.id), distributionSetId),
|
||||
spec.toPredicate(root, query, cb)),
|
||||
pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -956,7 +922,7 @@ public class DistributionSetManagement {
|
||||
|
||||
/**
|
||||
* Checking Distribution Set is already using while assign Software module.
|
||||
*
|
||||
*
|
||||
* @param distributionSet
|
||||
* @param softwareModules
|
||||
*/
|
||||
@@ -969,9 +935,9 @@ public class DistributionSetManagement {
|
||||
|
||||
private List<Specification<DistributionSet>> buildDistributionSetSpecifications(
|
||||
final DistributionSetFilter distributionSetFilter) {
|
||||
final List<Specification<DistributionSet>> specList = new ArrayList<Specification<DistributionSet>>();
|
||||
final List<Specification<DistributionSet>> specList = new ArrayList<>();
|
||||
|
||||
Specification<DistributionSet> spec = null;
|
||||
Specification<DistributionSet> spec;
|
||||
|
||||
if (null != distributionSetFilter.getIsComplete()) {
|
||||
spec = DistributionSetSpecification.isCompleted(distributionSetFilter.getIsComplete());
|
||||
@@ -1053,21 +1019,12 @@ public class DistributionSetManagement {
|
||||
*/
|
||||
private Page<DistributionSet> findByCriteriaAPI(@NotNull final Pageable pageable,
|
||||
final List<Specification<DistributionSet>> specList) {
|
||||
Specifications<DistributionSet> specs = null;
|
||||
if (!specList.isEmpty()) {
|
||||
specs = Specifications.where(specList.get(0));
|
||||
}
|
||||
if (specList.size() > 1) {
|
||||
for (final Specification<DistributionSet> s : specList.subList(1, specList.size())) {
|
||||
specs = specs.and(s);
|
||||
}
|
||||
|
||||
if (specList == null || specList.isEmpty()) {
|
||||
return distributionSetRepository.findAll(pageable);
|
||||
}
|
||||
|
||||
if (specs == null) {
|
||||
return distributionSetRepository.findAll(pageable);
|
||||
} else {
|
||||
return distributionSetRepository.findAll(specs, pageable);
|
||||
}
|
||||
return distributionSetRepository.findAll(SpecificationsBuilder.combineWithAnd(specList), pageable);
|
||||
}
|
||||
|
||||
private void checkAndThrowAlreadyIfDistributionSetMetadataExists(final DsMetadataCompositeKey metadataId) {
|
||||
|
||||
@@ -213,8 +213,8 @@ public class ReportManagement {
|
||||
* count
|
||||
*/
|
||||
@Cacheable("targetsCreatedOverPeriod")
|
||||
public <T> DataReportSeries<T> targetsCreatedOverPeriod(final DateType<T> dateType, final LocalDateTime from,
|
||||
final LocalDateTime to) {
|
||||
public <T extends Serializable> DataReportSeries<T> targetsCreatedOverPeriod(final DateType<T> dateType,
|
||||
final LocalDateTime from, final LocalDateTime to) {
|
||||
final Query createNativeQuery = entityManager
|
||||
.createNativeQuery(getTargetsCreatedQueryTemplate(dateType, from, to));
|
||||
final List<Object[]> resultList = createNativeQuery.getResultList();
|
||||
@@ -223,8 +223,7 @@ public class ReportManagement {
|
||||
.map(r -> new DataReportSeriesItem<>(dateType.format((String) r[0]), ((Number) r[1]).longValue()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final DataReportSeries<T> report = new DataReportSeries<>("CreatedTargets", reportItems);
|
||||
return report;
|
||||
return new DataReportSeries<>("CreatedTargets", reportItems);
|
||||
}
|
||||
|
||||
private String getTargetsCreatedQueryTemplate(final DateType<?> dateType, final LocalDateTime from,
|
||||
@@ -276,8 +275,8 @@ public class ReportManagement {
|
||||
* count
|
||||
*/
|
||||
@Cacheable("feedbackReceivedOverTime")
|
||||
public <T> DataReportSeries<T> feedbackReceivedOverTime(final DateType<T> dateType, final LocalDateTime from,
|
||||
final LocalDateTime to) {
|
||||
public <T extends Serializable> DataReportSeries<T> feedbackReceivedOverTime(final DateType<T> dateType,
|
||||
final LocalDateTime from, final LocalDateTime to) {
|
||||
final Query createNativeQuery = entityManager
|
||||
.createNativeQuery(getFeedbackReceivedQueryTemplate(dateType, from, to));
|
||||
final List<Object[]> resultList = createNativeQuery.getResultList();
|
||||
@@ -286,8 +285,7 @@ public class ReportManagement {
|
||||
.map(r -> new DataReportSeriesItem<>(dateType.format((String) r[0]), ((Number) r[1]).longValue()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final DataReportSeries<T> report = new DataReportSeries<>("FeedbackRecieved", reportItems);
|
||||
return report;
|
||||
return new DataReportSeries<>("FeedbackRecieved", reportItems);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -433,7 +431,7 @@ public class ReportManagement {
|
||||
}
|
||||
|
||||
private DataReportSeriesItem<String> toItem() {
|
||||
return new DataReportSeriesItem<String>(name.getName() != null ? name.getName() : "misc", count);
|
||||
return new DataReportSeriesItem<>(name.getName() != null ? name.getName() : "misc", count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule_;
|
||||
import org.eclipse.hawkbit.repository.model.SwMetadataCompositeKey;
|
||||
import org.eclipse.hawkbit.repository.specifications.SoftwareModuleSpecification;
|
||||
import org.eclipse.hawkbit.repository.specifications.SpecificationsBuilder;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.AuditorAware;
|
||||
@@ -48,7 +49,6 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.data.domain.SliceImpl;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -198,7 +198,7 @@ public class SoftwareManagement {
|
||||
/**
|
||||
* retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType}
|
||||
* .
|
||||
*
|
||||
*
|
||||
* @param pageable
|
||||
* page parameters
|
||||
* @param type
|
||||
@@ -209,7 +209,7 @@ public class SoftwareManagement {
|
||||
public Slice<SoftwareModule> findSoftwareModulesByType(@NotNull final Pageable pageable,
|
||||
@NotNull final SoftwareModuleType type) {
|
||||
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<Specification<SoftwareModule>>();
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
||||
|
||||
Specification<SoftwareModule> spec = SoftwareModuleSpecification.equalType(type);
|
||||
specList.add(spec);
|
||||
@@ -230,7 +230,7 @@ public class SoftwareManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
public Long countSoftwareModulesByType(@NotNull final SoftwareModuleType type) {
|
||||
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<Specification<SoftwareModule>>();
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
||||
|
||||
Specification<SoftwareModule> spec = SoftwareModuleSpecification.equalType(type);
|
||||
specList.add(spec);
|
||||
@@ -257,7 +257,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* retrieves {@link SoftwareModule}s by their name AND version.
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* of the {@link SoftwareModule}
|
||||
* @param version
|
||||
@@ -273,7 +273,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* Deletes the given {@link SoftwareModule} {@link Entity}.
|
||||
*
|
||||
*
|
||||
* @param bsm
|
||||
* is the {@link SoftwareModule} to be deleted
|
||||
*/
|
||||
@@ -291,26 +291,12 @@ public class SoftwareManagement {
|
||||
|
||||
private Slice<SoftwareModule> findSwModuleByCriteriaAPI(@NotNull final Pageable pageable,
|
||||
@NotEmpty final List<Specification<SoftwareModule>> specList) {
|
||||
|
||||
Specifications<SoftwareModule> specs = Specifications.where(specList.get(0));
|
||||
if (specList.size() > 1) {
|
||||
for (final Specification<SoftwareModule> s : specList.subList(1, specList.size())) {
|
||||
specs = specs.and(s);
|
||||
}
|
||||
}
|
||||
|
||||
return criteriaNoCountDao.findAll(specs, pageable, SoftwareModule.class);
|
||||
return criteriaNoCountDao.findAll(SpecificationsBuilder.combineWithAnd(specList), pageable,
|
||||
SoftwareModule.class);
|
||||
}
|
||||
|
||||
private Long countSwModuleByCriteriaAPI(@NotEmpty final List<Specification<SoftwareModule>> specList) {
|
||||
Specifications<SoftwareModule> specs = Specifications.where(specList.get(0));
|
||||
if (specList.size() > 1) {
|
||||
for (final Specification<SoftwareModule> s : specList.subList(1, specList.size())) {
|
||||
specs = specs.and(s);
|
||||
}
|
||||
}
|
||||
|
||||
return softwareModuleRepository.count(specs);
|
||||
return softwareModuleRepository.count(SpecificationsBuilder.combineWithAnd(specList));
|
||||
}
|
||||
|
||||
private void deleteGridFsArtifacts(final SoftwareModule swModule) {
|
||||
@@ -321,7 +307,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* Deletes {@link SoftwareModule}s which is any if the given ids.
|
||||
*
|
||||
*
|
||||
* @param ids
|
||||
* of the Software Moduels to be deleted
|
||||
*/
|
||||
@@ -366,20 +352,16 @@ public class SoftwareManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
public Slice<SoftwareModule> findSoftwareModulesAll(@NotNull final Pageable pageable) {
|
||||
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<Specification<SoftwareModule>>();
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
||||
|
||||
Specification<SoftwareModule> spec = SoftwareModuleSpecification.isDeletedFalse();
|
||||
specList.add(spec);
|
||||
|
||||
spec = new Specification<SoftwareModule>() {
|
||||
@Override
|
||||
public Predicate toPredicate(final Root<SoftwareModule> root, final CriteriaQuery<?> query,
|
||||
final CriteriaBuilder cb) {
|
||||
if (!query.getResultType().isAssignableFrom(Long.class)) {
|
||||
root.fetch(SoftwareModule_.type);
|
||||
}
|
||||
return cb.conjunction();
|
||||
spec = (root, query, cb) -> {
|
||||
if (!query.getResultType().isAssignableFrom(Long.class)) {
|
||||
root.fetch(SoftwareModule_.type);
|
||||
}
|
||||
return cb.conjunction();
|
||||
};
|
||||
|
||||
specList.add(spec);
|
||||
@@ -396,7 +378,7 @@ public class SoftwareManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
public Long countSoftwareModulesAll() {
|
||||
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<Specification<SoftwareModule>>();
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
||||
|
||||
final Specification<SoftwareModule> spec = SoftwareModuleSpecification.isDeletedFalse();
|
||||
specList.add(spec);
|
||||
@@ -479,7 +461,7 @@ public class SoftwareManagement {
|
||||
public Slice<SoftwareModule> findSoftwareModuleByFilters(@NotNull final Pageable pageable, final String searchText,
|
||||
final SoftwareModuleType type) {
|
||||
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<Specification<SoftwareModule>>();
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
||||
|
||||
Specification<SoftwareModule> spec = SoftwareModuleSpecification.isDeletedFalse();
|
||||
specList.add(spec);
|
||||
@@ -494,15 +476,11 @@ public class SoftwareManagement {
|
||||
specList.add(spec);
|
||||
}
|
||||
|
||||
spec = new Specification<SoftwareModule>() {
|
||||
@Override
|
||||
public Predicate toPredicate(final Root<SoftwareModule> root, final CriteriaQuery<?> query,
|
||||
final CriteriaBuilder cb) {
|
||||
if (!query.getResultType().isAssignableFrom(Long.class)) {
|
||||
root.fetch(SoftwareModule_.type);
|
||||
}
|
||||
return cb.conjunction();
|
||||
spec = (root, query, cb) -> {
|
||||
if (!query.getResultType().isAssignableFrom(Long.class)) {
|
||||
root.fetch(SoftwareModule_.type);
|
||||
}
|
||||
return cb.conjunction();
|
||||
};
|
||||
|
||||
specList.add(spec);
|
||||
@@ -592,7 +570,7 @@ public class SoftwareManagement {
|
||||
|
||||
private List<Specification<SoftwareModule>> buildSpecificationList(final String searchText,
|
||||
final SoftwareModuleType type) {
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<Specification<SoftwareModule>>();
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
||||
if (!Strings.isNullOrEmpty(searchText)) {
|
||||
specList.add(SoftwareModuleSpecification.likeNameOrVersion(searchText));
|
||||
}
|
||||
@@ -631,7 +609,7 @@ public class SoftwareManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
public Long countSoftwareModuleByFilters(final String searchText, final SoftwareModuleType type) {
|
||||
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<Specification<SoftwareModule>>();
|
||||
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
|
||||
|
||||
Specification<SoftwareModule> spec = SoftwareModuleSpecification.isDeletedFalse();
|
||||
specList.add(spec);
|
||||
@@ -788,7 +766,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* creates or updates a single software module meta data entry.
|
||||
*
|
||||
*
|
||||
* @param metadata
|
||||
* the meta data entry to create or update
|
||||
* @return the updated or created software module meta data entry
|
||||
@@ -813,7 +791,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* creates a list of software module meta data entries.
|
||||
*
|
||||
*
|
||||
* @param metadata
|
||||
* the meta data entries to create or update
|
||||
* @return the updated or created software module meta data entries
|
||||
@@ -835,7 +813,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* updates a distribution set meta data value if corresponding entry exists.
|
||||
*
|
||||
*
|
||||
* @param metadata
|
||||
* the meta data entry to be updated
|
||||
* @return the updated meta data entry
|
||||
@@ -858,7 +836,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* deletes a software module meta data entry.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the ID of the software module meta data to delete
|
||||
*/
|
||||
@@ -871,7 +849,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* finds all meta data by the given software module id.
|
||||
*
|
||||
*
|
||||
* @param swId
|
||||
* the software module id to retrieve the meta data from
|
||||
* @param pageable
|
||||
@@ -887,7 +865,7 @@ public class SoftwareManagement {
|
||||
|
||||
/**
|
||||
* finds all meta data by the given software module id.
|
||||
*
|
||||
*
|
||||
* @param softwareModuleId
|
||||
* the software module id to retrieve the meta data from
|
||||
* @param spec
|
||||
@@ -900,20 +878,19 @@ public class SoftwareManagement {
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
public Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(final Long softwareModuleId,
|
||||
@NotNull final Specification<SoftwareModuleMetadata> spec, @NotNull final Pageable pageable) {
|
||||
return softwareModuleMetadataRepository.findAll(new Specification<SoftwareModuleMetadata>() {
|
||||
@Override
|
||||
public Predicate toPredicate(final Root<SoftwareModuleMetadata> root, final CriteriaQuery<?> query,
|
||||
final CriteriaBuilder cb) {
|
||||
|
||||
return cb.and(cb.equal(root.get(SoftwareModuleMetadata_.softwareModule).get(SoftwareModule_.id),
|
||||
softwareModuleId), spec.toPredicate(root, query, cb));
|
||||
}
|
||||
}, pageable);
|
||||
return softwareModuleMetadataRepository
|
||||
.findAll(
|
||||
(Specification<SoftwareModuleMetadata>) (root, query,
|
||||
cb) -> cb.and(
|
||||
cb.equal(root.get(SoftwareModuleMetadata_.softwareModule)
|
||||
.get(SoftwareModule_.id), softwareModuleId),
|
||||
spec.toPredicate(root, query, cb)),
|
||||
pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* finds a single software module meta data by its id.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the id of the software module meta data containing the meta
|
||||
* data key and the ID of the software module
|
||||
|
||||
@@ -16,6 +16,7 @@ import javax.validation.constraints.NotNull;
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.repository.specifications.SpecificationsBuilder;
|
||||
import org.eclipse.hawkbit.repository.specifications.TargetFilterQuerySpecification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -33,7 +34,7 @@ import com.google.common.base.Strings;
|
||||
|
||||
/**
|
||||
* Business service facade for managing {@link TargetFilterQuery}s.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@@ -47,7 +48,7 @@ public class TargetFilterQueryManagement {
|
||||
|
||||
/**
|
||||
* creating new {@link TargetFilterQuery}.
|
||||
*
|
||||
*
|
||||
* @param customTargetFilter
|
||||
* @return the created {@link TargetFilterQuery}
|
||||
*/
|
||||
@@ -60,13 +61,12 @@ public class TargetFilterQueryManagement {
|
||||
if (targetFilterQueryRepository.findByName(customTargetFilter.getName()) != null) {
|
||||
throw new EntityAlreadyExistsException(customTargetFilter.getName());
|
||||
}
|
||||
final TargetFilterQuery filter = targetFilterQueryRepository.save(customTargetFilter);
|
||||
return filter;
|
||||
return targetFilterQueryRepository.save(customTargetFilter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete target filter query.
|
||||
*
|
||||
*
|
||||
* @param targetFilterQueryId
|
||||
* IDs of target filter query to be deleted
|
||||
*/
|
||||
@@ -78,9 +78,9 @@ public class TargetFilterQueryManagement {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Retrieves all target filter query{@link TargetFilterQuery}.
|
||||
*
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @return the found {@link TargetFilterQuery}s
|
||||
@@ -92,8 +92,8 @@ public class TargetFilterQueryManagement {
|
||||
|
||||
/**
|
||||
* Retrieves all target filter query which {@link TargetFilterQuery}.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @param name
|
||||
@@ -102,7 +102,7 @@ public class TargetFilterQueryManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
public Page<TargetFilterQuery> findTargetFilterQueryByFilters(@NotNull final Pageable pageable, final String name) {
|
||||
final List<Specification<TargetFilterQuery>> specList = new ArrayList<Specification<TargetFilterQuery>>();
|
||||
final List<Specification<TargetFilterQuery>> specList = new ArrayList<>();
|
||||
if (!Strings.isNullOrEmpty(name)) {
|
||||
specList.add(TargetFilterQuerySpecification.likeName(name));
|
||||
}
|
||||
@@ -110,7 +110,7 @@ public class TargetFilterQueryManagement {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @param specList
|
||||
@@ -119,29 +119,21 @@ public class TargetFilterQueryManagement {
|
||||
*/
|
||||
private Page<TargetFilterQuery> findTargetFilterQueryByCriteriaAPI(@NotNull final Pageable pageable,
|
||||
final List<Specification<TargetFilterQuery>> specList) {
|
||||
Specifications<TargetFilterQuery> specs = null;
|
||||
if (!specList.isEmpty()) {
|
||||
specs = Specifications.where(specList.get(0));
|
||||
}
|
||||
if (specList.size() > 1) {
|
||||
for (final Specification<TargetFilterQuery> s : specList.subList(1, specList.size())) {
|
||||
specs = specs.and(s);
|
||||
}
|
||||
}
|
||||
if (specs == null) {
|
||||
if (specList == null || specList.isEmpty()) {
|
||||
return targetFilterQueryRepository.findAll(pageable);
|
||||
} else {
|
||||
return targetFilterQueryRepository.findAll(specs, pageable);
|
||||
}
|
||||
|
||||
final Specifications<TargetFilterQuery> specs = SpecificationsBuilder.combineWithAnd(specList);
|
||||
return targetFilterQueryRepository.findAll(specs, pageable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find target filter query by name.
|
||||
*
|
||||
*
|
||||
* @param targetFilterQueryName
|
||||
* Target filter query name
|
||||
* @return the found {@link TargetFilterQuery}
|
||||
*
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
public TargetFilterQuery findTargetFilterQueryByName(@NotNull final String targetFilterQueryName) {
|
||||
@@ -150,11 +142,11 @@ public class TargetFilterQueryManagement {
|
||||
|
||||
/**
|
||||
* Find target filter query by id.
|
||||
*
|
||||
*
|
||||
* @param targetFilterQueryId
|
||||
* Target filter query id
|
||||
* @return the found {@link TargetFilterQuery}
|
||||
*
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
public TargetFilterQuery findTargetFilterQueryById(@NotNull final Long targetFilterQueryId) {
|
||||
@@ -163,7 +155,7 @@ public class TargetFilterQueryManagement {
|
||||
|
||||
/**
|
||||
* updates the {@link TargetFilterQuery}.
|
||||
*
|
||||
*
|
||||
* @param targetFilterQuery
|
||||
* to be updated
|
||||
* @return the updated {@link TargetFilterQuery}
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.model.Target_;
|
||||
import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
|
||||
import org.eclipse.hawkbit.repository.specifications.SpecificationsBuilder;
|
||||
import org.eclipse.hawkbit.repository.specifications.TargetSpecifications;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -59,7 +60,6 @@ import org.springframework.data.domain.SliceImpl;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -508,39 +508,18 @@ public class TargetManagement {
|
||||
* @return the page with the found {@link Target}
|
||||
*/
|
||||
private Slice<Target> findByCriteriaAPI(final Pageable pageable, final List<Specification<Target>> specList) {
|
||||
final Specifications<Target> specs = creatingTargetSpecifications(specList);
|
||||
|
||||
if (specs == null) {
|
||||
if (specList == null || specList.isEmpty()) {
|
||||
return criteriaNoCountDao.findAll(pageable, Target.class);
|
||||
} else {
|
||||
return criteriaNoCountDao.findAll(specs, pageable, Target.class);
|
||||
}
|
||||
|
||||
return criteriaNoCountDao.findAll(SpecificationsBuilder.combineWithAnd(specList), pageable, Target.class);
|
||||
}
|
||||
|
||||
private Long countByCriteriaAPI(final List<Specification<Target>> specList) {
|
||||
final Specifications<Target> specs = creatingTargetSpecifications(specList);
|
||||
|
||||
if (specs == null) {
|
||||
if (specList == null || specList.isEmpty()) {
|
||||
return targetRepository.count();
|
||||
} else {
|
||||
return targetRepository.count(specs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static Specifications<Target> creatingTargetSpecifications(final List<Specification<Target>> specList) {
|
||||
Specifications<Target> specs = null;
|
||||
if (!specList.isEmpty()) {
|
||||
specs = Specifications.where(specList.get(0));
|
||||
}
|
||||
if (specList.size() > 1) {
|
||||
specList.remove(0);
|
||||
for (final Specification<Target> s : specList) {
|
||||
specs = specs.and(s);
|
||||
}
|
||||
}
|
||||
return specs;
|
||||
return targetRepository.count(SpecificationsBuilder.combineWithAnd(specList));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,7 +77,7 @@ public class Rollout extends NamedEntity {
|
||||
private int rolloutGroupsCreated = 0;
|
||||
|
||||
@Transient
|
||||
private TotalTargetCountStatus totalTargetCountStatus;
|
||||
private transient TotalTargetCountStatus totalTargetCountStatus;
|
||||
|
||||
/**
|
||||
* @return the distributionSet
|
||||
@@ -234,7 +234,7 @@ public class Rollout extends NamedEntity {
|
||||
*/
|
||||
public TotalTargetCountStatus getTotalTargetCountStatus() {
|
||||
if (totalTargetCountStatus == null) {
|
||||
this.totalTargetCountStatus = new TotalTargetCountStatus(totalTargets);
|
||||
totalTargetCountStatus = new TotalTargetCountStatus(totalTargets);
|
||||
}
|
||||
return totalTargetCountStatus;
|
||||
}
|
||||
@@ -255,11 +255,11 @@ public class Rollout extends NamedEntity {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
public static enum RolloutStatus {
|
||||
public enum RolloutStatus {
|
||||
|
||||
/**
|
||||
* Rollouts is beeing created.
|
||||
|
||||
@@ -27,7 +27,7 @@ import javax.persistence.UniqueConstraint;
|
||||
|
||||
/**
|
||||
* JPA entity definition of persisting a group of an rollout.
|
||||
*
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
@@ -116,7 +116,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
}
|
||||
|
||||
public void setSuccessCondition(final RolloutGroupSuccessCondition finishCondition) {
|
||||
this.successCondition = finishCondition;
|
||||
successCondition = finishCondition;
|
||||
}
|
||||
|
||||
public String getSuccessConditionExp() {
|
||||
@@ -124,7 +124,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
}
|
||||
|
||||
public void setSuccessConditionExp(final String finishExp) {
|
||||
this.successConditionExp = finishExp;
|
||||
successConditionExp = finishExp;
|
||||
}
|
||||
|
||||
public RolloutGroupErrorCondition getErrorCondition() {
|
||||
@@ -140,7 +140,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
}
|
||||
|
||||
public void setErrorConditionExp(final String errorExp) {
|
||||
this.errorConditionExp = errorExp;
|
||||
errorConditionExp = errorExp;
|
||||
}
|
||||
|
||||
public RolloutGroupErrorAction getErrorAction() {
|
||||
@@ -188,7 +188,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
*/
|
||||
public TotalTargetCountStatus getTotalTargetCountStatus() {
|
||||
if (totalTargetCountStatus == null) {
|
||||
this.totalTargetCountStatus = new TotalTargetCountStatus(totalTargets);
|
||||
totalTargetCountStatus = new TotalTargetCountStatus(totalTargets);
|
||||
}
|
||||
return totalTargetCountStatus;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author Michael Hirsch
|
||||
*
|
||||
*/
|
||||
@@ -343,7 +343,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
}
|
||||
|
||||
public void setSuccessCondition(final RolloutGroupSuccessCondition finishCondition) {
|
||||
this.successCondition = finishCondition;
|
||||
successCondition = finishCondition;
|
||||
}
|
||||
|
||||
public String getSuccessConditionExp() {
|
||||
@@ -351,7 +351,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
}
|
||||
|
||||
public void setSuccessConditionExp(final String finishConditionExp) {
|
||||
this.successConditionExp = finishConditionExp;
|
||||
successConditionExp = finishConditionExp;
|
||||
}
|
||||
|
||||
public RolloutGroupSuccessAction getSuccessAction() {
|
||||
@@ -416,7 +416,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
|
||||
/**
|
||||
* Sets the finish condition and expression on the builder.
|
||||
*
|
||||
*
|
||||
* @param condition
|
||||
* the finish condition
|
||||
* @param expression
|
||||
@@ -432,7 +432,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
|
||||
/**
|
||||
* Sets the success action and expression on the builder.
|
||||
*
|
||||
*
|
||||
* @param action
|
||||
* the success action
|
||||
* @param expression
|
||||
@@ -448,7 +448,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
|
||||
/**
|
||||
* Sets the error condition and expression on the builder.
|
||||
*
|
||||
*
|
||||
* @param condition
|
||||
* the error condition
|
||||
* @param expression
|
||||
@@ -464,7 +464,7 @@ public class RolloutGroup extends NamedEntity {
|
||||
|
||||
/**
|
||||
* Sets the error action and expression on the builder.
|
||||
*
|
||||
*
|
||||
* @param action
|
||||
* the error action
|
||||
* @param expression
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
@@ -30,16 +31,18 @@ import javax.persistence.Table;
|
||||
@IdClass(RolloutTargetGroupId.class)
|
||||
@Entity
|
||||
@Table(name = "sp_rollouttargetgroup")
|
||||
public class RolloutTargetGroup {
|
||||
public class RolloutTargetGroup implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@ManyToOne(targetEntity = RolloutGroup.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||
@JoinColumn(name = "rolloutGroup_Id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollouttargetgroup_group"))
|
||||
@JoinColumn(name = "rolloutGroup_Id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollouttargetgroup_group") )
|
||||
private RolloutGroup rolloutGroup;
|
||||
|
||||
@Id
|
||||
@ManyToOne(targetEntity = Target.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||
@JoinColumn(name = "target_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollouttargetgroup_target"))
|
||||
@JoinColumn(name = "target_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_rollouttargetgroup_target") )
|
||||
private Target target;
|
||||
|
||||
@OneToMany(targetEntity = Action.class, fetch = FetchType.LAZY, cascade = { CascadeType.PERSIST })
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Store all states with the target count of a rollout or rolloutgroup.
|
||||
*
|
||||
*/
|
||||
@@ -27,12 +27,12 @@ public class TotalTargetCountStatus {
|
||||
SCHEDULED, RUNNING, ERROR, FINISHED, CANCELLED, NOTSTARTED
|
||||
}
|
||||
|
||||
private final Map<Status, Long> statusTotalCountMap = new HashMap<>();
|
||||
private final Map<Status, Long> statusTotalCountMap = new EnumMap<>(Status.class);
|
||||
private final Long totalTargetCount;
|
||||
|
||||
/**
|
||||
* Create a new states map with the target count for each state.
|
||||
*
|
||||
*
|
||||
* @param targetCountActionStatus
|
||||
* the action state map
|
||||
* @param totalTargets
|
||||
@@ -46,7 +46,7 @@ public class TotalTargetCountStatus {
|
||||
|
||||
/**
|
||||
* Create a new states map with the target count for each state.
|
||||
*
|
||||
*
|
||||
* @param totalTargetCount
|
||||
* the total target count
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ public class TotalTargetCountStatus {
|
||||
|
||||
/**
|
||||
* The current state mape which the total target count
|
||||
*
|
||||
*
|
||||
* @return the statusTotalCountMap the state map
|
||||
*/
|
||||
public Map<Status, Long> getStatusTotalCountMap() {
|
||||
@@ -65,7 +65,7 @@ public class TotalTargetCountStatus {
|
||||
|
||||
/**
|
||||
* Gets the total target count from a state.
|
||||
*
|
||||
*
|
||||
* @param status
|
||||
* the state key
|
||||
* @return the current target count cannot be <null>
|
||||
@@ -77,7 +77,7 @@ public class TotalTargetCountStatus {
|
||||
|
||||
/**
|
||||
* Populate all target status to a the given map
|
||||
*
|
||||
*
|
||||
* @param statusTotalCountMap
|
||||
* the map
|
||||
* @param rolloutStatusCountItems
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
*
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.specifications;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.domain.Specification;
|
||||
import org.springframework.data.jpa.domain.Specifications;
|
||||
|
||||
/**
|
||||
* Helper class to easily combine {@link Specification} instances.
|
||||
*
|
||||
*/
|
||||
public final class SpecificationsBuilder {
|
||||
|
||||
private SpecificationsBuilder() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine all given specification with and. The first specification is the
|
||||
* where clause.
|
||||
*
|
||||
* @param specList
|
||||
* all specification wich will combine
|
||||
* @return <null> if the given specification list is empty
|
||||
*/
|
||||
public static <T> Specifications<T> combineWithAnd(final List<Specification<T>> specList) {
|
||||
if (specList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Specifications<T> specs = Specifications.where(specList.get(0));
|
||||
specList.remove(0);
|
||||
for (final Specification<T> specification : specList) {
|
||||
specs = specs.and(specification);
|
||||
}
|
||||
return specs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,7 +16,19 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
*/
|
||||
public interface RolloutGroupConditionEvaluator {
|
||||
|
||||
boolean verifyExpression(final String expression);
|
||||
default boolean verifyExpression(final String expression) {
|
||||
// percentage value between 0 and 100
|
||||
try {
|
||||
final Integer value = Integer.valueOf(expression);
|
||||
if (value >= 0 || value <= 100) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
} catch (final NumberFormatException e) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean eval(Rollout rollout, RolloutGroup rolloutGroup, final String expression);
|
||||
}
|
||||
|
||||
@@ -18,31 +18,16 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component("thresholdRolloutGroupErrorCondition")
|
||||
public class ThresholdRolloutGroupErrorCondition implements RolloutGroupConditionEvaluator {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ThresholdRolloutGroupErrorCondition.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ThresholdRolloutGroupErrorCondition.class);
|
||||
|
||||
@Autowired
|
||||
private ActionRepository actionRepository;
|
||||
|
||||
@Override
|
||||
public boolean verifyExpression(final String expression) {
|
||||
// percentage value between 0 and 100
|
||||
try {
|
||||
final Integer value = Integer.valueOf(expression);
|
||||
if (value >= 0 || value <= 100) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
} catch (final RuntimeException e) {
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eval(final Rollout rollout, final RolloutGroup rolloutGroup, final String expression) {
|
||||
final Long totalGroup = actionRepository.countByRolloutAndRolloutGroup(rollout, rolloutGroup);
|
||||
@@ -60,7 +45,7 @@ public class ThresholdRolloutGroupErrorCondition implements RolloutGroupConditio
|
||||
// calculate threshold
|
||||
return ((float) error / (float) totalGroup) > ((float) threshold / 100F);
|
||||
} catch (final NumberFormatException e) {
|
||||
logger.error("Cannot evaluate condition expression " + expression, e);
|
||||
LOGGER.error("Cannot evaluate condition expression " + expression, e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,47 +12,41 @@ import org.eclipse.hawkbit.repository.ActionRepository;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Component("thresholdRolloutGroupSuccessCondition")
|
||||
public class ThresholdRolloutGroupSuccessCondition implements RolloutGroupConditionEvaluator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ThresholdRolloutGroupSuccessCondition.class);
|
||||
|
||||
@Autowired
|
||||
private ActionRepository actionRepository;
|
||||
|
||||
@Override
|
||||
public boolean verifyExpression(final String expression) {
|
||||
// percentage value between 0 and 100
|
||||
try {
|
||||
final Integer value = Integer.valueOf(expression);
|
||||
if (value >= 0 || value <= 100) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
} catch (final RuntimeException e) {
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eval(final Rollout rollout, final RolloutGroup rolloutGroup, final String expression) {
|
||||
final Long totalGroup = rolloutGroup.getTotalTargets();
|
||||
final Long finished = actionRepository.countByRolloutIdAndRolloutGroupIdAndStatus(rollout.getId(),
|
||||
final Long finished = this.actionRepository.countByRolloutIdAndRolloutGroupIdAndStatus(rollout.getId(),
|
||||
rolloutGroup.getId(), Action.Status.FINISHED);
|
||||
final Integer threshold = Integer.valueOf(expression);
|
||||
try {
|
||||
final Integer threshold = Integer.valueOf(expression);
|
||||
|
||||
if (totalGroup == 0) {
|
||||
// in case e.g. targets has been deleted we don't have any actions
|
||||
// left for this group, so the group is finished
|
||||
return true;
|
||||
if (totalGroup == 0) {
|
||||
// in case e.g. targets has been deleted we don't have any
|
||||
// actions
|
||||
// left for this group, so the group is finished
|
||||
return true;
|
||||
}
|
||||
// calculate threshold
|
||||
return ((float) finished / (float) totalGroup) >= ((float) threshold / 100F);
|
||||
} catch (final NumberFormatException e) {
|
||||
LOGGER.error("Cannot evaluate condition expression " + expression, e);
|
||||
return false;
|
||||
}
|
||||
// calculate threshold
|
||||
return ((float) finished / (float) totalGroup) >= ((float) threshold / 100F);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
private SpringViewProvider viewProvider;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
private transient ApplicationContext context;
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
@@ -89,13 +89,13 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
private ErrorView errorview;
|
||||
|
||||
@Autowired
|
||||
protected EventBus.SessionEventBus eventBus;
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
/**
|
||||
* An {@link com.google.common.eventbus.EventBus} subscriber which
|
||||
* subscribes {@link EntityEvent} from the repository to dispatch these
|
||||
* events to the UI {@link SessionEventBus}.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
* the entity event which has been published from the repository
|
||||
*/
|
||||
@@ -103,21 +103,28 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
@AllowConcurrentEvents
|
||||
public void dispatch(final org.eclipse.hawkbit.eventbus.event.Event event) {
|
||||
final VaadinSession session = getSession();
|
||||
if (session != null && session.getState() == State.OPEN) {
|
||||
final WrappedSession wrappedSession = session.getSession();
|
||||
if (wrappedSession != null) {
|
||||
final SecurityContext userContext = (SecurityContext) wrappedSession
|
||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||
if (eventSecurityCheck(userContext, event)) {
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
access(new DispatcherRunnable(eventBus, session, userContext, event));
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (session == null || session.getState() != State.OPEN) {
|
||||
return;
|
||||
}
|
||||
|
||||
final WrappedSession wrappedSession = session.getSession();
|
||||
if (wrappedSession == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SecurityContext userContext = (SecurityContext) wrappedSession
|
||||
.getAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
|
||||
if (!eventSecurityCheck(userContext, event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final SecurityContext oldContext = SecurityContextHolder.getContext();
|
||||
try {
|
||||
access(new DispatcherRunnable(eventBus, session, userContext, event));
|
||||
} finally {
|
||||
SecurityContextHolder.setContext(oldContext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected boolean eventSecurityCheck(final SecurityContext userContext,
|
||||
@@ -134,7 +141,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* com.vaadin.server.ClientConnector.DetachListener#detach(com.vaadin.server
|
||||
* .ClientConnector. DetachEvent)
|
||||
@@ -225,7 +232,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
|
||||
|
||||
/**
|
||||
* Get Specific Locale.
|
||||
*
|
||||
*
|
||||
* @param availableLocalesInApp
|
||||
* as set
|
||||
* @return String as preferred locale
|
||||
|
||||
@@ -44,9 +44,9 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Abstract layout of confirm actions window.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -84,13 +84,13 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.confirmwindow.layout.
|
||||
* AbstractConfirmationWindowLayout# getConfimrationTabs()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
||||
final Map<String, ConfirmationTab> tabs = new HashMap<String, ConfirmationTab>();
|
||||
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
||||
if (!artifactUploadState.getDeleteSofwareModules().isEmpty()) {
|
||||
tabs.put(i18n.get("caption.delete.swmodule.accordion.tab"), createSMDeleteConfirmationTab());
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
||||
|
||||
/**
|
||||
* Get SWModule table container.
|
||||
*
|
||||
*
|
||||
* @return IndexedContainer
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -153,9 +153,8 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
||||
final IndexedContainer swcontactContainer = new IndexedContainer();
|
||||
swcontactContainer.addContainerProperty("SWModuleId", String.class, "");
|
||||
swcontactContainer.addContainerProperty(SW_MODULE_NAME_MSG, String.class, "");
|
||||
Item item = null;
|
||||
for (final Long swModuleID : artifactUploadState.getDeleteSofwareModules().keySet()) {
|
||||
item = swcontactContainer.addItem(swModuleID);
|
||||
final Item item = swcontactContainer.addItem(swModuleID);
|
||||
item.getItemProperty("SWModuleId").setValue(swModuleID.toString());
|
||||
item.getItemProperty(SW_MODULE_NAME_MSG)
|
||||
.setValue(artifactUploadState.getDeleteSofwareModules().get(swModuleID));
|
||||
@@ -197,7 +196,7 @@ public class UploadViewConfirmationWindowLayout extends AbstractConfirmationWind
|
||||
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
|
||||
final String swNameVersion = HawkbitCommonUtil.getFormattedNameVersion(
|
||||
customFile.getBaseSoftwareModuleName(), customFile.getBaseSoftwareModuleVersion());
|
||||
if (HawkbitCommonUtil.bothSame(deleteSoftwareNameVersion, swNameVersion)) {
|
||||
if (deleteSoftwareNameVersion != null && deleteSoftwareNameVersion.equals(swNameVersion)) {
|
||||
tobeRemoved.add(customFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ public class ArtifactUploadState implements Serializable {
|
||||
|
||||
private final Map<Long, String> deleteSofwareModules = new HashMap<>();
|
||||
|
||||
private final Set<CustomFile> fileSelected = new HashSet<CustomFile>();
|
||||
private final Set<CustomFile> fileSelected = new HashSet<>();
|
||||
|
||||
private Long selectedBaseSwModuleId;
|
||||
|
||||
private SoftwareModule selectedBaseSoftwareModule;
|
||||
|
||||
private final Map<String, SoftwareModule> baseSwModuleList = new HashMap<String, SoftwareModule>();
|
||||
private final Map<String, SoftwareModule> baseSwModuleList = new HashMap<>();
|
||||
|
||||
private Set<Long> selectedSoftwareModules = Collections.emptySet();
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ArtifactUploadState implements Serializable {
|
||||
|
||||
/**
|
||||
* Set software.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SoftwareModuleFilters getSoftwareModuleFilters() {
|
||||
@@ -85,7 +85,7 @@ public class ArtifactUploadState implements Serializable {
|
||||
* @return the selectedBaseSwModuleId
|
||||
*/
|
||||
public Optional<Long> getSelectedBaseSwModuleId() {
|
||||
return this.selectedBaseSwModuleId != null ? Optional.of(this.selectedBaseSwModuleId) : Optional.empty();
|
||||
return selectedBaseSwModuleId != null ? Optional.of(selectedBaseSwModuleId) : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,8 +100,7 @@ public class ArtifactUploadState implements Serializable {
|
||||
* @return the selectedBaseSoftwareModule
|
||||
*/
|
||||
public Optional<SoftwareModule> getSelectedBaseSoftwareModule() {
|
||||
return this.selectedBaseSoftwareModule == null ? Optional.empty()
|
||||
: Optional.of(this.selectedBaseSoftwareModule);
|
||||
return selectedBaseSoftwareModule == null ? Optional.empty() : Optional.of(selectedBaseSoftwareModule);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,8 +10,6 @@ package org.eclipse.hawkbit.ui.artifacts.state;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
|
||||
/**
|
||||
* Custom file to hold details of uploaded file.
|
||||
*
|
||||
@@ -168,36 +166,50 @@ public class CustomFile implements Serializable {
|
||||
return failureReason;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() { // NOSONAR - as this is generated
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (fileName == null ? 0 : fileName.hashCode());
|
||||
result = prime * result + ((baseSoftwareModuleName == null) ? 0 : baseSoftwareModuleName.hashCode());
|
||||
result = prime * result + ((baseSoftwareModuleVersion == null) ? 0 : baseSoftwareModuleVersion.hashCode());
|
||||
result = prime * result + ((fileName == null) ? 0 : fileName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof CustomFile)) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final CustomFile other = (CustomFile) obj;
|
||||
return HawkbitCommonUtil.bothSame(fileName, other.fileName)
|
||||
&& HawkbitCommonUtil.bothSame(baseSoftwareModuleName, other.baseSoftwareModuleName)
|
||||
&& HawkbitCommonUtil.bothSame(baseSoftwareModuleVersion, other.baseSoftwareModuleVersion);
|
||||
if (baseSoftwareModuleName == null) {
|
||||
if (other.baseSoftwareModuleName != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!baseSoftwareModuleName.equals(other.baseSoftwareModuleName)) {
|
||||
return false;
|
||||
}
|
||||
if (baseSoftwareModuleVersion == null) {
|
||||
if (other.baseSoftwareModuleVersion != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!baseSoftwareModuleVersion.equals(other.baseSoftwareModuleVersion)) {
|
||||
return false;
|
||||
}
|
||||
if (fileName == null) {
|
||||
if (other.fileName != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!fileName.equals(other.fileName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.filterlayout;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
|
||||
import com.vaadin.ui.Button;
|
||||
@@ -17,20 +15,20 @@ import com.vaadin.ui.Button.ClickEvent;
|
||||
|
||||
/**
|
||||
* Abstract Single button click behaviour of filter buttons layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButtonClickBehaviour {
|
||||
|
||||
private static final long serialVersionUID = 478874092615793581L;
|
||||
|
||||
private Optional<Button> alreadyClickedButton = Optional.empty();
|
||||
private Button alreadyClickedButton;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClick#
|
||||
* processFilterButtonClick(com.vaadin.ui. Button.ClickEvent)
|
||||
*/
|
||||
@@ -40,18 +38,18 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
|
||||
if (isButtonUnClicked(clickedButton)) {
|
||||
/* If same button clicked */
|
||||
clickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
|
||||
alreadyClickedButton = Optional.empty();
|
||||
alreadyClickedButton = null;
|
||||
filterUnClicked(clickedButton);
|
||||
} else if (alreadyClickedButton.isPresent()) {
|
||||
} else if (alreadyClickedButton != null) {
|
||||
/* If button clicked and some other button is already clicked */
|
||||
alreadyClickedButton.get().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
|
||||
alreadyClickedButton.removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
|
||||
clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
|
||||
alreadyClickedButton = Optional.of(clickedButton);
|
||||
alreadyClickedButton = clickedButton;
|
||||
filterClicked(clickedButton);
|
||||
} else {
|
||||
/* If button clicked and not other button is clicked currently */
|
||||
clickedButton.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
|
||||
alreadyClickedButton = Optional.of(clickedButton);
|
||||
alreadyClickedButton = clickedButton;
|
||||
filterClicked(clickedButton);
|
||||
}
|
||||
}
|
||||
@@ -61,21 +59,19 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
|
||||
* @return
|
||||
*/
|
||||
private boolean isButtonUnClicked(final Button clickedButton) {
|
||||
return alreadyClickedButton.isPresent() && alreadyClickedButton.get().equals(clickedButton);
|
||||
return alreadyClickedButton != null && alreadyClickedButton.equals(clickedButton);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#
|
||||
* setDefaultClickedButton(com.vaadin .ui.Button)
|
||||
*/
|
||||
@Override
|
||||
protected void setDefaultClickedButton(final Button button) {
|
||||
if (button == null) {
|
||||
alreadyClickedButton = Optional.empty();
|
||||
} else {
|
||||
alreadyClickedButton = Optional.of(button);
|
||||
alreadyClickedButton = button;
|
||||
if (button != null) {
|
||||
button.addStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +79,7 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
|
||||
/**
|
||||
* @return the alreadyClickedButton
|
||||
*/
|
||||
public Optional<Button> getAlreadyClickedButton() {
|
||||
public Button getAlreadyClickedButton() {
|
||||
return alreadyClickedButton;
|
||||
}
|
||||
|
||||
@@ -91,7 +87,7 @@ public abstract class AbstractFilterSingleButtonClick extends AbstractFilterButt
|
||||
* @param alreadyClickedButton
|
||||
* the alreadyClickedButton to set
|
||||
*/
|
||||
public void setAlreadyClickedButton(final Optional<Button> alreadyClickedButton) {
|
||||
public void setAlreadyClickedButton(final Button alreadyClickedButton) {
|
||||
this.alreadyClickedButton = alreadyClickedButton;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Abstract class for target/ds tag token layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -47,9 +47,9 @@ public abstract class AbstractTagToken implements Serializable {
|
||||
|
||||
protected IndexedContainer container;
|
||||
|
||||
protected final Map<Long, TagData> tagDetails = new HashMap<Long, TagData>();
|
||||
protected final Map<Long, TagData> tagDetails = new HashMap<>();
|
||||
|
||||
protected final Map<Long, TagData> tokensAdded = new HashMap<Long, TagData>();
|
||||
protected final Map<Long, TagData> tokensAdded = new HashMap<>();
|
||||
|
||||
protected CssLayout tokenLayout = new CssLayout();
|
||||
|
||||
@@ -123,7 +123,7 @@ public abstract class AbstractTagToken implements Serializable {
|
||||
class CustomTokenField extends TokenField {
|
||||
private static final long serialVersionUID = 694216966472937436L;
|
||||
|
||||
final Container tokenContainer;
|
||||
Container tokenContainer;
|
||||
|
||||
CustomTokenField(final CssLayout cssLayout, final Container tokenContainer) {
|
||||
super(cssLayout);
|
||||
@@ -235,9 +235,11 @@ public abstract class AbstractTagToken implements Serializable {
|
||||
|
||||
/**
|
||||
* Tag details.
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static class TagData {
|
||||
public static class TagData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String name;
|
||||
|
||||
@@ -247,7 +249,7 @@ public abstract class AbstractTagToken implements Serializable {
|
||||
|
||||
/**
|
||||
* Tag data constructor.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* @param name
|
||||
* @param color
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package org.eclipse.hawkbit.ui.distributions.dstable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -57,7 +58,7 @@ import com.vaadin.ui.Window;
|
||||
|
||||
/**
|
||||
* Distribution set details layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@@ -153,12 +154,13 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
@SuppressWarnings("unchecked")
|
||||
private void showUnsavedAssignment() {
|
||||
Item item;
|
||||
final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = manageDistUIState.getAssignedList();
|
||||
final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = manageDistUIState
|
||||
.getAssignedList();
|
||||
final Long selectedDistId = manageDistUIState.getLastSelectedDistribution().isPresent()
|
||||
? manageDistUIState.getLastSelectedDistribution().get().getId() : null;
|
||||
Set<SoftwareModuleIdName> softwareModuleIdNameList = null;
|
||||
|
||||
for (final Map.Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : assignedList.entrySet()) {
|
||||
for (final Map.Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : assignedList.entrySet()) {
|
||||
if (entry.getKey().getId().equals(selectedDistId)) {
|
||||
softwareModuleIdNameList = entry.getValue();
|
||||
break;
|
||||
@@ -321,7 +323,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onEdit(com.vaadin.ui .Button.ClickEvent)
|
||||
*/
|
||||
@@ -336,7 +338,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getEditButtonId()
|
||||
*/
|
||||
@@ -347,7 +349,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onLoadIsSwModuleSelected ()
|
||||
*/
|
||||
@@ -359,7 +361,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* onLoadIsTableMaximized ()
|
||||
*/
|
||||
@@ -370,7 +372,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* populateDetailsWidget()
|
||||
*/
|
||||
@@ -381,7 +383,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getDefaultCaption()
|
||||
*/
|
||||
@@ -392,7 +394,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* addTabs(com.vaadin. ui.TabSheet)
|
||||
*/
|
||||
@@ -407,7 +409,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* clearDetails()
|
||||
*/
|
||||
@@ -418,7 +420,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* hasEditSoftwareModulePermission()
|
||||
*/
|
||||
@@ -507,7 +509,7 @@ public class DistributionSetDetails extends AbstractTableDetailsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.detailslayout.AbstractTableDetailsLayout#
|
||||
* getTabSheetId()
|
||||
*/
|
||||
|
||||
@@ -73,7 +73,7 @@ import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Distribution set table.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@@ -138,7 +138,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#getTableId()
|
||||
*/
|
||||
@@ -149,7 +149,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#createContainer(
|
||||
* )
|
||||
@@ -157,7 +157,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
@Override
|
||||
protected Container createContainer() {
|
||||
|
||||
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
|
||||
final Map<String, Object> queryConfiguration = new HashMap<>();
|
||||
manageDistUIState.getManageDistFilters().getSearchText()
|
||||
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
|
||||
|
||||
@@ -166,19 +166,16 @@ public class DistributionSetTable extends AbstractTable {
|
||||
manageDistUIState.getManageDistFilters().getClickedDistSetType());
|
||||
}
|
||||
|
||||
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<ManageDistBeanQuery>(
|
||||
ManageDistBeanQuery.class);
|
||||
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
|
||||
distributionQF.setQueryConfiguration(queryConfiguration);
|
||||
final LazyQueryContainer distContainer = new LazyQueryContainer(
|
||||
return new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
|
||||
distributionQF);
|
||||
|
||||
return distContainer;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#addContainerProperties
|
||||
* (com.vaadin.data.Container )
|
||||
*/
|
||||
@@ -191,7 +188,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* addCustomGeneratedColumns ()
|
||||
*/
|
||||
@@ -204,7 +201,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.table.AbstractTable#
|
||||
* isFirstRowSelectedOnLoad ()
|
||||
*/
|
||||
@@ -216,7 +213,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getItemIdToSelect()
|
||||
*/
|
||||
@Override
|
||||
@@ -229,7 +226,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#onValueChange()
|
||||
*/
|
||||
@@ -269,7 +266,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.table.AbstractTable#isMaximized()
|
||||
*/
|
||||
@@ -280,7 +277,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableVisibleColumns
|
||||
* ()
|
||||
*/
|
||||
@@ -291,7 +288,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.common.table.AbstractTable#getTableDropHandler()
|
||||
*/
|
||||
@Override
|
||||
@@ -317,7 +314,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
final TableTransferable transferable = (TableTransferable) event.getTransferable();
|
||||
final Table source = transferable.getSourceComponent();
|
||||
final Set<Long> softwareModuleSelected = (Set<Long>) source.getValue();
|
||||
final Set<Long> softwareModulesIdList = new HashSet<Long>();
|
||||
final Set<Long> softwareModulesIdList = new HashSet<>();
|
||||
|
||||
if (!softwareModuleSelected.contains(transferable.getData("itemId"))) {
|
||||
softwareModulesIdList.add((Long) transferable.getData("itemId"));
|
||||
@@ -345,11 +342,11 @@ public class DistributionSetTable extends AbstractTable {
|
||||
final String distVersion = (String) item.getItemProperty("version").getValue();
|
||||
final DistributionSetIdName distributionSetIdName = new DistributionSetIdName(distId, distName, distVersion);
|
||||
|
||||
final Map<Long, Set<SoftwareModuleIdName>> map;
|
||||
final HashMap<Long, HashSet<SoftwareModuleIdName>> map;
|
||||
if (manageDistUIState.getConsolidatedDistSoftwarewList().containsKey(distributionSetIdName)) {
|
||||
map = manageDistUIState.getConsolidatedDistSoftwarewList().get(distributionSetIdName);
|
||||
} else {
|
||||
map = new HashMap<Long, Set<SoftwareModuleIdName>>();
|
||||
map = new HashMap<>();
|
||||
manageDistUIState.getConsolidatedDistSoftwarewList().put(distributionSetIdName, map);
|
||||
}
|
||||
|
||||
@@ -382,7 +379,8 @@ public class DistributionSetTable extends AbstractTable {
|
||||
}
|
||||
}
|
||||
|
||||
final Set<SoftwareModuleIdName> softwareModules = new HashSet<SoftwareModuleIdName>();
|
||||
// hashset is seriablizable
|
||||
final HashSet<SoftwareModuleIdName> softwareModules = new HashSet<>();
|
||||
map.keySet().forEach(typeId -> softwareModules.addAll(map.get(typeId)));
|
||||
|
||||
updateDropedDetails(distributionSetIdName, softwareModules);
|
||||
@@ -405,8 +403,8 @@ public class DistributionSetTable extends AbstractTable {
|
||||
* @param softwareModule
|
||||
* @param softwareModuleIdName
|
||||
*/
|
||||
private void handleFirmwareCase(final Map<Long, Set<SoftwareModuleIdName>> map, final SoftwareModule softwareModule,
|
||||
final SoftwareModuleIdName softwareModuleIdName) {
|
||||
private void handleFirmwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
||||
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
||||
if (softwareModule.getType().getMaxAssignments() == 1) {
|
||||
if (!map.containsKey(softwareModule.getType().getId())) {
|
||||
map.put(softwareModule.getType().getId(), new HashSet<SoftwareModuleIdName>());
|
||||
@@ -423,8 +421,8 @@ public class DistributionSetTable extends AbstractTable {
|
||||
* @param softwareModule
|
||||
* @param softwareModuleIdName
|
||||
*/
|
||||
private void handleSoftwareCase(final Map<Long, Set<SoftwareModuleIdName>> map, final SoftwareModule softwareModule,
|
||||
final SoftwareModuleIdName softwareModuleIdName) {
|
||||
private void handleSoftwareCase(final Map<Long, HashSet<SoftwareModuleIdName>> map,
|
||||
final SoftwareModule softwareModule, final SoftwareModuleIdName softwareModuleIdName) {
|
||||
if (softwareModule.getType().getMaxAssignments() == Integer.MAX_VALUE) {
|
||||
if (!map.containsKey(softwareModule.getType().getId())) {
|
||||
map.put(softwareModule.getType().getId(), new HashSet<SoftwareModuleIdName>());
|
||||
@@ -434,7 +432,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
}
|
||||
|
||||
private void updateDropedDetails(final DistributionSetIdName distributionSetIdName,
|
||||
final Set<SoftwareModuleIdName> softwareModules) {
|
||||
final HashSet<SoftwareModuleIdName> softwareModules) {
|
||||
LOG.debug("Adding a log to check if distributionSetIdName is null : {} ", distributionSetIdName);
|
||||
manageDistUIState.getAssignedList().put(distributionSetIdName, softwareModules);
|
||||
|
||||
@@ -487,20 +485,20 @@ public class DistributionSetTable extends AbstractTable {
|
||||
}
|
||||
|
||||
private boolean isSoftwareModuleDragged(final Long distId, final SoftwareModule sm) {
|
||||
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : manageDistUIState.getAssignedList()
|
||||
.entrySet()) {
|
||||
if (distId.equals(entry.getKey().getId())) {
|
||||
final Set<SoftwareModuleIdName> swModuleIdNames = entry.getValue();
|
||||
for (final SoftwareModuleIdName swModuleIdName : swModuleIdNames) {
|
||||
|
||||
if ((sm.getName().concat(":" + sm.getVersion())).equals(swModuleIdName.getName())) {
|
||||
notification.displayValidationError(i18n.get("message.software.already.dragged",
|
||||
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion())));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : manageDistUIState
|
||||
.getAssignedList().entrySet()) {
|
||||
if (!distId.equals(entry.getKey().getId())) {
|
||||
continue;
|
||||
}
|
||||
final Set<SoftwareModuleIdName> swModuleIdNames = entry.getValue();
|
||||
for (final SoftwareModuleIdName swModuleIdName : swModuleIdNames) {
|
||||
if ((sm.getName().concat(":" + sm.getVersion())).equals(swModuleIdName.getName())) {
|
||||
notification.displayValidationError(i18n.get("message.software.already.dragged",
|
||||
HawkbitCommonUtil.concatStrings(":", sm.getName(), sm.getVersion())));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -564,21 +562,18 @@ public class DistributionSetTable extends AbstractTable {
|
||||
}
|
||||
|
||||
private void addTableStyleGenerator() {
|
||||
setCellStyleGenerator(new Table.CellStyleGenerator() {
|
||||
@Override
|
||||
public String getStyle(final Table source, final Object itemId, final Object propertyId) {
|
||||
if (propertyId == null) {
|
||||
// Styling for row
|
||||
final Item item = getItem(itemId);
|
||||
final Boolean isComplete = (Boolean) item
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).getValue();
|
||||
if (!isComplete) {
|
||||
return SPUIDefinitions.DISABLE_DISTRIBUTION;
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return null;
|
||||
setCellStyleGenerator((source, itemId, propertyId) -> {
|
||||
if (propertyId == null) {
|
||||
// Styling for row
|
||||
final Item item = getItem(itemId);
|
||||
final Boolean isComplete = (Boolean) item
|
||||
.getItemProperty(SPUILabelDefinitions.VAR_IS_DISTRIBUTION_COMPLETE).getValue();
|
||||
if (!isComplete) {
|
||||
return SPUIDefinitions.DISABLE_DISTRIBUTION;
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -603,7 +598,7 @@ public class DistributionSetTable extends AbstractTable {
|
||||
|
||||
/**
|
||||
* DistributionTableFilterEvent.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
* as instance of {@link DistributionTableFilterEvent}
|
||||
*/
|
||||
|
||||
@@ -51,9 +51,9 @@ import com.vaadin.ui.UI;
|
||||
|
||||
/**
|
||||
* Distributions footer layout implementation.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@org.springframework.stereotype.Component
|
||||
@ViewScope
|
||||
@@ -94,10 +94,11 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.DeleteActionsLayout#init()
|
||||
*/
|
||||
@Override
|
||||
@PostConstruct
|
||||
protected void init() {
|
||||
super.init();
|
||||
@@ -140,7 +141,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasDeletePermission()
|
||||
@@ -153,7 +154,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasUpdatePermission()
|
||||
@@ -166,7 +167,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteAreaLabel()
|
||||
@@ -178,7 +179,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteAreaId()
|
||||
@@ -191,7 +192,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getDeleteLayoutAcceptCriteria ()
|
||||
@@ -204,7 +205,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* processDroppedComponent(com .vaadin.event.dd.DragAndDropEvent)
|
||||
@@ -248,7 +249,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/**
|
||||
* Check if distribution set type is selected.
|
||||
*
|
||||
*
|
||||
* @param distTypeName
|
||||
* @return true if ds type is selected
|
||||
*/
|
||||
@@ -276,7 +277,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
private void addInDeleteDistributionList(final Table sourceTable, final TableTransferable transferable) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<DistributionSetIdName> distSelected = (Set<DistributionSetIdName>) sourceTable.getValue();
|
||||
final Set<DistributionSetIdName> distributionIdNameSet = new HashSet<DistributionSetIdName>();
|
||||
final Set<DistributionSetIdName> distributionIdNameSet = new HashSet<>();
|
||||
if (!distSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
||||
distributionIdNameSet.add((DistributionSetIdName) transferable.getData(SPUIDefinitions.ITEMID));
|
||||
} else {
|
||||
@@ -314,7 +315,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
final Set<Long> swModuleSelected = (Set<Long>) sourceTable.getValue();
|
||||
final Set<Long> swModuleIdNameSet = new HashSet<Long>();
|
||||
final Set<Long> swModuleIdNameSet = new HashSet<>();
|
||||
if (!swModuleSelected.contains(transferable.getData(SPUIDefinitions.ITEMID))) {
|
||||
swModuleIdNameSet.add((Long) transferable.getData(SPUIDefinitions.ITEMID));
|
||||
} else {
|
||||
@@ -336,7 +337,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
+ manageDistUIState.getDeleteSofwareModulesList().size()
|
||||
+ manageDistUIState.getDeletedDistributionList().size();
|
||||
|
||||
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> mapEntry : manageDistUIState
|
||||
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> mapEntry : manageDistUIState
|
||||
.getAssignedList().entrySet()) {
|
||||
count += manageDistUIState.getAssignedList().get(mapEntry.getKey()).size();
|
||||
}
|
||||
@@ -345,7 +346,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/**
|
||||
* DistributionsUIEvent.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
* as instance of {@link DistributionsUIEvent}
|
||||
*/
|
||||
@@ -357,27 +358,17 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param source
|
||||
* @return true if it is distribution table
|
||||
*/
|
||||
private boolean isDistributionTable(final Component source) {
|
||||
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.DIST_TABLE_ID);
|
||||
return SPUIComponetIdProvider.DIST_TABLE_ID.equals(source.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param source
|
||||
* @return true if it is SoftwareModule table
|
||||
*/
|
||||
private boolean isSoftwareModuleTable(final Component source) {
|
||||
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE);
|
||||
return SPUIComponetIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE.equals(source.getId());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getNoActionsButtonLabel()
|
||||
@@ -389,7 +380,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getActionsButtonLabel()
|
||||
@@ -403,7 +394,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* reloadActionCount()
|
||||
@@ -416,7 +407,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getUnsavedActionsWindowCaption ()
|
||||
@@ -428,7 +419,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* unsavedActionsWindowClosed()
|
||||
@@ -444,7 +435,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* getUnsavedActionsWindowContent ()
|
||||
@@ -457,7 +448,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.hawkbit.server.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasUnsavedActions()
|
||||
@@ -490,7 +481,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* hasBulkUploadPermission()
|
||||
*/
|
||||
@@ -501,7 +492,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* showBulkUploadWindow()
|
||||
*/
|
||||
@@ -514,7 +505,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.ui.common.footer.AbstractDeleteActionsLayout#
|
||||
* restoreBulkUploadStatusCount()
|
||||
*/
|
||||
@@ -531,7 +522,7 @@ public class DSDeleteActionsLayout extends AbstractDeleteActionsLayout {
|
||||
|
||||
/**
|
||||
* Check if the distribution set type is default.
|
||||
*
|
||||
*
|
||||
* @param dsTypeName
|
||||
* distribution set name
|
||||
* @return true if distribution set type is set default in configuration
|
||||
|
||||
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.ui.distributions.footer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
@@ -52,9 +53,9 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
* Abstract layout of confirm actions window.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@org.springframework.stereotype.Component
|
||||
@ViewScope
|
||||
@@ -107,13 +108,13 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.confirmwindow.layout.
|
||||
* AbstractConfirmationWindowLayout# getConfimrationTabs()
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, ConfirmationTab> getConfimrationTabs() {
|
||||
final Map<String, ConfirmationTab> tabs = new HashMap<String, ConfirmationTab>();
|
||||
final Map<String, ConfirmationTab> tabs = new HashMap<>();
|
||||
/* Create tab for SW Modules delete */
|
||||
if (!manageDistUIState.getDeleteSofwareModulesList().isEmpty()) {
|
||||
tabs.put(i18n.get("caption.delete.swmodule.accordion.tab"), createSMDeleteConfirmationTab());
|
||||
@@ -190,26 +191,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
private void deleteSMAll(final ConfirmationTab tab) {
|
||||
final Set<Long> swmoduleIds = manageDistUIState.getDeleteSofwareModulesList().keySet();
|
||||
|
||||
if (null != manageDistUIState.getAssignedList() && !manageDistUIState.getAssignedList().isEmpty()) {
|
||||
|
||||
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entryAssignSM : manageDistUIState
|
||||
.getAssignedList().entrySet()) {
|
||||
for (final Entry<Long, String> entryDeleteSM : manageDistUIState.getDeleteSofwareModulesList()
|
||||
.entrySet()) {
|
||||
final SoftwareModuleIdName smIdName = new SoftwareModuleIdName(entryDeleteSM.getKey(),
|
||||
entryDeleteSM.getValue());
|
||||
if (entryAssignSM.getValue().contains(smIdName)) {
|
||||
entryAssignSM.getValue().remove(smIdName);
|
||||
assignmnetTab.getTable().removeItem(HawkbitCommonUtil.concatStrings("|||",
|
||||
entryAssignSM.getKey().getId().toString(), smIdName.getId().toString()));
|
||||
}
|
||||
|
||||
if (entryAssignSM.getValue().isEmpty()) {
|
||||
manageDistUIState.getAssignedList().remove(entryAssignSM.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (manageDistUIState.getAssignedList() == null || manageDistUIState.getAssignedList().isEmpty()) {
|
||||
removeAssignedSoftwareModules();
|
||||
}
|
||||
|
||||
softwareManagement.deleteSoftwareModules(swmoduleIds);
|
||||
@@ -221,6 +204,25 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
eventBus.publish(this, SaveActionWindowEvent.DELETE_ALL_SOFWARE);
|
||||
}
|
||||
|
||||
private void removeAssignedSoftwareModules() {
|
||||
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entryAssignSM : manageDistUIState
|
||||
.getAssignedList().entrySet()) {
|
||||
for (final Entry<Long, String> entryDeleteSM : manageDistUIState.getDeleteSofwareModulesList().entrySet()) {
|
||||
final SoftwareModuleIdName smIdName = new SoftwareModuleIdName(entryDeleteSM.getKey(),
|
||||
entryDeleteSM.getValue());
|
||||
if (entryAssignSM.getValue().contains(smIdName)) {
|
||||
entryAssignSM.getValue().remove(smIdName);
|
||||
assignmnetTab.getTable().removeItem(HawkbitCommonUtil.concatStrings("|||",
|
||||
entryAssignSM.getKey().getId().toString(), smIdName.getId().toString()));
|
||||
}
|
||||
|
||||
if (entryAssignSM.getValue().isEmpty()) {
|
||||
manageDistUIState.getAssignedList().remove(entryAssignSM.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void discardSMAll(final ConfirmationTab tab) {
|
||||
removeCurrentTab(tab);
|
||||
manageDistUIState.getDeleteSofwareModulesList().clear();
|
||||
@@ -230,7 +232,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
|
||||
/**
|
||||
* Get SWModule table container.
|
||||
*
|
||||
*
|
||||
* @return IndexedContainer
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -238,9 +240,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
final IndexedContainer swcontactContainer = new IndexedContainer();
|
||||
swcontactContainer.addContainerProperty("SWModuleId", String.class, "");
|
||||
swcontactContainer.addContainerProperty(SW_MODULE_NAME_MSG, String.class, "");
|
||||
Item item = null;
|
||||
for (final Long swModuleID : manageDistUIState.getDeleteSofwareModulesList().keySet()) {
|
||||
item = swcontactContainer.addItem(swModuleID);
|
||||
final Item item = swcontactContainer.addItem(swModuleID);
|
||||
item.getItemProperty("SWModuleId").setValue(swModuleID.toString());
|
||||
item.getItemProperty(SW_MODULE_NAME_MSG)
|
||||
.setValue(manageDistUIState.getDeleteSofwareModulesList().get(swModuleID));
|
||||
@@ -640,7 +641,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
contactContainer.addContainerProperty(DIST_ID_NAME, DistributionSetIdName.class, "");
|
||||
contactContainer.addContainerProperty(SOFTWARE_MODULE_ID_NAME, SoftwareModuleIdName.class, "");
|
||||
|
||||
final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = manageDistUIState.getAssignedList();
|
||||
final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = manageDistUIState
|
||||
.getAssignedList();
|
||||
|
||||
assignedList.forEach((distIdname, softIdNameSet) -> softIdNameSet.forEach(softIdName -> {
|
||||
final String itemId = HawkbitCommonUtil.concatStrings("|||", distIdname.getId().toString(),
|
||||
@@ -672,8 +674,8 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
|
||||
});
|
||||
int count = 0;
|
||||
for (final Entry<DistributionSetIdName, Set<SoftwareModuleIdName>> entry : manageDistUIState.getAssignedList()
|
||||
.entrySet()) {
|
||||
for (final Entry<DistributionSetIdName, HashSet<SoftwareModuleIdName>> entry : manageDistUIState
|
||||
.getAssignedList().entrySet()) {
|
||||
count += entry.getValue().size();
|
||||
}
|
||||
addToConsolitatedMsg(FontAwesome.TASKS.getHtml() + SPUILabelDefinitions.HTML_SPACE
|
||||
@@ -707,7 +709,7 @@ public class DistributionsConfirmationWindowLayout extends AbstractConfirmationW
|
||||
if (softIdNameSet.isEmpty()) {
|
||||
manageDistUIState.getAssignedList().remove(discardDistIdName);
|
||||
}
|
||||
final Map<Long, Set<SoftwareModuleIdName>> map = manageDistUIState.getConsolidatedDistSoftwarewList()
|
||||
final Map<Long, HashSet<SoftwareModuleIdName>> map = manageDistUIState.getConsolidatedDistSoftwarewList()
|
||||
.get(discardDistIdName);
|
||||
map.keySet().forEach(typeId -> map.get(typeId).remove(discardSoftIdName));
|
||||
|
||||
|
||||
@@ -40,11 +40,11 @@ public class ManageDistUIState implements Serializable {
|
||||
@Autowired
|
||||
private ManageSoftwareModuleFilters softwareModuleFilters;
|
||||
|
||||
private final Map<DistributionSetIdName, Set<SoftwareModuleIdName>> assignedList = new HashMap<DistributionSetIdName, Set<SoftwareModuleIdName>>();
|
||||
private final Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> assignedList = new HashMap<>();
|
||||
|
||||
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<DistributionSetIdName>();
|
||||
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<>();
|
||||
|
||||
private Set<DistributionSetIdName> selectedDistributions = new HashSet<DistributionSetIdName>();
|
||||
private Set<DistributionSetIdName> selectedDistributions = new HashSet<>();
|
||||
|
||||
private DistributionSetIdName lastSelectedDistribution;
|
||||
|
||||
@@ -66,9 +66,9 @@ public class ManageDistUIState implements Serializable {
|
||||
|
||||
private boolean isDsTableMaximized = Boolean.FALSE;
|
||||
|
||||
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<String, SoftwareModuleIdName>();
|
||||
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<>();
|
||||
|
||||
private final Map<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>> consolidatedDistSoftwarewList = new HashMap<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>>();
|
||||
private final Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> consolidatedDistSoftwarewList = new HashMap<>();
|
||||
|
||||
private boolean noDataAvilableSwModule = Boolean.FALSE;
|
||||
|
||||
@@ -89,10 +89,11 @@ public class ManageDistUIState implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Need HashSet because the Set have to be serializable
|
||||
*
|
||||
* @return the assignedList
|
||||
*/
|
||||
public Map<DistributionSetIdName, Set<SoftwareModuleIdName>> getAssignedList() {
|
||||
public Map<DistributionSetIdName, HashSet<SoftwareModuleIdName>> getAssignedList() {
|
||||
return assignedList;
|
||||
}
|
||||
|
||||
@@ -119,7 +120,7 @@ public class ManageDistUIState implements Serializable {
|
||||
}
|
||||
|
||||
public void setSelectedDistributions(final Set<DistributionSetIdName> slectedDistributions) {
|
||||
this.selectedDistributions = slectedDistributions;
|
||||
selectedDistributions = slectedDistributions;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,7 +141,7 @@ public class ManageDistUIState implements Serializable {
|
||||
* @return the selectedBaseSwModuleId
|
||||
*/
|
||||
public Optional<Long> getSelectedBaseSwModuleId() {
|
||||
return this.selectedBaseSwModuleId != null ? Optional.of(this.selectedBaseSwModuleId) : Optional.empty();
|
||||
return selectedBaseSwModuleId != null ? Optional.of(selectedBaseSwModuleId) : Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,7 +215,7 @@ public class ManageDistUIState implements Serializable {
|
||||
|
||||
/**
|
||||
* Get isSwModuleTableMaximized.
|
||||
*
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isDsTableMaximized() {
|
||||
@@ -223,11 +224,11 @@ public class ManageDistUIState implements Serializable {
|
||||
|
||||
/***
|
||||
* Set isDsModuleTableMaximized.
|
||||
*
|
||||
*
|
||||
* @param isDsModuleTableMaximized
|
||||
*/
|
||||
public void setDsTableMaximized(final boolean isDsModuleTableMaximized) {
|
||||
this.isDsTableMaximized = isDsModuleTableMaximized;
|
||||
isDsTableMaximized = isDsModuleTableMaximized;
|
||||
}
|
||||
|
||||
public Map<String, SoftwareModuleIdName> getAssignedSoftwareModuleDetails() {
|
||||
@@ -279,7 +280,12 @@ public class ManageDistUIState implements Serializable {
|
||||
this.noDataAvailableDist = noDataAvailableDist;
|
||||
}
|
||||
|
||||
public Map<DistributionSetIdName, Map<Long, Set<SoftwareModuleIdName>>> getConsolidatedDistSoftwarewList() {
|
||||
/**
|
||||
* Need HashSet because the Set have to be serializable
|
||||
*
|
||||
* @return map
|
||||
*/
|
||||
public Map<DistributionSetIdName, HashMap<Long, HashSet<SoftwareModuleIdName>>> getConsolidatedDistSoftwarewList() {
|
||||
return consolidatedDistSoftwarewList;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class HawkbitLoginUI extends DefaultHawkbitUI {
|
||||
private SpringViewProvider viewProvider;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
private transient ApplicationContext context;
|
||||
|
||||
@Override
|
||||
protected void init(final VaadinRequest request) {
|
||||
|
||||
@@ -79,10 +79,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
private I18N i18n;
|
||||
|
||||
@Autowired
|
||||
private DeploymentManagement deploymentManagement;
|
||||
private transient DeploymentManagement deploymentManagement;
|
||||
|
||||
@Autowired
|
||||
private EventBus.SessionEventBus eventBus;
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
|
||||
@Autowired
|
||||
private UINotification notification;
|
||||
@@ -204,10 +204,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* Get Action based on status.
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
* as Action.Type
|
||||
*
|
||||
*
|
||||
* @return List of Actions
|
||||
*/
|
||||
private List<Object> getVisbleColumns() {
|
||||
@@ -227,12 +227,12 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* fetch the target details using controller id, and set it globally.
|
||||
*
|
||||
*
|
||||
* @param selectedTarget
|
||||
* reference of target
|
||||
*/
|
||||
public void populateTableData(final Target selectedTarget) {
|
||||
this.target = selectedTarget;
|
||||
target = selectedTarget;
|
||||
refreshContainer();
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* Populate Container for Action.
|
||||
*
|
||||
*
|
||||
* @param isActiveActions
|
||||
* as flag
|
||||
* @param reversedActions
|
||||
@@ -275,14 +275,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
final Item item = hierarchicalContainer.addItem(actionWithStatusCount.getActionId());
|
||||
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).setValue(
|
||||
actionWithStatusCount.getActionStatus());
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
|
||||
.setValue(actionWithStatusCount.getActionStatus());
|
||||
|
||||
/*
|
||||
* add action id.
|
||||
*/
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID).setValue(
|
||||
actionWithStatusCount.getActionId().toString());
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID)
|
||||
.setValue(actionWithStatusCount.getActionId().toString());
|
||||
/*
|
||||
* add active/inactive status to the item which will be used in
|
||||
* Column generator to generate respective icon
|
||||
@@ -294,28 +294,27 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
* add action Id to the item which will be used for fetching child
|
||||
* items ( previous action status ) during expand
|
||||
*/
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN).setValue(
|
||||
actionWithStatusCount.getActionId());
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTION_ID_HIDDEN)
|
||||
.setValue(actionWithStatusCount.getActionId());
|
||||
|
||||
/*
|
||||
* add distribution name to the item which will be displayed in the
|
||||
* table. The name should not exceed certain limit.
|
||||
*/
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
|
||||
HawkbitCommonUtil.getFormattedText(actionWithStatusCount.getDsName() + ":"
|
||||
+ actionWithStatusCount.getDsVersion()));
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(HawkbitCommonUtil
|
||||
.getFormattedText(actionWithStatusCount.getDsName() + ":" + actionWithStatusCount.getDsVersion()));
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_FORCED).setValue(action);
|
||||
|
||||
/* Default no child */
|
||||
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), false);
|
||||
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
|
||||
.setValue(
|
||||
SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null) ? actionWithStatusCount
|
||||
.getActionLastModifiedAt() : actionWithStatusCount.getActionCreatedAt()));
|
||||
.setValue(SPDateTimeUtil.getFormattedDate((actionWithStatusCount.getActionLastModifiedAt() != null)
|
||||
? actionWithStatusCount.getActionLastModifiedAt()
|
||||
: actionWithStatusCount.getActionCreatedAt()));
|
||||
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME).setValue(
|
||||
actionWithStatusCount.getRolloutName());
|
||||
item.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ROLLOUT_NAME)
|
||||
.setValue(actionWithStatusCount.getRolloutName());
|
||||
|
||||
if (actionWithStatusCount.getActionStatusCount() > 0) {
|
||||
((Hierarchical) hierarchicalContainer).setChildrenAllowed(actionWithStatusCount.getActionId(), true);
|
||||
@@ -390,10 +389,10 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
}
|
||||
final String distName = (String) hierarchicalContainer.getItem(itemId)
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).getValue();
|
||||
final Label activeStatusIcon = createActiveStatusLabel(
|
||||
activeValue,
|
||||
final Label activeStatusIcon = createActiveStatusLabel(activeValue,
|
||||
(Action.Status) hierarchicalContainer.getItem(itemId)
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).getValue() == Action.Status.ERROR);
|
||||
.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
|
||||
.getValue() == Action.Status.ERROR);
|
||||
activeStatusIcon.setId(new StringJoiner(".").add(distName).add(itemId.toString())
|
||||
.add(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE).add(activeValue).toString());
|
||||
return activeStatusIcon;
|
||||
@@ -412,7 +411,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
/**
|
||||
* Load the rows of previous status history of the selected action row and
|
||||
* add it next to the selected action row.
|
||||
*
|
||||
*
|
||||
* @param parentRowIdx
|
||||
* index of the selected action row.
|
||||
*/
|
||||
@@ -447,14 +446,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
*/
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_ACTIVE_HIDDEN).setValue("");
|
||||
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST).setValue(
|
||||
HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DIST)
|
||||
.setValue(HawkbitCommonUtil.getFormattedText(action.getDistributionSet().getName() + ":"
|
||||
+ action.getDistributionSet().getVersion()));
|
||||
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME).setValue(
|
||||
SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN).setValue(
|
||||
actionStatus.getStatus());
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_DATETIME)
|
||||
.setValue(SPDateTimeUtil.getFormattedDate(actionStatus.getCreatedAt()));
|
||||
childItem.getItemProperty(SPUIDefinitions.ACTION_HIS_TBL_STATUS_HIDDEN)
|
||||
.setValue(actionStatus.getStatus());
|
||||
showOrHideMessage(childItem, actionStatus);
|
||||
/* No further child items allowed for the child items */
|
||||
((Hierarchical) hierarchicalContainer).setChildrenAllowed(childId, false);
|
||||
@@ -469,7 +468,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* Hide the rows of previous status history of the selected action row.
|
||||
*
|
||||
*
|
||||
* @param parentRowIdx
|
||||
* index of the selected action row.
|
||||
*/
|
||||
@@ -487,7 +486,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* Get status icon.
|
||||
*
|
||||
*
|
||||
* @param status
|
||||
* as Status
|
||||
* @return Label as UI
|
||||
@@ -561,13 +560,11 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
if (actionWithActiveStatus.isHitAutoForceTime(currentTimeMillis)) {
|
||||
autoForceLabel.setDescription("autoforced");
|
||||
autoForceLabel.setStyleName(STATUS_ICON_GREEN);
|
||||
autoForceLabel.setDescription("auto forced since "
|
||||
+ SPDateTimeUtil.getDurationFormattedString(actionWithActiveStatus.getForcedTime(),
|
||||
currentTimeMillis, i18n));
|
||||
autoForceLabel.setDescription("auto forced since " + SPDateTimeUtil
|
||||
.getDurationFormattedString(actionWithActiveStatus.getForcedTime(), currentTimeMillis, i18n));
|
||||
} else {
|
||||
autoForceLabel.setDescription("auto forcing in "
|
||||
+ SPDateTimeUtil.getDurationFormattedString(currentTimeMillis,
|
||||
actionWithActiveStatus.getForcedTime(), i18n));
|
||||
autoForceLabel.setDescription("auto forcing in " + SPDateTimeUtil
|
||||
.getDurationFormattedString(currentTimeMillis, actionWithActiveStatus.getForcedTime(), i18n));
|
||||
autoForceLabel.setStyleName("statusIconPending");
|
||||
autoForceLabel.setValue(FontAwesome.HISTORY.getHtml());
|
||||
}
|
||||
@@ -576,7 +573,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* Create Status Label.
|
||||
*
|
||||
*
|
||||
* @param activeValue
|
||||
* as String
|
||||
* @return Labeal as UI
|
||||
@@ -649,7 +646,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* create Message block for Actions.
|
||||
*
|
||||
*
|
||||
* @param messages
|
||||
* as List of msg
|
||||
* @return Component as UI
|
||||
@@ -748,7 +745,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* Show confirmation window and if ok then only, force the action.
|
||||
*
|
||||
*
|
||||
* @param actionId
|
||||
* as Id if the action needs to be forced.
|
||||
*/
|
||||
@@ -776,9 +773,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
private void confirmAndForceQuitAction(final Long actionId) {
|
||||
/* Display the confirmation */
|
||||
final ConfirmationDialog confirmDialog = new ConfirmationDialog(
|
||||
i18n.get("caption.forcequit.action.confirmbox"), i18n.get("message.forcequit.action.confirm"),
|
||||
i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
|
||||
final ConfirmationDialog confirmDialog = new ConfirmationDialog(i18n.get("caption.forcequit.action.confirmbox"),
|
||||
i18n.get("message.forcequit.action.confirm"), i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
|
||||
if (ok) {
|
||||
final boolean cancelResult = forceQuitActiveAction(actionId);
|
||||
if (cancelResult) {
|
||||
@@ -793,14 +789,14 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
notification.displayValidationError(i18n.get("message.forcequit.action.failed"));
|
||||
}
|
||||
}
|
||||
}, FontAwesome.WARNING);
|
||||
} , FontAwesome.WARNING);
|
||||
UI.getCurrent().addWindow(confirmDialog.getWindow());
|
||||
confirmDialog.getWindow().bringToFront();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show confirmation window and if ok then only, cancel the action.
|
||||
*
|
||||
*
|
||||
* @param actionId
|
||||
* as Id if the action needs to be cancelled.
|
||||
*/
|
||||
@@ -880,8 +876,8 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
if (managementUIState.getDistributionTableFilters().getPinnedTargetId().isPresent()
|
||||
&& null != managementUIState.getDistributionTableFilters().getPinnedTargetId().get()) {
|
||||
final String alreadyPinnedControllerId = managementUIState.getDistributionTableFilters()
|
||||
.getPinnedTargetId().get();
|
||||
final String alreadyPinnedControllerId = managementUIState.getDistributionTableFilters().getPinnedTargetId()
|
||||
.get();
|
||||
// if the current target is pinned publish a pin event again
|
||||
if (null != alreadyPinnedControllerId && alreadyPinnedControllerId.equals(target.getControllerId())) {
|
||||
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
|
||||
@@ -898,7 +894,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
|
||||
|
||||
/**
|
||||
* Set messages false.
|
||||
*
|
||||
*
|
||||
* @param alreadyHasMessages
|
||||
* the alreadyHasMessages to set
|
||||
*/
|
||||
|
||||
@@ -54,6 +54,7 @@ import com.vaadin.ui.Alignment;
|
||||
import com.vaadin.ui.Button;
|
||||
import com.vaadin.ui.CheckBox;
|
||||
import com.vaadin.ui.ComboBox;
|
||||
import com.vaadin.ui.Component;
|
||||
import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.TextArea;
|
||||
@@ -109,7 +110,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
||||
private String originalDistDescription;
|
||||
private Boolean originalReqMigStep;
|
||||
private String originalDistSetType;
|
||||
private final List<Object> changedComponents = new ArrayList<Object>();
|
||||
private final List<Component> changedComponents = new ArrayList<>();
|
||||
private ValueChangeListener reqMigStepCheckboxListerner;
|
||||
private TextChangeListener descTextAreaListener;
|
||||
private TextChangeListener distNameTextFieldListener;
|
||||
@@ -197,12 +198,12 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
||||
|
||||
/**
|
||||
* Get the LazyQueryContainer instance for DistributionSetTypes.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private LazyQueryContainer getDistSetTypeLazyQueryContainer() {
|
||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
||||
final BeanQueryFactory<DistributionSetTypeBeanQuery> dtQF = new BeanQueryFactory<DistributionSetTypeBeanQuery>(
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
final BeanQueryFactory<DistributionSetTypeBeanQuery> dtQF = new BeanQueryFactory<>(
|
||||
DistributionSetTypeBeanQuery.class);
|
||||
dtQF.setQueryConfiguration(queryConfig);
|
||||
|
||||
@@ -499,7 +500,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
||||
|
||||
/**
|
||||
* populate data.
|
||||
*
|
||||
*
|
||||
* @param editDistId
|
||||
*/
|
||||
public void populateValuesOfDistribution(final Long editDistId) {
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.management.footer;
|
||||
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
|
||||
@@ -27,7 +26,7 @@ public final class DeleteActionsLayoutHelper {
|
||||
|
||||
/**
|
||||
* Checks if component is a target tag.
|
||||
*
|
||||
*
|
||||
* @param source
|
||||
* Component dropped
|
||||
* @return true if it component is target tag
|
||||
@@ -45,7 +44,7 @@ public final class DeleteActionsLayoutHelper {
|
||||
|
||||
/**
|
||||
* Checks if component is distribution tag.
|
||||
*
|
||||
*
|
||||
* @param source
|
||||
* component dropped
|
||||
* @return true if it component is distribution tag
|
||||
@@ -63,29 +62,29 @@ public final class DeleteActionsLayoutHelper {
|
||||
|
||||
/**
|
||||
* Checks if component is target table.
|
||||
*
|
||||
*
|
||||
* @param source
|
||||
* component dropped
|
||||
* @return true if it component is target table
|
||||
*/
|
||||
public static boolean isTargetTable(final Component source) {
|
||||
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.TARGET_TABLE_ID);
|
||||
return SPUIComponetIdProvider.TARGET_TABLE_ID.equalsIgnoreCase(source.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks id component is distribution table.
|
||||
*
|
||||
*
|
||||
* @param source
|
||||
* component dropped
|
||||
* @return true if it component is distribution table
|
||||
*/
|
||||
public static boolean isDistributionTable(final Component source) {
|
||||
return HawkbitCommonUtil.bothSame(source.getId(), SPUIComponetIdProvider.DIST_TABLE_ID);
|
||||
return SPUIComponetIdProvider.DIST_TABLE_ID.equalsIgnoreCase(source.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if dropped component can be deleted.
|
||||
*
|
||||
*
|
||||
* @param source
|
||||
* component dropped
|
||||
* @return true if component can be deleted
|
||||
|
||||
@@ -35,17 +35,19 @@ public class ManagementUIState implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7301409196969723794L;
|
||||
|
||||
private final transient Set<Object> expandParentActionRowId = new HashSet<>();
|
||||
|
||||
@Autowired
|
||||
private DistributionTableFilters distributionTableFilters;
|
||||
|
||||
@Autowired
|
||||
private TargetTableFilters targetTableFilters;
|
||||
|
||||
private final Map<TargetIdName, DistributionSetIdName> assignedList = new HashMap<TargetIdName, DistributionSetIdName>();
|
||||
private final Map<TargetIdName, DistributionSetIdName> assignedList = new HashMap<>();
|
||||
|
||||
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<DistributionSetIdName>();
|
||||
private final Set<DistributionSetIdName> deletedDistributionList = new HashSet<>();
|
||||
|
||||
private final Set<TargetIdName> deletedTargetList = new HashSet<TargetIdName>();
|
||||
private final Set<TargetIdName> deletedTargetList = new HashSet<>();
|
||||
|
||||
private Boolean targetTagLayoutVisible = Boolean.TRUE;
|
||||
|
||||
@@ -79,9 +81,7 @@ public class ManagementUIState implements Serializable {
|
||||
|
||||
private boolean noDataAvailableDistribution = Boolean.FALSE;
|
||||
|
||||
private final Set<String> canceledTargetName = new HashSet<String>();
|
||||
|
||||
private final Set<Object> expandParentActionRowId = new HashSet<Object>();
|
||||
private final Set<String> canceledTargetName = new HashSet<>();
|
||||
|
||||
private boolean customFilterSelected;
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ManagementUIState implements Serializable {
|
||||
* the isCustomFilterSelected to set
|
||||
*/
|
||||
public void setCustomFilterSelected(final boolean isCustomFilterSelected) {
|
||||
this.customFilterSelected = isCustomFilterSelected;
|
||||
customFilterSelected = isCustomFilterSelected;
|
||||
}
|
||||
|
||||
public Set<Object> getExpandParentActionRowId() {
|
||||
@@ -134,7 +134,7 @@ public class ManagementUIState implements Serializable {
|
||||
}
|
||||
|
||||
public void setTargetTagLayoutVisible(final Boolean targetTagVisible) {
|
||||
this.targetTagLayoutVisible = targetTagVisible;
|
||||
targetTagLayoutVisible = targetTagVisible;
|
||||
}
|
||||
|
||||
public Boolean getTargetTagLayoutVisible() {
|
||||
@@ -241,16 +241,16 @@ public class ManagementUIState implements Serializable {
|
||||
* increments the targets all counter.
|
||||
*/
|
||||
public void incrementTargetsCountAll() {
|
||||
this.targetsCountAll.incrementAndGet();
|
||||
targetsCountAll.incrementAndGet();
|
||||
}
|
||||
|
||||
/**
|
||||
* decrement the targets all counter.
|
||||
*/
|
||||
public void decrementTargetsCountAll() {
|
||||
final long decrementAndGet = this.targetsCountAll.decrementAndGet();
|
||||
final long decrementAndGet = targetsCountAll.decrementAndGet();
|
||||
if (decrementAndGet < 0) {
|
||||
this.targetsCountAll.set(0);
|
||||
targetsCountAll.set(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,12 +56,7 @@ import com.vaadin.ui.components.colorpicker.ColorSelector;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
/**
|
||||
*
|
||||
* Abstract class for create/update target tag layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public abstract class CreateUpdateTagLayout extends CustomComponent implements ColorChangeListener, ColorSelector {
|
||||
private static final long serialVersionUID = 4229177824620576456L;
|
||||
@@ -78,7 +73,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
protected I18N i18n;
|
||||
|
||||
@Autowired
|
||||
protected TagManagement tagManagement;
|
||||
protected transient TagManagement tagManagement;
|
||||
|
||||
@Autowired
|
||||
protected transient EventBus.SessionEventBus eventBus;
|
||||
@@ -124,14 +119,14 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
|
||||
/**
|
||||
* Save new tag / update new tag.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
protected abstract void save(final Button.ClickEvent event);
|
||||
|
||||
/**
|
||||
* Discard the changes and close the popup.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
protected abstract void discard(final Button.ClickEvent event);
|
||||
@@ -202,7 +197,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
getPreviewButtonColor(DEFAULT_COLOR);
|
||||
tagColorPreviewBtn.setStyleName(TAG_DYNAMIC_STYLE);
|
||||
|
||||
selectors = new HashSet<ColorSelector>();
|
||||
selectors = new HashSet<>();
|
||||
selectedColor = new Color(44, 151, 32);
|
||||
selPreview = new SpColorPickerPreview(selectedColor);
|
||||
|
||||
@@ -284,28 +279,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
*/
|
||||
private void previewButtonClicked() {
|
||||
if (!tagPreviewBtnClicked) {
|
||||
final String selectedOption = (String) optiongroup.getValue();
|
||||
if (null != selectedOption && selectedOption.equalsIgnoreCase(updateTagNw)) {
|
||||
if (null != tagNameComboBox.getValue()) {
|
||||
|
||||
final TargetTag targetTagSelected = tagManagement
|
||||
.findTargetTag(tagNameComboBox.getValue().toString());
|
||||
if (null != targetTagSelected) {
|
||||
selectedColor = targetTagSelected.getColour() != null
|
||||
? rgbToColorConverter(targetTagSelected.getColour())
|
||||
: rgbToColorConverter(DEFAULT_COLOR);
|
||||
} else {
|
||||
|
||||
final DistributionSetTag distTag = tagManagement
|
||||
.findDistributionSetTag(tagNameComboBox.getValue().toString());
|
||||
selectedColor = distTag.getColour() != null ? rgbToColorConverter(distTag.getColour())
|
||||
: rgbToColorConverter(DEFAULT_COLOR);
|
||||
}
|
||||
|
||||
} else {
|
||||
selectedColor = rgbToColorConverter(DEFAULT_COLOR);
|
||||
}
|
||||
}
|
||||
setColor();
|
||||
selPreview.setColor(selectedColor);
|
||||
fieldLayout.addComponent(sliders);
|
||||
mainLayout.addComponent(colorPickerLayout);
|
||||
@@ -314,28 +288,53 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
tagPreviewBtnClicked = !tagPreviewBtnClicked;
|
||||
}
|
||||
|
||||
private void setColor() {
|
||||
final String selectedOption = (String) optiongroup.getValue();
|
||||
if (selectedOption == null || !selectedOption.equalsIgnoreCase(updateTagNw)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (tagNameComboBox.getValue() == null) {
|
||||
selectedColor = rgbToColorConverter(DEFAULT_COLOR);
|
||||
return;
|
||||
}
|
||||
|
||||
final TargetTag targetTagSelected = tagManagement.findTargetTag(tagNameComboBox.getValue().toString());
|
||||
|
||||
if (targetTagSelected == null) {
|
||||
final DistributionSetTag distTag = tagManagement
|
||||
.findDistributionSetTag(tagNameComboBox.getValue().toString());
|
||||
selectedColor = distTag.getColour() != null ? rgbToColorConverter(distTag.getColour())
|
||||
: rgbToColorConverter(DEFAULT_COLOR);
|
||||
} else {
|
||||
selectedColor = targetTagSelected.getColour() != null ? rgbToColorConverter(targetTagSelected.getColour())
|
||||
: rgbToColorConverter(DEFAULT_COLOR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Covert RGB code to {@Color}.
|
||||
*
|
||||
*
|
||||
* @param value
|
||||
* RGB vale
|
||||
* @return Color
|
||||
*/
|
||||
protected Color rgbToColorConverter(final String value) {
|
||||
if (value.startsWith("rgb")) {
|
||||
// RGB color format rgb/rgba(255,255,255,0.1)
|
||||
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
|
||||
final int red = Integer.parseInt(colors[0]);
|
||||
final int green = Integer.parseInt(colors[1]);
|
||||
final int blue = Integer.parseInt(colors[2]);
|
||||
if (colors.length > 3) {
|
||||
final int alpha = (int) (Double.parseDouble(colors[3]) * 255d);
|
||||
return new Color(red, green, blue, alpha);
|
||||
} else {
|
||||
return new Color(red, green, blue);
|
||||
}
|
||||
if (!value.startsWith("rgb")) {
|
||||
return null;
|
||||
}
|
||||
// RGB color format rgb/rgba(255,255,255,0.1)
|
||||
final String[] colors = value.substring(value.indexOf('(') + 1, value.length() - 1).split(",");
|
||||
final int red = Integer.parseInt(colors[0]);
|
||||
final int green = Integer.parseInt(colors[1]);
|
||||
final int blue = Integer.parseInt(colors[2]);
|
||||
if (colors.length > 3) {
|
||||
final int alpha = (int) (Double.parseDouble(colors[3]) * 255d);
|
||||
return new Color(red, green, blue, alpha);
|
||||
} else {
|
||||
return new Color(red, green, blue);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Label getMandatoryLabel() {
|
||||
@@ -369,7 +368,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
|
||||
/**
|
||||
* Listener for option group - Create tag/Update.
|
||||
*
|
||||
*
|
||||
* @param event
|
||||
* ValueChangeEvent
|
||||
*/
|
||||
@@ -478,7 +477,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
|
||||
/**
|
||||
* Set tag name and desc field border color based on chosen color.
|
||||
*
|
||||
*
|
||||
* @param tagName
|
||||
* @param tagDesc
|
||||
* @param taregtTagColor
|
||||
@@ -506,7 +505,7 @@ public abstract class CreateUpdateTagLayout extends CustomComponent implements C
|
||||
/**
|
||||
* Get target style - Dynamically as per the color picked, cannot be done
|
||||
* from the static css.
|
||||
*
|
||||
*
|
||||
* @param colorPickedPreview
|
||||
*/
|
||||
private void getTargetDynamicStyles(final String colorPickedPreview) {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
package org.eclipse.hawkbit.ui.management.targettag;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
@@ -27,9 +26,9 @@ import com.vaadin.ui.Button.ClickEvent;
|
||||
|
||||
/**
|
||||
* Single button click behaviour of custom target filter buttons layout.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@SpringComponent
|
||||
@ViewScope
|
||||
@@ -48,28 +47,28 @@ public class CustomTargetTagFilterButtonClick extends AbstractFilterSingleButton
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see org.eclipse.hawkbit.server.ui.common.filterlayout.
|
||||
* AbstractFilterButtonClickBehaviour#filterUnClicked (com.vaadin.ui.Button)
|
||||
*/
|
||||
@Override
|
||||
protected void filterUnClicked(final Button clickedButton) {
|
||||
managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
|
||||
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
|
||||
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
|
||||
this.eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
*
|
||||
* @see hawkbit.server.ui.layouts.SPFilterButtonClickBehaviour#filterClicked
|
||||
* (com.vaadin.ui.Button )
|
||||
*/
|
||||
@Override
|
||||
protected void filterClicked(final Button clickedButton) {
|
||||
final TargetFilterQuery targetFilterQuery = targetFilterQueryManagement
|
||||
final TargetFilterQuery targetFilterQuery = this.targetFilterQueryManagement
|
||||
.findTargetFilterQueryById((Long) clickedButton.getData());
|
||||
managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery);
|
||||
eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);
|
||||
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(targetFilterQuery);
|
||||
this.eventBus.publish(this, TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY);
|
||||
}
|
||||
|
||||
protected void processButtonClick(final ClickEvent event) {
|
||||
@@ -77,12 +76,12 @@ public class CustomTargetTagFilterButtonClick extends AbstractFilterSingleButton
|
||||
}
|
||||
|
||||
protected void clearAppliedTargetFilterQuery() {
|
||||
if (getAlreadyClickedButton().isPresent()) {
|
||||
getAlreadyClickedButton().get().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
|
||||
setAlreadyClickedButton(Optional.empty());
|
||||
if (getAlreadyClickedButton() != null) {
|
||||
getAlreadyClickedButton().removeStyleName(SPUIStyleDefinitions.SP_FILTER_BTN_CLICKED_STYLE);
|
||||
setAlreadyClickedButton(null);
|
||||
}
|
||||
managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
|
||||
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
|
||||
this.managementUIState.getTargetTableFilters().setTargetFilterQuery(null);
|
||||
this.eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TARGET_FILTER_QUERY);
|
||||
}
|
||||
|
||||
protected void setDefaultButtonClicked(final Button button) {
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.vaadin.ui.Component;
|
||||
|
||||
/**
|
||||
* Interface to be implemented by any tenant specific configuration to show on
|
||||
* the UI.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
@@ -48,7 +50,7 @@ public interface TenantConfigurationItem extends Component {
|
||||
/**
|
||||
* Adds a configuration change listener to notify about configuration
|
||||
* changes.
|
||||
*
|
||||
*
|
||||
* @param listener
|
||||
* the listener to be notified in case the item changes some
|
||||
* configuration
|
||||
@@ -58,11 +60,12 @@ public interface TenantConfigurationItem extends Component {
|
||||
/**
|
||||
* Configuration Change Listener to be notified about configuration changes
|
||||
* in configuration item.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
interface TenantConfigurationChangeListener {
|
||||
@FunctionalInterface
|
||||
interface TenantConfigurationChangeListener extends Serializable {
|
||||
/**
|
||||
* called to notify about configuration has been changed.
|
||||
*/
|
||||
|
||||
@@ -263,14 +263,13 @@ public final class HawkbitCommonUtil {
|
||||
public static String concatStrings(final String delimiter, final String... texts) {
|
||||
final String delim = delimiter == null ? SP_STRING_EMPTY : delimiter;
|
||||
final StringBuilder conCatStrBldr = new StringBuilder();
|
||||
String conCatedStr = null;
|
||||
if (null != texts) {
|
||||
for (final String text : texts) {
|
||||
conCatStrBldr.append(delim);
|
||||
conCatStrBldr.append(text);
|
||||
}
|
||||
}
|
||||
conCatedStr = conCatStrBldr.toString();
|
||||
final String conCatedStr = conCatStrBldr.toString();
|
||||
return delim.length() > 0 && conCatedStr.startsWith(delim) ? conCatedStr.substring(1) : conCatedStr;
|
||||
}
|
||||
|
||||
@@ -343,31 +342,6 @@ public final class HawkbitCommonUtil {
|
||||
return labelId.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if two objects are same or not.
|
||||
*
|
||||
* @param obj1
|
||||
* as reference
|
||||
* @param obj2
|
||||
* as reference
|
||||
* @return true if both obj1 & obj2 are null (or) if the .equals() method
|
||||
* return true. false if only either one of obj1 & obj2 is null (or)
|
||||
* if .equals() method return false.
|
||||
*/
|
||||
public static boolean bothSame(final Object obj1, final Object obj2) {
|
||||
boolean result = false;
|
||||
if (obj1 == null && obj2 == null) {
|
||||
result = true;
|
||||
} else if (obj1 == null && obj2 != null) {
|
||||
result = false;
|
||||
} else if (obj1 != null && obj2 == null) {
|
||||
result = false;
|
||||
} else {
|
||||
result = obj2.equals(obj1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get label with software module name and description.
|
||||
*
|
||||
@@ -725,7 +699,7 @@ public final class HawkbitCommonUtil {
|
||||
final UserDetailsService idManagement = SpringContextHelper.getBean(UserDetailsService.class);
|
||||
try {
|
||||
imReslovedUser = HawkbitCommonUtil.getFormattedName(idManagement.loadUserByUsername(uuid));
|
||||
} catch (final UsernameNotFoundException e) {
|
||||
} catch (final UsernameNotFoundException e) { // NOSONAR
|
||||
// nope not need to handle
|
||||
}
|
||||
// If Null display the UID
|
||||
@@ -982,12 +956,10 @@ public final class HawkbitCommonUtil {
|
||||
* @return instance of {@link LazyQueryContainer}.
|
||||
*/
|
||||
public static LazyQueryContainer createLazyQueryContainer(
|
||||
final BeanQueryFactory<? extends AbstractBeanQuery> queryFactory) {
|
||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
||||
final BeanQueryFactory<? extends AbstractBeanQuery<?>> queryFactory) {
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
queryFactory.setQueryConfiguration(queryConfig);
|
||||
final LazyQueryContainer typeContainer = new LazyQueryContainer(
|
||||
new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), queryFactory);
|
||||
return typeContainer;
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, SPUILabelDefinitions.VAR_NAME), queryFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -998,12 +970,10 @@ public final class HawkbitCommonUtil {
|
||||
* @return LazyQueryContainer
|
||||
*/
|
||||
public static LazyQueryContainer createDSLazyQueryContainer(
|
||||
final BeanQueryFactory<? extends AbstractBeanQuery> queryFactory) {
|
||||
final Map<String, Object> queryConfig = new HashMap<String, Object>();
|
||||
final BeanQueryFactory<? extends AbstractBeanQuery<?>> queryFactory) {
|
||||
final Map<String, Object> queryConfig = new HashMap<>();
|
||||
queryFactory.setQueryConfiguration(queryConfig);
|
||||
final LazyQueryContainer typeContainer = new LazyQueryContainer(new LazyQueryDefinition(true, 20, "tagIdName"),
|
||||
queryFactory);
|
||||
return typeContainer;
|
||||
return new LazyQueryContainer(new LazyQueryDefinition(true, 20, "tagIdName"), queryFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1037,7 +1007,7 @@ public final class HawkbitCommonUtil {
|
||||
*/
|
||||
public static List<TableColumn> getTableVisibleColumns(final Boolean isMaximized, final Boolean isShowPinColumn,
|
||||
final I18N i18n) {
|
||||
final List<TableColumn> columnList = new ArrayList<TableColumn>();
|
||||
final List<TableColumn> columnList = new ArrayList<>();
|
||||
if (isMaximized) {
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_NAME, i18n.get(HEADER_NAME), 0.2f));
|
||||
columnList.add(new TableColumn(SPUILabelDefinitions.VAR_VERSION, i18n.get(HEADER_VERSION), 0.1f));
|
||||
|
||||
Reference in New Issue
Block a user