Merge remote-tracking branch 'eclipse/master' into BUG/TARGET_TABLE_PERFOMANCE

# Conflicts:
#
hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/push/DelayedEventBusPush
Strategy.java
This commit is contained in:
Kai Zimmermann
2016-03-29 14:04:12 +02:00
83 changed files with 392 additions and 3016 deletions

View File

@@ -7,3 +7,7 @@
- hawkbit.server.email.support has changed to hawkbit.server.ui.links.support - hawkbit.server.email.support has changed to hawkbit.server.ui.links.support
- hawkbit.server.email.request.account has changed to hawkbit.server.ui.links.requestAccount - hawkbit.server.email.request.account has changed to hawkbit.server.ui.links.requestAccount
- hawkbit.server.im.login.url has changed to hawkbit.server.ui.links.userManagement - hawkbit.server.im.login.url has changed to hawkbit.server.ui.links.userManagement
### REST API model changes for clients
- ENTITYPagedList classes have been removed; generic PagedList used instead (e.g. PagedList<TargetRest> instead of TargetPagedList).
- ENTITYsrest classes have been removed; List<ENTITYrest> used instead (e.g. List<TargetRest> instead of TargetsRest)

View File

@@ -154,6 +154,7 @@ public class SimulatorView extends VerticalLayout implements View {
public void pollCounterUpdate(final NextPollCounterUpdate update) { public void pollCounterUpdate(final NextPollCounterUpdate update) {
final List<AbstractSimulatedDevice> devices = update.getDevices(); final List<AbstractSimulatedDevice> devices = update.getDevices();
this.getUI().access(new Runnable() { this.getUI().access(new Runnable() {
@Override @Override
public void run() { public void run() {
devices.forEach(device -> { devices.forEach(device -> {
@@ -176,6 +177,7 @@ public class SimulatorView extends VerticalLayout implements View {
public void initUpdate(final InitUpdate update) { public void initUpdate(final InitUpdate update) {
final AbstractSimulatedDevice device = update.getDevice(); final AbstractSimulatedDevice device = update.getDevice();
this.getUI().access(new Runnable() { this.getUI().access(new Runnable() {
@Override @Override
public void run() { public void run() {
final BeanItem<AbstractSimulatedDevice> item = beanContainer.getItem(device.getId()); final BeanItem<AbstractSimulatedDevice> item = beanContainer.getItem(device.getId());

View File

@@ -8,6 +8,8 @@
*/ */
package org.eclipse.hawkbit.mgmt.client.scenarios; package org.eclipse.hawkbit.mgmt.client.scenarios;
import java.util.List;
import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetResourceClient;
import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetTypeResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetTypeResourceClient;
import org.eclipse.hawkbit.mgmt.client.resource.RolloutResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.RolloutResourceClient;
@@ -21,10 +23,10 @@ import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleAssigmentB
import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleBuilder;
import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleTypeBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleTypeBuilder;
import org.eclipse.hawkbit.mgmt.client.resource.builder.TargetBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.TargetBuilder;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -65,8 +67,9 @@ public class CreateStartedRolloutExample {
public void run() { public void run() {
// create three SoftwareModuleTypes // create three SoftwareModuleTypes
final SoftwareModuleTypesRest createdSoftwareModuleTypes = softwareModuleTypeResource.createSoftwareModuleTypes( final List<SoftwareModuleTypeRest> createdSoftwareModuleTypes = softwareModuleTypeResource
new SoftwareModuleTypeBuilder().key(SM_MODULE_TYPE).name(SM_MODULE_TYPE).maxAssignments(1).build()) .createSoftwareModuleTypes(new SoftwareModuleTypeBuilder().key(SM_MODULE_TYPE).name(SM_MODULE_TYPE)
.maxAssignments(1).build())
.getBody(); .getBody();
// create one DistributionSetType // create one DistributionSetType
@@ -75,12 +78,12 @@ public class CreateStartedRolloutExample {
.getBody(); .getBody();
// create one DistributionSet // create one DistributionSet
final DistributionSetsRest distributionSetsRest = distributionSetResource.createDistributionSets( final List<DistributionSetRest> distributionSetsRest = distributionSetResource.createDistributionSets(
new DistributionSetBuilder().name("rollout-example").version("1.0.0").type(DS_MODULE_TYPE).build()) new DistributionSetBuilder().name("rollout-example").version("1.0.0").type(DS_MODULE_TYPE).build())
.getBody(); .getBody();
// create three SoftwareModules // create three SoftwareModules
final SoftwareModulesRest softwareModulesRest = softwareModuleResource final List<SoftwareModuleRest> softwareModulesRest = softwareModuleResource
.createSoftwareModules( .createSoftwareModules(
new SoftwareModuleBuilder().name("firmware").version("1.0.0").type(SM_MODULE_TYPE).build()) new SoftwareModuleBuilder().name("firmware").version("1.0.0").type(SM_MODULE_TYPE).build())
.getBody(); .getBody();

View File

@@ -8,6 +8,8 @@
*/ */
package org.eclipse.hawkbit.mgmt.client.scenarios; package org.eclipse.hawkbit.mgmt.client.scenarios;
import java.util.List;
import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetResourceClient;
import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetTypeResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.DistributionSetTypeResourceClient;
import org.eclipse.hawkbit.mgmt.client.resource.SoftwareModuleResourceClient; import org.eclipse.hawkbit.mgmt.client.resource.SoftwareModuleResourceClient;
@@ -17,9 +19,9 @@ import org.eclipse.hawkbit.mgmt.client.resource.builder.DistributionSetTypeBuild
import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleAssigmentBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleAssigmentBuilder;
import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleBuilder;
import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleTypeBuilder; import org.eclipse.hawkbit.mgmt.client.resource.builder.SoftwareModuleTypeBuilder;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -68,8 +70,9 @@ public class GettingStartedDefaultScenario {
// create one SoftwareModuleTypes // create one SoftwareModuleTypes
LOGGER.info("Creating software module type {}", SM_MODULE_TYPE); LOGGER.info("Creating software module type {}", SM_MODULE_TYPE);
final SoftwareModuleTypesRest createdSoftwareModuleTypes = softwareModuleTypeResource.createSoftwareModuleTypes( final List<SoftwareModuleTypeRest> createdSoftwareModuleTypes = softwareModuleTypeResource
new SoftwareModuleTypeBuilder().key(SM_MODULE_TYPE).name(SM_MODULE_TYPE).maxAssignments(1).build()) .createSoftwareModuleTypes(new SoftwareModuleTypeBuilder().key(SM_MODULE_TYPE).name(SM_MODULE_TYPE)
.maxAssignments(1).build())
.getBody(); .getBody();
// create one DistributionSetType // create one DistributionSetType
@@ -83,17 +86,17 @@ public class GettingStartedDefaultScenario {
final String dsVersion3 = "2.1.0"; final String dsVersion3 = "2.1.0";
LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion1); LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion1);
final DistributionSetsRest distributionSetsRest1 = distributionSetResource.createDistributionSets( final List<DistributionSetRest> distributionSetsRest1 = distributionSetResource.createDistributionSets(
new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion1).type(DS_MODULE_TYPE).build()) new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion1).type(DS_MODULE_TYPE).build())
.getBody(); .getBody();
LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion2); LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion2);
final DistributionSetsRest distributionSetsRest2 = distributionSetResource.createDistributionSets( final List<DistributionSetRest> distributionSetsRest2 = distributionSetResource.createDistributionSets(
new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion2).type(DS_MODULE_TYPE).build()) new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion2).type(DS_MODULE_TYPE).build())
.getBody(); .getBody();
LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion3); LOGGER.info("Creating distribution set {}:{}", DS_EXAMPLE_NAME, dsVersion3);
final DistributionSetsRest distributionSetsRest3 = distributionSetResource.createDistributionSets( final List<DistributionSetRest> distributionSetsRest3 = distributionSetResource.createDistributionSets(
new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion3).type(DS_MODULE_TYPE).build()) new DistributionSetBuilder().name(DS_EXAMPLE_NAME).version(dsVersion3).type(DS_MODULE_TYPE).build())
.getBody(); .getBody();
@@ -103,15 +106,15 @@ public class GettingStartedDefaultScenario {
final String swVersion3 = "3"; final String swVersion3 = "3";
LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion1); LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion1);
final SoftwareModulesRest softwareModulesRest1 = softwareModuleResource.createSoftwareModules( final List<SoftwareModuleRest> softwareModulesRest1 = softwareModuleResource.createSoftwareModules(
new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion1).type(SM_MODULE_TYPE).build()) new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion1).type(SM_MODULE_TYPE).build())
.getBody(); .getBody();
LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion2); LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion2);
final SoftwareModulesRest softwareModulesRest2 = softwareModuleResource.createSoftwareModules( final List<SoftwareModuleRest> softwareModulesRest2 = softwareModuleResource.createSoftwareModules(
new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion2).type(SM_MODULE_TYPE).build()) new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion2).type(SM_MODULE_TYPE).build())
.getBody(); .getBody();
LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion3); LOGGER.info("Creating distribution set {}:{}", SM_EXAMPLE_NAME, swVersion3);
final SoftwareModulesRest softwareModulesRest3 = softwareModuleResource.createSoftwareModules( final List<SoftwareModuleRest> softwareModulesRest3 = softwareModuleResource.createSoftwareModules(
new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion3).type(SM_MODULE_TYPE).build()) new SoftwareModuleBuilder().name(SM_EXAMPLE_NAME).version(swVersion3).type(SM_MODULE_TYPE).build())
.getBody(); .getBody();

View File

@@ -38,10 +38,7 @@ import com.mongodb.gridfs.GridFSDBFile;
import com.mongodb.gridfs.GridFSFile; import com.mongodb.gridfs.GridFSFile;
/** /**
* The file management which looks up all the file in the filestore. * The file management which looks up all the file in the file tore.
*
*
*
* *
*/ */
public class ArtifactStore implements ArtifactRepository { public class ArtifactStore implements ArtifactRepository {
@@ -60,7 +57,7 @@ public class ArtifactStore implements ArtifactRepository {
private static final String MD5 = "md5"; private static final String MD5 = "md5";
/** /**
* The mongoDB field which holds the SHA1 hash, stored in the metadata * The mongoDB field which holds the SHA1 hash, stored in the meta data
* object. * object.
*/ */
private static final String SHA1 = "sha1"; private static final String SHA1 = "sha1";
@@ -75,11 +72,10 @@ public class ArtifactStore implements ArtifactRepository {
/** /**
* Retrieves a {@link GridFSDBFile} from the store by it's SHA1 hash. * Retrieves a {@link GridFSDBFile} from the store by it's SHA1 hash.
* *
* @param tenant
* the tenant to retrieve the artifacts from, ignore case.
* @param sha1Hash * @param sha1Hash
* the sha1-hash of the file to lookup. * the sha1-hash of the file to lookup.
* @return The gridfs file object or {@code null} if no file exists. *
* @return The DbArtifact object or {@code null} if no file exists.
*/ */
@Override @Override
public DbArtifact getArtifactBySha1(final String sha1Hash) { public DbArtifact getArtifactBySha1(final String sha1Hash) {
@@ -226,8 +222,7 @@ public class ArtifactStore implements ArtifactRepository {
* @return a paged list of artifacts mapped from the given dbFiles * @return a paged list of artifacts mapped from the given dbFiles
*/ */
private List<DbArtifact> map(final List<GridFSDBFile> dbFiles) { private List<DbArtifact> map(final List<GridFSDBFile> dbFiles) {
final List<DbArtifact> collect = dbFiles.stream().map(dbFile -> map(dbFile)).collect(Collectors.toList()); return dbFiles.stream().map(dbFile -> map(dbFile)).collect(Collectors.toList());
return collect;
} }
/** /**
@@ -238,7 +233,7 @@ public class ArtifactStore implements ArtifactRepository {
* the tenant to retrieve the artifacts from, ignore case. * the tenant to retrieve the artifacts from, ignore case.
* @param sha1Hashes * @param sha1Hashes
* the sha1-hashes of the files to lookup. * the sha1-hashes of the files to lookup.
* @return list of artfiacts * @return list of artifacts
*/ */
@Override @Override
public List<DbArtifact> getArtifactsBySha1(final List<String> sha1Hashes) { public List<DbArtifact> getArtifactsBySha1(final List<String> sha1Hashes) {

View File

@@ -14,9 +14,6 @@ import java.io.OutputStream;
/** /**
* Database representation of artifact. * Database representation of artifact.
* *
*
*
*
*/ */
public class DbArtifact { public class DbArtifact {

View File

@@ -11,9 +11,6 @@ package org.eclipse.hawkbit.artifact.repository.model;
/** /**
* Database representation of artifact hash. * Database representation of artifact hash.
* *
*
*
*
*/ */
public class DbArtifactHash { public class DbArtifactHash {

View File

@@ -11,9 +11,6 @@ package org.eclipse.hawkbit;
/** /**
* A constant class which holds only static constants used within the SP server. * A constant class which holds only static constants used within the SP server.
* *
*
*
*
*/ */
public final class Constants { public final class Constants {
@@ -27,7 +24,7 @@ public final class Constants {
public static final int MAX_ENTRIES_IN_STATEMENT = 999; public static final int MAX_ENTRIES_IN_STATEMENT = 999;
/** /**
* constant class only private constructor. * Constant class only private constructor.
*/ */
private Constants() { private Constants() {

View File

@@ -20,7 +20,7 @@ import org.eclipse.hawkbit.eventbus.event.TargetDeletedEvent;
import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent; import org.eclipse.hawkbit.eventbus.event.TargetInfoUpdateEvent;
import org.eclipse.hawkbit.executor.AfterTransactionCommitExecutor; import org.eclipse.hawkbit.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.TargetRepository; import org.eclipse.hawkbit.repository.TargetRepository;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetInfo; import org.eclipse.hawkbit.repository.model.TargetInfo;
import org.eclipse.hawkbit.tenancy.TenantAware; import org.eclipse.hawkbit.tenancy.TenantAware;
@@ -31,7 +31,7 @@ import com.google.common.eventbus.EventBus;
/** /**
* An aspect implementation which wraps the necessary repository services for * An aspect implementation which wraps the necessary repository services for
* saving {@link BaseEntity}s to publish create or update events. * saving {@link TenantAwareBaseEntity}s to publish create or update events.
* *
* *
* *

View File

@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.eventbus.event.RolloutGroupPropertyChangeEvent;
import org.eclipse.hawkbit.eventbus.event.RolloutPropertyChangeEvent; import org.eclipse.hawkbit.eventbus.event.RolloutPropertyChangeEvent;
import org.eclipse.hawkbit.executor.AfterTransactionCommitExecutor; import org.eclipse.hawkbit.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import org.eclipse.hawkbit.repository.model.Rollout; import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup; import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.helper.AfterTransactionCommitExecutorHolder; import org.eclipse.hawkbit.repository.model.helper.AfterTransactionCommitExecutorHolder;
@@ -83,7 +83,7 @@ public class EntityPropertyChangeListener extends DescriptorEventAdapter {
} }
} }
private <T extends BaseEntity> Map<String, AbstractPropertyChangeEvent<T>.Values> getChangeSet( private <T extends TenantAwareBaseEntity> Map<String, AbstractPropertyChangeEvent<T>.Values> getChangeSet(
final Class<T> clazz, final DescriptorEvent event) { final Class<T> clazz, final DescriptorEvent event) {
final T rolloutGroup = clazz.cast(event.getObject()); final T rolloutGroup = clazz.cast(event.getObject());
final ObjectChangeSet changeSet = ((UpdateObjectQuery) event.getQuery()).getObjectChangeSet(); final ObjectChangeSet changeSet = ((UpdateObjectQuery) event.getQuery()).getObjectChangeSet();

View File

@@ -8,18 +8,18 @@
*/ */
package org.eclipse.hawkbit.eventbus.event; package org.eclipse.hawkbit.eventbus.event;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
* An abstract definition class for {@link EntityEvent} for {@link BaseEntity}s, * An abstract definition class for {@link EntityEvent} for {@link TenantAwareBaseEntity}s,
* which holds the {@link BaseEntity}. * which holds the {@link TenantAwareBaseEntity}.
* *
* *
* *
* @param <E> * @param <E>
* the type of the {@link BaseEntity} * the type of the {@link TenantAwareBaseEntity}
*/ */
public abstract class AbstractBaseEntityEvent<E extends BaseEntity> extends AbstractDistributedEvent public abstract class AbstractBaseEntityEvent<E extends TenantAwareBaseEntity> extends AbstractDistributedEvent
implements EntityEvent { implements EntityEvent {
/** /**

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.eventbus.event;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
* *
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
* *
* @param <E> * @param <E>
*/ */
public abstract class AbstractEntityBulkEvent<E extends BaseEntity> implements EntityBulkEvent<E> { public abstract class AbstractEntityBulkEvent<E extends TenantAwareBaseEntity> implements EntityBulkEvent<E> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@@ -10,14 +10,14 @@ package org.eclipse.hawkbit.eventbus.event;
import java.util.Map; import java.util.Map;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
* Property change event. * Property change event.
* *
* @param <E> * @param <E>
*/ */
public class AbstractPropertyChangeEvent<E extends BaseEntity> extends AbstractBaseEntityEvent<E> { public class AbstractPropertyChangeEvent<E extends TenantAwareBaseEntity> extends AbstractBaseEntityEvent<E> {
private static final long serialVersionUID = -3671601415138242311L; private static final long serialVersionUID = -3671601415138242311L;
private final transient Map<String, Values> changeSet; private final transient Map<String, Values> changeSet;

View File

@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.eventbus.event;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
/** /**
* An event interface which declares event types that an entities has been * An event interface which declares event types that an entities has been
@@ -20,7 +20,7 @@ import org.eclipse.hawkbit.repository.model.BaseEntity;
* @param <E> * @param <E>
* the entity type * the entity type
*/ */
public interface EntityBulkEvent<E extends BaseEntity> extends Serializable, Event { public interface EntityBulkEvent<E extends TenantAwareBaseEntity> extends Serializable, Event {
/** /**
* A typesafe way to retrieve the the entities from the event, which might * A typesafe way to retrieve the the entities from the event, which might

View File

@@ -10,14 +10,14 @@ package org.eclipse.hawkbit.repository;
import java.io.Serializable; import java.io.Serializable;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.repository.NoRepositoryBean; import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* Command repository operations for all {@link BaseEntity}s. * Command repository operations for all {@link TenantAwareBaseEntity}s.
* *
* *
* *
@@ -29,11 +29,11 @@ import org.springframework.transaction.annotation.Transactional;
*/ */
@NoRepositoryBean @NoRepositoryBean
@Transactional(readOnly = true) @Transactional(readOnly = true)
public interface BaseEntityRepository<T extends BaseEntity, I extends Serializable> public interface BaseEntityRepository<T extends TenantAwareBaseEntity, I extends Serializable>
extends PagingAndSortingRepository<T, I> { extends PagingAndSortingRepository<T, I> {
/** /**
* Deletes all {@link BaseEntity} of a given tenant. * Deletes all {@link TenantAwareBaseEntity} of a given tenant.
* *
* @param tenant * @param tenant
* to delete data from * to delete data from

View File

@@ -176,7 +176,7 @@ public class DistributionSetManagement {
final Iterable<DistributionSet> sets = findDistributionSetListWithDetails(dsIds); final Iterable<DistributionSet> sets = findDistributionSetListWithDetails(dsIds);
final DistributionSetTag myTag = tagManagement.findDistributionSetTag(tagName); final DistributionSetTag myTag = tagManagement.findDistributionSetTag(tagName);
DistributionSetTagAssigmentResult result = null; DistributionSetTagAssigmentResult result;
final List<DistributionSet> allDSs = new ArrayList<>(); final List<DistributionSet> allDSs = new ArrayList<>();
for (final DistributionSet set : sets) { for (final DistributionSet set : sets) {
if (set.getTags().add(myTag)) { if (set.getTags().add(myTag)) {
@@ -199,8 +199,7 @@ public class DistributionSetManagement {
} }
final DistributionSetTagAssigmentResult resultAssignment = result; final DistributionSetTagAssigmentResult resultAssignment = result;
afterCommit afterCommit.afterCommit(() -> eventBus.post(new DistributionSetTagAssigmentResultEvent(resultAssignment)));
.afterCommit(() -> eventBus.post(new DistributionSetTagAssigmentResultEvent(resultAssignment)));
// no reason to persist the tag // no reason to persist the tag
entityManager.detach(myTag); entityManager.detach(myTag);
@@ -870,7 +869,7 @@ public class DistributionSetManagement {
cb) -> cb.and( cb) -> cb.and(
cb.equal(root.get(DistributionSetMetadata_.distributionSet) cb.equal(root.get(DistributionSetMetadata_.distributionSet)
.get(DistributionSet_.id), distributionSetId), .get(DistributionSet_.id), distributionSetId),
spec.toPredicate(root, query, cb)), spec.toPredicate(root, query, cb)),
pageable); pageable);
} }

View File

@@ -327,13 +327,11 @@ public class SystemManagement {
"Standard Edge Controller Linux distribution set type. OS only.").addMandatoryModuleType(eclOs) "Standard Edge Controller Linux distribution set type. OS only.").addMandatoryModuleType(eclOs)
.addOptionalModuleType(eclApp)); .addOptionalModuleType(eclApp));
final DistributionSetType defaultType = distributionSetTypeRepository return distributionSetTypeRepository
.save(new DistributionSetType("ecl_os_app_jvm", "OS with optional app and jvm", .save(new DistributionSetType("ecl_os_app_jvm", "OS with optional app and jvm",
"Standard Edge Controller Linux distribution set type. OS with optional application.") "Standard Edge Controller Linux distribution set type. OS with optional application.")
.addMandatoryModuleType(eclOs).addOptionalModuleType(eclApp) .addMandatoryModuleType(eclOs).addOptionalModuleType(eclApp)
.addOptionalModuleType(eclJvm)); .addOptionalModuleType(eclJvm));
return defaultType;
} }
/** /**

View File

@@ -52,7 +52,7 @@ import org.eclipse.persistence.annotations.CascadeOnDelete;
@NamedEntityGraph(name = "Action.all", attributeNodes = { @NamedAttributeNode("distributionSet"), @NamedEntityGraph(name = "Action.all", attributeNodes = { @NamedAttributeNode("distributionSet"),
@NamedAttributeNode(value = "target", subgraph = "target.ds") }, subgraphs = @NamedSubgraph(name = "target.ds", attributeNodes = @NamedAttributeNode("assignedDistributionSet") ) ) }) @NamedAttributeNode(value = "target", subgraph = "target.ds") }, subgraphs = @NamedSubgraph(name = "target.ds", attributeNodes = @NamedAttributeNode("assignedDistributionSet") ) ) })
@Entity @Entity
public class Action extends BaseEntity implements Comparable<Action> { public class Action extends TenantAwareBaseEntity implements Comparable<Action> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**

View File

@@ -41,7 +41,7 @@ import com.google.common.base.Splitter;
@Index(name = "sp_idx_action_status_prim", columnList = "tenant,id") }) @Index(name = "sp_idx_action_status_prim", columnList = "tenant,id") })
@NamedEntityGraph(name = "ActionStatus.withMessages", attributeNodes = { @NamedAttributeNode("messages") }) @NamedEntityGraph(name = "ActionStatus.withMessages", attributeNodes = { @NamedAttributeNode("messages") })
@Entity @Entity
public class ActionStatus extends BaseEntity { public class ActionStatus extends TenantAwareBaseEntity {
/** /**
* *
@@ -52,7 +52,7 @@ public class ActionStatus extends BaseEntity {
private Long occurredAt; private Long occurredAt;
@ManyToOne(fetch = FetchType.LAZY, optional = false) @ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumn(name = "action", nullable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_act_stat_action") ) @JoinColumn(name = "action", nullable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_act_stat_action"))
private Action action; private Action action;
@Column(name = "status") @Column(name = "status")
@@ -60,7 +60,7 @@ public class ActionStatus extends BaseEntity {
@CascadeOnDelete @CascadeOnDelete
@ElementCollection(fetch = FetchType.LAZY, targetClass = String.class) @ElementCollection(fetch = FetchType.LAZY, targetClass = String.class)
@CollectionTable(name = "sp_action_status_messages", joinColumns = @JoinColumn(name = "action_status_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_stat_msg_act_stat") ) , indexes = { @CollectionTable(name = "sp_action_status_messages", joinColumns = @JoinColumn(name = "action_status_id", foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_stat_msg_act_stat")), indexes = {
@Index(name = "sp_idx_action_status_msgs_01", columnList = "action_status_id") }) @Index(name = "sp_idx_action_status_msgs_01", columnList = "action_status_id") })
@Column(name = "detail_message", length = 512) @Column(name = "detail_message", length = 512)
private final List<String> messages = new ArrayList<>(); private final List<String> messages = new ArrayList<>();
@@ -103,66 +103,46 @@ public class ActionStatus extends BaseEntity {
} }
/** /**
* * JPA default constructor.
*/ */
public ActionStatus() { public ActionStatus() {
// JPA default constructor.
} }
/**
* @return the occurredAt
*/
public Long getOccurredAt() { public Long getOccurredAt() {
return occurredAt; return occurredAt;
} }
/**
* @param occurredAt
* the occurredAt to set
*/
public void setOccurredAt(final Long occurredAt) { public void setOccurredAt(final Long occurredAt) {
this.occurredAt = occurredAt; this.occurredAt = occurredAt;
} }
/** /**
* Adds message. * Adds message including splitting in case it exceeds 512 length.
* *
* @param message * @param message
* to add * to add
*/ */
public final void addMessage(final String message) { public final void addMessage(final String message) {
Splitter.fixedLength(512).split(message).forEach(chunk -> messages.add(chunk)); Splitter.fixedLength(512).split(message).forEach(messages::add);
} }
public List<String> getMessages() { public List<String> getMessages() {
return messages; return messages;
} }
/**
* @return the action
*/
public Action getAction() { public Action getAction() {
return action; return action;
} }
/**
* @param action
* the action to set
*/
public void setAction(final Action action) { public void setAction(final Action action) {
this.action = action; this.action = action;
} }
/**
* @return the status
*/
public Status getStatus() { public Status getStatus() {
return status; return status;
} }
/**
* @param status
* the status to set
*/
public void setStatus(final Status status) { public void setStatus(final Status status) {
this.status = status; this.status = status;
} }

View File

@@ -20,7 +20,7 @@ import javax.persistence.MappedSuperclass;
* *
*/ */
@MappedSuperclass @MappedSuperclass
public abstract class Artifact extends BaseEntity { public abstract class Artifact extends TenantAwareBaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "sha1_hash", length = 40, nullable = true) @Column(name = "sha1_hash", length = 40, nullable = true)

View File

@@ -18,17 +18,10 @@ import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import javax.persistence.Version; import javax.persistence.Version;
import org.eclipse.hawkbit.eventbus.CacheFieldEntityListener; import org.eclipse.hawkbit.eventbus.CacheFieldEntityListener;
import org.eclipse.hawkbit.eventbus.EntityPropertyChangeListener; import org.eclipse.hawkbit.eventbus.EntityPropertyChangeListener;
import org.eclipse.hawkbit.repository.exception.TenantNotExistException;
import org.eclipse.hawkbit.repository.model.helper.SystemManagementHolder;
import org.eclipse.hawkbit.repository.model.helper.TenantAwareHolder;
import org.eclipse.persistence.annotations.Multitenant;
import org.eclipse.persistence.annotations.MultitenantType;
import org.eclipse.persistence.annotations.TenantDiscriminatorColumn;
import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedBy;
@@ -37,18 +30,12 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.hateoas.Identifiable; import org.springframework.hateoas.Identifiable;
/** /**
* Holder of all base attributes common to all entities. * Holder of the base attributes common to all entities.
*
*
*
*
* *
*/ */
@MappedSuperclass @MappedSuperclass
@Access(AccessType.FIELD) @Access(AccessType.FIELD)
@EntityListeners({ AuditingEntityListener.class, CacheFieldEntityListener.class, EntityPropertyChangeListener.class }) @EntityListeners({ AuditingEntityListener.class, CacheFieldEntityListener.class, EntityPropertyChangeListener.class })
@TenantDiscriminatorColumn(name = "tenant", length = 40)
@Multitenant(MultitenantType.SINGLE_TABLE)
public abstract class BaseEntity implements Serializable, Identifiable<Long> { public abstract class BaseEntity implements Serializable, Identifiable<Long> {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@@ -66,44 +53,11 @@ public abstract class BaseEntity implements Serializable, Identifiable<Long> {
@Column(name = "optlock_revision") @Column(name = "optlock_revision")
private long optLockRevision; private long optLockRevision;
@Column(name = "tenant", nullable = false, insertable = false, updatable = false, length = 40)
private String tenant;
/** /**
* * Default constructor needed for JPA entities.
*/ */
public BaseEntity() { public BaseEntity() {
// Default constructor needed for JPA entities.
}
/**
* @param entity
* the entity to copy
*/
public BaseEntity(final BaseEntity entity) {
id = entity.id;
createdAt = entity.createdAt;
createdBy = entity.createdBy;
lastModifiedAt = entity.lastModifiedAt;
lastModifiedBy = entity.lastModifiedBy;
optLockRevision = entity.optLockRevision;
}
/**
* PrePersist listener method for all {@link BaseEntity} entities.
*/
@PrePersist
public void prePersist() {
// before persisting the entity check the current ID of the tenant by
// using the TenantAware
// service
final String currentTenant = SystemManagementHolder.getInstance().currentTenant();
if (currentTenant == null) {
throw new TenantNotExistException("Tenant "
+ TenantAwareHolder.getInstance().getTenantAware().getCurrentTenant()
+ " does not exists, cannot create entity " + this.getClass() + " with id " + id);
}
setTenant(currentTenant.toUpperCase());
} }
@Access(AccessType.PROPERTY) @Access(AccessType.PROPERTY)
@@ -130,37 +84,21 @@ public abstract class BaseEntity implements Serializable, Identifiable<Long> {
return lastModifiedBy; return lastModifiedBy;
} }
/**
* @param createdBy
* the createdBy to set
*/
@CreatedBy @CreatedBy
public void setCreatedBy(final String createdBy) { public void setCreatedBy(final String createdBy) {
this.createdBy = createdBy; this.createdBy = createdBy;
} }
/**
* @param lastModifiedBy
* the lastModifiedBy to set
*/
@LastModifiedBy @LastModifiedBy
public void setLastModifiedBy(final String lastModifiedBy) { public void setLastModifiedBy(final String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy; this.lastModifiedBy = lastModifiedBy;
} }
/**
* @param createdAt
* the createdAt to set
*/
@CreatedDate @CreatedDate
public void setCreatedAt(final Long createdAt) { public void setCreatedAt(final Long createdAt) {
this.createdAt = createdAt; this.createdAt = createdAt;
} }
/**
* @param lastModifiedAt
* the lastModifiedAt to set
*/
@LastModifiedDate @LastModifiedDate
public void setLastModifiedAt(final Long lastModifiedAt) { public void setLastModifiedAt(final Long lastModifiedAt) {
this.lastModifiedAt = lastModifiedAt; this.lastModifiedAt = lastModifiedAt;
@@ -170,52 +108,20 @@ public abstract class BaseEntity implements Serializable, Identifiable<Long> {
return optLockRevision; return optLockRevision;
} }
/**
* @return the tenant
*/
public String getTenant() {
return tenant;
}
/**
* @param tenant
* the tenant to set
*/
public void setTenant(final String tenant) {
this.tenant = tenant;
}
/**
* @return the id
*/
@Override @Override
public Long getId() { public Long getId() {
return id; return id;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override @Override
public String toString() { public String toString() {
return "BaseEntity [id=" + id + "]"; return "BaseEntity [id=" + id + "]";
} }
/**
* @param id
* the id to set
*/
public void setId(final Long id) { public void setId(final Long id) {
this.id = id; this.id = id;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override @Override
public int hashCode() { // NOSONAR - as this is generated code public int hashCode() { // NOSONAR - as this is generated code
final int prime = 31; final int prime = 31;
@@ -225,11 +131,6 @@ public abstract class BaseEntity implements Serializable, Identifiable<Long> {
return result; return result;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override @Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated public boolean equals(final Object obj) { // NOSONAR - as this is generated
// code // code

View File

@@ -12,7 +12,7 @@ import javax.persistence.Column;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
/** /**
* {@link BaseEntity} extension for all entities that are named in addition to * {@link TenantAwareBaseEntity} extension for all entities that are named in addition to
* their technical ID. * their technical ID.
* *
* *
@@ -22,7 +22,7 @@ import javax.persistence.MappedSuperclass;
* *
*/ */
@MappedSuperclass @MappedSuperclass
public abstract class NamedEntity extends BaseEntity { public abstract class NamedEntity extends TenantAwareBaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Column(name = "name", nullable = false, length = 64) @Column(name = "name", nullable = false, length = 64)

View File

@@ -22,7 +22,7 @@ import javax.persistence.UniqueConstraint;
@Table(name = "sp_target_filter_query", indexes = { @Table(name = "sp_target_filter_query", indexes = {
@Index(name = "sp_idx_target_filter_query_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = { @Index(name = "sp_idx_target_filter_query_01", columnList = "tenant,name") }, uniqueConstraints = @UniqueConstraint(columnNames = {
"name", "tenant" }, name = "uk_tenant_custom_filter_name") ) "name", "tenant" }, name = "uk_tenant_custom_filter_name") )
public class TargetFilterQuery extends BaseEntity { public class TargetFilterQuery extends TenantAwareBaseEntity {
/** /**
* *
* *

View File

@@ -0,0 +1,103 @@
/**
* 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.model;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import org.eclipse.hawkbit.repository.exception.TenantNotExistException;
import org.eclipse.hawkbit.repository.model.helper.SystemManagementHolder;
import org.eclipse.hawkbit.repository.model.helper.TenantAwareHolder;
import org.eclipse.persistence.annotations.Multitenant;
import org.eclipse.persistence.annotations.MultitenantType;
import org.eclipse.persistence.annotations.TenantDiscriminatorColumn;
/**
* Holder of the base attributes common to all tenant aware entities.
*
*/
@MappedSuperclass
@TenantDiscriminatorColumn(name = "tenant", length = 40)
@Multitenant(MultitenantType.SINGLE_TABLE)
public abstract class TenantAwareBaseEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
@Column(name = "tenant", nullable = false, insertable = false, updatable = false, length = 40)
private String tenant;
/**
* Default constructor needed for JPA entities.
*/
public TenantAwareBaseEntity() {
// Default constructor needed for JPA entities.
}
/**
* PrePersist listener method for all {@link TenantAwareBaseEntity}
* entities.
*/
@PrePersist
public void prePersist() {
// before persisting the entity check the current ID of the tenant by
// using the TenantAware
// service
final String currentTenant = SystemManagementHolder.getInstance().currentTenant();
if (currentTenant == null) {
throw new TenantNotExistException("Tenant "
+ TenantAwareHolder.getInstance().getTenantAware().getCurrentTenant()
+ " does not exists, cannot create entity " + this.getClass() + " with id " + super.getId());
}
setTenant(currentTenant.toUpperCase());
}
public String getTenant() {
return tenant;
}
public void setTenant(final String tenant) {
this.tenant = tenant;
}
@Override
public String toString() {
return "BaseEntity [id=" + super.getId() + "]";
}
@Override
public int hashCode() { // NOSONAR - as this is generated
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((tenant == null) ? 0 : tenant.hashCode());
return result;
}
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TenantAwareBaseEntity other = (TenantAwareBaseEntity) obj;
if (tenant == null) {
if (other.tenant != null) {
return false;
}
} else if (!tenant.equals(other.tenant)) {
return false;
}
return true;
}
}

View File

@@ -25,8 +25,8 @@ import javax.persistence.UniqueConstraint;
*/ */
@Entity @Entity
@Table(name = "sp_tenant_configuration", uniqueConstraints = @UniqueConstraint(columnNames = { "conf_key", @Table(name = "sp_tenant_configuration", uniqueConstraints = @UniqueConstraint(columnNames = { "conf_key",
"tenant" }, name = "uk_tenant_key") ) "tenant" }, name = "uk_tenant_key"))
public class TenantConfiguration extends BaseEntity implements Serializable { public class TenantConfiguration extends TenantAwareBaseEntity implements Serializable {
/** /**
* *
@@ -44,7 +44,7 @@ public class TenantConfiguration extends BaseEntity implements Serializable {
* JPA default constructor. * JPA default constructor.
*/ */
public TenantConfiguration() { public TenantConfiguration() {
// JPA default constructor.
} }
/** /**

View File

@@ -89,7 +89,7 @@ public class TenantConfigurationValue<T> {
*/ */
public static <K> TenantConfigurationValueBuilder<K> builder() { public static <K> TenantConfigurationValueBuilder<K> builder() {
return new TenantConfigurationValueBuilder<K>(); return new TenantConfigurationValueBuilder<>();
} }
/** /**

View File

@@ -8,76 +8,45 @@
*/ */
package org.eclipse.hawkbit.repository.model; package org.eclipse.hawkbit.repository.model;
import java.io.Serializable;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.ConstraintMode; import javax.persistence.ConstraintMode;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.ForeignKey; import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index; import javax.persistence.Index;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.persistence.Version;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
/** /**
* Tenant metadata that is configured globally for the entire tenant. This * Tenant entity with meta data that is configured globally for the entire
* entity is * tenant. This entity is not tenant aware to allow the system to access it
* * through the {@link EntityManager} even before the actual tenant exists.
* *
* * Entities owned by the tenant are based on {@link TenantAwareBaseEntity}.
* *
*/ */
@Access(AccessType.FIELD)
@Table(name = "sp_tenant", indexes = { @Table(name = "sp_tenant", indexes = {
@Index(name = "sp_idx_tenant_prim", columnList = "tenant,id") }, uniqueConstraints = { @Index(name = "sp_idx_tenant_prim", columnList = "tenant,id") }, uniqueConstraints = {
@UniqueConstraint(columnNames = { "tenant" }, name = "uk_tenantmd_tenant") }) @UniqueConstraint(columnNames = { "tenant" }, name = "uk_tenantmd_tenant") })
@Entity @Entity
public class TenantMetaData implements Serializable { public class TenantMetaData extends BaseEntity {
/**
*
*/
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "tenant", nullable = false, length = 40) @Column(name = "tenant", nullable = false, length = 40)
private String tenant; private String tenant;
private String createdBy;
private String lastModifiedBy;
private Long createdAt;
private Long lastModifiedAt;
@Version
@Column(name = "optlock_revision")
private long optLockRevision;
@OneToOne(fetch = FetchType.LAZY) @OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "default_ds_type", nullable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_tenant_md_default_ds_type") ) @JoinColumn(name = "default_ds_type", nullable = false, foreignKey = @ForeignKey(value = ConstraintMode.CONSTRAINT, name = "fk_tenant_md_default_ds_type"))
// use deprecated annotation until HHH-8862 is fixed
@SuppressWarnings("deprecation")
// @org.hibernate.annotations.ForeignKey( name =
// "fk_tenant_md_default_ds_type" )
private DistributionSetType defaultDsType; private DistributionSetType defaultDsType;
/**
* Default constructor needed for JPA entities.
*/
public TenantMetaData() { public TenantMetaData() {
// Default constructor needed for JPA entities.
} }
/** /**
@@ -93,167 +62,20 @@ public class TenantMetaData implements Serializable {
this.tenant = tenant; this.tenant = tenant;
} }
/**
* @return the defaultDsType
*/
public DistributionSetType getDefaultDsType() { public DistributionSetType getDefaultDsType() {
return defaultDsType; return defaultDsType;
} }
/**
* Set the DistributionSet for a tenant.
*
* @param defaultDsType
* the new default DistributionSet
*/
public void setDefaultDsType(final DistributionSetType defaultDsType) { public void setDefaultDsType(final DistributionSetType defaultDsType) {
this.defaultDsType = defaultDsType; this.defaultDsType = defaultDsType;
} }
/**
* @return the id
*/
public Long getId() {
return id;
}
/**
* @param id
* the id to set
*/
public void setId(final Long id) {
this.id = id;
}
@Access(AccessType.PROPERTY)
@Column(name = "created_at", insertable = true, updatable = false)
public Long getCreatedAt() {
return createdAt;
}
@Access(AccessType.PROPERTY)
@Column(name = "created_by", insertable = true, updatable = false, length = 40)
public String getCreatedBy() {
return createdBy;
}
@Access(AccessType.PROPERTY)
@Column(name = "last_modified_at", insertable = false, updatable = true)
public Long getLastModifiedAt() {
return lastModifiedAt;
}
@Access(AccessType.PROPERTY)
@Column(name = "last_modified_by", insertable = false, updatable = true, length = 40)
public String getLastModifiedBy() {
return lastModifiedBy;
}
/**
* @param createdBy
* the createdBy to set
*/
@CreatedBy
public void setCreatedBy(final String createdBy) {
this.createdBy = createdBy;
}
/**
* @param lastModifiedBy
* the lastModifiedBy to set
*/
@LastModifiedBy
public void setLastModifiedBy(final String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
/**
* @param createdAt
* the createdAt to set
*/
@CreatedDate
public void setCreatedAt(final Long createdAt) {
this.createdAt = createdAt;
}
/**
* @param lastModifiedAt
* the lastModifiedAt to set
*/
@LastModifiedDate
public void setLastModifiedAt(final Long lastModifiedAt) {
this.lastModifiedAt = lastModifiedAt;
}
/**
* @return the optLockRevision
*/
public long getOptLockRevision() {
return optLockRevision;
}
/**
* @param optLockRevision
* the optLockRevision to set
*/
public void setOptLockRevision(final long optLockRevision) {
this.optLockRevision = optLockRevision;
}
/**
* @return the tenant
*/
public String getTenant() { public String getTenant() {
return tenant; return tenant;
} }
/**
* @param tenant
* the tenant to set
*/
public void setTenant(final String tenant) { public void setTenant(final String tenant) {
this.tenant = tenant; this.tenant = tenant;
} }
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
// code
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TenantMetaData other = (TenantMetaData) obj;
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
return true;
}
} }

View File

@@ -20,7 +20,7 @@ import org.eclipse.hawkbit.TestDataUtil;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status; import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus; import org.eclipse.hawkbit.repository.model.ActionStatus;
import org.eclipse.hawkbit.repository.model.BaseEntity; import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag; import org.eclipse.hawkbit.repository.model.TargetTag;
@@ -207,7 +207,7 @@ public class TargetManagementSearchTest extends AbstractIntegrationTest {
final Slice<Target> result = targetManagement.findTargetsAllOrderByLinkedDistributionSet(pageReq, ds.getId(), final Slice<Target> result = targetManagement.findTargetsAllOrderByLinkedDistributionSet(pageReq, ds.getId(),
null, null, null, Boolean.FALSE, null); null, null, null, Boolean.FALSE, null);
final Comparator<BaseEntity> byId = (e1, e2) -> Long.compare(e2.getId(), e1.getId()); final Comparator<TenantAwareBaseEntity> byId = (e1, e2) -> Long.compare(e2.getId(), e1.getId());
assertThat(result.getNumberOfElements()).isEqualTo(9); assertThat(result.getNumberOfElements()).isEqualTo(9);
final List<Target> expected = new ArrayList<Target>(); final List<Target> expected = new ArrayList<Target>();

View File

@@ -13,7 +13,7 @@ spring.data.mongodb.port=28017
hawkbit.server.ddi.security.authentication.header.enabled=true hawkbit.server.ddi.security.authentication.header.enabled=true
hawkbit.server.ddi.security.authentication.gatewaytoken.name=TestToken hawkbit.server.ddi.security.authentication.gatewaytoken.name=TestToken
hawkbit.server.artifact.repo.upload.maxFileSize=5MB multipart.max-file-size=5MB
hawkbit.server.security.dos.maxStatusEntriesPerAction=100 hawkbit.server.security.dos.maxStatusEntriesPerAction=100
@@ -26,7 +26,6 @@ spring.datasource.username=sa
spring.datasource.password=sa spring.datasource.password=sa
flyway.enabled=true flyway.enabled=true
flyway.initOnMigrate=true
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
#spring.jpa.show-sql=true #spring.jpa.show-sql=true

View File

@@ -13,17 +13,15 @@ import java.util.List;
import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRest;
import org.eclipse.hawkbit.rest.resource.model.MetadataRestPageList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetPagedList;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentRequestBody; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentRequestBody;
import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleAssigmentRest; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleAssigmentRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulePagedList; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -58,7 +56,7 @@ public interface DistributionSetRestApi {
* JsonResponseExceptionHandler is handling the response. * JsonResponseExceptionHandler is handling the response.
*/ */
@RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<DistributionSetPagedList> getDistributionSets( public ResponseEntity<PagedList<DistributionSetRest>> getDistributionSets(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -93,7 +91,7 @@ public interface DistributionSetRestApi {
*/ */
@RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE, @RequestMapping(method = RequestMethod.POST, consumes = { MediaType.APPLICATION_JSON_VALUE,
"application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) "application/hal+json" }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<DistributionSetsRest> createDistributionSets( public ResponseEntity<List<DistributionSetRest>> createDistributionSets(
@RequestBody final List<DistributionSetRequestBodyPost> sets); @RequestBody final List<DistributionSetRequestBodyPost> sets);
/** /**
@@ -148,7 +146,7 @@ public interface DistributionSetRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/assignedTargets", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/assignedTargets", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
public ResponseEntity<TargetPagedList> getAssignedTargets( public ResponseEntity<PagedList<TargetRest>> getAssignedTargets(
@PathVariable("distributionSetId") final Long distributionSetId, @PathVariable("distributionSetId") final Long distributionSetId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@@ -179,7 +177,7 @@ public interface DistributionSetRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/installedTargets", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/installedTargets", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
public ResponseEntity<TargetPagedList> getInstalledTargets( public ResponseEntity<PagedList<TargetRest>> getInstalledTargets(
@PathVariable("distributionSetId") final Long distributionSetId, @PathVariable("distributionSetId") final Long distributionSetId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@@ -228,7 +226,7 @@ public interface DistributionSetRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/metadata", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/metadata", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
public ResponseEntity<MetadataRestPageList> getMetadata( public ResponseEntity<PagedList<MetadataRest>> getMetadata(
@PathVariable("distributionSetId") final Long distributionSetId, @PathVariable("distributionSetId") final Long distributionSetId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@@ -357,7 +355,7 @@ public interface DistributionSetRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/assignedSM", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetId}/assignedSM", produces = {
"application/hal+json", MediaType.APPLICATION_JSON_VALUE }) "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<SoftwareModulePagedList> getAssignedSoftwareModules( public ResponseEntity<PagedList<SoftwareModuleRest>> getAssignedSoftwareModules(
@PathVariable("distributionSetId") final Long distributionSetId, @PathVariable("distributionSetId") final Long distributionSetId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,

View File

@@ -11,10 +11,10 @@ package org.eclipse.hawkbit.rest.resource.api;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.tag.AssignedDistributionSetRequestBody; import org.eclipse.hawkbit.rest.resource.model.tag.AssignedDistributionSetRequestBody;
import org.eclipse.hawkbit.rest.resource.model.tag.DistributionSetTagAssigmentResultRest; import org.eclipse.hawkbit.rest.resource.model.tag.DistributionSetTagAssigmentResultRest;
import org.eclipse.hawkbit.rest.resource.model.tag.TagPagedList;
import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.tag.TagRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagRest;
import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest;
@@ -53,7 +53,7 @@ public interface DistributionSetTagRestApi {
* JsonResponseExceptionHandler is handling the response. * JsonResponseExceptionHandler is handling the response.
*/ */
@RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<TagPagedList> getDistributionSetTags( public ResponseEntity<PagedList<TagRest>> getDistributionSetTags(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -137,7 +137,7 @@ public interface DistributionSetTagRestApi {
* exists. * exists.
*/ */
@RequestMapping(method = RequestMethod.GET, value = RestConstants.DISTRIBUTIONSET_REQUEST_MAPPING) @RequestMapping(method = RequestMethod.GET, value = RestConstants.DISTRIBUTIONSET_REQUEST_MAPPING)
public ResponseEntity<DistributionSetsRest> getAssignedDistributionSets( public ResponseEntity<List<DistributionSetRest>> getAssignedDistributionSets(
@PathVariable("distributionsetTagId") final Long distributionsetTagId); @PathVariable("distributionsetTagId") final Long distributionsetTagId);
/** /**
@@ -175,7 +175,7 @@ public interface DistributionSetTagRestApi {
* exists. * exists.
*/ */
@RequestMapping(method = RequestMethod.POST, value = RestConstants.DISTRIBUTIONSET_REQUEST_MAPPING) @RequestMapping(method = RequestMethod.POST, value = RestConstants.DISTRIBUTIONSET_REQUEST_MAPPING)
public ResponseEntity<DistributionSetsRest> assignDistributionSets( public ResponseEntity<List<DistributionSetRest>> assignDistributionSets(
@PathVariable("distributionsetTagId") final Long distributionsetTagId, @PathVariable("distributionsetTagId") final Long distributionsetTagId,
@RequestBody final List<AssignedDistributionSetRequestBody> assignedDSRequestBodies); @RequestBody final List<AssignedDistributionSetRequestBody> assignedDSRequestBodies);

View File

@@ -12,13 +12,11 @@ import java.util.List;
import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.rest.resource.model.IdRest; import org.eclipse.hawkbit.rest.resource.model.IdRest;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypePagedList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypesRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -57,7 +55,7 @@ public interface DistributionSetTypeRestApi {
* response. * response.
*/ */
@RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<DistributionSetTypePagedList> getDistributionSetTypes( public ResponseEntity<PagedList<DistributionSetTypeRest>> getDistributionSetTypes(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -119,7 +117,7 @@ public interface DistributionSetTypeRestApi {
*/ */
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json", @RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<DistributionSetTypesRest> createDistributionSetTypes( public ResponseEntity<List<DistributionSetTypeRest>> createDistributionSetTypes(
@RequestBody final List<DistributionSetTypeRequestBodyPost> distributionSetTypes); @RequestBody final List<DistributionSetTypeRequestBodyPost> distributionSetTypes);
/** /**
@@ -133,7 +131,7 @@ public interface DistributionSetTypeRestApi {
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetTypeId}/" @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetTypeId}/"
+ RestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES, produces = { "application/hal+json", + RestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES, produces = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }) MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<SoftwareModuleTypesRest> getMandatoryModules( public ResponseEntity<List<SoftwareModuleTypeRest>> getMandatoryModules(
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId); @PathVariable("distributionSetTypeId") final Long distributionSetTypeId);
/** /**
@@ -181,7 +179,7 @@ public interface DistributionSetTypeRestApi {
@RequestMapping(method = RequestMethod.GET, value = "/{distributionSetTypeId}/" @RequestMapping(method = RequestMethod.GET, value = "/{distributionSetTypeId}/"
+ RestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULE_TYPES, produces = { "application/hal+json", + RestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULE_TYPES, produces = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }) MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<SoftwareModuleTypesRest> getOptionalModules( public ResponseEntity<List<SoftwareModuleTypeRest>> getOptionalModules(
@PathVariable("distributionSetTypeId") final Long distributionSetTypeId); @PathVariable("distributionSetTypeId") final Long distributionSetTypeId);
/** /**

View File

@@ -9,12 +9,11 @@
package org.eclipse.hawkbit.rest.resource.api; package org.eclipse.hawkbit.rest.resource.api;
import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutPagedList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody;
import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutRestRequestBody; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutRestRequestBody;
import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupPagedList;
import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupResponseBody; import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupResponseBody;
import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -50,7 +49,7 @@ public interface RolloutRestApi {
* JsonResponseExceptionHandler is handling the response. * JsonResponseExceptionHandler is handling the response.
*/ */
@RequestMapping(method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) @RequestMapping(method = RequestMethod.GET, produces = { MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
public ResponseEntity<RolloutPagedList> getRollouts( public ResponseEntity<PagedList<RolloutResponseBody>> getRollouts(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -154,7 +153,8 @@ public interface RolloutRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{rolloutId}/deploygroups", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{rolloutId}/deploygroups", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
public ResponseEntity<RolloutGroupPagedList> getRolloutGroups(@PathVariable("rolloutId") final Long rolloutId, public ResponseEntity<PagedList<RolloutGroupResponseBody>> getRolloutGroups(
@PathVariable("rolloutId") final Long rolloutId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -200,7 +200,7 @@ public interface RolloutRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{rolloutId}/deploygroups/{groupId}/targets", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{rolloutId}/deploygroups/{groupId}/targets", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
public ResponseEntity<TargetPagedList> getRolloutGroupTargets(@PathVariable("rolloutId") final Long rolloutId, public ResponseEntity<PagedList<TargetRest>> getRolloutGroupTargets(@PathVariable("rolloutId") final Long rolloutId,
@PathVariable("groupId") final Long groupId, @PathVariable("groupId") final Long groupId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,

View File

@@ -12,14 +12,11 @@ import java.util.List;
import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRest;
import org.eclipse.hawkbit.rest.resource.model.MetadataRestPageList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest; import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest;
import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactsRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulePagedList;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -79,7 +76,8 @@ public interface SoftwareModuleRestAPI {
@RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/artifacts", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/artifacts", produces = {
"application/hal+json", MediaType.APPLICATION_JSON_VALUE }) "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
@ResponseBody @ResponseBody
public ResponseEntity<ArtifactsRest> getArtifacts(@PathVariable("softwareModuleId") final Long softwareModuleId); public ResponseEntity<List<ArtifactRest>> getArtifacts(
@PathVariable("softwareModuleId") final Long softwareModuleId);
/** /**
* Handles the GET request of retrieving a single Artifact meta data * Handles the GET request of retrieving a single Artifact meta data
@@ -134,7 +132,7 @@ public interface SoftwareModuleRestAPI {
* JsonResponseExceptionHandler is handling the response. * JsonResponseExceptionHandler is handling the response.
*/ */
@RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<SoftwareModulePagedList> getSoftwareModules( public ResponseEntity<PagedList<SoftwareModuleRest>> getSoftwareModules(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -168,7 +166,7 @@ public interface SoftwareModuleRestAPI {
*/ */
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json", @RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<SoftwareModulesRest> createSoftwareModules( public ResponseEntity<List<SoftwareModuleRest>> createSoftwareModules(
@RequestBody final List<SoftwareModuleRequestBodyPost> softwareModules); @RequestBody final List<SoftwareModuleRequestBodyPost> softwareModules);
/** /**
@@ -187,7 +185,7 @@ public interface SoftwareModuleRestAPI {
@RequestBody final SoftwareModuleRequestBodyPut restSoftwareModule); @RequestBody final SoftwareModuleRequestBodyPut restSoftwareModule);
/** /**
* Handles the DELETE request for a single softwaremodule. * Handles the DELETE request for a single software module.
* *
* @param softwareModuleId * @param softwareModuleId
* the ID of the module to retrieve * the ID of the module to retrieve
@@ -219,7 +217,7 @@ public interface SoftwareModuleRestAPI {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/metadata", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{softwareModuleId}/metadata", produces = {
MediaType.APPLICATION_JSON_VALUE, "application/hal+json" }) MediaType.APPLICATION_JSON_VALUE, "application/hal+json" })
public ResponseEntity<MetadataRestPageList> getMetadata( public ResponseEntity<PagedList<MetadataRest>> getMetadata(
@PathVariable("softwareModuleId") final Long softwareModuleId, @PathVariable("softwareModuleId") final Long softwareModuleId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,

View File

@@ -11,11 +11,10 @@ package org.eclipse.hawkbit.rest.resource.api;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypePagedList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -52,7 +51,7 @@ public interface SoftwareModuleTypeRestApi {
* JsonResponseExceptionHandler is handling the response. * JsonResponseExceptionHandler is handling the response.
*/ */
@RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<SoftwareModuleTypePagedList> getTypes( public ResponseEntity<PagedList<SoftwareModuleTypeRest>> getTypes(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -113,7 +112,7 @@ public interface SoftwareModuleTypeRestApi {
*/ */
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json", @RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<SoftwareModuleTypesRest> createSoftwareModuleTypes( public ResponseEntity<List<SoftwareModuleTypeRest>> createSoftwareModuleTypes(
@RequestBody final List<SoftwareModuleTypeRequestBodyPost> softwareModuleTypes); @RequestBody final List<SoftwareModuleTypeRequestBodyPost> softwareModuleTypes);
} }

View File

@@ -11,16 +11,14 @@ package org.eclipse.hawkbit.rest.resource.api;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.rest.resource.model.action.ActionPagedList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.action.ActionRest; import org.eclipse.hawkbit.rest.resource.model.action.ActionRest;
import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusPagedList; import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.target.DistributionSetAssigmentRest; import org.eclipse.hawkbit.rest.resource.model.target.DistributionSetAssigmentRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetAttributes; import org.eclipse.hawkbit.rest.resource.model.target.TargetAttributes;
import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList;
import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody; import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody;
import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -70,7 +68,7 @@ public interface TargetRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<TargetPagedList> getTargets( public ResponseEntity<PagedList<TargetRest>> getTargets(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -89,7 +87,7 @@ public interface TargetRestApi {
*/ */
@RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json", @RequestMapping(method = RequestMethod.POST, consumes = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) MediaType.APPLICATION_JSON_VALUE }, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<TargetsRest> createTargets(@RequestBody final List<TargetRequestBody> targets); public ResponseEntity<List<TargetRest>> createTargets(@RequestBody final List<TargetRequestBody> targets);
/** /**
* Handles the PUT request of updating a target. The ID is within the URL * Handles the PUT request of updating a target. The ID is within the URL
@@ -160,7 +158,7 @@ public interface TargetRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{targetId}/actions", produces = { "application/hal+json", @RequestMapping(method = RequestMethod.GET, value = "/{targetId}/actions", produces = { "application/hal+json",
MediaType.APPLICATION_JSON_VALUE }) MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<ActionPagedList> getActionHistory(@PathVariable("targetId") final String targetId, public ResponseEntity<PagedList<ActionRest>> getActionHistory(@PathVariable("targetId") final String targetId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -225,8 +223,8 @@ public interface TargetRestApi {
*/ */
@RequestMapping(method = RequestMethod.GET, value = "/{targetId}/actions/{actionId}/status", produces = { @RequestMapping(method = RequestMethod.GET, value = "/{targetId}/actions/{actionId}/status", produces = {
"application/hal+json", MediaType.APPLICATION_JSON_VALUE }) "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<ActionStatusPagedList> getActionStatusList(@PathVariable("targetId") final String targetId, public ResponseEntity<PagedList<ActionStatusRest>> getActionStatusList(
@PathVariable("actionId") final Long actionId, @PathVariable("targetId") final String targetId, @PathVariable("actionId") final Long actionId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam); @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam);

View File

@@ -11,13 +11,13 @@ package org.eclipse.hawkbit.rest.resource.api;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.rest.resource.RestConstants; import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.tag.AssignedTargetRequestBody; import org.eclipse.hawkbit.rest.resource.model.tag.AssignedTargetRequestBody;
import org.eclipse.hawkbit.rest.resource.model.tag.TagPagedList;
import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.tag.TagRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagRest;
import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest;
import org.eclipse.hawkbit.rest.resource.model.tag.TargetTagAssigmentResultRest; import org.eclipse.hawkbit.rest.resource.model.tag.TargetTagAssigmentResultRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
@@ -53,7 +53,7 @@ public interface TargetTagRestApi {
* JsonResponseExceptionHandler is handling the response. * JsonResponseExceptionHandler is handling the response.
*/ */
@RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE }) @RequestMapping(method = RequestMethod.GET, produces = { "application/hal+json", MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<TagPagedList> getTargetTags( public ResponseEntity<PagedList<TagRest>> getTargetTags(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -129,7 +129,7 @@ public interface TargetTagRestApi {
* in case the given {@code targetTagId} doesn't exists. * in case the given {@code targetTagId} doesn't exists.
*/ */
@RequestMapping(method = RequestMethod.GET, value = RestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING) @RequestMapping(method = RequestMethod.GET, value = RestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING)
public ResponseEntity<TargetsRest> getAssignedTargets(@PathVariable("targetTagId") final Long targetTagId); public ResponseEntity<List<TargetRest>> getAssignedTargets(@PathVariable("targetTagId") final Long targetTagId);
/** /**
* Handles the POST request to toggle the assignment of targets by the given * Handles the POST request to toggle the assignment of targets by the given
@@ -163,7 +163,7 @@ public interface TargetTagRestApi {
* in case the given {@code targetTagId} doesn't exists. * in case the given {@code targetTagId} doesn't exists.
*/ */
@RequestMapping(method = RequestMethod.POST, value = RestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING) @RequestMapping(method = RequestMethod.POST, value = RestConstants.TARGET_TAG_TAGERTS_REQUEST_MAPPING)
public ResponseEntity<TargetsRest> assignTargets(@PathVariable("targetTagId") final Long targetTagId, public ResponseEntity<List<TargetRest>> assignTargets(@PathVariable("targetTagId") final Long targetTagId,
@RequestBody final List<AssignedTargetRequestBody> assignedTargetRequestBodies); @RequestBody final List<AssignedTargetRequestBody> assignedTargetRequestBodies);
/** /**

View File

@@ -1,38 +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.rest.resource.model;
import java.util.List;
/**
* The rest model for a paged meta data list.
*
*/
public class MetadataRestPageList extends PagedList<MetadataRest> {
private final List<MetadataRest> content;
/**
* @param content
* the meta data rest model list as content
* @param total
* the total number of the meta data
*/
public MetadataRestPageList(final List<MetadataRest> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of this paged list
*/
public List<MetadataRest> getContent() {
return content;
}
}

View File

@@ -20,19 +20,18 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
/** /**
* A list representation with meta data for pagination, e.g. containing the * A list representation with meta data for pagination, e.g. containing the
* total elements. The content of the acutal list is stored in the * total elements and size of content. The content of the actual list is stored
* {@link #content} field. * in the {@link #content} field.
* *
* @param <T> * @param <T>
* the type of elements in this list * the type of elements in this list
* *
*
*
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
public class PagedList<T> extends ResourceSupport { public class PagedList<T> extends ResourceSupport {
private final List<T> content;
private final long totalElements; private final long totalElements;
private final int size; private final int size;
@@ -50,6 +49,7 @@ public class PagedList<T> extends ResourceSupport {
public PagedList(@NotNull final List<T> content, final long total) { public PagedList(@NotNull final List<T> content, final long total) {
this.size = content.size(); this.size = content.size();
this.totalElements = total; this.totalElements = total;
this.content = content;
} }
/** /**
@@ -65,4 +65,9 @@ public class PagedList<T> extends ResourceSupport {
public long getTotal() { public long getTotal() {
return totalElements; return totalElements;
} }
public List<T> getContent() {
return content;
}
} }

View File

@@ -1,48 +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.rest.resource.model.action;
import java.util.Collections;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list rest model for {@link ErrorAction} to RESTful API representation.
*
*/
public class ActionPagedList extends PagedList<ActionRest> {
private final List<ActionRest> content;
/**
* Empty default constructor.
*/
public ActionPagedList() {
super(Collections.emptyList(), 0);
this.content = Collections.emptyList();
}
/**
* @param content
* @param total
*/
public ActionPagedList(final List<ActionRest> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<ActionRest> getContent() {
return content;
}
}

View File

@@ -1,54 +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.rest.resource.model.action;
import java.util.Collections;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* Paged list rest model for ActionStatus to RESTful API representation.
*
*
*
*
*/
@JsonIgnoreProperties(ignoreUnknown = true)
public class ActionStatusPagedList extends PagedList<ActionStatusRest> {
private final List<ActionStatusRest> content;
/**
* @param content
* @param total
*/
public ActionStatusPagedList(final List<ActionStatusRest> content, final long total) {
super(content, total);
this.content = content;
}
/**
* Default constructor.
*/
public ActionStatusPagedList() {
super(Collections.emptyList(), 0);
this.content = Collections.emptyList();
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<ActionStatusRest> getContent() {
return content;
}
}

View File

@@ -18,9 +18,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
/** /**
* A json annotated rest model for ActionStatus to RESTful API representation. * A json annotated rest model for ActionStatus to RESTful API representation.
* *
*
*
*
*/ */
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -1,277 +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.rest.resource.model.action;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.springframework.hateoas.ResourceSupport;
/**
* A list representation of the ActionStatus because Spring MVC cannot handle
* plain lists interfaces as request body.
*
*
*
*
*/
public class ActionStatussRest extends ResourceSupport implements List<ActionStatusRest> {
private final List<ActionStatusRest> delegate = new ArrayList<>();
/**
* @return
* @see java.util.List#size()
*/
@Override
public int size() {
return delegate.size();
}
/**
* @return
* @see java.util.List#isEmpty()
*/
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
/**
* @param o
* @return
* @see java.util.List#contains(java.lang.Object)
*/
@Override
public boolean contains(final Object o) {
return delegate.contains(o);
}
/**
* @return
* @see java.util.List#iterator()
*/
@Override
public Iterator<ActionStatusRest> iterator() {
return delegate.iterator();
}
/**
* @return
* @see java.util.List#toArray()
*/
@Override
public Object[] toArray() {
return delegate.toArray();
}
/**
* @param a
* @return
* @see java.util.List#toArray(java.lang.Object[])
*/
@Override
public <T> T[] toArray(final T[] a) {
return delegate.toArray(a);
}
/**
* @param e
* @return
* @see java.util.List#add(java.lang.Object)
*/
@Override
public boolean add(final ActionStatusRest e) {
return delegate.add(e);
}
/**
* @param o
* @return
* @see java.util.List#remove(java.lang.Object)
*/
@Override
public boolean remove(final Object o) {
return delegate.remove(o);
}
/**
* @param c
* @return
* @see java.util.List#containsAll(java.util.Collection)
*/
@Override
public boolean containsAll(final Collection<?> c) {
return delegate.containsAll(c);
}
/**
* @param c
* @return
* @see java.util.List#addAll(java.util.Collection)
*/
@Override
public boolean addAll(final Collection<? extends ActionStatusRest> c) {
return delegate.addAll(c);
}
/**
* @param index
* @param c
* @return
* @see java.util.List#addAll(int, java.util.Collection)
*/
@Override
public boolean addAll(final int index, final Collection<? extends ActionStatusRest> c) {
return delegate.addAll(index, c);
}
/**
* @param c
* @return
* @see java.util.List#removeAll(java.util.Collection)
*/
@Override
public boolean removeAll(final Collection<?> c) {
return delegate.removeAll(c);
}
/**
* @param c
* @return
* @see java.util.List#retainAll(java.util.Collection)
*/
@Override
public boolean retainAll(final Collection<?> c) {
return delegate.retainAll(c);
}
/**
*
* @see java.util.List#clear()
*/
@Override
public void clear() {
delegate.clear();
}
/**
* @param o
* @return
* @see java.util.List#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object o) {
return delegate.equals(o);
}
/**
* @return
* @see java.util.List#hashCode()
*/
@Override
public int hashCode() {
return delegate.hashCode();
}
/**
* @param index
* @return
* @see java.util.List#get(int)
*/
@Override
public ActionStatusRest get(final int index) {
return delegate.get(index);
}
/**
* @param index
* @param element
* @return
* @see java.util.List#set(int, java.lang.Object)
*/
@Override
public ActionStatusRest set(final int index, final ActionStatusRest element) {
return delegate.set(index, element);
}
/**
* @param index
* @param element
* @see java.util.List#add(int, java.lang.Object)
*/
@Override
public void add(final int index, final ActionStatusRest element) {
delegate.add(index, element);
}
/**
* @param index
* @return
* @see java.util.List#remove(int)
*/
@Override
public ActionStatusRest remove(final int index) {
return delegate.remove(index);
}
/**
* @param o
* @return
* @see java.util.List#indexOf(java.lang.Object)
*/
@Override
public int indexOf(final Object o) {
return delegate.indexOf(o);
}
/**
* @param o
* @return
* @see java.util.List#lastIndexOf(java.lang.Object)
*/
@Override
public int lastIndexOf(final Object o) {
return delegate.lastIndexOf(o);
}
/**
* @return
* @see java.util.List#listIterator()
*/
@Override
public ListIterator<ActionStatusRest> listIterator() {
return delegate.listIterator();
}
/**
* @param index
* @return
* @see java.util.List#listIterator(int)
*/
@Override
public ListIterator<ActionStatusRest> listIterator(final int index) {
return delegate.listIterator(index);
}
/**
* @param fromIndex
* @param toIndex
* @return
* @see java.util.List#subList(int, int)
*/
@Override
public List<ActionStatusRest> subList(final int fromIndex, final int toIndex) {
return delegate.subList(fromIndex, toIndex);
}
}

View File

@@ -1,273 +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.rest.resource.model.artifact;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.springframework.hateoas.ResourceSupport;
/**
* List representation of the {@link ArtifactRest}.
*
*/
public class ArtifactsRest extends ResourceSupport implements List<ArtifactRest> {
private final List<ArtifactRest> delegate = new ArrayList<>();
/**
* @return
* @see java.util.List#size()
*/
@Override
public int size() {
return delegate.size();
}
/**
* @return
* @see java.util.List#isEmpty()
*/
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
/**
* @param o
* @return
* @see java.util.List#contains(java.lang.Object)
*/
@Override
public boolean contains(final Object o) {
return delegate.contains(o);
}
/**
* @return
* @see java.util.List#iterator()
*/
@Override
public Iterator<ArtifactRest> iterator() {
return delegate.iterator();
}
/**
* @return
* @see java.util.List#toArray()
*/
@Override
public Object[] toArray() {
return delegate.toArray();
}
/**
* @param a
* @return
* @see java.util.List#toArray(java.lang.Object[])
*/
@Override
public <T> T[] toArray(final T[] a) {
return delegate.toArray(a);
}
/**
* @param e
* @return
* @see java.util.List#add(java.lang.Object)
*/
@Override
public boolean add(final ArtifactRest e) {
return delegate.add(e);
}
/**
* @param o
* @return
* @see java.util.List#remove(java.lang.Object)
*/
@Override
public boolean remove(final Object o) {
return delegate.remove(o);
}
/**
* @param c
* @return
* @see java.util.List#containsAll(java.util.Collection)
*/
@Override
public boolean containsAll(final Collection<?> c) {
return delegate.containsAll(c);
}
/**
* @param c
* @return
* @see java.util.List#addAll(java.util.Collection)
*/
@Override
public boolean addAll(final Collection<? extends ArtifactRest> c) {
return delegate.addAll(c);
}
/**
* @param index
* @param c
* @return
* @see java.util.List#addAll(int, java.util.Collection)
*/
@Override
public boolean addAll(final int index, final Collection<? extends ArtifactRest> c) {
return delegate.addAll(index, c);
}
/**
* @param c
* @return
* @see java.util.List#removeAll(java.util.Collection)
*/
@Override
public boolean removeAll(final Collection<?> c) {
return delegate.removeAll(c);
}
/**
* @param c
* @return
* @see java.util.List#retainAll(java.util.Collection)
*/
@Override
public boolean retainAll(final Collection<?> c) {
return delegate.retainAll(c);
}
/**
*
* @see java.util.List#clear()
*/
@Override
public void clear() {
delegate.clear();
}
/**
* @param o
* @return
* @see java.util.List#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object o) {
return delegate.equals(o);
}
/**
* @return
* @see java.util.List#hashCode()
*/
@Override
public int hashCode() {
return delegate.hashCode();
}
/**
* @param index
* @return
* @see java.util.List#get(int)
*/
@Override
public ArtifactRest get(final int index) {
return delegate.get(index);
}
/**
* @param index
* @param element
* @return
* @see java.util.List#set(int, java.lang.Object)
*/
@Override
public ArtifactRest set(final int index, final ArtifactRest element) {
return delegate.set(index, element);
}
/**
* @param index
* @param element
* @see java.util.List#add(int, java.lang.Object)
*/
@Override
public void add(final int index, final ArtifactRest element) {
delegate.add(index, element);
}
/**
* @param index
* @return
* @see java.util.List#remove(int)
*/
@Override
public ArtifactRest remove(final int index) {
return delegate.remove(index);
}
/**
* @param o
* @return
* @see java.util.List#indexOf(java.lang.Object)
*/
@Override
public int indexOf(final Object o) {
return delegate.indexOf(o);
}
/**
* @param o
* @return
* @see java.util.List#lastIndexOf(java.lang.Object)
*/
@Override
public int lastIndexOf(final Object o) {
return delegate.lastIndexOf(o);
}
/**
* @return
* @see java.util.List#listIterator()
*/
@Override
public ListIterator<ArtifactRest> listIterator() {
return delegate.listIterator();
}
/**
* @param index
* @return
* @see java.util.List#listIterator(int)
*/
@Override
public ListIterator<ArtifactRest> listIterator(final int index) {
return delegate.listIterator(index);
}
/**
* @param fromIndex
* @param toIndex
* @return
* @see java.util.List#subList(int, int)
*/
@Override
public List<ArtifactRest> subList(final int fromIndex, final int toIndex) {
return delegate.subList(fromIndex, toIndex);
}
}

View File

@@ -1,39 +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.rest.resource.model.distributionset;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list for SoftwareModule.
*
*/
public class DistributionSetPagedList extends PagedList<DistributionSetRest> {
private final List<DistributionSetRest> content;
/**
* @param content
* @param total
*/
public DistributionSetPagedList(final List<DistributionSetRest> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<DistributionSetRest> getContent() {
return content;
}
}

View File

@@ -1,277 +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.rest.resource.model.distributionset;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.springframework.hateoas.ResourceSupport;
/**
* List representation of the {@link DistributionSetRest} because Spring MVC
* cannot handle plain lists interfaces as request body.
*
*
*
*
*/
public class DistributionSetsRest extends ResourceSupport implements List<DistributionSetRest> {
private final List<DistributionSetRest> delegate = new ArrayList<>();
/**
* @return
* @see java.util.List#size()
*/
@Override
public int size() {
return delegate.size();
}
/**
* @return
* @see java.util.List#isEmpty()
*/
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
/**
* @param o
* @return
* @see java.util.List#contains(java.lang.Object)
*/
@Override
public boolean contains(final Object o) {
return delegate.contains(o);
}
/**
* @return
* @see java.util.List#iterator()
*/
@Override
public Iterator<DistributionSetRest> iterator() {
return delegate.iterator();
}
/**
* @return
* @see java.util.List#toArray()
*/
@Override
public Object[] toArray() {
return delegate.toArray();
}
/**
* @param a
* @return
* @see java.util.List#toArray(java.lang.Object[])
*/
@Override
public <T> T[] toArray(final T[] a) {
return delegate.toArray(a);
}
/**
* @param e
* @return
* @see java.util.List#add(java.lang.Object)
*/
@Override
public boolean add(final DistributionSetRest e) {
return delegate.add(e);
}
/**
* @param o
* @return
* @see java.util.List#remove(java.lang.Object)
*/
@Override
public boolean remove(final Object o) {
return delegate.remove(o);
}
/**
* @param c
* @return
* @see java.util.List#containsAll(java.util.Collection)
*/
@Override
public boolean containsAll(final Collection<?> c) {
return delegate.containsAll(c);
}
/**
* @param c
* @return
* @see java.util.List#addAll(java.util.Collection)
*/
@Override
public boolean addAll(final Collection<? extends DistributionSetRest> c) {
return delegate.addAll(c);
}
/**
* @param index
* @param c
* @return
* @see java.util.List#addAll(int, java.util.Collection)
*/
@Override
public boolean addAll(final int index, final Collection<? extends DistributionSetRest> c) {
return delegate.addAll(index, c);
}
/**
* @param c
* @return
* @see java.util.List#removeAll(java.util.Collection)
*/
@Override
public boolean removeAll(final Collection<?> c) {
return delegate.removeAll(c);
}
/**
* @param c
* @return
* @see java.util.List#retainAll(java.util.Collection)
*/
@Override
public boolean retainAll(final Collection<?> c) {
return delegate.retainAll(c);
}
/**
*
* @see java.util.List#clear()
*/
@Override
public void clear() {
delegate.clear();
}
/**
* @param o
* @return
* @see java.util.List#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object o) {
return delegate.equals(o);
}
/**
* @return
* @see java.util.List#hashCode()
*/
@Override
public int hashCode() {
return delegate.hashCode();
}
/**
* @param index
* @return
* @see java.util.List#get(int)
*/
@Override
public DistributionSetRest get(final int index) {
return delegate.get(index);
}
/**
* @param index
* @param element
* @return
* @see java.util.List#set(int, java.lang.Object)
*/
@Override
public DistributionSetRest set(final int index, final DistributionSetRest element) {
return delegate.set(index, element);
}
/**
* @param index
* @param element
* @see java.util.List#add(int, java.lang.Object)
*/
@Override
public void add(final int index, final DistributionSetRest element) {
delegate.add(index, element);
}
/**
* @param index
* @return
* @see java.util.List#remove(int)
*/
@Override
public DistributionSetRest remove(final int index) {
return delegate.remove(index);
}
/**
* @param o
* @return
* @see java.util.List#indexOf(java.lang.Object)
*/
@Override
public int indexOf(final Object o) {
return delegate.indexOf(o);
}
/**
* @param o
* @return
* @see java.util.List#lastIndexOf(java.lang.Object)
*/
@Override
public int lastIndexOf(final Object o) {
return delegate.lastIndexOf(o);
}
/**
* @return
* @see java.util.List#listIterator()
*/
@Override
public ListIterator<DistributionSetRest> listIterator() {
return delegate.listIterator();
}
/**
* @param index
* @return
* @see java.util.List#listIterator(int)
*/
@Override
public ListIterator<DistributionSetRest> listIterator(final int index) {
return delegate.listIterator(index);
}
/**
* @param fromIndex
* @param toIndex
* @return
* @see java.util.List#subList(int, int)
*/
@Override
public List<DistributionSetRest> subList(final int fromIndex, final int toIndex) {
return delegate.subList(fromIndex, toIndex);
}
}

View File

@@ -1,40 +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.rest.resource.model.distributionsettype;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list for DistributionSetType.
*
*
*/
public class DistributionSetTypePagedList extends PagedList<DistributionSetTypeRest> {
private final List<DistributionSetTypeRest> content;
/**
* @param content
* @param total
*/
public DistributionSetTypePagedList(final List<DistributionSetTypeRest> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<DistributionSetTypeRest> getContent() {
return content;
}
}

View File

@@ -1,274 +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.rest.resource.model.distributionsettype;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.springframework.hateoas.ResourceSupport;
/**
* List representation of the {@link DistributionSetTypeRest} because Spring MVC
* cannot handle plain lists interfaces as request body.
*
*/
public class DistributionSetTypesRest extends ResourceSupport implements List<DistributionSetTypeRest> {
private final List<DistributionSetTypeRest> delegate = new ArrayList<>();
/**
* @return
* @see java.util.List#size()
*/
@Override
public int size() {
return delegate.size();
}
/**
* @return
* @see java.util.List#isEmpty()
*/
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
/**
* @param o
* @return
* @see java.util.List#contains(java.lang.Object)
*/
@Override
public boolean contains(final Object o) {
return delegate.contains(o);
}
/**
* @return
* @see java.util.List#iterator()
*/
@Override
public Iterator<DistributionSetTypeRest> iterator() {
return delegate.iterator();
}
/**
* @return
* @see java.util.List#toArray()
*/
@Override
public Object[] toArray() {
return delegate.toArray();
}
/**
* @param a
* @return
* @see java.util.List#toArray(java.lang.Object[])
*/
@Override
public <T> T[] toArray(final T[] a) {
return delegate.toArray(a);
}
/**
* @param e
* @return
* @see java.util.List#add(java.lang.Object)
*/
@Override
public boolean add(final DistributionSetTypeRest e) {
return delegate.add(e);
}
/**
* @param o
* @return
* @see java.util.List#remove(java.lang.Object)
*/
@Override
public boolean remove(final Object o) {
return delegate.remove(o);
}
/**
* @param c
* @return
* @see java.util.List#containsAll(java.util.Collection)
*/
@Override
public boolean containsAll(final Collection<?> c) {
return delegate.containsAll(c);
}
/**
* @param c
* @return
* @see java.util.List#addAll(java.util.Collection)
*/
@Override
public boolean addAll(final Collection<? extends DistributionSetTypeRest> c) {
return delegate.addAll(c);
}
/**
* @param index
* @param c
* @return
* @see java.util.List#addAll(int, java.util.Collection)
*/
@Override
public boolean addAll(final int index, final Collection<? extends DistributionSetTypeRest> c) {
return delegate.addAll(index, c);
}
/**
* @param c
* @return
* @see java.util.List#removeAll(java.util.Collection)
*/
@Override
public boolean removeAll(final Collection<?> c) {
return delegate.removeAll(c);
}
/**
* @param c
* @return
* @see java.util.List#retainAll(java.util.Collection)
*/
@Override
public boolean retainAll(final Collection<?> c) {
return delegate.retainAll(c);
}
/**
*
* @see java.util.List#clear()
*/
@Override
public void clear() {
delegate.clear();
}
/**
* @param o
* @return
* @see java.util.List#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object o) {
return delegate.equals(o);
}
/**
* @return
* @see java.util.List#hashCode()
*/
@Override
public int hashCode() {
return delegate.hashCode();
}
/**
* @param index
* @return
* @see java.util.List#get(int)
*/
@Override
public DistributionSetTypeRest get(final int index) {
return delegate.get(index);
}
/**
* @param index
* @param element
* @return
* @see java.util.List#set(int, java.lang.Object)
*/
@Override
public DistributionSetTypeRest set(final int index, final DistributionSetTypeRest element) {
return delegate.set(index, element);
}
/**
* @param index
* @param element
* @see java.util.List#add(int, java.lang.Object)
*/
@Override
public void add(final int index, final DistributionSetTypeRest element) {
delegate.add(index, element);
}
/**
* @param index
* @return
* @see java.util.List#remove(int)
*/
@Override
public DistributionSetTypeRest remove(final int index) {
return delegate.remove(index);
}
/**
* @param o
* @return
* @see java.util.List#indexOf(java.lang.Object)
*/
@Override
public int indexOf(final Object o) {
return delegate.indexOf(o);
}
/**
* @param o
* @return
* @see java.util.List#lastIndexOf(java.lang.Object)
*/
@Override
public int lastIndexOf(final Object o) {
return delegate.lastIndexOf(o);
}
/**
* @return
* @see java.util.List#listIterator()
*/
@Override
public ListIterator<DistributionSetTypeRest> listIterator() {
return delegate.listIterator();
}
/**
* @param index
* @return
* @see java.util.List#listIterator(int)
*/
@Override
public ListIterator<DistributionSetTypeRest> listIterator(final int index) {
return delegate.listIterator(index);
}
/**
* @param fromIndex
* @param toIndex
* @return
* @see java.util.List#subList(int, int)
*/
@Override
public List<DistributionSetTypeRest> subList(final int fromIndex, final int toIndex) {
return delegate.subList(fromIndex, toIndex);
}
}

View File

@@ -1,36 +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.rest.resource.model.rollout;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list for Rollout.
*
*
*/
public class RolloutPagedList extends PagedList<RolloutResponseBody> {
private final List<RolloutResponseBody> content;
public RolloutPagedList(final List<RolloutResponseBody> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<RolloutResponseBody> getContent() {
return content;
}
}

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.rest.resource.model.rolloutgroup;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list for Rollout.
*
*/
public class RolloutGroupPagedList extends PagedList<RolloutGroupResponseBody> {
private final List<RolloutGroupResponseBody> content;
public RolloutGroupPagedList(final List<RolloutGroupResponseBody> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<RolloutGroupResponseBody> getContent() {
return content;
}
}

View File

@@ -1,39 +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.rest.resource.model.softwaremodule;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list for SoftwareModule.
*
*/
public class SoftwareModulePagedList extends PagedList<SoftwareModuleRest> {
private final List<SoftwareModuleRest> content;
/**
* @param content
* @param total
*/
public SoftwareModulePagedList(final List<SoftwareModuleRest> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<SoftwareModuleRest> getContent() {
return content;
}
}

View File

@@ -1,277 +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.rest.resource.model.softwaremodule;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.springframework.hateoas.ResourceSupport;
/**
* List representation of the {@link SoftwareModuleRest} because Spring MVC
* cannot handle plain lists interfaces as request body.
*
*
*
*
*/
public class SoftwareModulesRest extends ResourceSupport implements List<SoftwareModuleRest> {
private final List<SoftwareModuleRest> delegate = new ArrayList<>();
/**
* @return
* @see java.util.List#size()
*/
@Override
public int size() {
return delegate.size();
}
/**
* @return
* @see java.util.List#isEmpty()
*/
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
/**
* @param o
* @return
* @see java.util.List#contains(java.lang.Object)
*/
@Override
public boolean contains(final Object o) {
return delegate.contains(o);
}
/**
* @return
* @see java.util.List#iterator()
*/
@Override
public Iterator<SoftwareModuleRest> iterator() {
return delegate.iterator();
}
/**
* @return
* @see java.util.List#toArray()
*/
@Override
public Object[] toArray() {
return delegate.toArray();
}
/**
* @param a
* @return
* @see java.util.List#toArray(java.lang.Object[])
*/
@Override
public <T> T[] toArray(final T[] a) {
return delegate.toArray(a);
}
/**
* @param e
* @return
* @see java.util.List#add(java.lang.Object)
*/
@Override
public boolean add(final SoftwareModuleRest e) {
return delegate.add(e);
}
/**
* @param o
* @return
* @see java.util.List#remove(java.lang.Object)
*/
@Override
public boolean remove(final Object o) {
return delegate.remove(o);
}
/**
* @param c
* @return
* @see java.util.List#containsAll(java.util.Collection)
*/
@Override
public boolean containsAll(final Collection<?> c) {
return delegate.containsAll(c);
}
/**
* @param c
* @return
* @see java.util.List#addAll(java.util.Collection)
*/
@Override
public boolean addAll(final Collection<? extends SoftwareModuleRest> c) {
return delegate.addAll(c);
}
/**
* @param index
* @param c
* @return
* @see java.util.List#addAll(int, java.util.Collection)
*/
@Override
public boolean addAll(final int index, final Collection<? extends SoftwareModuleRest> c) {
return delegate.addAll(index, c);
}
/**
* @param c
* @return
* @see java.util.List#removeAll(java.util.Collection)
*/
@Override
public boolean removeAll(final Collection<?> c) {
return delegate.removeAll(c);
}
/**
* @param c
* @return
* @see java.util.List#retainAll(java.util.Collection)
*/
@Override
public boolean retainAll(final Collection<?> c) {
return delegate.retainAll(c);
}
/**
*
* @see java.util.List#clear()
*/
@Override
public void clear() {
delegate.clear();
}
/**
* @param o
* @return
* @see java.util.List#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object o) {
return delegate.equals(o);
}
/**
* @return
* @see java.util.List#hashCode()
*/
@Override
public int hashCode() {
return delegate.hashCode();
}
/**
* @param index
* @return
* @see java.util.List#get(int)
*/
@Override
public SoftwareModuleRest get(final int index) {
return delegate.get(index);
}
/**
* @param index
* @param element
* @return
* @see java.util.List#set(int, java.lang.Object)
*/
@Override
public SoftwareModuleRest set(final int index, final SoftwareModuleRest element) {
return delegate.set(index, element);
}
/**
* @param index
* @param element
* @see java.util.List#add(int, java.lang.Object)
*/
@Override
public void add(final int index, final SoftwareModuleRest element) {
delegate.add(index, element);
}
/**
* @param index
* @return
* @see java.util.List#remove(int)
*/
@Override
public SoftwareModuleRest remove(final int index) {
return delegate.remove(index);
}
/**
* @param o
* @return
* @see java.util.List#indexOf(java.lang.Object)
*/
@Override
public int indexOf(final Object o) {
return delegate.indexOf(o);
}
/**
* @param o
* @return
* @see java.util.List#lastIndexOf(java.lang.Object)
*/
@Override
public int lastIndexOf(final Object o) {
return delegate.lastIndexOf(o);
}
/**
* @return
* @see java.util.List#listIterator()
*/
@Override
public ListIterator<SoftwareModuleRest> listIterator() {
return delegate.listIterator();
}
/**
* @param index
* @return
* @see java.util.List#listIterator(int)
*/
@Override
public ListIterator<SoftwareModuleRest> listIterator(final int index) {
return delegate.listIterator(index);
}
/**
* @param fromIndex
* @param toIndex
* @return
* @see java.util.List#subList(int, int)
*/
@Override
public List<SoftwareModuleRest> subList(final int fromIndex, final int toIndex) {
return delegate.subList(fromIndex, toIndex);
}
}

View File

@@ -1,39 +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.rest.resource.model.softwaremoduletype;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
/**
* Paged list for SoftwareModuleType.
*
*/
public class SoftwareModuleTypePagedList extends PagedList<SoftwareModuleTypeRest> {
private final List<SoftwareModuleTypeRest> content;
/**
* @param content
* @param total
*/
public SoftwareModuleTypePagedList(final List<SoftwareModuleTypeRest> content, final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<SoftwareModuleTypeRest> getContent() {
return content;
}
}

View File

@@ -19,9 +19,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
* A json annotated rest model for SoftwareModuleType to RESTful API * A json annotated rest model for SoftwareModuleType to RESTful API
* representation. * representation.
* *
*
*
*
*/ */
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)

View File

@@ -1,274 +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.rest.resource.model.softwaremoduletype;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.springframework.hateoas.ResourceSupport;
/**
* List representation of the {@link SoftwareModuleTypeRest} because Spring MVC
* cannot handle plain lists interfaces as request body.
*
*/
public class SoftwareModuleTypesRest extends ResourceSupport implements List<SoftwareModuleTypeRest> {
private final List<SoftwareModuleTypeRest> delegate = new ArrayList<>();
/**
* @return
* @see java.util.List#size()
*/
@Override
public int size() {
return delegate.size();
}
/**
* @return
* @see java.util.List#isEmpty()
*/
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
/**
* @param o
* @return
* @see java.util.List#contains(java.lang.Object)
*/
@Override
public boolean contains(final Object o) {
return delegate.contains(o);
}
/**
* @return
* @see java.util.List#iterator()
*/
@Override
public Iterator<SoftwareModuleTypeRest> iterator() {
return delegate.iterator();
}
/**
* @return
* @see java.util.List#toArray()
*/
@Override
public Object[] toArray() {
return delegate.toArray();
}
/**
* @param a
* @return
* @see java.util.List#toArray(java.lang.Object[])
*/
@Override
public <T> T[] toArray(final T[] a) {
return delegate.toArray(a);
}
/**
* @param e
* @return
* @see java.util.List#add(java.lang.Object)
*/
@Override
public boolean add(final SoftwareModuleTypeRest e) {
return delegate.add(e);
}
/**
* @param o
* @return
* @see java.util.List#remove(java.lang.Object)
*/
@Override
public boolean remove(final Object o) {
return delegate.remove(o);
}
/**
* @param c
* @return
* @see java.util.List#containsAll(java.util.Collection)
*/
@Override
public boolean containsAll(final Collection<?> c) {
return delegate.containsAll(c);
}
/**
* @param c
* @return
* @see java.util.List#addAll(java.util.Collection)
*/
@Override
public boolean addAll(final Collection<? extends SoftwareModuleTypeRest> c) {
return delegate.addAll(c);
}
/**
* @param index
* @param c
* @return
* @see java.util.List#addAll(int, java.util.Collection)
*/
@Override
public boolean addAll(final int index, final Collection<? extends SoftwareModuleTypeRest> c) {
return delegate.addAll(index, c);
}
/**
* @param c
* @return
* @see java.util.List#removeAll(java.util.Collection)
*/
@Override
public boolean removeAll(final Collection<?> c) {
return delegate.removeAll(c);
}
/**
* @param c
* @return
* @see java.util.List#retainAll(java.util.Collection)
*/
@Override
public boolean retainAll(final Collection<?> c) {
return delegate.retainAll(c);
}
/**
*
* @see java.util.List#clear()
*/
@Override
public void clear() {
delegate.clear();
}
/**
* @param o
* @return
* @see java.util.List#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object o) {
return delegate.equals(o);
}
/**
* @return
* @see java.util.List#hashCode()
*/
@Override
public int hashCode() {
return delegate.hashCode();
}
/**
* @param index
* @return
* @see java.util.List#get(int)
*/
@Override
public SoftwareModuleTypeRest get(final int index) {
return delegate.get(index);
}
/**
* @param index
* @param element
* @return
* @see java.util.List#set(int, java.lang.Object)
*/
@Override
public SoftwareModuleTypeRest set(final int index, final SoftwareModuleTypeRest element) {
return delegate.set(index, element);
}
/**
* @param index
* @param element
* @see java.util.List#add(int, java.lang.Object)
*/
@Override
public void add(final int index, final SoftwareModuleTypeRest element) {
delegate.add(index, element);
}
/**
* @param index
* @return
* @see java.util.List#remove(int)
*/
@Override
public SoftwareModuleTypeRest remove(final int index) {
return delegate.remove(index);
}
/**
* @param o
* @return
* @see java.util.List#indexOf(java.lang.Object)
*/
@Override
public int indexOf(final Object o) {
return delegate.indexOf(o);
}
/**
* @param o
* @return
* @see java.util.List#lastIndexOf(java.lang.Object)
*/
@Override
public int lastIndexOf(final Object o) {
return delegate.lastIndexOf(o);
}
/**
* @return
* @see java.util.List#listIterator()
*/
@Override
public ListIterator<SoftwareModuleTypeRest> listIterator() {
return delegate.listIterator();
}
/**
* @param index
* @return
* @see java.util.List#listIterator(int)
*/
@Override
public ListIterator<SoftwareModuleTypeRest> listIterator(final int index) {
return delegate.listIterator(index);
}
/**
* @param fromIndex
* @param toIndex
* @return
* @see java.util.List#subList(int, int)
*/
@Override
public List<SoftwareModuleTypeRest> subList(final int fromIndex, final int toIndex) {
return delegate.subList(fromIndex, toIndex);
}
}

View File

@@ -8,7 +8,9 @@
*/ */
package org.eclipse.hawkbit.rest.resource.model.tag; package org.eclipse.hawkbit.rest.resource.model.tag;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
@@ -25,24 +27,24 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class DistributionSetTagAssigmentResultRest { public class DistributionSetTagAssigmentResultRest {
@JsonProperty @JsonProperty
private DistributionSetsRest assignedDistributionSets; private List<DistributionSetRest> assignedDistributionSets;
@JsonProperty @JsonProperty
private DistributionSetsRest unassignedDistributionSets; private List<DistributionSetRest> unassignedDistributionSets;
public DistributionSetsRest getAssignedDistributionSets() { public List<DistributionSetRest> getAssignedDistributionSets() {
return assignedDistributionSets; return assignedDistributionSets;
} }
public DistributionSetsRest getUnassignedDistributionSets() { public List<DistributionSetRest> getUnassignedDistributionSets() {
return unassignedDistributionSets; return unassignedDistributionSets;
} }
public void setAssignedDistributionSets(final DistributionSetsRest assignedDistributionSets) { public void setAssignedDistributionSets(final List<DistributionSetRest> assignedDistributionSets) {
this.assignedDistributionSets = assignedDistributionSets; this.assignedDistributionSets = assignedDistributionSets;
} }
public void setUnassignedDistributionSets(final DistributionSetsRest unassignedDistributionSets) { public void setUnassignedDistributionSets(final List<DistributionSetRest> unassignedDistributionSets) {
this.unassignedDistributionSets = unassignedDistributionSets; this.unassignedDistributionSets = unassignedDistributionSets;
} }

View File

@@ -1,43 +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.rest.resource.model.tag;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Paged list for tags.
*
*/
public class TagPagedList extends PagedList<TagRest> {
private final List<TagRest> content;
/**
* @param content
* @param total
*/
@JsonCreator
public TagPagedList(@JsonProperty("content") final List<TagRest> content, @JsonProperty("total") final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<TagRest> getContent() {
return content;
}
}

View File

@@ -8,7 +8,9 @@
*/ */
package org.eclipse.hawkbit.rest.resource.model.tag; package org.eclipse.hawkbit.rest.resource.model.tag;
import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
@@ -25,24 +27,24 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public class TargetTagAssigmentResultRest { public class TargetTagAssigmentResultRest {
@JsonProperty @JsonProperty
private TargetsRest assignedTargets; private List<TargetRest> assignedTargets;
@JsonProperty @JsonProperty
private TargetsRest unassignedTargets; private List<TargetRest> unassignedTargets;
public void setAssignedTargets(final TargetsRest assignedTargets) { public void setAssignedTargets(final List<TargetRest> assignedTargets) {
this.assignedTargets = assignedTargets; this.assignedTargets = assignedTargets;
} }
public TargetsRest getAssignedTargets() { public List<TargetRest> getAssignedTargets() {
return assignedTargets; return assignedTargets;
} }
public void setUnassignedTargets(final TargetsRest unassignedTargets) { public void setUnassignedTargets(final List<TargetRest> unassignedTargets) {
this.unassignedTargets = unassignedTargets; this.unassignedTargets = unassignedTargets;
} }
public TargetsRest getUnassignedTargets() { public List<TargetRest> getUnassignedTargets() {
return unassignedTargets; return unassignedTargets;
} }

View File

@@ -1,39 +0,0 @@
/**
* Copyright (c) 2011-2015 Bosch Software Innovations GmbH, Germany. All rights reserved.
*/
package org.eclipse.hawkbit.rest.resource.model.target;
import java.util.List;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Paged list for targets.
*
*/
public class TargetPagedList extends PagedList<TargetRest> {
private final List<TargetRest> content;
/**
* @param content
* @param total
*/
@JsonCreator
public TargetPagedList(@JsonProperty("content") final List<TargetRest> content,
@JsonProperty("total") final long total) {
super(content, total);
this.content = content;
}
/**
* @return the content of the paged list. Never {@code null}.
*/
public List<TargetRest> getContent() {
return content;
}
}

View File

@@ -1,269 +0,0 @@
/**
* Copyright (c) 2011-2015 Bosch Software Innovations GmbH, Germany. All rights reserved.
*/
package org.eclipse.hawkbit.rest.resource.model.target;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.springframework.hateoas.ResourceSupport;
/**
* A list representation of the {@link TargetRest} because Spring MVC cannot
* handle plain lists interfaces as request body.
*
*/
public class TargetsRest extends ResourceSupport implements List<TargetRest> {
private final List<TargetRest> delegate = new ArrayList<>();
/**
* @return
* @see java.util.List#size()
*/
@Override
public int size() {
return delegate.size();
}
/**
* @return
* @see java.util.List#isEmpty()
*/
@Override
public boolean isEmpty() {
return delegate.isEmpty();
}
/**
* @param o
* @return
* @see java.util.List#contains(java.lang.Object)
*/
@Override
public boolean contains(final Object o) {
return delegate.contains(o);
}
/**
* @return
* @see java.util.List#iterator()
*/
@Override
public Iterator<TargetRest> iterator() {
return delegate.iterator();
}
/**
* @return
* @see java.util.List#toArray()
*/
@Override
public Object[] toArray() {
return delegate.toArray();
}
/**
* @param a
* @return
* @see java.util.List#toArray(java.lang.Object[])
*/
@Override
public <T> T[] toArray(final T[] a) {
return delegate.toArray(a);
}
/**
* @param e
* @return
* @see java.util.List#add(java.lang.Object)
*/
@Override
public boolean add(final TargetRest e) {
return delegate.add(e);
}
/**
* @param o
* @return
* @see java.util.List#remove(java.lang.Object)
*/
@Override
public boolean remove(final Object o) {
return delegate.remove(o);
}
/**
* @param c
* @return
* @see java.util.List#containsAll(java.util.Collection)
*/
@Override
public boolean containsAll(final Collection<?> c) {
return delegate.containsAll(c);
}
/**
* @param c
* @return
* @see java.util.List#addAll(java.util.Collection)
*/
@Override
public boolean addAll(final Collection<? extends TargetRest> c) {
return delegate.addAll(c);
}
/**
* @param index
* @param c
* @return
* @see java.util.List#addAll(int, java.util.Collection)
*/
@Override
public boolean addAll(final int index, final Collection<? extends TargetRest> c) {
return delegate.addAll(index, c);
}
/**
* @param c
* @return
* @see java.util.List#removeAll(java.util.Collection)
*/
@Override
public boolean removeAll(final Collection<?> c) {
return delegate.removeAll(c);
}
/**
* @param c
* @return
* @see java.util.List#retainAll(java.util.Collection)
*/
@Override
public boolean retainAll(final Collection<?> c) {
return delegate.retainAll(c);
}
/**
*
* @see java.util.List#clear()
*/
@Override
public void clear() {
delegate.clear();
}
/**
* @param o
* @return
* @see java.util.List#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object o) {
return delegate.equals(o);
}
/**
* @return
* @see java.util.List#hashCode()
*/
@Override
public int hashCode() {
return delegate.hashCode();
}
/**
* @param index
* @return
* @see java.util.List#get(int)
*/
@Override
public TargetRest get(final int index) {
return delegate.get(index);
}
/**
* @param index
* @param element
* @return
* @see java.util.List#set(int, java.lang.Object)
*/
@Override
public TargetRest set(final int index, final TargetRest element) {
return delegate.set(index, element);
}
/**
* @param index
* @param element
* @see java.util.List#add(int, java.lang.Object)
*/
@Override
public void add(final int index, final TargetRest element) {
delegate.add(index, element);
}
/**
* @param index
* @return
* @see java.util.List#remove(int)
*/
@Override
public TargetRest remove(final int index) {
return delegate.remove(index);
}
/**
* @param o
* @return
* @see java.util.List#indexOf(java.lang.Object)
*/
@Override
public int indexOf(final Object o) {
return delegate.indexOf(o);
}
/**
* @param o
* @return
* @see java.util.List#lastIndexOf(java.lang.Object)
*/
@Override
public int lastIndexOf(final Object o) {
return delegate.lastIndexOf(o);
}
/**
* @return
* @see java.util.List#listIterator()
*/
@Override
public ListIterator<TargetRest> listIterator() {
return delegate.listIterator();
}
/**
* @param index
* @return
* @see java.util.List#listIterator(int)
*/
@Override
public ListIterator<TargetRest> listIterator(final int index) {
return delegate.listIterator(index);
}
/**
* @param fromIndex
* @param toIndex
* @return
* @see java.util.List#subList(int, int)
*/
@Override
public List<TargetRest> subList(final int fromIndex, final int toIndex) {
return delegate.subList(fromIndex, toIndex);
}
}

View File

@@ -27,7 +27,6 @@ import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi;
import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody;
/** /**
@@ -193,8 +192,8 @@ public final class DistributionSetMapper {
return result; return result;
} }
static DistributionSetsRest toResponseDistributionSets(final Iterable<DistributionSet> sets) { static List<DistributionSetRest> toResponseDistributionSets(final Iterable<DistributionSet> sets) {
final DistributionSetsRest response = new DistributionSetsRest(); final List<DistributionSetRest> response = new ArrayList<>();
if (sets != null) { if (sets != null) {
for (final DistributionSet set : sets) { for (final DistributionSet set : sets) {

View File

@@ -33,17 +33,15 @@ import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.DistributionSetRestApi; import org.eclipse.hawkbit.rest.resource.api.DistributionSetRestApi;
import org.eclipse.hawkbit.rest.resource.helper.RestResourceConversionHelper; import org.eclipse.hawkbit.rest.resource.helper.RestResourceConversionHelper;
import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRest;
import org.eclipse.hawkbit.rest.resource.model.MetadataRestPageList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetPagedList;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentRequestBody; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentRequestBody;
import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody; import org.eclipse.hawkbit.rest.resource.model.distributionset.TargetAssignmentResponseBody;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleAssigmentRest; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleAssigmentRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulePagedList; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.eclipse.hawkbit.tenancy.TenantAware; import org.eclipse.hawkbit.tenancy.TenantAware;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -81,7 +79,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
private DistributionSetManagement distributionSetManagement; private DistributionSetManagement distributionSetManagement;
@Override @Override
public ResponseEntity<DistributionSetPagedList> getDistributionSets(final int pagingOffsetParam, public ResponseEntity<PagedList<DistributionSetRest>> getDistributionSets(final int pagingOffsetParam,
final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int pagingLimitParam, final String sortParam, final String rsqlParam) {
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
@@ -98,7 +96,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
} }
final List<DistributionSetRest> rest = DistributionSetMapper.toResponseFromDsList(findDsPage.getContent()); final List<DistributionSetRest> rest = DistributionSetMapper.toResponseFromDsList(findDsPage.getContent());
return new ResponseEntity<>(new DistributionSetPagedList(rest, findDsPage.getTotalElements()), HttpStatus.OK); return new ResponseEntity<>(new PagedList<>(rest, findDsPage.getTotalElements()), HttpStatus.OK);
} }
@Override @Override
@@ -109,7 +107,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
} }
@Override @Override
public ResponseEntity<DistributionSetsRest> createDistributionSets( public ResponseEntity<List<DistributionSetRest>> createDistributionSets(
final List<DistributionSetRequestBodyPost> sets) { final List<DistributionSetRequestBodyPost> sets) {
LOG.debug("creating {} distribution sets", sets.size()); LOG.debug("creating {} distribution sets", sets.size());
@@ -155,8 +153,8 @@ public class DistributionSetResource implements DistributionSetRestApi {
} }
@Override @Override
public ResponseEntity<TargetPagedList> getAssignedTargets(final Long distributionSetId, final int pagingOffsetParam, public ResponseEntity<PagedList<TargetRest>> getAssignedTargets(final Long distributionSetId,
final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
// immediately // immediately
@@ -175,12 +173,12 @@ public class DistributionSetResource implements DistributionSetRestApi {
targetsAssignedDS = this.targetManagement.findTargetByAssignedDistributionSet(distributionSetId, pageable); targetsAssignedDS = this.targetManagement.findTargetByAssignedDistributionSet(distributionSetId, pageable);
} }
return new ResponseEntity<>(new TargetPagedList(TargetMapper.toResponse(targetsAssignedDS.getContent()), return new ResponseEntity<>(new PagedList<>(TargetMapper.toResponse(targetsAssignedDS.getContent()),
targetsAssignedDS.getTotalElements()), HttpStatus.OK); targetsAssignedDS.getTotalElements()), HttpStatus.OK);
} }
@Override @Override
public ResponseEntity<TargetPagedList> getInstalledTargets(final Long distributionSetId, public ResponseEntity<PagedList<TargetRest>> getInstalledTargets(final Long distributionSetId,
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
// immediately // immediately
@@ -200,7 +198,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
pageable); pageable);
} }
return new ResponseEntity<>(new TargetPagedList(TargetMapper.toResponse(targetsInstalledDS.getContent()), return new ResponseEntity<>(new PagedList<TargetRest>(TargetMapper.toResponse(targetsInstalledDS.getContent()),
targetsInstalledDS.getTotalElements()), HttpStatus.OK); targetsInstalledDS.getTotalElements()), HttpStatus.OK);
} }
@@ -219,8 +217,8 @@ public class DistributionSetResource implements DistributionSetRestApi {
} }
@Override @Override
public ResponseEntity<MetadataRestPageList> getMetadata(final Long distributionSetId, final int pagingOffsetParam, public ResponseEntity<PagedList<MetadataRest>> getMetadata(final Long distributionSetId,
final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
// immediately // immediately
@@ -242,7 +240,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
} }
return new ResponseEntity<>( return new ResponseEntity<>(
new MetadataRestPageList(DistributionSetMapper.toResponseDsMetadata(metaDataPage.getContent()), new PagedList<>(DistributionSetMapper.toResponseDsMetadata(metaDataPage.getContent()),
metaDataPage.getTotalElements()), metaDataPage.getTotalElements()),
HttpStatus.OK); HttpStatus.OK);
@@ -323,7 +321,7 @@ public class DistributionSetResource implements DistributionSetRestApi {
} }
@Override @Override
public ResponseEntity<SoftwareModulePagedList> getAssignedSoftwareModules(final Long distributionSetId, public ResponseEntity<PagedList<SoftwareModuleRest>> getAssignedSoftwareModules(final Long distributionSetId,
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) { final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
// immediately // immediately
@@ -334,10 +332,8 @@ public class DistributionSetResource implements DistributionSetRestApi {
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting); final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);
final Page<SoftwareModule> softwaremodules = this.softwareManagement.findSoftwareModuleByAssignedTo(pageable, final Page<SoftwareModule> softwaremodules = this.softwareManagement.findSoftwareModuleByAssignedTo(pageable,
foundDs); foundDs);
return new ResponseEntity<>( return new ResponseEntity<>(new PagedList<>(SoftwareModuleMapper.toResponse(softwaremodules.getContent()),
new SoftwareModulePagedList(SoftwareModuleMapper.toResponse(softwaremodules.getContent()), softwaremodules.getTotalElements()), HttpStatus.OK);
softwaremodules.getTotalElements()),
HttpStatus.OK);
} }
private DistributionSet findDistributionSetWithExceptionIfNotFound(final Long distributionSetId) { private DistributionSet findDistributionSetWithExceptionIfNotFound(final Long distributionSetId) {

View File

@@ -20,10 +20,10 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult; import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.DistributionSetTagRestApi; import org.eclipse.hawkbit.rest.resource.api.DistributionSetTagRestApi;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetsRest; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.tag.AssignedDistributionSetRequestBody; import org.eclipse.hawkbit.rest.resource.model.tag.AssignedDistributionSetRequestBody;
import org.eclipse.hawkbit.rest.resource.model.tag.DistributionSetTagAssigmentResultRest; import org.eclipse.hawkbit.rest.resource.model.tag.DistributionSetTagAssigmentResultRest;
import org.eclipse.hawkbit.rest.resource.model.tag.TagPagedList;
import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.tag.TagRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagRest;
import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest;
@@ -53,8 +53,8 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi {
private DistributionSetManagement distributionSetManagement; private DistributionSetManagement distributionSetManagement;
@Override @Override
public ResponseEntity<TagPagedList> getDistributionSetTags(final int pagingOffsetParam, final int pagingLimitParam, public ResponseEntity<PagedList<TagRest>> getDistributionSetTags(final int pagingOffsetParam,
final String sortParam, final String rsqlParam) { final int pagingLimitParam, final String sortParam, final String rsqlParam) {
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
@@ -76,7 +76,7 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi {
} }
final List<TagRest> rest = TagMapper.toResponseDistributionSetTag(findTargetsAll.getContent()); final List<TagRest> rest = TagMapper.toResponseDistributionSetTag(findTargetsAll.getContent());
return new ResponseEntity<>(new TagPagedList(rest, countTargetsAll), HttpStatus.OK); return new ResponseEntity<>(new PagedList<>(rest, countTargetsAll), HttpStatus.OK);
} }
@Override @Override
@@ -121,7 +121,7 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi {
} }
@Override @Override
public ResponseEntity<DistributionSetsRest> getAssignedDistributionSets(final Long distributionsetTagId) { public ResponseEntity<List<DistributionSetRest>> getAssignedDistributionSets(final Long distributionsetTagId) {
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId); final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
return new ResponseEntity<>( return new ResponseEntity<>(
DistributionSetMapper.toResponseDistributionSets(tag.getAssignedToDistributionSet()), HttpStatus.OK); DistributionSetMapper.toResponseDistributionSets(tag.getAssignedToDistributionSet()), HttpStatus.OK);
@@ -151,7 +151,7 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi {
} }
@Override @Override
public ResponseEntity<DistributionSetsRest> assignDistributionSets(final Long distributionsetTagId, public ResponseEntity<List<DistributionSetRest>> assignDistributionSets(final Long distributionsetTagId,
final List<AssignedDistributionSetRequestBody> assignedDSRequestBodies) { final List<AssignedDistributionSetRequestBody> assignedDSRequestBodies) {
LOG.debug("Assign DistributionSet {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId); LOG.debug("Assign DistributionSet {} for ds tag {}", assignedDSRequestBodies.size(), distributionsetTagId);
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId); final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);

View File

@@ -21,15 +21,11 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi; import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypesRest;
/** /**
* A mapper which maps repository model to RESTful model representation and * A mapper which maps repository model to RESTful model representation and
* back. * back.
* *
*
*
*
*/ */
final class DistributionSetTypeMapper { final class DistributionSetTypeMapper {
@@ -63,7 +59,7 @@ final class DistributionSetTypeMapper {
} }
return smType; return smType;
}).forEach(softmType -> result.addMandatoryModuleType(softmType)); }).forEach(result::addMandatoryModuleType);
// Add optional // Add optional
smsRest.getOptionalmodules().stream().map(opt -> { smsRest.getOptionalmodules().stream().map(opt -> {
@@ -74,13 +70,13 @@ final class DistributionSetTypeMapper {
} }
return smType; return smType;
}).forEach(softmType -> result.addOptionalModuleType(softmType)); }).forEach(result::addOptionalModuleType);
return result; return result;
} }
static DistributionSetTypesRest toTypesResponse(final List<DistributionSetType> types) { static List<DistributionSetTypeRest> toTypesResponse(final List<DistributionSetType> types) {
final DistributionSetTypesRest response = new DistributionSetTypesRest(); final List<DistributionSetTypeRest> response = new ArrayList<>();
for (final DistributionSetType dsType : types) { for (final DistributionSetType dsType : types) {
response.add(toResponse(dsType)); response.add(toResponse(dsType));
} }

View File

@@ -21,13 +21,11 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi; import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi;
import org.eclipse.hawkbit.rest.resource.model.IdRest; import org.eclipse.hawkbit.rest.resource.model.IdRest;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypePagedList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest; import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypeRest;
import org.eclipse.hawkbit.rest.resource.model.distributionsettype.DistributionSetTypesRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@@ -56,7 +54,7 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi {
private DistributionSetManagement distributionSetManagement; private DistributionSetManagement distributionSetManagement;
@Override @Override
public ResponseEntity<DistributionSetTypePagedList> getDistributionSetTypes( public ResponseEntity<PagedList<DistributionSetTypeRest>> getDistributionSetTypes(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -81,7 +79,7 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi {
final List<DistributionSetTypeRest> rest = DistributionSetTypeMapper final List<DistributionSetTypeRest> rest = DistributionSetTypeMapper
.toListResponse(findModuleTypessAll.getContent()); .toListResponse(findModuleTypessAll.getContent());
return new ResponseEntity<>(new DistributionSetTypePagedList(rest, countModulesAll), HttpStatus.OK); return new ResponseEntity<>(new PagedList<>(rest, countModulesAll), HttpStatus.OK);
} }
@Override @Override
@@ -119,7 +117,7 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi {
} }
@Override @Override
public ResponseEntity<DistributionSetTypesRest> createDistributionSetTypes( public ResponseEntity<List<DistributionSetTypeRest>> createDistributionSetTypes(
@RequestBody final List<DistributionSetTypeRequestBodyPost> distributionSetTypes) { @RequestBody final List<DistributionSetTypeRequestBodyPost> distributionSetTypes) {
final List<DistributionSetType> createdSoftwareModules = distributionSetManagement.createDistributionSetTypes( final List<DistributionSetType> createdSoftwareModules = distributionSetManagement.createDistributionSetTypes(
@@ -139,14 +137,12 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi {
} }
@Override @Override
public ResponseEntity<SoftwareModuleTypesRest> getMandatoryModules(@PathVariable final Long distributionSetTypeId) { public ResponseEntity<List<SoftwareModuleTypeRest>> getMandatoryModules(
@PathVariable final Long distributionSetTypeId) {
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId); final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
return new ResponseEntity<>(SoftwareModuleTypeMapper.toListResponse(foundType.getMandatoryModuleTypes()),
final SoftwareModuleTypesRest rest = new SoftwareModuleTypesRest(); HttpStatus.OK);
rest.addAll(SoftwareModuleTypeMapper.toListResponse(foundType.getMandatoryModuleTypes()));
return new ResponseEntity<>(rest, HttpStatus.OK);
} }
@Override @Override
@@ -182,14 +178,13 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi {
} }
@Override @Override
public ResponseEntity<SoftwareModuleTypesRest> getOptionalModules(@PathVariable final Long distributionSetTypeId) { public ResponseEntity<List<SoftwareModuleTypeRest>> getOptionalModules(
@PathVariable final Long distributionSetTypeId) {
final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId); final DistributionSetType foundType = findDistributionSetTypeWithExceptionIfNotFound(distributionSetTypeId);
final SoftwareModuleTypesRest rest = new SoftwareModuleTypesRest(); return new ResponseEntity<>(SoftwareModuleTypeMapper.toListResponse(foundType.getOptionalModuleTypes()),
HttpStatus.OK);
rest.addAll(SoftwareModuleTypeMapper.toListResponse(foundType.getOptionalModuleTypes()));
return new ResponseEntity<>(rest, HttpStatus.OK);
} }
@Override @Override

View File

@@ -8,8 +8,8 @@
*/ */
package org.eclipse.hawkbit.rest.resource; package org.eclipse.hawkbit.rest.resource;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.NamedEntity; import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.TenantAwareBaseEntity;
import org.eclipse.hawkbit.rest.resource.model.BaseEntityRest; import org.eclipse.hawkbit.rest.resource.model.BaseEntityRest;
import org.eclipse.hawkbit.rest.resource.model.NamedEntityRest; import org.eclipse.hawkbit.rest.resource.model.NamedEntityRest;
@@ -28,7 +28,7 @@ final class RestModelMapper {
} }
static void mapBaseToBase(final BaseEntityRest response, final BaseEntity base) { static void mapBaseToBase(final BaseEntityRest response, final TenantAwareBaseEntity base) {
response.setCreatedBy(base.getCreatedBy()); response.setCreatedBy(base.getCreatedBy());
response.setLastModifiedBy(base.getLastModifiedBy()); response.setLastModifiedBy(base.getLastModifiedBy());
if (base.getCreatedAt() != null) { if (base.getCreatedAt() != null) {

View File

@@ -28,12 +28,10 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCond
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.RolloutRestApi; import org.eclipse.hawkbit.rest.resource.api.RolloutRestApi;
import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutPagedList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutResponseBody;
import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutRestRequestBody; import org.eclipse.hawkbit.rest.resource.model.rollout.RolloutRestRequestBody;
import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupPagedList;
import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupResponseBody; import org.eclipse.hawkbit.rest.resource.model.rolloutgroup.RolloutGroupResponseBody;
import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList;
import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@@ -64,8 +62,8 @@ public class RolloutResource implements RolloutRestApi {
private DistributionSetManagement distributionSetManagement; private DistributionSetManagement distributionSetManagement;
@Override @Override
public ResponseEntity<RolloutPagedList> getRollouts(final int pagingOffsetParam, final int pagingLimitParam, public ResponseEntity<PagedList<RolloutResponseBody>> getRollouts(final int pagingOffsetParam,
final String sortParam, final String rsqlParam) { final int pagingLimitParam, final String sortParam, final String rsqlParam) {
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
@@ -82,7 +80,7 @@ public class RolloutResource implements RolloutRestApi {
} }
final List<RolloutResponseBody> rest = RolloutMapper.toResponseRollout(findModulesAll.getContent()); final List<RolloutResponseBody> rest = RolloutMapper.toResponseRollout(findModulesAll.getContent());
return new ResponseEntity<>(new RolloutPagedList(rest, findModulesAll.getTotalElements()), HttpStatus.OK); return new ResponseEntity<>(new PagedList<>(rest, findModulesAll.getTotalElements()), HttpStatus.OK);
} }
@Override @Override
@@ -168,8 +166,8 @@ public class RolloutResource implements RolloutRestApi {
} }
@Override @Override
public ResponseEntity<RolloutGroupPagedList> getRolloutGroups(final Long rolloutId, final int pagingOffsetParam, public ResponseEntity<PagedList<RolloutGroupResponseBody>> getRolloutGroups(final Long rolloutId,
final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
final Rollout rollout = findRolloutOrThrowException(rolloutId); final Rollout rollout = findRolloutOrThrowException(rolloutId);
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
@@ -188,8 +186,7 @@ public class RolloutResource implements RolloutRestApi {
final List<RolloutGroupResponseBody> rest = RolloutMapper final List<RolloutGroupResponseBody> rest = RolloutMapper
.toResponseRolloutGroup(findRolloutGroupsAll.getContent()); .toResponseRolloutGroup(findRolloutGroupsAll.getContent());
return new ResponseEntity<>(new RolloutGroupPagedList(rest, findRolloutGroupsAll.getTotalElements()), return new ResponseEntity<>(new PagedList<>(rest, findRolloutGroupsAll.getTotalElements()), HttpStatus.OK);
HttpStatus.OK);
} }
@Override @Override
@@ -200,7 +197,7 @@ public class RolloutResource implements RolloutRestApi {
} }
@Override @Override
public ResponseEntity<TargetPagedList> getRolloutGroupTargets(final Long rolloutId, final Long groupId, public ResponseEntity<PagedList<TargetRest>> getRolloutGroupTargets(final Long rolloutId, final Long groupId,
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int pagingOffsetParam, final int pagingLimitParam, final String sortParam, final String rsqlParam) {
findRolloutOrThrowException(rolloutId); findRolloutOrThrowException(rolloutId);
final RolloutGroup rolloutGroup = findRolloutGroupOrThrowException(groupId); final RolloutGroup rolloutGroup = findRolloutGroupOrThrowException(groupId);
@@ -222,7 +219,8 @@ public class RolloutResource implements RolloutRestApi {
rolloutGroupTargets = pageTargets; rolloutGroupTargets = pageTargets;
} }
final List<TargetRest> rest = TargetMapper.toResponse(rolloutGroupTargets.getContent()); final List<TargetRest> rest = TargetMapper.toResponse(rolloutGroupTargets.getContent());
return new ResponseEntity<>(new TargetPagedList(rest, rolloutGroupTargets.getTotalElements()), HttpStatus.OK); return new ResponseEntity<>(new PagedList<TargetRest>(rest, rolloutGroupTargets.getTotalElements()),
HttpStatus.OK);
} }
private Rollout findRolloutOrThrowException(final Long rolloutId) { private Rollout findRolloutOrThrowException(final Long rolloutId) {

View File

@@ -26,18 +26,13 @@ import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleTypeRestApi;
import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRest;
import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactHash; import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactHash;
import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest; import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest;
import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactsRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest;
/** /**
* A mapper which maps repository model to RESTful model representation and * A mapper which maps repository model to RESTful model representation and
* back. * back.
* *
*
*
*
*/ */
public final class SoftwareModuleMapper { public final class SoftwareModuleMapper {
private SoftwareModuleMapper() { private SoftwareModuleMapper() {
@@ -102,8 +97,8 @@ public final class SoftwareModuleMapper {
return mappedList; return mappedList;
} }
static SoftwareModulesRest toResponseSoftwareModules(final Iterable<SoftwareModule> softwareModules) { static List<SoftwareModuleRest> toResponseSoftwareModules(final Iterable<SoftwareModule> softwareModules) {
final SoftwareModulesRest response = new SoftwareModulesRest(); final List<SoftwareModuleRest> response = new ArrayList<>();
for (final SoftwareModule softwareModule : softwareModules) { for (final SoftwareModule softwareModule : softwareModules) {
response.add(toResponse(softwareModule)); response.add(toResponse(softwareModule));
} }
@@ -192,8 +187,8 @@ public final class SoftwareModuleMapper {
return artifactRest; return artifactRest;
} }
static ArtifactsRest artifactsToResponse(final List<Artifact> artifacts) { static List<ArtifactRest> artifactsToResponse(final List<Artifact> artifacts) {
final ArtifactsRest mappedList = new ArtifactsRest(); final List<ArtifactRest> mappedList = new ArrayList<>();
if (artifacts != null) { if (artifacts != null) {
for (final Artifact artifact : artifacts) { for (final Artifact artifact : artifacts) {

View File

@@ -23,14 +23,11 @@ import org.eclipse.hawkbit.repository.model.SwMetadataCompositeKey;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleRestAPI; import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleRestAPI;
import org.eclipse.hawkbit.rest.resource.model.MetadataRest; import org.eclipse.hawkbit.rest.resource.model.MetadataRest;
import org.eclipse.hawkbit.rest.resource.model.MetadataRestPageList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest; import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactRest;
import org.eclipse.hawkbit.rest.resource.model.artifact.ArtifactsRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulePagedList;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest; import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModuleRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremodule.SoftwareModulesRest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -93,7 +90,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
} }
@Override @Override
public ResponseEntity<ArtifactsRest> getArtifacts(@PathVariable final Long softwareModuleId) { public ResponseEntity<List<ArtifactRest>> getArtifacts(@PathVariable final Long softwareModuleId) {
final SoftwareModule module = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); final SoftwareModule module = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
return new ResponseEntity<>(SoftwareModuleMapper.artifactsToResponse(module.getArtifacts()), HttpStatus.OK); return new ResponseEntity<>(SoftwareModuleMapper.artifactsToResponse(module.getArtifacts()), HttpStatus.OK);
@@ -120,7 +117,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
} }
@Override @Override
public ResponseEntity<SoftwareModulePagedList> getSoftwareModules( public ResponseEntity<PagedList<SoftwareModuleRest>> getSoftwareModules(
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -144,7 +141,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
} }
final List<SoftwareModuleRest> rest = SoftwareModuleMapper.toResponse(findModulesAll.getContent()); final List<SoftwareModuleRest> rest = SoftwareModuleMapper.toResponse(findModulesAll.getContent());
return new ResponseEntity<>(new SoftwareModulePagedList(rest, countModulesAll), HttpStatus.OK); return new ResponseEntity<>(new PagedList<>(rest, countModulesAll), HttpStatus.OK);
} }
@Override @Override
@@ -155,7 +152,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
} }
@Override @Override
public ResponseEntity<SoftwareModulesRest> createSoftwareModules( public ResponseEntity<List<SoftwareModuleRest>> createSoftwareModules(
@RequestBody final List<SoftwareModuleRequestBodyPost> softwareModules) { @RequestBody final List<SoftwareModuleRequestBodyPost> softwareModules) {
LOG.debug("creating {} softwareModules", softwareModules.size()); LOG.debug("creating {} softwareModules", softwareModules.size());
final Iterable<SoftwareModule> createdSoftwareModules = softwareManagement final Iterable<SoftwareModule> createdSoftwareModules = softwareManagement
@@ -193,7 +190,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
} }
@Override @Override
public ResponseEntity<MetadataRestPageList> getMetadata(@PathVariable final Long softwareModuleId, public ResponseEntity<PagedList<MetadataRest>> getMetadata(@PathVariable final Long softwareModuleId,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = RestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
@RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = RestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
@@ -217,7 +214,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
} }
return new ResponseEntity<>( return new ResponseEntity<>(
new MetadataRestPageList(SoftwareModuleMapper.toResponseSwMetadata(metaDataPage.getContent()), new PagedList<>(SoftwareModuleMapper.toResponseSwMetadata(metaDataPage.getContent()),
metaDataPage.getTotalElements()), metaDataPage.getTotalElements()),
HttpStatus.OK); HttpStatus.OK);
} }

View File

@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleTypeRestApi; import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleTypeRestApi;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest;
/** /**
* A mapper which maps repository model to RESTful model representation and * A mapper which maps repository model to RESTful model representation and
@@ -50,8 +49,8 @@ final class SoftwareModuleTypeMapper {
smsRest.getMaxAssignments()); smsRest.getMaxAssignments());
} }
static SoftwareModuleTypesRest toTypesResponse(final List<SoftwareModuleType> types) { static List<SoftwareModuleTypeRest> toTypesResponse(final List<SoftwareModuleType> types) {
final SoftwareModuleTypesRest response = new SoftwareModuleTypesRest(); final List<SoftwareModuleTypeRest> response = new ArrayList<>();
for (final SoftwareModuleType softwareModule : types) { for (final SoftwareModuleType softwareModule : types) {
response.add(toResponse(softwareModule)); response.add(toResponse(softwareModule));
} }

View File

@@ -18,11 +18,10 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleTypeRestApi; import org.eclipse.hawkbit.rest.resource.api.SoftwareModuleTypeRestApi;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypePagedList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPost;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest; import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypeRest;
import org.eclipse.hawkbit.rest.resource.model.softwaremoduletype.SoftwareModuleTypesRest;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
@@ -43,8 +42,8 @@ public class SoftwareModuleTypeResource implements SoftwareModuleTypeRestApi {
private SoftwareManagement softwareManagement; private SoftwareManagement softwareManagement;
@Override @Override
public ResponseEntity<SoftwareModuleTypePagedList> getTypes(final int pagingOffsetParam, final int pagingLimitParam, public ResponseEntity<PagedList<SoftwareModuleTypeRest>> getTypes(final int pagingOffsetParam,
final String sortParam, final String rsqlParam) { final int pagingLimitParam, final String sortParam, final String rsqlParam) {
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
@@ -65,7 +64,7 @@ public class SoftwareModuleTypeResource implements SoftwareModuleTypeRestApi {
final List<SoftwareModuleTypeRest> rest = SoftwareModuleTypeMapper final List<SoftwareModuleTypeRest> rest = SoftwareModuleTypeMapper
.toListResponse(findModuleTypessAll.getContent()); .toListResponse(findModuleTypessAll.getContent());
return new ResponseEntity<>(new SoftwareModuleTypePagedList(rest, countModulesAll), HttpStatus.OK); return new ResponseEntity<>(new PagedList<>(rest, countModulesAll), HttpStatus.OK);
} }
@Override @Override
@@ -99,7 +98,7 @@ public class SoftwareModuleTypeResource implements SoftwareModuleTypeRestApi {
} }
@Override @Override
public ResponseEntity<SoftwareModuleTypesRest> createSoftwareModuleTypes( public ResponseEntity<List<SoftwareModuleTypeRest>> createSoftwareModuleTypes(
final List<SoftwareModuleTypeRequestBodyPost> softwareModuleTypes) { final List<SoftwareModuleTypeRequestBodyPost> softwareModuleTypes) {
final List<SoftwareModuleType> createdSoftwareModules = this.softwareManagement final List<SoftwareModuleType> createdSoftwareModules = this.softwareManagement

View File

@@ -27,18 +27,16 @@ import org.eclipse.hawkbit.rest.resource.api.TargetRestApi;
import org.eclipse.hawkbit.rest.resource.model.PollStatusRest; import org.eclipse.hawkbit.rest.resource.model.PollStatusRest;
import org.eclipse.hawkbit.rest.resource.model.action.ActionRest; import org.eclipse.hawkbit.rest.resource.model.action.ActionRest;
import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusRest; import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusRest;
import org.eclipse.hawkbit.rest.resource.model.action.ActionStatussRest;
import org.eclipse.hawkbit.rest.resource.model.action.ActionsRest; import org.eclipse.hawkbit.rest.resource.model.action.ActionsRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody; import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody;
import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest;
/** /**
* A mapper which maps repository model to RESTful model representation and * A mapper which maps repository model to RESTful model representation and
* back. * back.
* *
*/ */
final public class TargetMapper { public final class TargetMapper {
private TargetMapper() { private TargetMapper() {
// Utility class // Utility class
@@ -64,7 +62,7 @@ final public class TargetMapper {
} }
/** /**
* Add the pollstatus to a target response. * Add the poll status to a target response.
* *
* @param target * @param target
* the target * the target
@@ -91,8 +89,8 @@ final public class TargetMapper {
* the targets * the targets
* @return the response * @return the response
*/ */
public static TargetsRest toResponseWithLinksAndPollStatus(final Iterable<Target> targets) { public static List<TargetRest> toResponseWithLinksAndPollStatus(final Iterable<Target> targets) {
final TargetsRest mappedList = new TargetsRest(); final List<TargetRest> mappedList = new ArrayList<>();
if (targets != null) { if (targets != null) {
for (final Target target : targets) { for (final Target target : targets) {
final TargetRest response = toResponse(target); final TargetRest response = toResponse(target);
@@ -111,8 +109,8 @@ final public class TargetMapper {
* list of targets * list of targets
* @return the response * @return the response
*/ */
public static TargetsRest toResponse(final Iterable<Target> targets) { public static List<TargetRest> toResponse(final Iterable<Target> targets) {
final TargetsRest mappedList = new TargetsRest(); final List<TargetRest> mappedList = new ArrayList<>();
if (targets != null) { if (targets != null) {
for (final Target target : targets) { for (final Target target : targets) {
final TargetRest response = toResponse(target); final TargetRest response = toResponse(target);
@@ -184,12 +182,12 @@ final public class TargetMapper {
return target; return target;
} }
static ActionStatussRest toActionStatusRestResponse(final Action action, final List<ActionStatus> actionStatus) { static List<ActionStatusRest> toActionStatusRestResponse(final List<ActionStatus> actionStatus) {
final ActionStatussRest mappedList = new ActionStatussRest(); final List<ActionStatusRest> mappedList = new ArrayList<>();
if (actionStatus != null) { if (actionStatus != null) {
for (final ActionStatus status : actionStatus) { for (final ActionStatus status : actionStatus) {
final ActionStatusRest response = toResponse(action, status); final ActionStatusRest response = toResponse(status);
mappedList.add(response); mappedList.add(response);
} }
} }
@@ -293,7 +291,7 @@ final public class TargetMapper {
return result; return result;
} }
private static ActionStatusRest toResponse(final Action action, final ActionStatus actionStatus) { private static ActionStatusRest toResponse(final ActionStatus actionStatus) {
final ActionStatusRest result = new ActionStatusRest(); final ActionStatusRest result = new ActionStatusRest();
result.setMessages(actionStatus.getMessages()); result.setMessages(actionStatus.getMessages());

View File

@@ -29,16 +29,14 @@ import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.DistributionSetRestApi; import org.eclipse.hawkbit.rest.resource.api.DistributionSetRestApi;
import org.eclipse.hawkbit.rest.resource.api.TargetRestApi; import org.eclipse.hawkbit.rest.resource.api.TargetRestApi;
import org.eclipse.hawkbit.rest.resource.helper.RestResourceConversionHelper; import org.eclipse.hawkbit.rest.resource.helper.RestResourceConversionHelper;
import org.eclipse.hawkbit.rest.resource.model.action.ActionPagedList; import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.action.ActionRest; import org.eclipse.hawkbit.rest.resource.model.action.ActionRest;
import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusPagedList; import org.eclipse.hawkbit.rest.resource.model.action.ActionStatusRest;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest; import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
import org.eclipse.hawkbit.rest.resource.model.target.DistributionSetAssigmentRest; import org.eclipse.hawkbit.rest.resource.model.target.DistributionSetAssigmentRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetAttributes; import org.eclipse.hawkbit.rest.resource.model.target.TargetAttributes;
import org.eclipse.hawkbit.rest.resource.model.target.TargetPagedList;
import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody; import org.eclipse.hawkbit.rest.resource.model.target.TargetRequestBody;
import org.eclipse.hawkbit.rest.resource.model.target.TargetRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -77,7 +75,7 @@ public class TargetResource implements TargetRestApi {
} }
@Override @Override
public ResponseEntity<TargetPagedList> getTargets(final int pagingOffsetParam, final int pagingLimitParam, public ResponseEntity<PagedList<TargetRest>> getTargets(final int pagingOffsetParam, final int pagingLimitParam,
final String sortParam, final String rsqlParam) { final String sortParam, final String rsqlParam) {
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
@@ -98,11 +96,11 @@ public class TargetResource implements TargetRestApi {
} }
final List<TargetRest> rest = TargetMapper.toResponse(findTargetsAll.getContent()); final List<TargetRest> rest = TargetMapper.toResponse(findTargetsAll.getContent());
return new ResponseEntity<>(new TargetPagedList(rest, countTargetsAll), HttpStatus.OK); return new ResponseEntity<>(new PagedList<TargetRest>(rest, countTargetsAll), HttpStatus.OK);
} }
@Override @Override
public ResponseEntity<TargetsRest> createTargets(final List<TargetRequestBody> targets) { public ResponseEntity<List<TargetRest>> createTargets(final List<TargetRequestBody> targets) {
LOG.debug("creating {} targets", targets.size()); LOG.debug("creating {} targets", targets.size());
final Iterable<Target> createdTargets = this.targetManagement.createTargets(TargetMapper.fromRequest(targets)); final Iterable<Target> createdTargets = this.targetManagement.createTargets(TargetMapper.fromRequest(targets));
LOG.debug("{} targets created, return status {}", targets.size(), HttpStatus.CREATED); LOG.debug("{} targets created, return status {}", targets.size(), HttpStatus.CREATED);
@@ -147,7 +145,7 @@ public class TargetResource implements TargetRestApi {
} }
@Override @Override
public ResponseEntity<ActionPagedList> getActionHistory(final String targetId, final int pagingOffsetParam, public ResponseEntity<PagedList<ActionRest>> getActionHistory(final String targetId, final int pagingOffsetParam,
final int pagingLimitParam, final String sortParam, final String rsqlParam) { final int pagingLimitParam, final String sortParam, final String rsqlParam) {
final Target foundTarget = findTargetWithExceptionIfNotFound(targetId); final Target foundTarget = findTargetWithExceptionIfNotFound(targetId);
@@ -169,7 +167,7 @@ public class TargetResource implements TargetRestApi {
} }
return new ResponseEntity<>( return new ResponseEntity<>(
new ActionPagedList(TargetMapper.toResponse(targetId, activeActions.getContent()), totalActionCount), new PagedList<>(TargetMapper.toResponse(targetId, activeActions.getContent()), totalActionCount),
HttpStatus.OK); HttpStatus.OK);
} }
@@ -220,7 +218,7 @@ public class TargetResource implements TargetRestApi {
} }
@Override @Override
public ResponseEntity<ActionStatusPagedList> getActionStatusList(final String targetId, final Long actionId, public ResponseEntity<PagedList<ActionStatusRest>> getActionStatusList(final String targetId, final Long actionId,
final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) { final int pagingOffsetParam, final int pagingLimitParam, final String sortParam) {
final Target target = findTargetWithExceptionIfNotFound(targetId); final Target target = findTargetWithExceptionIfNotFound(targetId);
@@ -238,10 +236,8 @@ public class TargetResource implements TargetRestApi {
final Page<ActionStatus> statusList = this.deploymentManagement.findActionStatusByAction( final Page<ActionStatus> statusList = this.deploymentManagement.findActionStatusByAction(
new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting), action, true); new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting), action, true);
return new ResponseEntity<>( return new ResponseEntity<>(new PagedList<>(TargetMapper.toActionStatusRestResponse(statusList.getContent()),
new ActionStatusPagedList(TargetMapper.toActionStatusRestResponse(action, statusList.getContent()), statusList.getTotalElements()), HttpStatus.OK);
statusList.getTotalElements()),
HttpStatus.OK);
} }

View File

@@ -20,13 +20,13 @@ import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult; import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.TargetTagRestApi; import org.eclipse.hawkbit.rest.resource.api.TargetTagRestApi;
import org.eclipse.hawkbit.rest.resource.model.PagedList;
import org.eclipse.hawkbit.rest.resource.model.tag.AssignedTargetRequestBody; import org.eclipse.hawkbit.rest.resource.model.tag.AssignedTargetRequestBody;
import org.eclipse.hawkbit.rest.resource.model.tag.TagPagedList;
import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut; import org.eclipse.hawkbit.rest.resource.model.tag.TagRequestBodyPut;
import org.eclipse.hawkbit.rest.resource.model.tag.TagRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagRest;
import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest; import org.eclipse.hawkbit.rest.resource.model.tag.TagsRest;
import org.eclipse.hawkbit.rest.resource.model.tag.TargetTagAssigmentResultRest; import org.eclipse.hawkbit.rest.resource.model.tag.TargetTagAssigmentResultRest;
import org.eclipse.hawkbit.rest.resource.model.target.TargetsRest; import org.eclipse.hawkbit.rest.resource.model.target.TargetRest;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -54,7 +54,7 @@ public class TargetTagResource implements TargetTagRestApi {
private TargetManagement targetManagement; private TargetManagement targetManagement;
@Override @Override
public ResponseEntity<TagPagedList> getTargetTags(final int pagingOffsetParam, final int pagingLimitParam, public ResponseEntity<PagedList<TagRest>> getTargetTags(final int pagingOffsetParam, final int pagingLimitParam,
final String sortParam, final String rsqlParam) { final String sortParam, final String rsqlParam) {
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
@@ -77,7 +77,7 @@ public class TargetTagResource implements TargetTagRestApi {
} }
final List<TagRest> rest = TagMapper.toResponse(findTargetsAll.getContent()); final List<TagRest> rest = TagMapper.toResponse(findTargetsAll.getContent());
return new ResponseEntity<>(new TagPagedList(rest, countTargetsAll), HttpStatus.OK); return new ResponseEntity<>(new PagedList<>(rest, countTargetsAll), HttpStatus.OK);
} }
@Override @Override
@@ -118,7 +118,7 @@ public class TargetTagResource implements TargetTagRestApi {
} }
@Override @Override
public ResponseEntity<TargetsRest> getAssignedTargets(final Long targetTagId) { public ResponseEntity<List<TargetRest>> getAssignedTargets(final Long targetTagId) {
final TargetTag targetTag = findTargetTagById(targetTagId); final TargetTag targetTag = findTargetTagById(targetTagId);
return new ResponseEntity<>(TargetMapper.toResponseWithLinksAndPollStatus(targetTag.getAssignedToTargets()), return new ResponseEntity<>(TargetMapper.toResponseWithLinksAndPollStatus(targetTag.getAssignedToTargets()),
HttpStatus.OK); HttpStatus.OK);
@@ -140,7 +140,7 @@ public class TargetTagResource implements TargetTagRestApi {
} }
@Override @Override
public ResponseEntity<TargetsRest> assignTargets(final Long targetTagId, public ResponseEntity<List<TargetRest>> assignTargets(final Long targetTagId,
final List<AssignedTargetRequestBody> assignedTargetRequestBodies) { final List<AssignedTargetRequestBody> assignedTargetRequestBodies) {
LOG.debug("Assign Targets {} for target tag {}", assignedTargetRequestBodies.size(), targetTagId); LOG.debug("Assign Targets {} for target tag {}", assignedTargetRequestBodies.size(), targetTagId);
final TargetTag targetTag = findTargetTagById(targetTagId); final TargetTag targetTag = findTargetTagById(targetTagId);

View File

@@ -97,9 +97,9 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
} }
@Override @Override
protected boolean isClickedByDefault(final Long buttonId) { protected boolean isClickedByDefault(final String typeName) {
return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && artifactUploadState return artifactUploadState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() && artifactUploadState
.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId); .getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
} }
@Override @Override

View File

@@ -161,7 +161,6 @@ public class SoftwareModuleDetailsTable extends Table {
if (null != distributionSet) { if (null != distributionSet) {
if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission()) { if (isUnassignSoftModAllowed && permissionChecker.hasUpdateDistributionPermission()) {
try { try {
distributionSetManagement.checkDistributionSetAlreadyUse(distributionSet);
isTargetAssigned = false; isTargetAssigned = false;
} catch (final EntityLockedException exception) { } catch (final EntityLockedException exception) {
isTargetAssigned = true; isTargetAssigned = true;

View File

@@ -114,7 +114,7 @@ public abstract class AbstractFilterButtons extends Table {
typeButton.addClickListener(event -> filterButtonClickBehaviour.processFilterButtonClick(event)); typeButton.addClickListener(event -> filterButtonClickBehaviour.processFilterButtonClick(event));
if (typeButton.getData().equals(SPUIDefinitions.NO_TAG_BUTTON_ID) && isNoTagSateSelected()) { if (typeButton.getData().equals(SPUIDefinitions.NO_TAG_BUTTON_ID) && isNoTagSateSelected()) {
filterButtonClickBehaviour.setDefaultClickedButton(typeButton); filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
} else if (id != null && isClickedByDefault(id)) { } else if (id != null && isClickedByDefault(name)) {
filterButtonClickBehaviour.setDefaultClickedButton(typeButton); filterButtonClickBehaviour.setDefaultClickedButton(typeButton);
} }
final DragAndDropWrapper wrapper = createDragAndDropWrapper(typeButton, name, id); final DragAndDropWrapper wrapper = createDragAndDropWrapper(typeButton, name, id);
@@ -205,10 +205,11 @@ public abstract class AbstractFilterButtons extends Table {
/** /**
* Check if button should be displayed as clicked by default. * Check if button should be displayed as clicked by default.
* *
* @param id * @param buttonCaption
* @return * button caption
* @return true if button is clicked
*/ */
protected abstract boolean isClickedByDefault(final Long buttonId); protected abstract boolean isClickedByDefault(final String buttonCaption);
/** /**
* Get filter button Id. * Get filter button Id.

View File

@@ -12,10 +12,7 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import com.vaadin.data.Container; import com.vaadin.data.Container;
import com.vaadin.data.Container.Indexed; import com.vaadin.data.Container.Indexed;
import com.vaadin.shared.ui.grid.HeightMode;
import com.vaadin.ui.Grid; import com.vaadin.ui.Grid;
import com.vaadin.ui.Label;
import com.vaadin.ui.themes.ValoTheme;
/** /**
* Abstract table class. * Abstract table class.

View File

@@ -79,10 +79,9 @@ public class DSTypeFilterButtons extends AbstractFilterButtons {
} }
@Override @Override
protected boolean isClickedByDefault(final Long buttonId) { protected boolean isClickedByDefault(final String typeName) {
return manageDistUIState.getManageDistFilters().getClickedDistSetType() != null return manageDistUIState.getManageDistFilters().getClickedDistSetType() != null
&& manageDistUIState.getManageDistFilters().getClickedDistSetType().getId().equals(buttonId); && manageDistUIState.getManageDistFilters().getClickedDistSetType().getName().equals(typeName);
} }
@Override @Override

View File

@@ -82,10 +82,9 @@ public class DistSMTypeFilterButtons extends AbstractFilterButtons {
} }
@Override @Override
protected boolean isClickedByDefault(final Long buttonId) { protected boolean isClickedByDefault(final String typeName) {
return manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent() return manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().isPresent()
&& manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getId().equals(buttonId); && manageDistUIState.getSoftwareModuleFilters().getSoftwareModuleType().get().getName().equals(typeName);
} }
@Override @Override

View File

@@ -16,7 +16,6 @@ import javax.annotation.PreDestroy;
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent; import org.eclipse.hawkbit.eventbus.event.DistributionSetTagCreatedBulkEvent;
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent; import org.eclipse.hawkbit.eventbus.event.DistributionSetTagDeletedEvent;
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagUpdateEvent; import org.eclipse.hawkbit.eventbus.event.DistributionSetTagUpdateEvent;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetTag; import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtonClickBehaviour; import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtonClickBehaviour;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons; import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterButtons;
@@ -58,9 +57,6 @@ public class DistributionTagButtons extends AbstractFilterButtons {
@Autowired @Autowired
private DistributionTagDropEvent spDistTagDropEvent; private DistributionTagDropEvent spDistTagDropEvent;
@Autowired
private transient TagManagement tagMgmtService;
@Autowired @Autowired
private ManagementUIState managementUIState; private ManagementUIState managementUIState;
@@ -121,10 +117,9 @@ public class DistributionTagButtons extends AbstractFilterButtons {
} }
@Override @Override
protected boolean isClickedByDefault(final Long buttonId) { protected boolean isClickedByDefault(final String tagName) {
final DistributionSetTag dsTagObject = tagMgmtService.findDistributionSetTagById(buttonId);
return null != managementUIState.getDistributionTableFilters().getDistSetTags() return null != managementUIState.getDistributionTableFilters().getDistSetTags()
&& managementUIState.getDistributionTableFilters().getDistSetTags().contains(dsTagObject.getName()); && managementUIState.getDistributionTableFilters().getDistSetTags().contains(tagName);
} }
@Override @Override

View File

@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.eventbus.event.TargetTagCreatedBulkEvent;
import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent; import org.eclipse.hawkbit.eventbus.event.TargetTagDeletedEvent;
import org.eclipse.hawkbit.eventbus.event.TargetTagUpdateEvent; import org.eclipse.hawkbit.eventbus.event.TargetTagUpdateEvent;
import org.eclipse.hawkbit.repository.SpPermissionChecker; import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.model.TargetIdName; import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.repository.model.TargetTag; import org.eclipse.hawkbit.repository.model.TargetTag;
@@ -70,9 +69,6 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
@Autowired @Autowired
private ManagementUIState managementUIState; private ManagementUIState managementUIState;
@Autowired
private transient TagManagement tagMgmtService;
@Autowired @Autowired
private ManagementViewAcceptCriteria managementViewAcceptCriteria; private ManagementViewAcceptCriteria managementViewAcceptCriteria;
@@ -139,10 +135,9 @@ public class TargetTagFilterButtons extends AbstractFilterButtons {
} }
@Override @Override
protected boolean isClickedByDefault(final Long buttonId) { protected boolean isClickedByDefault(final String tagName) {
final TargetTag newTagClickedObj = tagMgmtService.findTargetTagById(buttonId); return managementUIState.getTargetTableFilters().getClickedTargetTags() != null
return managementUIState.getTargetTableFilters().getClickedTargetTags() != null && managementUIState && managementUIState.getTargetTableFilters().getClickedTargetTags().contains(tagName);
.getTargetTableFilters().getClickedTargetTags().contains(newTagClickedObj.getName());
} }
@Override @Override

View File

@@ -42,15 +42,15 @@ import com.vaadin.ui.UI;
* {@link com.google.common.eventbus.EventBus} and store them first in an queue * {@link com.google.common.eventbus.EventBus} and store them first in an queue
* where they will dispatched every 2 seconds to the {@link EventBus} in a * where they will dispatched every 2 seconds to the {@link EventBus} in a
* Vaadin access thread {@link UI#access(Runnable)}. * Vaadin access thread {@link UI#access(Runnable)}.
* *
* This strategy avoids blocking UIs when too many events are fired and * This strategy avoids blocking UIs when too many events are fired and
* dispatched to the UI thread. The UI will freeze in the time. To avoid that * dispatched to the UI thread. The UI will freeze in the time. To avoid that
* all events are collected first and same events are merged to a list of events * all events are collected first and same events are merged to a list of events
* before they dispatched to the UI thread. * before they dispatched to the UI thread.
* *
* The strategy also verifies the current tenant in the session with the tenant * The strategy also verifies the current tenant in the session with the tenant
* in the event and only forwards event from the right tenant to the UI. * in the event and only forwards event from the right tenant to the UI.
* *
*/ */
public class DelayedEventBusPushStrategy implements EventPushStrategy { public class DelayedEventBusPushStrategy implements EventPushStrategy {
@@ -68,7 +68,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
/** /**
* Constructor. * Constructor.
* *
* @param eventBus * @param eventBus
* the session event bus to where the events should be dispatched * the session event bus to where the events should be dispatched
* @param systemEventBus * @param systemEventBus
@@ -130,7 +130,7 @@ public class DelayedEventBusPushStrategy implements EventPushStrategy {
/** /**
* Checks if the tenant within the event is equal with the current tenant in * Checks if the tenant within the event is equal with the current tenant in
* the context. * the context.
* *
* @param userContext * @param userContext
* the security context of the current session * the security context of the current session
* @param event * @param event