Split into separate maven modules.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-05-25 17:43:57 +02:00
parent cf450dabfa
commit f2e13b8d22
310 changed files with 647 additions and 482 deletions

View File

@@ -46,7 +46,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>

View File

@@ -38,7 +38,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -93,7 +93,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<classifier>tests</classifier> <classifier>tests</classifier>
<scope>test</scope> <scope>test</scope>

View File

@@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -90,7 +90,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<classifier>tests</classifier> <classifier>tests</classifier>
</dependency> </dependency>

View File

@@ -22,7 +22,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -23,7 +23,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
@@ -92,7 +92,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.hawkbit</groupId> <groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId> <artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
<classifier>tests</classifier> <classifier>tests</classifier>
<scope>test</scope> <scope>test</scope>

View File

@@ -32,9 +32,8 @@ import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SystemManagement; import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TargetManagement; import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TargetWithActionType;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.TargetWithActionType;
import org.eclipse.hawkbit.repository.jpa.model.DsMetadataCompositeKey;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -94,7 +93,8 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
if (rsqlParam != null) { if (rsqlParam != null) {
findDsPage = this.distributionSetManagement.findDistributionSetsAll(rsqlParam, pageable, false); findDsPage = this.distributionSetManagement.findDistributionSetsAll(rsqlParam, pageable, false);
} else { } else {
findDsPage = this.distributionSetManagement.findDistributionSetsByDeletedAndOrCompleted(pageable, false, null); findDsPage = this.distributionSetManagement.findDistributionSetsByDeletedAndOrCompleted(pageable, false,
null);
} }
final List<MgmtDistributionSet> rest = MgmtDistributionSetMapper.toResponseFromDsList(findDsPage.getContent()); final List<MgmtDistributionSet> rest = MgmtDistributionSetMapper.toResponseFromDsList(findDsPage.getContent());
@@ -273,8 +273,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
// immediately // immediately
final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId); final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId);
final DistributionSetMetadata findOne = this.distributionSetManagement final DistributionSetMetadata findOne = this.distributionSetManagement.findOne(ds, metadataKey);
.findOne(new DsMetadataCompositeKey(ds, metadataKey));
return ResponseEntity.<MgmtMetadata> ok(MgmtDistributionSetMapper.toResponseDsMetadata(findOne)); return ResponseEntity.<MgmtMetadata> ok(MgmtDistributionSetMapper.toResponseDsMetadata(findOne));
} }
@@ -295,7 +294,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
// check if distribution set exists otherwise throw exception // check if distribution set exists otherwise throw exception
// immediately // immediately
final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId); final DistributionSet ds = findDistributionSetWithExceptionIfNotFound(distributionSetId);
this.distributionSetManagement.deleteDistributionSetMetadata(new DsMetadataCompositeKey(ds, metadataKey)); this.distributionSetManagement.deleteDistributionSetMetadata(ds, metadataKey);
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
} }

View File

@@ -23,7 +23,6 @@ import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest; import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.model.SwMetadataCompositeKey;
import org.eclipse.hawkbit.repository.model.Artifact; import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata; import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
@@ -246,7 +245,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
public ResponseEntity<Void> deleteMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId, public ResponseEntity<Void> deleteMetadata(@PathVariable("softwareModuleId") final Long softwareModuleId,
@PathVariable("metadataKey") final String metadataKey) { @PathVariable("metadataKey") final String metadataKey) {
final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
softwareManagement.deleteSoftwareModuleMetadata(new SwMetadataCompositeKey(sw, metadataKey)); softwareManagement.deleteSoftwareModuleMetadata(sw, metadataKey);
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
} }

View File

