Adaptations due to Vaadin 8 merge
Signed-off-by: Ammar Bikic <ammar.bikic@bosch.io>
This commit is contained in:
@@ -97,7 +97,7 @@ public interface ArtifactManagement {
|
||||
void delete(long id);
|
||||
|
||||
/**
|
||||
* Searches for {@link Artifact} with given {@link Long}.
|
||||
* Searches for {@link Artifact} with given {@link Identifiable}.
|
||||
*
|
||||
* @param id
|
||||
* to search for
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) 2020 Bosch.IO 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;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface Identifiable<T extends Serializable> {
|
||||
|
||||
T getId();
|
||||
}
|
||||
@@ -8,9 +8,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.hateoas.Identifiable;
|
||||
|
||||
/**
|
||||
* Use to display software modules for the selected distribution.
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -15,17 +17,12 @@ import java.util.concurrent.TimeUnit;
|
||||
* Core information of all entities.
|
||||
*
|
||||
*/
|
||||
public interface BaseEntity extends Serializable {
|
||||
public interface BaseEntity extends Serializable, Identifiable<Long> {
|
||||
|
||||
static Long getIdOrNull(final BaseEntity entity) {
|
||||
return entity == null ? null : entity.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unique identifier of the {@link BaseEntity}.
|
||||
*/
|
||||
Long getId();
|
||||
|
||||
/**
|
||||
* @return time in {@link TimeUnit#MILLISECONDS} when the {@link BaseEntity}
|
||||
* was created.
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.springframework.hateoas.Identifiable;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -8,11 +8,15 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
public abstract class AbstractBaseEntityBuilder {
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
|
||||
public abstract class AbstractBaseEntityBuilder implements Identifiable<Long> {
|
||||
|
||||
protected Long id;
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.data.mappers;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyIdentifiableEntity;
|
||||
import org.springframework.hateoas.Identifiable;
|
||||
|
||||
/**
|
||||
* Interface for mapping identifiable entities, fetched from backend, to the
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class AbstractMetaDataDataProvider<U extends MetaData, F>
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected AbstractMetaDataDataProvider() {
|
||||
this(new Sort(Direction.DESC, "key"));
|
||||
this(Sort.by(Direction.DESC, "key"));
|
||||
}
|
||||
|
||||
protected AbstractMetaDataDataProvider(final Sort defaultSortOrder) {
|
||||
|
||||
@@ -10,12 +10,12 @@ package org.eclipse.hawkbit.ui.common.data.providers;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
import org.eclipse.hawkbit.ui.common.data.mappers.IdentifiableEntityToProxyIdentifiableEntityMapper;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyIdentifiableEntity;
|
||||
import org.springframework.data.domain.Slice;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.hateoas.Identifiable;
|
||||
|
||||
/**
|
||||
* Base class for loading a batch of {@link Identifiable} entities from backend
|
||||
@@ -41,7 +41,7 @@ public abstract class AbstractProxyDataProvider<T extends ProxyIdentifiableEntit
|
||||
* IdentifiableEntityToProxyIdentifiableEntityMapper of generic type
|
||||
*/
|
||||
public AbstractProxyDataProvider(final IdentifiableEntityToProxyIdentifiableEntityMapper<T, U> mapper) {
|
||||
this(mapper, new Sort(Direction.ASC, "id"));
|
||||
this(mapper, Sort.by(Direction.ASC, "id"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ActionDataProvider extends AbstractProxyDataProvider<ProxyAction, A
|
||||
*/
|
||||
public ActionDataProvider(final DeploymentManagement deploymentManagement,
|
||||
final ActionToProxyActionMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.DESC, "id"));
|
||||
super(entityMapper, Sort.by(Direction.DESC, "id"));
|
||||
|
||||
this.deploymentManagement = deploymentManagement;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ActionStatusDataProvider extends AbstractProxyDataProvider<ProxyAct
|
||||
*/
|
||||
public ActionStatusDataProvider(final DeploymentManagement deploymentManagement,
|
||||
final ActionStatusToProxyActionStatusMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.DESC, "id"));
|
||||
super(entityMapper, Sort.by(Direction.DESC, "id"));
|
||||
|
||||
this.deploymentManagement = deploymentManagement;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ActionStatusMsgDataProvider extends AbstractGenericDataProvider<Pro
|
||||
* Message not available text
|
||||
*/
|
||||
public ActionStatusMsgDataProvider(final DeploymentManagement deploymentManagement, final String noMessageText) {
|
||||
this(deploymentManagement, noMessageText, new Sort(Direction.DESC, "id"));
|
||||
this(deploymentManagement, noMessageText, Sort.by(Direction.DESC, "id"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ArtifactDataProvider extends AbstractProxyDataProvider<ProxyArtifac
|
||||
*/
|
||||
public ArtifactDataProvider(final ArtifactManagement artifactManagement,
|
||||
final ArtifactToProxyArtifactMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.DESC, "filename"));
|
||||
super(entityMapper, Sort.by(Direction.DESC, "filename"));
|
||||
|
||||
this.artifactManagement = artifactManagement;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DistributionSetStatelessDataProvider
|
||||
*/
|
||||
public DistributionSetStatelessDataProvider(final DistributionSetManagement distributionSetManagement,
|
||||
final DistributionSetToProxyDistributionMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.ASC, "name", "version"));
|
||||
super(entityMapper, Sort.by(Direction.ASC, "name", "version"));
|
||||
|
||||
this.distributionSetManagement = distributionSetManagement;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class DistributionSetTagDataProvider extends AbstractProxyDataProvider<Pr
|
||||
*/
|
||||
public DistributionSetTagDataProvider(final DistributionSetTagManagement distributionSetTagManagement,
|
||||
final TagToProxyTagMapper<DistributionSetTag> mapper) {
|
||||
super(mapper, new Sort(Direction.ASC, "name"));
|
||||
super(mapper, Sort.by(Direction.ASC, "name"));
|
||||
this.distributionSetTagManagement = distributionSetTagManagement;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DistributionSetTypeDataProvider<T extends ProxyIdentifiableEntity>
|
||||
*/
|
||||
public DistributionSetTypeDataProvider(final DistributionSetTypeManagement distributionSetTypeManagement,
|
||||
final IdentifiableEntityToProxyIdentifiableEntityMapper<T, DistributionSetType> mapper) {
|
||||
super(mapper, new Sort(Direction.ASC, "name"));
|
||||
super(mapper, Sort.by(Direction.ASC, "name"));
|
||||
|
||||
this.distributionSetTypeManagement = distributionSetTypeManagement;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RolloutDataProvider extends AbstractProxyDataProvider<ProxyRollout,
|
||||
*/
|
||||
public RolloutDataProvider(final RolloutManagement rolloutManagement,
|
||||
final RolloutToProxyRolloutMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.DESC, "lastModifiedAt"));
|
||||
super(entityMapper, Sort.by(Direction.DESC, "lastModifiedAt"));
|
||||
|
||||
this.rolloutManagement = rolloutManagement;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class SoftwareModuleTypeDataProvider<T extends ProxyIdentifiableEntity>
|
||||
*/
|
||||
public SoftwareModuleTypeDataProvider(final SoftwareModuleTypeManagement softwareModuleTypeManagement,
|
||||
final IdentifiableEntityToProxyIdentifiableEntityMapper<T, SoftwareModuleType> mapper) {
|
||||
super(mapper, new Sort(Direction.ASC, "name"));
|
||||
super(mapper, Sort.by(Direction.ASC, "name"));
|
||||
this.softwareModuleTypeManagement = softwareModuleTypeManagement;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TargetFilterQueryDataProvider
|
||||
*/
|
||||
public TargetFilterQueryDataProvider(final TargetFilterQueryManagement targetFilterQueryManagement,
|
||||
final TargetFilterQueryToProxyTargetFilterMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.ASC, "name"));
|
||||
super(entityMapper, Sort.by(Direction.ASC, "name"));
|
||||
|
||||
this.targetFilterQueryManagement = targetFilterQueryManagement;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TargetFilterQueryDetailsDataProvider
|
||||
*/
|
||||
public TargetFilterQueryDetailsDataProvider(final TargetFilterQueryManagement targetFilterQueryManagement,
|
||||
final TargetFilterQueryToProxyTargetFilterMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.ASC, "name"));
|
||||
super(entityMapper, Sort.by(Direction.ASC, "name"));
|
||||
|
||||
this.targetFilterQueryManagement = targetFilterQueryManagement;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TargetFilterStateDataProvider extends AbstractProxyDataProvider<Pro
|
||||
*/
|
||||
public TargetFilterStateDataProvider(final TargetManagement targetManagement,
|
||||
final TargetToProxyTargetMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.ASC, "name"));
|
||||
super(entityMapper, Sort.by(Direction.ASC, "name"));
|
||||
|
||||
this.targetManagement = targetManagement;
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TargetManagementStateDataProvider
|
||||
*/
|
||||
public TargetManagementStateDataProvider(final TargetManagement targetManagement,
|
||||
final TargetToProxyTargetMapper entityMapper) {
|
||||
super(entityMapper, new Sort(Direction.DESC, "lastModifiedAt"));
|
||||
super(entityMapper, Sort.by(Direction.DESC, "lastModifiedAt"));
|
||||
|
||||
this.targetManagement = targetManagement;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class TargetTagDataProvider extends AbstractProxyDataProvider<ProxyTag, T
|
||||
*/
|
||||
public TargetTagDataProvider(final TargetTagManagement tagManagementService,
|
||||
final TagToProxyTagMapper<TargetTag> mapper) {
|
||||
super(mapper, new Sort(Direction.ASC, "name"));
|
||||
super(mapper, Sort.by(Direction.ASC, "name"));
|
||||
|
||||
this.tagManagementService = tagManagementService;
|
||||
}
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.data.proxies;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.hateoas.Identifiable;
|
||||
|
||||
/**
|
||||
* Proxy entity representing the {@link Identifiable} entity, fetched from
|
||||
* backend.
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.repository.Identifiable;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyNamedEntity;
|
||||
import org.eclipse.hawkbit.ui.common.data.proxies.ProxyTag;
|
||||
@@ -97,10 +98,10 @@ public abstract class AbstractTagToken<T extends ProxyNamedEntity>
|
||||
tagPanelLayout.tagDeleted(tagId);
|
||||
}
|
||||
|
||||
protected boolean checkAssignmentResult(final List<? extends BaseEntity> assignedEntities,
|
||||
protected boolean checkAssignmentResult(final List<? extends Identifiable<Long>> assignedEntities,
|
||||
final Long expectedAssignedEntityId) {
|
||||
if (!CollectionUtils.isEmpty(assignedEntities) && expectedAssignedEntityId != null) {
|
||||
final List<Long> assignedDsIds = assignedEntities.stream().map(BaseEntity::getId)
|
||||
final List<Long> assignedDsIds = assignedEntities.stream().map(Identifiable::getId)
|
||||
.collect(Collectors.toList());
|
||||
if (assignedDsIds.contains(expectedAssignedEntityId)) {
|
||||
return true;
|
||||
@@ -109,7 +110,7 @@ public abstract class AbstractTagToken<T extends ProxyNamedEntity>
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean checkUnassignmentResult(final BaseEntity unAssignedEntity,
|
||||
protected boolean checkUnassignmentResult(final Identifiable<Long> unAssignedEntity,
|
||||
final Long expectedUnAssignedEntityId) {
|
||||
return unAssignedEntity != null && expectedUnAssignedEntityId != null
|
||||
&& unAssignedEntity.getId().equals(expectedUnAssignedEntityId);
|
||||
|
||||
Reference in New Issue
Block a user