Merge branch 'master' into Artifiact_upload_directory_upload

This commit is contained in:
asharani-murugesh
2016-02-25 17:07:20 +01:00
29 changed files with 312 additions and 287 deletions

5
.gitignore vendored
View File

@@ -16,6 +16,11 @@
*.jar
*.war
######################
# Sonar
######################
.sonar_lock
# Eclipse IDE
*.pydevproject

View File

@@ -0,0 +1,3 @@
# 3rd Party Dependencies
Contains listing of all maven (transient) licenses of the project. Is primary used to identify all changes between eclipse releases.

View File

@@ -15,8 +15,8 @@ hawkbit.server.controller.security.authentication.gatewaytoken.enabled=false
spring.profiles.active=amqp
vaadin.servlet.params.productionMode=false
vaadin.static.servlet.params.productionMode=false
vaadin.servlet.productionMode=false
vaadin.static.servlet.productionMode=false
## Configuration for RabbitMQ integration
hawkbit.server.amqp.username=guest

View File

@@ -88,7 +88,7 @@ public class MongoDBTestRule implements TestRule {
System.setProperty("spring.data.mongodb.port", String.valueOf(port));
}
Version version = Version.V3_1_0;
Version version = Version.V3_0_8;
if (System.getProperty("inf.mongodb.version") != null) {
version = Version.valueOf("V" + System.getProperty("inf.mongodb.version").trim().replaceAll("\\.", "_"));
}

View File