@@ -30,7 +30,6 @@ import org.eclipse.hawkbit.TestDataUtil;
import org.eclipse.hawkbit.WithUser; import org.eclipse.hawkbit.WithUser;
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants; import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.model.DsMetadataCompositeKey;
import org.eclipse.hawkbit.repository.model.Action.Status; import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
@@ -685,10 +684,8 @@ public class MgmtDistributionSetResourceTest extends AbstractRestIntegrationTest
.andExpect(jsonPath("[1]key", equalTo(knownKey2))) .andExpect(jsonPath("[1]key", equalTo(knownKey2)))
.andExpect(jsonPath("[1]value", equalTo(knownValue2))); .andExpect(jsonPath("[1]value", equalTo(knownValue2)));
final DistributionSetMetadata metaKey1 = distributionSetManagement final DistributionSetMetadata metaKey1 = distributionSetManagement.findOne(testDS, knownKey1);
.findOne(new DsMetadataCompositeKey(testDS, knownKey1)); final DistributionSetMetadata metaKey2 = distributionSetManagement.findOne(testDS, knownKey2);
final DistributionSetMetadata metaKey2 = distributionSetManagement
.findOne(new DsMetadataCompositeKey(testDS, knownKey2));
assertThat(metaKey1.getValue()).isEqualTo(knownValue1); assertThat(metaKey1.getValue()).isEqualTo(knownValue1);
assertThat(metaKey2.getValue()).isEqualTo(knownValue2); assertThat(metaKey2.getValue()).isEqualTo(knownValue2);
@@ -715,8 +712,7 @@ public class MgmtDistributionSetResourceTest extends AbstractRestIntegrationTest
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue))); .andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue)));
final DistributionSetMetadata assertDS = distributionSetManagement final DistributionSetMetadata assertDS = distributionSetManagement.findOne(testDS, knownKey);
.findOne(new DsMetadataCompositeKey(testDS, knownKey));
assertThat(assertDS.getValue()).isEqualTo(updateValue); assertThat(assertDS.getValue()).isEqualTo(updateValue);
} }
@@ -737,7 +733,7 @@ public class MgmtDistributionSetResourceTest extends AbstractRestIntegrationTest
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk()); .andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
try { try {
distributionSetManagement.findOne(new DsMetadataCompositeKey(testDS, knownKey)); distributionSetManagement.findOne(testDS, knownKey);
fail("expected EntityNotFoundException but didn't throw"); fail("expected EntityNotFoundException but didn't throw");
} catch (final EntityNotFoundException e) { } catch (final EntityNotFoundException e) {
// ok as expected // ok as expected

View File

@@ -0,0 +1,40 @@
<!--
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
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository</artifactId>
<version>0.2.0-SNAPSHOT</version>
</parent>
<artifactId>hawkbit-repository-api</artifactId>
<name>hawkBit :: Repository API</name>
<dependencies>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-security-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.hateoas</groupId>
<artifactId>spring-hateoas</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -16,7 +16,6 @@ import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException; import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.TargetWithActionType;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.ActionType; import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.ActionStatus; import org.eclipse.hawkbit.repository.model.ActionStatus;
@@ -101,8 +100,6 @@ public interface DeploymentManagement {
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID, DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID,
@NotEmpty Collection<TargetWithActionType> targets); @NotEmpty Collection<TargetWithActionType> targets);
// TODO document: why are rollouts in the signature ? can all the parameters
// be null or the list empty?
/** /**
* method assigns the {@link DistributionSet} to all {@link Target}s by * method assigns the {@link DistributionSet} to all {@link Target}s by
* their IDs with a specific {@link ActionType} and {@code forcetime}. * their IDs with a specific {@link ActionType} and {@code forcetime}.
@@ -190,7 +187,6 @@ public interface DeploymentManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Long countActionsByTarget(@NotNull Target target); Long countActionsByTarget(@NotNull Target target);
// TODO: validate parameters
/** /**
* Creates an action entry into the action repository. In case of existing * Creates an action entry into the action repository. In case of existing
* scheduled actions the scheduled actions gets canceled. A scheduled action * scheduled actions the scheduled actions gets canceled. A scheduled action
@@ -210,8 +206,9 @@ public interface DeploymentManagement {
* the roll out group for this action * the roll out group for this action
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
void createScheduledAction(Collection<Target> targets, DistributionSet distributionSet, ActionType actionType, void createScheduledAction(@NotEmpty Collection<Target> targets, @NotNull DistributionSet distributionSet,
long forcedTime, Rollout rollout, RolloutGroup rolloutGroup); @NotNull ActionType actionType, Long forcedTime, @NotNull Rollout rollout,
@NotNull RolloutGroup rolloutGroup);
/** /**
* Get the {@link Action} entity for given actionId. * Get the {@link Action} entity for given actionId.

View File

@@ -12,7 +12,6 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.persistence.Entity;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -21,8 +20,6 @@ import org.eclipse.hawkbit.repository.exception.DistributionSetCreationFailedMis
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException; import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
import org.eclipse.hawkbit.repository.jpa.model.DistributionSetTypeElement;
import org.eclipse.hawkbit.repository.jpa.model.DsMetadataCompositeKey;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata; import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
@@ -37,8 +34,6 @@ import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Management service for {@link DistributionSet}s. * Management service for {@link DistributionSet}s.
@@ -176,7 +171,6 @@ public interface DistributionSetManagement {
* @return created {@link Entity} * @return created {@link Entity}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
List<DistributionSetType> createDistributionSetTypes(@NotNull Collection<DistributionSetType> types); List<DistributionSetType> createDistributionSetTypes(@NotNull Collection<DistributionSetType> types);
/** /**
@@ -215,7 +209,7 @@ public interface DistributionSetManagement {
* the ID of the distribution set meta data to delete * the ID of the distribution set meta data to delete
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
void deleteDistributionSetMetadata(@NotNull DsMetadataCompositeKey id); void deleteDistributionSetMetadata(@NotNull final DistributionSet distributionSet, @NotNull final String key);
/** /**
* Deletes or mark as delete in case the type is in use. * Deletes or mark as delete in case the type is in use.
@@ -456,7 +450,7 @@ public interface DistributionSetManagement {
* in case the meta data does not exists for the given key * in case the meta data does not exists for the given key
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
DistributionSetMetadata findOne(@NotNull DsMetadataCompositeKey id); DistributionSetMetadata findOne(@NotNull DistributionSet distributionSet, @NotNull String key);
/** /**
* Generates an empty {@link DistributionSet} without persisting it. * Generates an empty {@link DistributionSet} without persisting it.

View File

@@ -67,6 +67,10 @@ public interface ReportManagement {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final PerMonth PER_MONTH = new PerMonth(); private static final PerMonth PER_MONTH = new PerMonth();
private DateTypes() {
// Utility class
}
/** /**
* @return PerMonth * @return PerMonth
*/ */
@@ -74,9 +78,6 @@ public interface ReportManagement {
return PER_MONTH; return PER_MONTH;
} }
private DateTypes() {
}
} }
/** /**

View File

@@ -18,7 +18,6 @@ import org.eclipse.hawkbit.repository.model.TargetWithActionStatus;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
/** /**
@@ -40,7 +39,6 @@ public interface RolloutGroupManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Page<RolloutGroup> findAllRolloutGroupsWithDetailedStatus(@NotNull Long rolloutId, @NotNull Pageable pageable); Page<RolloutGroup> findAllRolloutGroupsWithDetailedStatus(@NotNull Long rolloutId, @NotNull Pageable pageable);
// TODO discuss: target read perm missing?
/** /**
* *
* Find all targets with action status by rollout group id. The action * Find all targets with action status by rollout group id. The action
@@ -55,7 +53,7 @@ public interface RolloutGroupManagement {
* rollout group * rollout group
* @return {@link TargetWithActionStatus} target with action status * @return {@link TargetWithActionStatus} target with action status
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
Page<TargetWithActionStatus> findAllTargetsWithActionStatus(@NotNull PageRequest pageRequest, Page<TargetWithActionStatus> findAllTargetsWithActionStatus(@NotNull PageRequest pageRequest,
@NotNull RolloutGroup rolloutGroup); @NotNull RolloutGroup rolloutGroup);
@@ -100,7 +98,6 @@ public interface RolloutGroupManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
Page<RolloutGroup> findRolloutGroupsByRolloutId(@NotNull Long rolloutId, @NotNull Pageable pageable); Page<RolloutGroup> findRolloutGroupsByRolloutId(@NotNull Long rolloutId, @NotNull Pageable pageable);
// TODO discuss: target read perm missing?
/** /**
* Get targets of specified rollout group. * Get targets of specified rollout group.
* *
@@ -111,10 +108,9 @@ public interface RolloutGroupManagement {
* *
* @return Page<Target> list of targets of a rollout group * @return Page<Target> list of targets of a rollout group
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
Page<Target> findRolloutGroupTargets(@NotNull RolloutGroup rolloutGroup, @NotNull Pageable page); Page<Target> findRolloutGroupTargets(@NotNull RolloutGroup rolloutGroup, @NotNull Pageable page);
// TODO discuss: target read perm missing?
/** /**
* Get targets of specified rollout group. * Get targets of specified rollout group.
* *
@@ -127,7 +123,7 @@ public interface RolloutGroupManagement {
* *
* @return Page<Target> list of targets of a rollout group * @return Page<Target> list of targets of a rollout group
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
Page<Target> findRolloutGroupTargets(@NotNull RolloutGroup rolloutGroup, @NotNull String rsqlParam, Page<Target> findRolloutGroupTargets(@NotNull RolloutGroup rolloutGroup, @NotNull String rsqlParam,
@NotNull Pageable pageable); @NotNull Pageable pageable);

View File

@@ -11,14 +11,12 @@ package org.eclipse.hawkbit.repository;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import javax.persistence.Entity;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException; import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.model.SwMetadataCompositeKey; import org.eclipse.hawkbit.repository.model.AssignedSoftwareModule;
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata; import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
@@ -159,7 +157,7 @@ public interface SoftwareManagement {
* the ID of the software module meta data to delete * the ID of the software module meta data to delete
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
void deleteSoftwareModuleMetadata(@NotNull SwMetadataCompositeKey id); void deleteSoftwareModuleMetadata(@NotNull SoftwareModule softwareModule, @NotNull String key);
/** /**
* Deletes {@link SoftwareModule}s which is any if the given ids. * Deletes {@link SoftwareModule}s which is any if the given ids.
@@ -312,7 +310,7 @@ public interface SoftwareManagement {
* @return the page of found {@link SoftwareModule} * @return the page of found {@link SoftwareModule}
*/ */
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Slice<CustomSoftwareModule> findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc( Slice<AssignedSoftwareModule> findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
@NotNull Pageable pageable, @NotNull Long orderByDistributionId, String searchText, @NotNull Pageable pageable, @NotNull Long orderByDistributionId, String searchText,
SoftwareModuleType type); SoftwareModuleType type);

