Merge branch 'master' into feature_target_filtering_supports_overdue

Conflicts:
	hawkbit-repository\hawkbit-repository-jpa\src\main\java\org\eclipse\hawkbit\repository\jpa\JpaDeploymentManagement.java
	hawkbit-repository\hawkbit-repository-jpa\src\main\java\org\eclipse\hawkbit\repository\jpa\JpaTargetManagement.java
	hawkbit-ui\src\main\java\org\eclipse\hawkbit\ui\management\targettable\TargetBeanQuery.java
	hawkbit-ui\src\main\java\org\eclipse\hawkbit\ui\management\targettable\TargetTable.java


Signed-off-by: Marcel Mager (INST-IOT/ESB) <Marcel.Mager@bosch-si.com>
This commit is contained in:
Marcel Mager (INST-IOT/ESB)
2016-10-18 12:57:10 +02:00
114 changed files with 1741 additions and 1133 deletions

View File

@@ -187,13 +187,16 @@ public interface ArtifactManagement {
void deleteExternalArtifact(@NotNull Long id);
/**
* Deletes a local artifact.
* Garbage collects local artifact binary file if only referenced by given
* {@link LocalArtifact} metadata object.
*
* @param existing
* @param onlyByThisReferenced
* the related local artifact
*
* @return <code>true</code> if an binary was actually garbage collected
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
void deleteLocalArtifact(@NotNull LocalArtifact existing);
boolean clearLocalArtifactBinary(@NotNull LocalArtifact onlyByThisReferenced);
/**
* Deletes {@link Artifact} based on given id.

View File

@@ -255,7 +255,8 @@ public interface ControllerManagement {
/**
* Refreshes the time of the last time the controller has been connected to
* the server.
* the server. Switches {@link TargetUpdateStatus#UNKNOWN} to
* {@link TargetUpdateStatus#REGISTERED} if necessary.
*
* @param controllerId
* of the target to to update

View File

@@ -142,7 +142,7 @@ public interface RolloutGroupManagement {
@NotNull Pageable pageable);
/**
* Get count of targets in different status in rollout group.
* Get {@link RolloutGroup} by Id.
*
* @param rolloutGroupId
* rollout group id

View File

@@ -192,6 +192,15 @@ public interface TargetManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
void deleteTargets(@NotEmpty Long... targetIDs);
/**
* Deletes all targets with the given IDs.
*
* @param targetIDs
* the technical IDs of the targets to be deleted
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
void deleteTargets(@NotEmpty Collection<Long> targetIDs);
/**
* finds all {@link Target#getControllerId()} which are currently in the
* database.

View File

@@ -1,70 +0,0 @@
/**
* 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.eventbus.event;
import java.util.Arrays;
import java.util.List;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/**
*
* A abstract typesafe bulkevent which contains all changed base entities.
*
* @param <E>
*/
public abstract class AbstractEntityBulkEvent<E extends TenantAwareBaseEntity> implements EntityBulkEvent<E> {
private static final long serialVersionUID = 1L;
private List<E> entities;
private String tenant;
/**
* Constructor.
*
* @param tenant
* the tenant
* @param entities
* the changed entities
*/
public AbstractEntityBulkEvent(final String tenant, final List<E> entities) {
this.entities = entities;
this.tenant = tenant;
}
/**
* Constructor.
*
* @param tenant
* the tenant
* @param entitiy
* the changed entity
*/
public AbstractEntityBulkEvent(final String tenant, final E entitiy) {
this(tenant, Arrays.asList(entitiy));
}
@Override
public List<E> getEntities() {
return entities;
}
@Override
public long getRevision() {
return -1;
}
@Override
public String getTenant() {
return tenant;
}
}

View File

@@ -0,0 +1,63 @@
/**
* 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.eventbus.event;
import org.eclipse.hawkbit.eventbus.event.Event;
import org.eclipse.hawkbit.repository.model.Target;
/**
* Event that gets sent when the assignment of a distribution set to a target
* gets canceled.
*
*
*
*/
public class CancelTargetAssignmentEvent implements Event {
private final Target target;
private final Long actionId;
/**
* Creates a new {@link CancelTargetAssignmentEvent}.
*
* @param target
* entity
* @param actionId
* the action id of the assignment
*/
public CancelTargetAssignmentEvent(final Target target, final Long actionId) {
this.target = target;
this.actionId = actionId;
}
/**
* @return the action id of the assignment
*/
public Long getActionId() {
return actionId;
}
/**
* @return target where the action got canceled
*/
public Target getTarget() {
return target;
}
@Override
public long getRevision() {
return -1;
}
@Override
public String getTenant() {
return target.getTenant();
}
}

View File

@@ -8,27 +8,43 @@
*/
package org.eclipse.hawkbit.repository.eventbus.event;
import org.eclipse.hawkbit.eventbus.event.Event;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
/**
* A event for assignment target tag.
*/
public class DistributionSetTagAssigmentResultEvent {
public class DistributionSetTagAssigmentResultEvent implements Event {
private final DistributionSetTagAssignmentResult assigmentResult;
private final String tenant;
/**
* Constructor.
*
* @param assigmentResult
* the assignment result-
* the assignment result
* @param tenant
* current
*/
public DistributionSetTagAssigmentResultEvent(final DistributionSetTagAssignmentResult assigmentResult) {
public DistributionSetTagAssigmentResultEvent(final DistributionSetTagAssignmentResult assigmentResult,
final String tenant) {
this.assigmentResult = assigmentResult;
this.tenant = tenant;
}
public DistributionSetTagAssignmentResult getAssigmentResult() {
return assigmentResult;
}
@Override
public long getRevision() {
return -1;
}
@Override
public String getTenant() {
return tenant;
}
}

View File

@@ -1,46 +0,0 @@
/**
* 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.eventbus.event;
import java.util.List;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
/**
* * A bulk event which contains one or many new ds tag after creating.
*/
public class DistributionSetTagCreatedBulkEvent extends AbstractEntityBulkEvent<DistributionSetTag> {
private static final long serialVersionUID = 1L;
/**
* Constructor.
*
* @param tenant
* the tenant
* @param entities
* the new ds tags
*/
public DistributionSetTagCreatedBulkEvent(final String tenant, final List<DistributionSetTag> entities) {
super(tenant, entities);
}
/**
* Constructor.
*
* @param tenant
* the tenant.
* @param entity
* the new ds tag
*/
public DistributionSetTagCreatedBulkEvent(final String tenant, final DistributionSetTag entity) {
super(tenant, entity);
}
}

View File

@@ -0,0 +1,31 @@
/**
* 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.eventbus.event;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
/**
* Defines the {@link AbstractBaseEntityEvent} for creation of a new
* {@link DistributionSetTag}.
*
*/
public class DistributionSetTagCreatedEvent extends AbstractBaseEntityEvent<DistributionSetTag> {
private static final long serialVersionUID = 1L;
/**
* Constructor.
*
* @param tag
* the tag which is updated
*/
public DistributionSetTagCreatedEvent(final DistributionSetTag tag) {
super(tag);
}
}

View File

@@ -1,35 +0,0 @@
/**
* 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.eventbus.event;
import java.io.Serializable;
import java.util.List;
import org.eclipse.hawkbit.eventbus.event.Event;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/**
* An event interface which declares event types that an entities has been
* changed.
*
* @param <E>
* the entity type
*/
public interface EntityBulkEvent<E extends TenantAwareBaseEntity> extends Serializable, Event {
/**
* A typesafe way to retrieve the the entities from the event, which might
* be loaded lazy in case the event has been distributed from another node.
*
* @return the entities might be lazy loaded. Might be {@code null} in case
* the entity e.g. is queried lazy on a different node and has been
* already deleted from the database
*/
List<E> getEntities();
}

View File

@@ -8,22 +8,27 @@
*/
package org.eclipse.hawkbit.repository.eventbus.event;
import org.eclipse.hawkbit.eventbus.event.Event;
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
/**
* A event for assignment target tag.
*/
public class TargetTagAssigmentResultEvent {
public class TargetTagAssigmentResultEvent implements Event {
private final TargetTagAssignmentResult assigmentResult;
private final String tenant;
/**
* Constructor.
*
* @param assigmentResult
* the assignment result-
* @param tenant
* current
*/
public TargetTagAssigmentResultEvent(final TargetTagAssignmentResult assigmentResult) {
public TargetTagAssigmentResultEvent(final TargetTagAssignmentResult assigmentResult, final String tenant) {
this.tenant = tenant;
this.assigmentResult = assigmentResult;
}
@@ -31,4 +36,14 @@ public class TargetTagAssigmentResultEvent {
return assigmentResult;
}
@Override
public long getRevision() {
return -1;
}
@Override
public String getTenant() {
return tenant;
}
}

View File

@@ -1,46 +0,0 @@
/**
* 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.eventbus.event;
import java.util.List;
import org.eclipse.hawkbit.repository.model.TargetTag;
/**
* A bulk event which contains one or many new target tags after creating.
*/
public class TargetTagCreatedBulkEvent extends AbstractEntityBulkEvent<TargetTag> {
private static final long serialVersionUID = 1L;
/**
* Constructor.
*
* @param tenant
* the tenant
* @param entities
* the new targets
*/
public TargetTagCreatedBulkEvent(final String tenant, final List<TargetTag> entities) {
super(tenant, entities);
}
/**
* Constructor.
*
* @param tenant
* the tenant
* @param entity
* one new target
*/
public TargetTagCreatedBulkEvent(final String tenant, final TargetTag entity) {
super(tenant, entity);
}
}

View File

@@ -0,0 +1,31 @@
/**
* 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.eventbus.event;
import org.eclipse.hawkbit.repository.model.TargetTag;
/**
* Defines the {@link AbstractBaseEntityEvent} for creation of a new
* {@link TargetTag}.
*
*/
public class TargetTagCreatedEvent extends AbstractBaseEntityEvent<TargetTag> {
private static final long serialVersionUID = 1L;
/**
* Constructor.
*
* @param tag
* the tag which has been created
*/
public TargetTagCreatedEvent(final TargetTag tag) {
super(tag);
}
}

View File

@@ -10,13 +10,16 @@ package org.eclipse.hawkbit.repository.model;
import java.util.List;
import org.eclipse.hawkbit.eventbus.event.Event;
/**
* Result object for {@link DistributionSetTag} assignments.
*
*/
public class DistributionSetTagAssignmentResult extends AssignmentResult<DistributionSet> {
public class DistributionSetTagAssignmentResult extends AssignmentResult<DistributionSet> implements Event {
private final DistributionSetTag distributionSetTag;
private final String tenant;
/**
* Constructor.
@@ -36,14 +39,24 @@ public class DistributionSetTagAssignmentResult extends AssignmentResult<Distrib
*/
public DistributionSetTagAssignmentResult(final int alreadyAssigned, final int assigned, final int unassigned,
final List<DistributionSet> assignedDs, final List<DistributionSet> unassignedDs,
final DistributionSetTag distributionSetTag) {
super(assigned, alreadyAssigned,unassigned, assignedDs, unassignedDs);
final DistributionSetTag distributionSetTag, final String tenant) {
super(assigned, alreadyAssigned, unassigned, assignedDs, unassignedDs);
this.distributionSetTag = distributionSetTag;
this.tenant = tenant;
}
public DistributionSetTag getDistributionSetTag() {
return distributionSetTag;
}
@Override
public long getRevision() {
return 0;
}
@Override
public String getTenant() {
return tenant;
}
}

View File

@@ -70,13 +70,13 @@ public interface Target extends NamedEntity {
* @return <code>true</code> if tag could be added sucessfully (i.e. was not
* already in the list).
*/
public boolean addTag(TargetTag tag);
boolean addTag(TargetTag tag);
/**
* @param tag
* to remove
* @return <code>true</code> if tag was in the list and removed
*/
public boolean removeTag(TargetTag tag);
boolean removeTag(TargetTag tag);
}