@@ -29,10 +29,8 @@ flyway.initOnMigrate=true
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
# Vaadin Servlet
vaadin.static.servlet.params.resourceCacheTime=${spring.resources.cache-period}
vaadin.static.servlet.params.productionMode=true
vaadin.servlet.params.productionMode=true
vaadin.servlet.params.resourceCacheTime=${spring.resources.cache-period}
vaadin.static.servlet.productionMode=true
vaadin.servlet.productionMode=true
vaadin.servlet.urlMapping=/UI/*
vaadin.servlet.params.heartbeatInterval=60
vaadin.servlet.params.closeIdleSessions=false

View File

@@ -37,19 +37,9 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Transactional(readOnly = true)
public interface ActionRepository extends BaseEntityRepository<Action, Long>, JpaSpecificationExecutor<Action> {
/*
* (non-Javadoc)
*
* @see org.springframework.data.repository.CrudRepository#findAll()
*/
@Override
@EntityGraph(value = "Action.all", type = EntityGraphType.LOAD)
Iterable<Action> findAll();
/**
* Retrieves an Action with all lazy attributes.
*
*
* @param actionId
* the ID of the action
* @return the found {@link Action}
@@ -67,13 +57,12 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
* the {@link DistributionSet} on which will be filtered
* @return the found {@link Action}s
*/
@EntityGraph(value = "Action.all", type = EntityGraphType.LOAD)
Page<Action> findByDistributionSet(final Pageable pageable, final DistributionSet ds);
/**
* Retrieves all {@link Action}s which are referring the given
* {@link Target}.
*
*
* @param pageable
* page parameters
* @param target
@@ -84,8 +73,9 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Retrieves all {@link Action}s which are active and referring the given
* {@link Target} in a specified order.
*
* {@link Target} in a specified order. Loads also the lazy
* {@link Action#getDistributionSet()} field.
*
* @param pageable
* page parameters
* @param target
@@ -125,14 +115,13 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
* @return the found {@link UpdateAction}s
*/
@Query("Select a from Action a where a.target = :target and a.distributionSet = :ds order by a.id")
@EntityGraph(value = "Action.all", type = EntityGraphType.LOAD)
Page<Action> findByTargetAndDistributionSet(final Pageable pageable, @Param("target") final Target target,
@Param("ds") DistributionSet ds);
/**
* Retrieves all {@link Action}s of a specific target, without pagination
* ordered by action ID.
*
*
* @param target
* to search for
* @return a list of actions according to the searched target
@@ -143,7 +132,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Retrieves all {@link Action}s of a specific target and given active flag
* ordered by action ID.
*
*
* @param pageable
* the pagination parameter
* @param target
@@ -159,8 +148,9 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Retrieves all {@link Action}s of a specific target and given active flag
* ordered by action ID.
*
* ordered by action ID. Loads also the lazy
* {@link Action#getDistributionSet()} field.
*
* @param target
* to search for
* @param active
@@ -174,7 +164,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Updates all {@link Action} to inactive for all targets with given ID.
*
*
* @param keySet
* the list of actions to set inactive
* @param targetsIds
@@ -190,7 +180,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
* Switches the status of actions from one specific status into another,
* only if the actions are in a specific status. This should be a atomar
* operation.
*
*
* @param statusToSet
* the new status the actions should get
* @param targetIds
@@ -210,7 +200,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
* Switches the status of actions from one specific status into another,
* only if the actions are in a specific status. This should be a atomar
* operation.
*
*
* @param statusToSet
* the new status the actions should get
* @param rollout
@@ -227,7 +217,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
@Param("active") boolean active, @Param("currentStatus") Action.Status currentStatus);
/**
*
*
* Retrieves all {@link Action}s which are active and referring to the given
* target Ids and distribution set required migration step.
*
@@ -243,36 +233,24 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Counts all {@link Action}s referring to the given target.
*
*
* @param target
* the target to count the {@link Action}s
* @return the count of actions referring to the given target
*/
Long countByTarget(Target target);
/*
* (non-Javadoc)
*
* @see org.springframework.data.repository.CrudRepository#save(java.lang.
* Iterable)
*/
@Override
@CacheEvict(value = "feedbackReceivedOverTime", allEntries = true)
<S extends Action> List<S> save(Iterable<S> entities);
/*
* (non-Javadoc)
*
* @see
* org.springframework.data.repository.CrudRepository#save(java.lang.Object)
*/
@Override
@CacheEvict(value = "feedbackReceivedOverTime", allEntries = true)
<S extends Action> S save(S entity);
/**
* Counts all {@link Action}s referring to the given DistributionSet.
*
*
* @param distributionSet
* DistributionSet to count the {@link Action}s from
* @return the count of actions referring to the given distributionSet
@@ -281,7 +259,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Counts all {@link Action}s referring to the given rollout.
*
*
* @param rollout
* the rollout to count the {@link Action}s from
* @return the count of actions referring to the given rollout
@@ -293,7 +271,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
* are currently not in the given status. An in-clause statement does not
* work with the spring-data, so this is specific usecase regarding to the
* rollout-management to find out actions which are not in specific states.
*
*
* @param rollout
* the rollout the actions are belong to
* @param rolloutGroup
@@ -312,7 +290,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Counts all actions referring to a given rollout and rolloutgroup.
*
*
* @param rollout
* the rollout the actions belong to
* @param rolloutGroup
@@ -323,7 +301,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Counts all actions referring to a given rollout, rolloutgroup and status.
*
*
* @param rolloutId
* the ID of rollout the actions belong to
* @param rolloutGroupId
@@ -338,7 +316,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Retrieving all actions referring to a given rollout with a specific
* action as parent reference and a specific status.
*
*
* Finding all actions of a specific rolloutgroup parent relation.
*
* @param rollout
@@ -355,7 +333,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Retrieves all actions for a specific rollout and in a specific status.
*
*
* @param rollout
* the rollout the actions beglong to
* @param actionStatus
@@ -367,7 +345,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Get list of objects which has details of status and count of targets in
* each status in specified rollout.
*
*
* @param rolloutId
* id of {@link Rollout}
* @return list of objects with status and target count
@@ -378,7 +356,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Get list of objects which has details of status and count of targets in
* each status in specified rollout.
*
*
* @param rolloutId
* id of {@link Rollout}
* @return list of objects with status and target count
@@ -389,7 +367,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Get list of objects which has details of status and count of targets in
* each status in specified rollout group.
*
*
* @param rolloutGroupId
* id of {@link RolloutGroup}
* @return list of objects with status and target count
@@ -400,7 +378,7 @@ public interface ActionRepository extends BaseEntityRepository<Action, Long>, Jp
/**
* Get list of objects which has details of status and count of targets in
* each status in specified rollout group.
*
*
* @param rolloutGroupId
* list of id of {@link RolloutGroup}
* @return list of objects with status and target count

View File

@@ -378,11 +378,13 @@ public class DeploymentManagement {
actionStatusRepository.save(actionStatus);
});
// select updated targets in order to return them
// flush to get action IDs
entityManager.flush();
// collect updated target and actions IDs in order to return them
final DistributionSetAssignmentResult result = new DistributionSetAssignmentResult(
targets.stream().map(target -> target.getControllerId()).collect(Collectors.toList()), targets.size(),
controllerIDs.size() - targets.size(), Lists.newArrayList(targetIdsToActions.values()),
targetManagement);
controllerIDs.size() - targets.size(),
targetIdsToActions.values().stream().map(Action::getId).collect(Collectors.toList()), targetManagement);
LOG.debug("assignDistribution({}) finished {}", set, result);
@@ -391,13 +393,16 @@ public class DeploymentManagement {
// detaching as it is not necessary to persist the set itself
entityManager.detach(set);
// send distribution set assignment event
sendDistributionSetAssignmentEvent(targets, targetIdsCancellList, targetIdsToActions, softwareModules);
return result;
}
private void sendDistributionSetAssignmentEvent(final List<Target> targets, final Set<Long> targetIdsCancellList,
final Map<String, Action> targetIdsToActions, final List<SoftwareModule> softwareModules) {
targets.stream().filter(t -> !!!targetIdsCancellList.contains(t.getId()))
.forEach(t -> assignDistributionSetEvent(t, targetIdsToActions.get(t.getControllerId()).getId(),
softwareModules));
return result;
}
/**
@@ -709,8 +714,8 @@ public class DeploymentManagement {
}
/**
* Get the {@link Action} entity for given actionId with all lazy
* attributes.
* Get the {@link Action} entity for given actionId with all lazy attributes
* (i.e. distributionSet, target, target.assignedDs).
*
* @param actionId
* to be id of the action

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.repository;
import java.util.List;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.AssignmentResult;
import org.eclipse.hawkbit.repository.model.Target;
@@ -19,14 +18,11 @@ import org.eclipse.hawkbit.repository.model.Target;
* information of an assignment and how much of the assignment has been done and
* how much of the assignments had already been existed.
*
*
*
*
*/
public class DistributionSetAssignmentResult extends AssignmentResult {
private final List<String> assignedTargets;
private final List<Action> actions;
private final List<Long> actions;
private final TargetManagement targetManagement;
@@ -48,7 +44,7 @@ public class DistributionSetAssignmentResult extends AssignmentResult {
*
*/
public DistributionSetAssignmentResult(final List<String> assignedTargets, final int assigned,
final int alreadyAssigned, final List<Action> actions, final TargetManagement targetManagement) {
final int alreadyAssigned, final List<Long> actions, final TargetManagement targetManagement) {
super(assigned, alreadyAssigned);
this.assignedTargets = assignedTargets;
this.actions = actions;
@@ -63,9 +59,9 @@ public class DistributionSetAssignmentResult extends AssignmentResult {
}
/**
* @return the actionId
* @return the actionIds
*/
public List<Action> getActions() {
public List<Long> getActions() {
return actions;
}

View File

@@ -24,6 +24,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.NamedAttributeNode;
import javax.persistence.NamedEntityGraph;
import javax.persistence.NamedEntityGraphs;
import javax.persistence.NamedSubgraph;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -34,28 +35,22 @@ import org.eclipse.persistence.annotations.CascadeOnDelete;
/**
* <p>
* Applicable transition changes of the software {@link SoftwareModule} state of
* a {@link Target}, e.g. install, uninstall, update, start, stop, and
* preparations for the transition change, i.e. download.
* Applicable transition changes of the {@link SoftwareModule}s state of a
* {@link Target}, e.g. install, uninstall, update and preparations for the
* transition change, i.e. download.
* </p>
*
* <p>
* Actions are managed by the SP server (SPS) and applied to the edge controller
* by the SP controller (SPC). Actions may also be value added commands that are
* nor directly related to SP, e.g. factory reset.
* Actions are managed by the SP server and applied to the targets by the
* client.
* <p>
*
*
*
*
*
*/
@Table(name = "sp_action", indexes = { @Index(name = "sp_idx_action_01", columnList = "tenant,distribution_set"),
@Index(name = "sp_idx_action_02", columnList = "tenant,target,active"),
@Index(name = "sp_idx_action_prim", columnList = "tenant,id") })
@NamedEntityGraphs({ @NamedEntityGraph(name = "Action.ds", attributeNodes = { @NamedAttributeNode("distributionSet") }),
@NamedEntityGraph(name = "Action.all", attributeNodes = { @NamedAttributeNode("distributionSet"),
@NamedAttributeNode("target") }) })
@NamedAttributeNode(value = "target", subgraph = "target.ds") }, subgraphs = @NamedSubgraph(name = "target.ds", attributeNodes = @NamedAttributeNode("assignedDistributionSet") ) ) })
@Entity
public class Action extends BaseEntity implements Comparable<Action> {
private static final long serialVersionUID = 1L;

View File

@@ -55,7 +55,7 @@ public abstract class AbstractIntegrationTestWithMongoDB extends AbstractIntegra
System.setProperty("spring.data.mongodb.port", String.valueOf(port));
}
Version version = Version.V3_0_5;
Version version = Version.V3_0_8;
if (System.getProperty("inf.mongodb.version") != null) {
version = Version
.valueOf("V" + System.getProperty("inf.mongodb.version").trim().replaceAll("\\.", "_"));

View File

@@ -66,6 +66,22 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
@Autowired
private EventBus eventBus;
@Test
@Description("Test verifies that the repistory retrieves the action including all defined (lazy) details.")
public void findActionWithLazyDetails() {
final DistributionSet testDs = TestDataUtil.generateDistributionSet("TestDs", "1.0", softwareManagement,
distributionSetManagement, new ArrayList<DistributionSetTag>());
final List<Target> testTarget = targetManagement.createTargets(TestDataUtil.generateTargets(1));
// one action with one action status is generated
final Long actionId = deploymentManagement.assignDistributionSet(testDs, testTarget).getActions().get(0);
final Action action = deploymentManagement.findActionWithDetails(actionId);
assertThat(action.getDistributionSet()).as("DistributionSet in action").isNotNull();
assertThat(action.getTarget()).as("Target in action").isNotNull();
assertThat(action.getTarget().getAssignedDistributionSet()).as("AssignedDistributionSet of target in action")
.isNotNull();
}
@Test
@Description("Test verifies that the custom query to find all actions include the count of action status is working correctly")
public void findActionsWithStatusCountByTarget() {
@@ -73,7 +89,8 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
distributionSetManagement, new ArrayList<DistributionSetTag>());
final List<Target> testTarget = targetManagement.createTargets(TestDataUtil.generateTargets(1));
// one action with one action status is generated
final Action action = deploymentManagement.assignDistributionSet(testDs, testTarget).getActions().get(0);
final Action action = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(testDs, testTarget).getActions().get(0));
// save 2 action status
actionStatusRepository.save(new ActionStatus(action, Status.RETRIEVED, System.currentTimeMillis()));
actionStatusRepository.save(new ActionStatus(action, Status.RUNNING, System.currentTimeMillis()));
@@ -349,7 +366,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
* test a simple deployment by calling the
* {@link TargetRepository#assignDistributionSet(DistributionSet, Iterable)}
* and checking the active action and the action history of the targets.
*
*
* @throws InterruptedException
*/
@Test
@@ -805,7 +822,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
// assign ds to create an action
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement
.assignDistributionSet(ds.getId(), ActionType.SOFT, Action.NO_FORCE_TIME, target.getControllerId());
final Action action = assignDistributionSet.getActions().get(0);
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
// verify preparation
Action findAction = deploymentManagement.findAction(action.getId());
assertThat(findAction.getActionType()).isEqualTo(ActionType.SOFT);
@@ -828,7 +845,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
// assign ds to create an action
final DistributionSetAssignmentResult assignDistributionSet = deploymentManagement
.assignDistributionSet(ds.getId(), ActionType.FORCED, Action.NO_FORCE_TIME, target.getControllerId());
final Action action = assignDistributionSet.getActions().get(0);
final Action action = deploymentManagement.findActionWithDetails(assignDistributionSet.getActions().get(0));
// verify perparation
Action findAction = deploymentManagement.findAction(action.getId());
assertThat(findAction.getActionType()).isEqualTo(ActionType.FORCED);
@@ -848,7 +865,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
* <p>
* <b>All created distribution sets are assigned to all targets of the
* target list deployedTargets.</b>
*
*
* @param undeployedTargetPrefix
* prefix to be used as target controller prefix
* @param noOfUndeployedTargets

View File

@@ -138,7 +138,8 @@ public class ReportManagementTest extends AbstractIntegrationTest {
final Target createTarget = targetManagement.createTarget(new Target("t" + month));
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(distributionSet,
Lists.newArrayList(createTarget));
controllerManagament.registerRetrieved(result.getActions().get(0),
controllerManagament.registerRetrieved(
deploymentManagement.findActionWithDetails(result.getActions().get(0)),
"Controller retrieved update action and should start now the download.");
}
DataReportSeries<LocalDate> feedbackReceivedOverTime = reportManagement
@@ -158,7 +159,8 @@ public class ReportManagementTest extends AbstractIntegrationTest {
final Target createTarget = targetManagement.createTarget(new Target("t2" + month));
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(distributionSet,
Lists.newArrayList(createTarget));
controllerManagament.registerRetrieved(result.getActions().get(0),
controllerManagament.registerRetrieved(
deploymentManagement.findActionWithDetails(result.getActions().get(0)),
"Controller retrieved update action and should start now the download.");
}
feedbackReceivedOverTime = reportManagement.feedbackReceivedOverTime(DateTypes.perMonth(), from, to);
@@ -572,7 +574,7 @@ public class ReportManagementTest extends AbstractIntegrationTest {
/*
* (non-Javadoc)
*
*
* @see org.springframework.data.auditing.DateTimeProvider#getNow()
*/
@Override

View File

@@ -174,7 +174,7 @@ public class TargetManagementTest extends AbstractIntegrationTest {
final DistributionSetAssignmentResult result = deploymentManagement.assignDistributionSet(set.getId(), "4711");
final Action action = result.getActions().get(0);
final Action action = deploymentManagement.findActionWithDetails(result.getActions().get(0));
action.setStatus(Status.FINISHED);
controllerManagament.addUpdateActionStatus(
new ActionStatus(action, Status.FINISHED, System.currentTimeMillis(), "message"), action);
@@ -221,7 +221,7 @@ public class TargetManagementTest extends AbstractIntegrationTest {
* verifies, that all {@link TargetTag} of parameter. NOTE: it's accepted
* that the target have additional tags assigned to them which are not
* contained within parameter tags.
*
*
* @param strict
* if true, the given targets MUST contain EXACTLY ALL given
* tags, AND NO OTHERS. If false, the given targets MUST contain

View File

@@ -199,13 +199,14 @@ public final class RepositoryDataGenerator {
}
private void createActionStatusHistory(final List<Action> actions, final int sizeMultiplikator) {
private void createActionStatusHistory(final List<Long> actions, final int sizeMultiplikator) {
final AtomicInteger counter = new AtomicInteger();
int index = 0;
for (final Action actionGiven : actions) {
for (final Long actionGiven : actions) {
// retrieved
Action action = controllerManagement.registerRetrieved(actionGiven,
Action action = controllerManagement.registerRetrieved(
deploymentManagement.findActionWithDetails(actionGiven),
"Controller retrieved update action and should start now the download.");
// download
@@ -260,10 +261,11 @@ public final class RepositoryDataGenerator {
}
}
private void createSimpleActionStatusHistory(final List<Action> actions) {
for (final Action actionGiven : actions) {
private void createSimpleActionStatusHistory(final List<Long> actions) {
for (final Long actionGiven : actions) {
// retrieved
Action action = controllerManagement.registerRetrieved(actionGiven,
Action action = controllerManagement.registerRetrieved(
deploymentManagement.findActionWithDetails(actionGiven),
"Controller retrieved update action and should start now the download.");
// close

View File

@@ -56,7 +56,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
final List<Target> toAssign = new ArrayList<Target>();
toAssign.add(savedTarget);
final Action updateAction = deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0);
final Action updateAction = deploymentManagement
.findActionWithDetails(deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0));
final Action cancelAction = deploymentManagement.cancelAction(updateAction,
targetManagement.findTargetByControllerID(savedTarget.getControllerId()));
@@ -112,7 +113,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
final List<Target> toAssign = new ArrayList<Target>();
toAssign.add(savedTarget);
final Action updateAction = deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0);
final Action updateAction = deploymentManagement
.findActionWithDetails(deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0));
long current = System.currentTimeMillis();
mvc.perform(get("/{tenant}/controller/v1/4712", tenantAware.getCurrentTenant()))
@@ -227,7 +229,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
final Target savedTarget = targetManagement.createTarget(target);
final List<Target> toAssign = new ArrayList<Target>();
toAssign.add(savedTarget);
final Action updateAction = deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0);
final Action updateAction = deploymentManagement
.findActionWithDetails(deploymentManagement.assignDistributionSet(ds, toAssign).getActions().get(0));
return deploymentManagement.cancelAction(updateAction,
targetManagement.findTargetByControllerID(savedTarget.getControllerId()));
@@ -243,8 +246,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
final Target savedTarget = targetManagement.createTarget(target);
final Action updateAction = deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" })
.getActions().get(0);
final Action updateAction = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" }).getActions().get(0));
// cancel action manually
final Action cancelAction = deploymentManagement.cancelAction(updateAction,
@@ -340,12 +343,12 @@ public class CancelActionTest extends AbstractIntegrationTest {
final Target savedTarget = targetManagement.createTarget(target);
final Action updateAction = deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" })
.getActions().get(0);
final Action updateAction2 = deploymentManagement.assignDistributionSet(ds2.getId(), new String[] { "4712" })
.getActions().get(0);
final Action updateAction3 = deploymentManagement.assignDistributionSet(ds3.getId(), new String[] { "4712" })
.getActions().get(0);
final Action updateAction = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" }).getActions().get(0));
final Action updateAction2 = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(ds2.getId(), new String[] { "4712" }).getActions().get(0));
final Action updateAction3 = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(ds3.getId(), new String[] { "4712" }).getActions().get(0));
assertThat(actionStatusRepository.findAll()).hasSize(3);
@@ -456,8 +459,8 @@ public class CancelActionTest extends AbstractIntegrationTest {
final List<Target> toAssign = new ArrayList<Target>();
toAssign.add(target);
final Action action = deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" })
.getActions().get(0);
final Action action = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(ds.getId(), new String[] { "4712" }).getActions().get(0));
final Action cancelAction = deploymentManagement.cancelAction(action,
targetManagement.findTargetByControllerID(target.getControllerId()));

View File

@@ -484,7 +484,8 @@ public class DeploymentBaseTest extends AbstractIntegrationTestWithMongoDB {
final DistributionSet savedSet = TestDataUtil.generateDistributionSet("", softwareManagement,
distributionSetManagement);
final Action action1 = deploymentManagement.assignDistributionSet(savedSet, toAssign).getActions().get(0);
final Action action1 = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(savedSet, toAssign).getActions().get(0));
mvc.perform(
get("/{tenant}/controller/v1/4712/deploymentBase/" + action1.getId(), tenantAware.getCurrentTenant()))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
@@ -544,12 +545,12 @@ public class DeploymentBaseTest extends AbstractIntegrationTestWithMongoDB {
final List<Target> toAssign = new ArrayList<Target>();
toAssign.add(savedTarget1);
final Action action1 = deploymentManagement.assignDistributionSet(ds1.getId(), new String[] { "4712" })
.getActions().get(0);
final Action action2 = deploymentManagement.assignDistributionSet(ds2.getId(), new String[] { "4712" })
.getActions().get(0);
final Action action3 = deploymentManagement.assignDistributionSet(ds3.getId(), new String[] { "4712" })
.getActions().get(0);
final Action action1 = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(ds1.getId(), new String[] { "4712" }).getActions().get(0));
final Action action2 = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(ds2.getId(), new String[] { "4712" }).getActions().get(0));
final Action action3 = deploymentManagement.findActionWithDetails(
deploymentManagement.assignDistributionSet(ds3.getId(), new String[] { "4712" }).getActions().get(0));
Target myT = targetManagement.findTargetByControllerID("4712");
assertThat(myT.getTargetInfo().getUpdateStatus()).isEqualTo(TargetUpdateStatus.PENDING);

View File

@@ -78,7 +78,8 @@ public class SoftwareModuleTable extends AbstractTable {
@Autowired
private UploadViewAcceptCriteria uploadViewAcceptCriteria;
/**
* Initialize the filter layout.
*/
@@ -127,12 +128,7 @@ public class SoftwareModuleTable extends AbstractTable {
*/
@Override
protected Container createContainer() {
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
artifactUploadState.getSoftwareModuleFilters().getSearchText()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
.ifPresent(type -> queryConfiguration.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
final BeanQueryFactory<BaseSwModuleBeanQuery> swQF = new BeanQueryFactory<BaseSwModuleBeanQuery>(
BaseSwModuleBeanQuery.class);
@@ -142,6 +138,19 @@ public class SoftwareModuleTable extends AbstractTable {
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
return container;
}
private Map<String, Object> prepareQueryConfigFilters() {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
artifactUploadState.getSoftwareModuleFilters().getSearchText()
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType()
.ifPresent(type -> queryConfig.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
return queryConfig;
}
@Override
protected void addContainerProperties(final Container container) {

View File

@@ -219,8 +219,10 @@ public class SoftwareModuleTableHeader extends AbstractTableHeader {
*/
@Override
protected void resetSearchText() {
artifactUploadState.getSoftwareModuleFilters().setSearchText(null);
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
if(artifactUploadState.getSoftwareModuleFilters().getSearchText().isPresent()){
artifactUploadState.getSoftwareModuleFilters().setSearchText(null);
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
}
}
/*

View File

@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.ui.components;
import java.util.Arrays;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
@@ -23,7 +24,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.vaadin.sass.internal.util.StringUtil;
import com.vaadin.server.ExternalResource;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.Resource;
@@ -108,16 +108,16 @@ public final class SPUIComponentProvider {
final Class<? extends SPUIHeaderLayoutDecorator> tableHeaderLayoutDecorator) {
// Do we really need this???
HorizontalLayout hLayout = getHorizontalLayout(new SPUIHorizontalLayout().getUiHorizontalLayout().getClass());
if (tableHeaderLayoutDecorator == null) {
return hLayout;
}
try {
SPUIHeaderLayoutDecorator layoutDecorator = null;
if (tableHeaderLayoutDecorator != null) {
layoutDecorator = tableHeaderLayoutDecorator.newInstance();
hLayout = layoutDecorator.decorate(hLayout);
}
} catch (final InstantiationException exception) {
LOG.error("Error occured while creating horizontal decorator " + SPUIHeaderLayoutDecorator.class,
exception);
} catch (final IllegalAccessException exception) {
final SPUIHeaderLayoutDecorator layoutDecorator = tableHeaderLayoutDecorator.newInstance();
hLayout = layoutDecorator.decorate(hLayout);
} catch (final InstantiationException | IllegalAccessException exception) {
LOG.error("Error occured while creating horizontal decorator " + SPUIHeaderLayoutDecorator.class,
exception);
}
@@ -324,7 +324,7 @@ public final class SPUIComponentProvider {
* @return Label
*/
public static Label createNameValueLabel(final String label, final String... values) {
final String valueStr = StringUtil.collectionToDelimitedString(Arrays.asList(values), " ");
final String valueStr = StringUtils.join(Arrays.asList(values), " ");
final Label nameValueLabel = new Label(getBoldHTMLText(label) + valueStr, ContentMode.HTML);
nameValueLabel.setSizeFull();
nameValueLabel.addStyleName(SPUIDefinitions.TEXT_STYLE);

View File

@@ -114,7 +114,7 @@ public class DistributionSetTable extends AbstractTable {
@Autowired
private transient TargetManagement targetManagement;
/**
* Initialize the component.
*/
@@ -157,21 +157,28 @@ public class DistributionSetTable extends AbstractTable {
@Override
protected Container createContainer() {
final Map<String, Object> queryConfiguration = new HashMap<>();
manageDistUIState.getManageDistFilters().getSearchText()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
if (null != manageDistUIState.getManageDistFilters().getClickedDistSetType()) {
queryConfiguration.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
manageDistUIState.getManageDistFilters().getClickedDistSetType());
}
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
final BeanQueryFactory<ManageDistBeanQuery> distributionQF = new BeanQueryFactory<>(ManageDistBeanQuery.class);
distributionQF.setQueryConfiguration(queryConfiguration);
return new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
distributionQF);
}
private Map<String, Object> prepareQueryConfigFilters() {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
manageDistUIState.getManageDistFilters().getSearchText()
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
if (null != manageDistUIState.getManageDistFilters().getClickedDistSetType()) {
queryConfig.put(SPUIDefinitions.FILTER_BY_DISTRIBUTION_SET_TYPE,
manageDistUIState.getManageDistFilters().getClickedDistSetType());
}
return queryConfig;
}
/*
* (non-Javadoc)

View File

@@ -170,9 +170,10 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
@Override
protected void resetSearchText() {
manageDistUIstate.getManageDistFilters().setSearchText(null);
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
if(manageDistUIstate.getManageDistFilters().getSearchText().isPresent()){
manageDistUIstate.getManageDistFilters().setSearchText(null);
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
}
}
@Override

View File

@@ -94,8 +94,8 @@ public class SwModuleTable extends AbstractTable {
@Autowired
private ArtifactDetailsLayout artifactDetailsLayout;
/**
/**
* Initialize the filter layout.
*/
@PostConstruct
@@ -177,15 +177,7 @@ public class SwModuleTable extends AbstractTable {
*/
@Override
protected Container createContainer() {
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
manageDistUIState.getSoftwareModuleFilters().getSearchText()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType()
.ifPresent(type -> queryConfiguration.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
manageDistUIState.getLastSelectedDistribution().ifPresent(
distIdName -> queryConfiguration.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, distIdName.getId()));
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
final BeanQueryFactory<SwModuleBeanQuery> swQF = new BeanQueryFactory<SwModuleBeanQuery>(
SwModuleBeanQuery.class);
@@ -195,6 +187,20 @@ public class SwModuleTable extends AbstractTable {
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, "swId"), swQF);
return container;
}
private Map<String, Object> prepareQueryConfigFilters() {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
manageDistUIState.getSoftwareModuleFilters().getSearchText()
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType()
.ifPresent(type -> queryConfig.put(SPUIDefinitions.BY_SOFTWARE_MODULE_TYPE, type));
manageDistUIState.getLastSelectedDistribution().ifPresent(
distIdName -> queryConfig.put(SPUIDefinitions.ORDER_BY_DISTRIBUTION, distIdName.getId()));
return queryConfig;
}
/*
* (non-Javadoc)

View File

@@ -203,8 +203,10 @@ public class SwModuleTableHeader extends AbstractTableHeader {
*/
@Override
protected void resetSearchText() {
manageDistUIState.getSoftwareModuleFilters().setSearchText(null);
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
if(manageDistUIState.getSoftwareModuleFilters().getSearchText().isPresent()){
manageDistUIState.getSoftwareModuleFilters().setSearchText(null);
eventbus.publish(this, SMFilterEvent.REMOVER_FILTER_BY_TEXT);
}
}
/*

View File

@@ -112,7 +112,8 @@ public class DistributionTable extends AbstractTable {
private Boolean isDistPinned = false;
private Button distributinPinnedBtn;
/**
* Initialize the distribution table.
*/
@@ -141,7 +142,7 @@ public class DistributionTable extends AbstractTable {
|| event == DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT
|| event == DistributionTableFilterEvent.FILTER_BY_TAG) {
UI.getCurrent().access(() -> refreshFilter());
}
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)
@@ -219,18 +220,8 @@ public class DistributionTable extends AbstractTable {
*/
@Override
protected Container createContainer() {
final Map<String, Object> queryConfiguration = new HashMap<String, Object>();
managementUIState.getDistributionTableFilters().getSearchText()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.FILTER_BY_TEXT, value));
managementUIState.getDistributionTableFilters().getPinnedTargetId()
.ifPresent(value -> queryConfiguration.put(SPUIDefinitions.ORDER_BY_PINNED_TARGET, value));
final List<String> list = new ArrayList<String>();
queryConfiguration.put(SPUIDefinitions.FILTER_BY_NO_TAG,
managementUIState.getDistributionTableFilters().isNoTagSelected());
if (!managementUIState.getDistributionTableFilters().getDistSetTags().isEmpty()) {
list.addAll(managementUIState.getDistributionTableFilters().getDistSetTags());
}
queryConfiguration.put(SPUIDefinitions.FILTER_BY_TAG, list);
final Map<String, Object> queryConfiguration = prepareQueryConfigFilters();
final BeanQueryFactory<DistributionBeanQuery> distributionQF = new BeanQueryFactory<DistributionBeanQuery>(
DistributionBeanQuery.class);
distributionQF.setQueryConfiguration(queryConfiguration);
@@ -239,6 +230,22 @@ public class DistributionTable extends AbstractTable {
distributionQF);
return distributionContainer;
}
private Map<String, Object> prepareQueryConfigFilters() {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
managementUIState.getDistributionTableFilters().getSearchText()
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
managementUIState.getDistributionTableFilters().getPinnedTargetId()
.ifPresent(value -> queryConfig.put(SPUIDefinitions.ORDER_BY_PINNED_TARGET, value));
final List<String> list = new ArrayList<String>();
queryConfig.put(SPUIDefinitions.FILTER_BY_NO_TAG,
managementUIState.getDistributionTableFilters().isNoTagSelected());
if (!managementUIState.getDistributionTableFilters().getDistSetTags().isEmpty()) {
list.addAll(managementUIState.getDistributionTableFilters().getDistSetTags());
}
queryConfig.put(SPUIDefinitions.FILTER_BY_TAG, list);
return queryConfig;
}
/*
* (non-Javadoc)

View File

@@ -210,8 +210,10 @@ public class DistributionTableHeader extends AbstractTableHeader {
*/
@Override
protected void resetSearchText() {
managementUIState.getDistributionTableFilters().setSearchText(null);
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
if( managementUIState.getDistributionTableFilters().getSearchText().isPresent()){
managementUIState.getDistributionTableFilters().setSearchText(null);
eventbus.publish(this, DistributionTableFilterEvent.REMOVE_FILTER_BY_TEXT);
}
}
/*

View File

@@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -73,8 +74,8 @@ import org.vaadin.spring.events.EventBus;
import org.vaadin.spring.events.EventScope;
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import com.google.gwt.thirdparty.guava.common.base.Strings;
import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.event.Action;
@@ -104,6 +105,8 @@ import com.vaadin.ui.themes.ValoTheme;
@ViewScope
public class TargetTable extends AbstractTable implements Handler {
private static final String TARGET_PINNED = "targetPinned";
private static final long serialVersionUID = -2300392868806614568L;
private static final Logger LOG = LoggerFactory.getLogger(TargetTable.class);
@@ -138,6 +141,8 @@ public class TargetTable extends AbstractTable implements Handler {
private Boolean isTargetPinned = Boolean.FALSE;
private ShortcutAction actionSelectAll;
private ShortcutAction actionUnSelectAll;
@Override
@PostConstruct
@@ -271,7 +276,7 @@ public class TargetTable extends AbstractTable implements Handler {
final Map<String, Object> queryConfig = prepareQueryConfigFilters();
// Create TargetBeanQuery factory with the query config.
final BeanQueryFactory<TargetBeanQuery> targetQF = new BeanQueryFactory<TargetBeanQuery>(TargetBeanQuery.class);
final BeanQueryFactory<TargetBeanQuery> targetQF = new BeanQueryFactory<>(TargetBeanQuery.class);
targetQF.setQueryConfiguration(queryConfig);
// create lazy query container with lazy defination and query
@@ -394,7 +399,7 @@ public class TargetTable extends AbstractTable implements Handler {
*/
@Override
protected List<TableColumn> getTableVisibleColumns() {
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_CREATED_BY, i18n.get("header.createdBy"), 0.1f));
@@ -469,7 +474,7 @@ public class TargetTable extends AbstractTable implements Handler {
}
private Map<String, Object> prepareQueryConfigFilters() {
final Map<String, Object> queryConfig = new HashMap<String, Object>();
final Map<String, Object> queryConfig = new HashMap<>();
managementUIState.getTargetTableFilters().getSearchText()
.ifPresent(value -> queryConfig.put(SPUIDefinitions.FILTER_BY_TEXT, value));
managementUIState.getTargetTableFilters().getDistributionSet()
@@ -481,7 +486,7 @@ public class TargetTable extends AbstractTable implements Handler {
queryConfig.put(SPUIDefinitions.FILTER_BY_NO_TAG, managementUIState.getTargetTableFilters().isNoTagSelected());
if (isFilteredByTags()) {
final List<String> list = new ArrayList<String>();
final List<String> list = new ArrayList<>();
list.addAll(managementUIState.getTargetTableFilters().getClickedTargetTags());
queryConfig.put(SPUIDefinitions.FILTER_BY_TAG, list.toArray(new String[list.size()]));
}
@@ -522,7 +527,7 @@ public class TargetTable extends AbstractTable implements Handler {
pinBtn.setId(SPUIComponetIdProvider.TARGET_PIN_ICON + "." + itemId);
pinBtn.addClickListener(event -> addPinClickListener(event));
if (isPinned(((TargetIdName) itemId).getControllerId())) {
pinBtn.addStyleName("targetPinned");
pinBtn.addStyleName(TARGET_PINNED);
isTargetPinned = Boolean.TRUE;
targetPinnedBtn = pinBtn;
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
@@ -533,7 +538,7 @@ public class TargetTable extends AbstractTable implements Handler {
}
private boolean isPinned(final String targetId) {
boolean result = false;
boolean result;
if (managementUIState.getDistributionTableFilters().getPinnedTargetId().isPresent()
&& targetId.equals(managementUIState.getDistributionTableFilters().getPinnedTargetId().get())) {
result = true;
@@ -594,7 +599,7 @@ public class TargetTable extends AbstractTable implements Handler {
eventBus.publish(this, PinUnpinEvent.PIN_TARGET);
/* change target table styling */
styleTargetTable();
eventBtn.addStyleName("targetPinned");
eventBtn.addStyleName(TARGET_PINNED);
isTargetPinned = Boolean.FALSE;
}
@@ -605,7 +610,7 @@ public class TargetTable extends AbstractTable implements Handler {
}
private void resetPinStyle(final Button pinBtn) {
pinBtn.removeStyleName("targetPinned");
pinBtn.removeStyleName(TARGET_PINNED);
pinBtn.addStyleName(SPUIStyleDefinitions.TARGET_STATUS_PIN_TOGGLE);
HawkbitCommonUtil.applyStatusLblStyle(this, pinBtn, pinBtn.getData());
}
@@ -644,7 +649,7 @@ public class TargetTable extends AbstractTable implements Handler {
final com.vaadin.event.dd.TargetDetails taregtDet = event.getTargetDetails();
final Table targetTable = (Table) taregtDet.getTarget();
final Set<TargetIdName> targetSelected = HawkbitCommonUtil.getSelectedTargetDetails(targetTable);
final Set<String> targetList = new HashSet<String>();
final Set<String> targetList = new HashSet<>();
final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
final Object targetItemId = dropData.getItemIdOver();
if (!targetSelected.contains(targetItemId)) {
@@ -701,9 +706,8 @@ public class TargetTable extends AbstractTable implements Handler {
private static Set<DistributionSetIdName> getDraggedDistributionSet(final TableTransferable transferable,
final Table source) {
@SuppressWarnings("unchecked")
final Set<DistributionSetIdName> distSelected = HawkbitCommonUtil.getSelectedDSDetails(source);
final Set<DistributionSetIdName> distributionIdSet = new HashSet<DistributionSetIdName>();
final Set<DistributionSetIdName> distributionIdSet = new HashSet<>();
if (!distSelected.contains(transferable.getData(ITEMID))) {
distributionIdSet.add((DistributionSetIdName) transferable.getData(ITEMID));
} else {
@@ -828,15 +832,11 @@ public class TargetTable extends AbstractTable implements Handler {
}
}
/**
* @param filterEvent
* @return
*/
private boolean checkFilterEvent(final TargetFilterEvent filterEvent) {
boolean isFilterEvent = false;
boolean isFilter = false;
boolean isRemoveFilters = false;
boolean isStatusFilter = false;
private static boolean checkFilterEvent(final TargetFilterEvent filterEvent) {
boolean isFilterEvent;
boolean isFilter;
boolean isRemoveFilters;
boolean isStatusFilter;
isFilter = filterEvent == TargetFilterEvent.FILTER_BY_TEXT || filterEvent == TargetFilterEvent.FILTER_BY_TAG
|| filterEvent == TargetFilterEvent.FILTER_BY_DISTRIBUTION
|| filterEvent == TargetFilterEvent.FILTER_BY_TARGET_FILTER_QUERY;
@@ -1020,11 +1020,11 @@ public class TargetTable extends AbstractTable implements Handler {
private List<TargetIdName> getTargetIdsBySimpleFilters(final PageRequest pageRequest) {
final Long filterByDistId = managementUIState.getTargetTableFilters().getDistributionSet().isPresent()
? managementUIState.getTargetTableFilters().getDistributionSet().get().getId() : null;
final List<TargetUpdateStatus> statusList = new ArrayList<TargetUpdateStatus>();
final List<TargetUpdateStatus> statusList = new ArrayList<>();
if (isFilteredByStatus()) {
statusList.addAll(managementUIState.getTargetTableFilters().getClickedStatusTargetTags());
}
final List<String> tagList = new ArrayList<String>();
final List<String> tagList = new ArrayList<>();
if (isFilteredByTags()) {
tagList.addAll(managementUIState.getTargetTableFilters().getClickedTargetTags());
}
@@ -1081,7 +1081,7 @@ public class TargetTable extends AbstractTable implements Handler {
String[] targetTags = null;
Long distributionId = null;
String searchText = null;
Boolean noTagClicked = Boolean.FALSE;
Boolean noTagClicked;
Long pinnedDistId = null;
if (isFilteredByTags()) {
@@ -1129,13 +1129,13 @@ public class TargetTable extends AbstractTable implements Handler {
&& !Strings.isNullOrEmpty(managementUIState.getTargetTableFilters().getSearchText().get());
}
private Boolean anyFilterSelected(final Collection<TargetUpdateStatus> status, final Long distributionId,
private static Boolean anyFilterSelected(final Collection<TargetUpdateStatus> status, final Long distributionId,
final Boolean noTagClicked, final String[] targetTags, final String searchText) {
return status == null && distributionId == null && Strings.isNullOrEmpty(searchText)
&& !isTagSelected(targetTags, noTagClicked);
}
private Boolean isTagSelected(final String[] targetTags, final Boolean noTagClicked) {
private static Boolean isTagSelected(final String[] targetTags, final Boolean noTagClicked) {
return targetTags == null && !noTagClicked;
}

View File

@@ -258,8 +258,10 @@ public class TargetTableHeader extends AbstractTableHeader {
@Override
protected void resetSearchText() {
managementUIState.getTargetTableFilters().setSearchText(null);
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
if(managementUIState.getTargetTableFilters().getSearchText().isPresent()){
managementUIState.getTargetTableFilters().setSearchText(null);
eventBus.publish(this, TargetFilterEvent.REMOVE_FILTER_BY_TEXT);
}
}
private String getSearchText() {

View File

@@ -15,7 +15,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import com.google.gwt.thirdparty.guava.common.base.Strings;
import com.google.common.base.Strings;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.AbstractTextField.TextChangeEventMode;
import com.vaadin.ui.Alignment;

134
pom.xml
View File

@@ -15,7 +15,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
<version>1.2.8.RELEASE</version>
</parent>
<groupId>org.eclipse.hawkbit</groupId>
@@ -57,42 +57,61 @@
</repositories>
<properties>
<spring.boot.version>1.2.7.RELEASE</spring.boot.version>
<java.version>1.8</java.version>
<spring.boot.version>1.2.8.RELEASE</spring.boot.version>
<!-- Spring boot overrides - START -->
<h2.version>1.4.186</h2.version>
<jackson.version>2.5.0</jackson.version>
<hibernate-validator.version>5.2.2.Final</hibernate-validator.version>
<spring-data-releasetrain.version>Fowler-SR1</spring-data-releasetrain.version>
<!-- Spring boot version overrides (should be reviewed with every boot upgrade) - START -->
<!-- Newer versions needed than defined in Boot-->
<jackson.version>2.5.5</jackson.version>
<hibernate-validator.version>5.2.4.Final</hibernate-validator.version>
<spring-cloud-connectors.version>1.2.0.RELEASE</spring-cloud-connectors.version>
<mongodb.version>3.0.2</mongodb.version>
<!-- Spring boot overrides - END -->
<!-- Support for MongoDB 3 -->
<spring-data-releasetrain.version>Fowler-SR1</spring-data-releasetrain.version>
<mongodb.version>3.2.2</mongodb.version>
<!-- Spring boot version overrides - END -->
<!-- Vaadin versions - START -->
<vaadin.spring.version>1.0.0</vaadin.spring.version>
<vaadin.spring.addon.version>0.0.6.RELEASE</vaadin.spring.addon.version>
<vaadin.version>7.5.7</vaadin.version>
<vaadin.version>7.5.10</vaadin.version>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
<vaadin.addon.vaadin-lazyquerycontainer.version>7.4.0.1</vaadin.addon.vaadin-lazyquerycontainer.version>
<vaadin.addon.flexibleoptiongroup.version>2.2.0</vaadin.addon.flexibleoptiongroup.version>
<vaadin.addon.tokenfield.version>7.0.1</vaadin.addon.tokenfield.version>
<vaadin.addon.dbar-addon.version>1.2.0</vaadin.addon.dbar-addon.version>
<vaadin.addon.contextmenu.version>4.5</vaadin.addon.contextmenu.version>
<!-- Vaadin versions - END -->
<!-- Misc -->
<!-- Misc libraries versions - START -->
<fest-assert.version>1.4</fest-assert.version>
<org.easytesting.version>2.0M10</org.easytesting.version>
<java.version>1.8</java.version>
<allure.version>1.4.15</allure.version>
<eclipselink.version>2.6.0</eclipselink.version>
<eclipselink.version>2.6.2</eclipselink.version>
<org.powermock.version>1.5.4</org.powermock.version>
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
<json-path.version>0.9.1</json-path.version>
<commons-lang3.version>3.4</commons-lang3.version>
<aspectj.version>1.8.5</aspectj.version>
<guava.version>19.0</guava.version>
<mariadb-java-client.version>1.3.5</mariadb-java-client.version>
<embedded-mongo.version>1.50.2</embedded-mongo.version>
<jersey-client.version>1.18.1</jersey-client.version>
<javax.el-api.version>2.2.4</javax.el-api.version>
<corn-cps.version>1.1.7</corn-cps.version>
<jlorem.version>1.1</jlorem.version>
<json-simple.version>1.1.1</json-simple.version>
<commons-lang3.version>3.4</commons-lang3.version>
<json.version>20141113</json.version>
<rsql-parser.version>2.0.0</rsql-parser.version>
<!-- Misc libraries versions - END -->
<!-- Release -->
<!-- Release - START -->
<release.scm.connection>scm:git:https://github.com/eclipse/hawkbit.git</release.scm.connection>
<release.scm.developerConnection>scm:git:https://github.com/eclipse/hawkbit.git</release.scm.developerConnection>
<release.scm.url>https://github.com/eclipse/hawkbit.git</release.scm.url>
<!-- Release - END -->
<!-- Sonar -->
<!-- Sonar - START-->
<sonar.host.url>https://sonar.eu-gb.mybluemix.net</sonar.host.url>
<sonar.github.repository>eclipse/hawkbit</sonar.github.repository>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
@@ -123,7 +142,7 @@
<!-- Tells Sonar where the Jacoco coverage result file is located for
Integration Tests -->
<sonar.jacoco.itReportPath>${jacoco.outputDir}/${jacoco.out.it.file}</sonar.jacoco.itReportPath>
<guava.version>19.0</guava.version>
<!-- Sonar - END-->
</properties>
@@ -335,7 +354,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
<version>${slf4j.version}</version>
</dependency>
<!-- Vaadin -->
<dependency>
@@ -363,30 +382,6 @@
<artifactId>vaadin-push</artifactId>
<version>${vaadin.version}</version>
</dependency>
<!-- Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory).
For widgetset compilation, vaadin-client-compiler is automatically added
on the compilation classpath by vaadin-maven-plugin so normally there is
no need for an explicit dependency. -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
@@ -395,44 +390,44 @@
<dependency>
<groupId>org.vaadin.addons.lazyquerycontainer</groupId>
<artifactId>vaadin-lazyquerycontainer</artifactId>
<version>7.4.0.1</version>
<version>${vaadin.addon.vaadin-lazyquerycontainer.version}</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>flexibleoptiongroup</artifactId>
<version>2.2.0</version>
<version>${vaadin.addon.flexibleoptiongroup.version}</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>tokenfield</artifactId>
<version>7.0.1</version>
<version>${vaadin.addon.tokenfield.version}</version>
</dependency>
<dependency>
<groupId>org.vaadin.alump.distributionbar</groupId>
<artifactId>dbar-addon</artifactId>
<version>1.2.0</version>
<version>${vaadin.addon.dbar-addon.version}</version>
</dependency>
<dependency>
<groupId>org.vaadin.addons</groupId>
<artifactId>contextmenu</artifactId>
<version>4.5</version>
<version>${vaadin.addon.contextmenu.version}</version>
</dependency>
<!-- Misc -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
<version>${javax.el-api.version}</version>
</dependency>
<dependency>
<groupId>net.sf.corn</groupId>
<artifactId>corn-cps</artifactId>
<version>1.1.7</version>
<version>${corn-cps.version}</version>
</dependency>
<dependency>
<groupId>net._01001111</groupId>
<artifactId>jlorem</artifactId>
<version>1.1</version>
<version>${jlorem.version}</version>
</dependency>
<!-- Spring -->
<dependency>
@@ -514,13 +509,6 @@
</exclusion>
</exclusions>
</dependency>
<!-- Override of classmate version, that is a hibernate validator
dependency. allow PB of CQ -->
<dependency>
<groupId>com.fasterxml</groupId>
<artifactId>classmate</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
@@ -530,7 +518,7 @@
<dependency>
<groupId>cz.jirutka.rsql</groupId>
<artifactId>rsql-parser</artifactId>
<version>2.0.0</version>
<version>${rsql-parser.version}</version>
</dependency>
<!-- JSON PATH, used to e.g. parse vcap services from environment -->
<dependency>
@@ -541,7 +529,7 @@
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
<version>${json-simple.version}</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
@@ -549,13 +537,13 @@
</exclusion>
</exclusions>
</dependency>
<!-- Spring boot overrides - START -->
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- Spring boot overrides - END -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
@@ -567,22 +555,16 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench</artifactId>
<version>4.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20141113</version>
<version>${json.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>1.50.0</version>
<version>${embedded-mongo.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -606,7 +588,7 @@
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.18.1</version>
<version>${jersey-client.version}</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -618,13 +600,13 @@
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.9.1</version>
<version>${json-path.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>1.2.3</version>
<version>${mariadb-java-client.version}</version>
<scope>test</scope>
</dependency>
<dependency>