View File

@@ -12,7 +12,6 @@ import java.net.URI;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import javax.persistence.Entity;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;

View File

@@ -6,14 +6,14 @@
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
*/ */
package org.eclipse.hawkbit.repository.jpa; package org.eclipse.hawkbit.repository;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.ActionType; import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.repository.model.Target;
/** /**
* A custom JPA database return value object with the proper constructor so JPA * A custom view on {@link Target} with {@link ActionType}.
* is able to parse the result-set directly into this object.
* *
* *
* *

View File

@@ -6,7 +6,7 @@
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
*/ */
package org.eclipse.hawkbit.repository.rsql; package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError; import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.SpServerRtException; import org.eclipse.hawkbit.exception.SpServerRtException;

View File

@@ -6,7 +6,7 @@
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
*/ */
package org.eclipse.hawkbit.repository.rsql; package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.SpServerError; import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.exception.SpServerRtException; import org.eclipse.hawkbit.exception.SpServerRtException;

View File

@@ -0,0 +1,48 @@
/**
* 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;
/**
* View for querying {@link Action} include the count of the action's
* {@link ActionStatus} entries.
*
*/
public interface ActionWithStatusCount {
/**
* @return {@link Action}
*/
Action getAction();
/**
* @return {@link DistributionSet} ID.
*/
Long getDsId();
/**
* @return {@link DistributionSet} name.
*/
String getDsName();
/**
* @return {@link DistributionSet} version.
*/
String getDsVersion();
/**
* @return number of {@link ActionStatus} entries
*/
Long getActionStatusCount();
/**
* @return name of the {@link Rollout}.
*/
String getRolloutName();
}

