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