View File

@@ -14,7 +14,7 @@ import java.io.Serializable;
* Use to display software modules for the selected distribution. * Use to display software modules for the selected distribution.
* *
*/ */
public class CustomSoftwareModule implements Serializable { public class AssignedSoftwareModule implements Serializable {
private static final long serialVersionUID = 6144585781451168439L; private static final long serialVersionUID = 6144585781451168439L;
@@ -31,22 +31,28 @@ public class CustomSoftwareModule implements Serializable {
* as true if the software module is assigned and false if not * as true if the software module is assigned and false if not
* assigned. * assigned.
*/ */
public CustomSoftwareModule(final SoftwareModule softwareModule, final boolean assigned) { public AssignedSoftwareModule(final SoftwareModule softwareModule, final boolean assigned) {
this.softwareModule = softwareModule; this.softwareModule = softwareModule;
this.assigned = assigned; this.assigned = assigned;
} }
/**
* @return {@link SoftwareModule}
*/
public SoftwareModule getSoftwareModule() { public SoftwareModule getSoftwareModule() {
return softwareModule; return softwareModule;
} }
/**
* @return <code>true</code> if assigned
*/
public boolean isAssigned() { public boolean isAssigned() {
return assigned; return assigned;
} }
@Override @Override
public String toString() { public String toString() {
return "CustomSoftwareModule [softwareModule=" + softwareModule + ", assigned=" + assigned + "]"; return "AssignedSoftwareModule [softwareModule=" + softwareModule + ", assigned=" + assigned + "]";
} }
@Override @Override
@@ -66,10 +72,10 @@ public class CustomSoftwareModule implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!(obj instanceof CustomSoftwareModule)) { if (!(obj instanceof AssignedSoftwareModule)) {
return false; return false;
} }
final CustomSoftwareModule other = (CustomSoftwareModule) obj; final AssignedSoftwareModule other = (AssignedSoftwareModule) obj;
if (assigned != other.assigned) { if (assigned != other.assigned) {
return false; return false;
} }

View File

@@ -19,7 +19,6 @@ public class AssignmentResult<T extends BaseEntity> {
private final int total; private final int total;
private final int assigned; private final int assigned;
private final int alreadyAssigned; private final int alreadyAssigned;
private final int unassigned; private final int unassigned;
private final List<T> assignedEntity; private final List<T> assignedEntity;
private final List<T> unassignedEntity; private final List<T> unassignedEntity;
@@ -47,28 +46,45 @@ public class AssignmentResult<T extends BaseEntity> {
this.assignedEntity = assignedEntity; this.assignedEntity = assignedEntity;
this.unassignedEntity = unassignedEntity; this.unassignedEntity = unassignedEntity;
} }
/**
* @return number of newly assigned elements.
*/
public int getAssigned() { public int getAssigned() {
return assigned; return assigned;
} }
/**
* @return total number (assigned and already assigned).
*/
public int getTotal() { public int getTotal() {
return total; return total;
} }
/**
* @return number of already assigned/ignored elements.
*/
public int getAlreadyAssigned() { public int getAlreadyAssigned() {
return alreadyAssigned; return alreadyAssigned;
} }
/**
* @return number of unsassigned elements
*/
public int getUnassigned() { public int getUnassigned() {
return unassigned; return unassigned;
} }
/**
* @return {@link List} of assigned entity.
*/
public List<T> getAssignedEntity() { public List<T> getAssignedEntity() {
return assignedEntity; return assignedEntity;
} }
/**
* @return {@link List} of unassigned entity.
*/
public List<T> getUnassignedEntity() { public List<T> getUnassignedEntity() {
return unassignedEntity; return unassignedEntity;
} }

View File

@@ -10,8 +10,6 @@ package org.eclipse.hawkbit.repository.model;
import java.util.Set; import java.util.Set;
import org.eclipse.hawkbit.repository.jpa.model.DistributionSetTypeElement;
/** /**
* A {@link DistributionSetType} is an abstract definition for * A {@link DistributionSetType} is an abstract definition for
* {@link DistributionSet} that defines what {@link SoftwareModule}s can be * {@link DistributionSet} that defines what {@link SoftwareModule}s can be

Some files were not shown because too many files have changed in this diff Show More