Removed default implementations as JaCoCo has problems with those. Split

software management.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-05-18 16:16:30 +02:00
parent 6654d71969
commit 3c0d5396b0
50 changed files with 789 additions and 523 deletions

View File

@@ -24,11 +24,11 @@ import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
import org.eclipse.hawkbit.cache.CacheConstants;
import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.jpa.SystemManagement;
import org.eclipse.hawkbit.im.authentication.TenantUserPasswordAuthenticationToken;
import org.eclipse.hawkbit.im.authentication.UserAuthenticationFilter;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.rest.resource.RestConstants;
import org.eclipse.hawkbit.security.ControllerTenantAwareAuthenticationDetailsSource;
import org.eclipse.hawkbit.security.DdiSecurityProperties;

View File

@@ -371,18 +371,18 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
logAndThrowMessageError(message, "Status for action does not exisit.");
}
final Action addUpdateActionStatus = getUpdateActionStatus(action, actionStatus);
final Action addUpdateActionStatus = getUpdateActionStatus(actionStatus);
if (!addUpdateActionStatus.isActive()) {
lookIfUpdateAvailable(action.getTarget());
}
}
private Action getUpdateActionStatus(final Action action, final ActionStatus actionStatus) {
private Action getUpdateActionStatus(final ActionStatus actionStatus) {
if (actionStatus.getStatus().equals(Status.CANCELED)) {
return controllerManagement.addCancelActionStatus(actionStatus, action);
return controllerManagement.addCancelActionStatus(actionStatus);
}
return controllerManagement.addUpdateActionStatus(actionStatus, action);
return controllerManagement.addUpdateActionStatus(actionStatus);
}
private Action checkActionExist(final Message message, final ActionUpdateStatus actionUpdateStatus) {

View File

@@ -346,7 +346,7 @@ public class AmqpMessageHandlerServiceTest {
// Mock
final Action action = createActionWithTarget(22L, Status.FINISHED);
when(controllerManagementMock.findActionWithDetails(Matchers.any())).thenReturn(action);
when(controllerManagementMock.addUpdateActionStatus(Matchers.any(), Matchers.any())).thenReturn(action);
when(controllerManagementMock.addUpdateActionStatus(Matchers.any())).thenReturn(action);
// for the test the same action can be used
final List<Action> actionList = new ArrayList<>();
actionList.add(action);

View File

@@ -32,8 +32,6 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.hateoas.Identifiable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;
/**
* Service for {@link Artifact} management operations.
@@ -99,11 +97,8 @@ public interface ArtifactManagement {
* @throw ArtifactUploadFailedException if upload fails
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
default LocalArtifact createLocalArtifact(final InputStream inputStream, final Long moduleId, final String filename,
final boolean overrideExisting) {
return createLocalArtifact(inputStream, moduleId, filename, null, null, overrideExisting, null);
}
LocalArtifact createLocalArtifact(@NotNull InputStream inputStream, @NotNull Long moduleId, final String filename,
final boolean overrideExisting);
/**
* Persists artifact binary as provided by given InputStream. assign the
@@ -126,11 +121,8 @@ public interface ArtifactManagement {
* @throw ArtifactUploadFailedException if upload fails
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
default LocalArtifact createLocalArtifact(final InputStream inputStream, final Long moduleId, final String filename,
final boolean overrideExisting, final String contentType) {
return createLocalArtifact(inputStream, moduleId, filename, null, null, overrideExisting, contentType);
}
LocalArtifact createLocalArtifact(@NotNull InputStream inputStream, @NotNull Long moduleId,
@NotNull String filename, final boolean overrideExisting, @NotNull String contentType);
/**
* Persists artifact binary as provided by given InputStream. assign the
@@ -282,14 +274,7 @@ public interface ArtifactManagement {
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
default SoftwareModule findSoftwareModuleWithDetails(@NotNull final Long id) {
final SoftwareModule result = findSoftwareModuleById(id);
if (result != null) {
result.getArtifacts().size();
}
return result;
}
SoftwareModule findSoftwareModuleWithDetails(@NotNull Long id);
/**
* Loads {@link org.eclipse.hawkbit.artifact.server.json.model.Artifact}
@@ -307,4 +292,4 @@ public interface ArtifactManagement {
+ SpringEvalExpressions.HAS_CONTROLLER_DOWNLOAD)
DbArtifact loadLocalArtifactBinary(@NotNull LocalArtifact artifact);
}
}

View File

@@ -249,9 +249,7 @@ public interface ControllerManagement {
*/
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
default TargetInfo updateLastTargetQuery(@NotNull final TargetInfo target, @NotNull final URI address) {
return updateTargetStatus(target, null, System.currentTimeMillis(), address);
}
TargetInfo updateLastTargetQuery(@NotNull TargetInfo target, @NotNull URI address);
/**
* Update selective the target status of a given {@code target}.
@@ -273,4 +271,4 @@ public interface ControllerManagement {
TargetInfo updateTargetStatus(@NotNull TargetInfo targetInfo, TargetUpdateStatus status, Long lastTargetQuery,
URI address);
}
}

View File

@@ -8,9 +8,7 @@
*/
package org.eclipse.hawkbit.repository;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.validation.constraints.NotNull;
@@ -82,14 +80,8 @@ public interface DeploymentManagement {
* {@link DistributionSetType}.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
// Exception squid:S2095: see
// https://jira.sonarsource.com/browse/SONARJAVA-1478
@SuppressWarnings({ "squid:S2095" })
default DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID, final ActionType actionType,
final long forcedTimestamp, @NotEmpty final String... targetIDs) {
return assignDistributionSet(dsID, Arrays.stream(targetIDs)
.map(t -> new TargetWithActionType(t, actionType, forcedTimestamp)).collect(Collectors.toList()));
}
DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID, final ActionType actionType,
final long forcedTimestamp, @NotEmpty final String... targetIDs);
/**
* method assigns the {@link DistributionSet} to all {@link Target}s by
@@ -154,10 +146,7 @@ public interface DeploymentManagement {
* {@link DistributionSetType}.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
default DistributionSetAssignmentResult assignDistributionSet(@NotNull final Long dsID,
@NotEmpty final String... targetIDs) {
return assignDistributionSet(dsID, ActionType.FORCED, Action.NO_FORCE_TIME, targetIDs);
}
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID, @NotEmpty String... targetIDs);
/**
* Cancels given {@link Action} for given {@link Target}. The method will
@@ -450,4 +439,4 @@ public interface DeploymentManagement {
+ SpringEvalExpressions.IS_SYSTEM_CODE)
Action startScheduledAction(@NotNull Action action);
}
}

View File

@@ -14,9 +14,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSetType;
/**
* Holds distribution set filter parameters.
*
*
*
*/
public final class DistributionSetFilter {
private final Boolean isDeleted;

View File

@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.persistence.Entity;
import javax.validation.constraints.NotNull;
@@ -163,9 +162,7 @@ public interface DistributionSetManagement {
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
default List<DistributionSetType> createDistributionSetTypes(@NotNull final Collection<DistributionSetType> types) {
return types.stream().map(this::createDistributionSetType).collect(Collectors.toList());
}
List<DistributionSetType> createDistributionSetTypes(@NotNull Collection<DistributionSetType> types);
/**
* <p>
@@ -183,10 +180,7 @@ public interface DistributionSetManagement {
* to delete
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
default void deleteDistributionSet(@NotNull final DistributionSet set) {
deleteDistributionSet(set.getId());
}
void deleteDistributionSet(@NotNull DistributionSet set);
/**
* Deleted {@link DistributionSet}s by their IDs. That is either a soft
@@ -235,11 +229,8 @@ public interface DistributionSetManagement {
* to look for.
* @return {@link DistributionSet} or <code>null</code> if it does not exist
*/
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
default DistributionSet findDistributionSetById(@NotNull final Long distid) {
return findDistributionSetByIdWithDetails(distid);
}
DistributionSet findDistributionSetById(@NotNull Long distid);
/**
* Find {@link DistributionSet} based on given ID including (lazy loaded)
@@ -487,11 +478,8 @@ public interface DistributionSetManagement {
* the assignment outcome.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
default DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty final Collection<DistributionSet> sets,
@NotNull final DistributionSetTag tag) {
return toggleTagAssignment(sets.stream().map(ds -> ds.getId()).collect(Collectors.toList()), tag.getName());
}
DistributionSetTagAssignmentResult toggleTagAssignment(@NotEmpty Collection<DistributionSet> sets,
@NotNull DistributionSetTag tag);
/**
* Toggles {@link DistributionSetTag} assignment to given
@@ -588,4 +576,4 @@ public interface DistributionSetManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
DistributionSetType updateDistributionSetType(@NotNull DistributionSetType dsType);
}
}

View File

@@ -206,4 +206,4 @@ public interface ReportManagement {
}
}
}

View File

@@ -21,6 +21,10 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.access.prepost.PreAuthorize;
/**
* Repository management service for RolloutGroup.
*
*/
public interface RolloutGroupManagement {
/**

View File

@@ -335,4 +335,4 @@ public interface RolloutManagement {
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
float getFinishedPercentForRunningGroup(@NotNull Long rolloutId, @NotNull RolloutGroup rolloutGroup);
}
}

View File

@@ -32,7 +32,7 @@ import org.springframework.stereotype.Component;
@Profile("!test")
public class RolloutScheduler {
private static final Logger logger = LoggerFactory.getLogger(RolloutScheduler.class);
private static final Logger LOGGER = LoggerFactory.getLogger(RolloutScheduler.class);
@Autowired
private TenantAware tenantAware;
@@ -57,7 +57,7 @@ public class RolloutScheduler {
*/
@Scheduled(initialDelayString = RolloutProperties.Scheduler.PROP_SCHEDULER_DELAY_PLACEHOLDER, fixedDelayString = RolloutProperties.Scheduler.PROP_SCHEDULER_DELAY_PLACEHOLDER)
public void rolloutScheduler() {
logger.debug("rollout schedule checker has been triggered.");
LOGGER.debug("rollout schedule checker has been triggered.");
// run this code in system code privileged to have the necessary
// permission to query and create entities.
systemSecurityContext.runAsSystem(() -> {
@@ -68,7 +68,7 @@ public class RolloutScheduler {
// iterate through all tenants and execute the rollout check for
// each tenant seperately.
final List<String> tenants = systemManagement.findTenants();
logger.info("Checking rollouts for {} tenants", tenants.size());
LOGGER.info("Checking rollouts for {} tenants", tenants.size());
for (final String tenant : tenants) {
tenantAware.runAsTenant(tenant, () -> {
rolloutManagement.checkRunningRollouts(rolloutProperties.getScheduler().getFixedDelay());

View File

@@ -0,0 +1,471 @@
/**
* 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;
import java.util.Collection;
import java.util.List;
import javax.persistence.Entity;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.repository.model.SwMetadataCompositeKey;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.access.prepost.PreAuthorize;
/**
* Service for managing {@link SoftwareModule}s.
*
*/
public interface SoftwareManagement {
/**
* Updates existing {@link SoftwareModule}. Update-able values are
* {@link SoftwareModule#getDescription()}
* {@link SoftwareModule#getVendor()}.
*
* @param sm
* to update
*
* @return the saved {@link Entity}.
*
* @throws NullPointerException
* of {@link SoftwareModule#getId()} is <code>null</code>
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModule updateSoftwareModule(@NotNull SoftwareModule sm);
/**
* Updates existing {@link SoftwareModuleType}. Update-able value is
* {@link SoftwareModuleType#getDescription()} and
* {@link SoftwareModuleType#getColour()}.
*
* @param sm
* to update
* @return updated {@link Entity}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleType updateSoftwareModuleType(@NotNull SoftwareModuleType sm);
/**
*
* @param swModule
* SoftwareModule to create
* @return SoftwareModule
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
SoftwareModule createSoftwareModule(@NotNull SoftwareModule swModule);
/**
* Create {@link SoftwareModule}s in the repository.
*
* @param swModules
* {@link SoftwareModule}s to create
* @return SoftwareModule
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<SoftwareModule> createSoftwareModule(@NotNull Iterable<SoftwareModule> swModules);
/**
* retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType}
* .
*
* @param pageable
* page parameters
* @param type
* to be filtered on
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Slice<SoftwareModule> findSoftwareModulesByType(@NotNull Pageable pageable, @NotNull SoftwareModuleType type);
/**
* Counts {@link SoftwareModule}s with given {@link SoftwareModuleType}.
*
* @param type
* to count
* @return number of found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Long countSoftwareModulesByType(@NotNull SoftwareModuleType type);
/**
* Finds {@link SoftwareModule} by given id.
*
* @param id
* to search for
* @return the found {@link SoftwareModule}s or <code>null</code> if not
* found.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER)
SoftwareModule findSoftwareModuleById(@NotNull Long id);
/**
* retrieves {@link SoftwareModule} by their name AND version AND type..
*
* @param name
* of the {@link SoftwareModule}
* @param version
* of the {@link SoftwareModule}
* @param type
* of the {@link SoftwareModule}
* @return the found {@link SoftwareModule} or <code>null</code>
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
SoftwareModule findSoftwareModuleByNameAndVersion(@NotEmpty String name, @NotEmpty String version,
@NotNull SoftwareModuleType type);
/**
* Deletes the given {@link SoftwareModule} {@link Entity}.
*
* @param bsm
* is the {@link SoftwareModule} to be deleted
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
void deleteSoftwareModule(@NotNull SoftwareModule bsm);
/**
* Deletes {@link SoftwareModule}s which is any if the given ids.
*
* @param ids
* of the Software Modules to be deleted
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
void deleteSoftwareModules(@NotNull Iterable<Long> ids);
/**
* Retrieves all software modules. Deleted ones are filtered.
*
* @param pageable
* pagination parameter
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Slice<SoftwareModule> findSoftwareModulesAll(@NotNull Pageable pageable);
/**
* Count all {@link SoftwareModule}s in the repository that are not marked
* as deleted.
*
* @return number of {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Long countSoftwareModulesAll();
/**
* Retrieves software module including details (
* {@link SoftwareModule#getArtifacts()}).
*
* @param id
* parameter
* @param isDeleted
* parameter
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
SoftwareModule findSoftwareModuleWithDetails(@NotNull Long id);
/**
* Retrieves all {@link SoftwareModule}s with a given specification.
*
* @param spec
* the specification to filter the software modules
* @param pageable
* pagination parameter
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModule> findSoftwareModulesByPredicate(@NotNull Specification<SoftwareModule> spec,
@NotNull Pageable pageable);
/**
* Retrieves all {@link SoftwareModuleType}s with a given specification.
*
* @param spec
* the specification to filter the software modules types
* @param pageable
* pagination parameter
* @return the found {@link SoftwareModuleType}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleType> findSoftwareModuleTypesByPredicate(@NotNull Specification<SoftwareModuleType> spec,
@NotNull Pageable pageable);
/**
* Retrieves all software modules with a given list of ids
* {@link SoftwareModule#getId()}.
*
* @param ids
* to search for
* @return {@link List} of found {@link SoftwareModule}s
*/
List<SoftwareModule> findSoftwareModulesById(@NotEmpty Collection<Long> ids);
/**
* Filter {@link SoftwareModule}s with given
* {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()}
* and {@link SoftwareModule#getType()} that are not marked as deleted.
*
* @param pageable
* page parameter
* @param searchText
* to be filtered as "like" on {@link SoftwareModule#getName()}
* @param type
* to be filtered as "like" on {@link SoftwareModule#getType()}
* @return the page of found {@link SoftwareModule}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Slice<SoftwareModule> findSoftwareModuleByFilters(@NotNull Pageable pageable, String searchText,
SoftwareModuleType type);
/**
* Filter {@link SoftwareModule}s with given
* {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()}
* search text and {@link SoftwareModule#getType()} that are not marked as
* deleted and sort them by means of given distribution set related modules
* on top of the list.
*
* After that the modules are sorted by {@link SoftwareModule#getName()} and
* {@link SoftwareModule#getVersion()} in ascending order.
*
* @param pageable
* page parameter
* @param orderByDistributionId
* the ID of distribution set to be ordered on top
* @param searchText
* filtered as "like" on {@link SoftwareModule#getName()}
* @param type
* filtered as "equal" on {@link SoftwareModule#getType()}
* @return the page of found {@link SoftwareModule}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Slice<CustomSoftwareModule> findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
@NotNull Pageable pageable, @NotNull Long orderByDistributionId, String searchText,
SoftwareModuleType type);
/**
* Counts {@link SoftwareModule}s with given
* {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()}
* and {@link SoftwareModule#getType()} that are not marked as deleted.
*
* @param searchText
* to search for in name and version
* @param type
* to filter the result
* @return number of found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Long countSoftwareModuleByFilters(String searchText, SoftwareModuleType type);
/**
* @param pageable
* parameter
* @return all {@link SoftwareModuleType}s in the repository.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull Pageable pageable);
/**
* @return number of {@link SoftwareModuleType}s in the repository.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Long countSoftwareModuleTypesAll();
/**
*
* @param key
* to search for
* @return {@link SoftwareModuleType} in the repository with given
* {@link SoftwareModuleType#getKey()}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
SoftwareModuleType findSoftwareModuleTypeByKey(@NotNull String key);
/**
*
* @param id
* to search for
* @return {@link SoftwareModuleType} in the repository with given
* {@link SoftwareModuleType#getId()}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
SoftwareModuleType findSoftwareModuleTypeById(@NotNull Long id);
/**
*
* @param name
* to search for
* @return all {@link SoftwareModuleType}s in the repository with given
* {@link SoftwareModuleType#getName()}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
SoftwareModuleType findSoftwareModuleTypeByName(@NotNull String name);
/**
* Creates new {@link SoftwareModuleType}.
*
* @param type
* to create
* @return created {@link Entity}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
SoftwareModuleType createSoftwareModuleType(@NotNull SoftwareModuleType type);
/**
* Creates multiple {@link SoftwareModuleType}s.
*
* @param types
* to create
* @return created {@link Entity}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
List<SoftwareModuleType> createSoftwareModuleType(@NotNull final Collection<SoftwareModuleType> types);
/**
* Deletes or marks as delete in case the type is in use.
*
* @param type
* to delete
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
void deleteSoftwareModuleType(@NotNull SoftwareModuleType type);
/**
* @param pageable
* the page request to page the result set
* @param set
* to search for
* @return all {@link SoftwareModule}s that are assigned to given
* {@link DistributionSet}.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModule> findSoftwareModuleByAssignedTo(@NotNull Pageable pageable, @NotNull DistributionSet set);
/**
* @param pageable
* the page request to page the result set
* @param set
* to search for
* @param type
* to filter
* @return all {@link SoftwareModule}s that are assigned to given
* {@link DistributionSet} filtered by {@link SoftwareModuleType}.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModule> findSoftwareModuleByAssignedToAndType(@NotNull Pageable pageable, @NotNull DistributionSet set,
@NotNull SoftwareModuleType type);
/**
* creates or updates a single software module meta data entry.
*
* @param metadata
* the meta data entry to create or update
* @return the updated or created software module meta data entry
* @throws EntityAlreadyExistsException
* in case the meta data entry already exists for the specific
* key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleMetadata createSoftwareModuleMetadata(@NotNull SoftwareModuleMetadata metadata);
/**
* creates a list of software module meta data entries.
*
* @param metadata
* the meta data entries to create or update
* @return the updated or created software module meta data entries
* @throws EntityAlreadyExistsException
* in case one of the meta data entry already exists for the
* specific key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
List<SoftwareModuleMetadata> createSoftwareModuleMetadata(@NotNull Collection<SoftwareModuleMetadata> metadata);
/**
* updates a distribution set meta data value if corresponding entry exists.
*
* @param metadata
* the meta data entry to be updated
* @return the updated meta data entry
* @throws EntityNotFoundException
* in case the meta data entry does not exists and cannot be
* updated
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
SoftwareModuleMetadata updateSoftwareModuleMetadata(@NotNull SoftwareModuleMetadata metadata);
/**
* deletes a software module meta data entry.
*
* @param id
* the ID of the software module meta data to delete
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
void deleteSoftwareModuleMetadata(@NotNull SwMetadataCompositeKey id);
/**
* finds all meta data by the given software module id.
*
* @param swId
* the software module id to retrieve the meta data from
* @param pageable
* the page request to page the result
* @return a paged result of all meta data entries for a given software
* module id
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long swId,
@NotNull Pageable pageable);
/**
* finds all meta data by the given software module id.
*
* @param softwareModuleId
* the software module id to retrieve the meta data from
* @param spec
* the specification to filter the result
* @param pageable
* the page request to page the result
* @return a paged result of all meta data entries for a given software
* module id
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long softwareModuleId,
@NotNull Specification<SoftwareModuleMetadata> spec, @NotNull Pageable pageable);
/**
* finds a single software module meta data by its id.
*
* @param id
* the id of the software module meta data containing the meta
* data key and the ID of the software module
* @return the found SoftwareModuleMetadata or {@code null} if not exits
* @throws EntityNotFoundException
* in case the meta data does not exists for the given key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
SoftwareModuleMetadata findSoftwareModuleMetadata(@NotNull SwMetadataCompositeKey id);
}

View File

@@ -1,3 +1,11 @@
/**
* 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;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
@@ -9,6 +17,10 @@ import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.env.Environment;
import org.springframework.security.access.prepost.PreAuthorize;
/**
* Management service for tenant configurations.
*
*/
public interface TenantConfigurationManagement {
/**
@@ -131,4 +143,4 @@ public interface TenantConfigurationManagement {
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
void deleteConfiguration(TenantConfigurationKey configurationKey);
}
}

View File

@@ -0,0 +1,100 @@
/**
* 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.jpa;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetInfo;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
/**
* Utility class for deployment related topics.
*
*/
public final class DeploymentHelper {
private DeploymentHelper() {
// utility class
}
/**
* Internal helper method used only inside service level. As a result is no
* additional security necessary.
*
* @param target
* to update
* @param status
* of the target
* @param setInstalledDate
* to set
* @param entityManager
* for the operation
* @param targetInfoRepository
* for the operation
*
* @return updated target
*/
static Target updateTargetInfo(@NotNull final Target target, @NotNull final TargetUpdateStatus status,
final boolean setInstalledDate, final TargetInfoRepository targetInfoRepository,
final EntityManager entityManager) {
final TargetInfo ts = target.getTargetInfo();
ts.setUpdateStatus(status);
if (setInstalledDate) {
ts.setInstallationDate(System.currentTimeMillis());
}
targetInfoRepository.save(ts);
return entityManager.merge(target);
}
/**
* This method is called, when cancellation has been successful. It sets the
* action to canceled, resets the meta data of the target and in case there
* is a new action this action is triggered.
*
* @param action
* the action which is set to canceled
* @param actionRepository
* for the operation
* @param targetManagement
* for the operation
* @param entityManager
* for the operation
* @param targetInfoRepository
* for the operation
*/
static void successCancellation(final Action action, final ActionRepository actionRepository,
final TargetManagement targetManagement, final TargetInfoRepository targetInfoRepository,
final EntityManager entityManager) {
// set action inactive
action.setActive(false);
action.setStatus(Status.CANCELED);
final Target target = action.getTarget();
final List<Action> nextActiveActions = actionRepository.findByTargetAndActiveOrderByIdAsc(target, true).stream()
.filter(a -> !a.getId().equals(action.getId())).collect(Collectors.toList());
if (nextActiveActions.isEmpty()) {
target.setAssignedDistributionSet(target.getTargetInfo().getInstalledDistributionSet());
updateTargetInfo(target, TargetUpdateStatus.IN_SYNC, false, targetInfoRepository, entityManager);
} else {
target.setAssignedDistributionSet(nextActiveActions.get(0).getDistributionSet());
}
targetManagement.updateTarget(target);
}
}

View File

@@ -267,4 +267,20 @@ public class JpaArtifactManagement implements ArtifactManagement {
LOG.debug("storing new artifact into repository {}", artifact);
return localArtifactRepository.save(artifact);
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public LocalArtifact createLocalArtifact(final InputStream inputStream, final Long moduleId, final String filename,
final boolean overrideExisting) {
return createLocalArtifact(inputStream, moduleId, filename, null, null, overrideExisting, null);
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public LocalArtifact createLocalArtifact(final InputStream inputStream, final Long moduleId, final String filename,
final boolean overrideExisting, final String contentType) {
return createLocalArtifact(inputStream, moduleId, filename, null, null, overrideExisting, contentType);
}
}

View File

@@ -409,9 +409,15 @@ public class JpaControllerManagement implements ControllerManagement {
}
@Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public String getSecurityTokenByControllerId(final String controllerId) {
final Target target = targetRepository.findByControllerId(controllerId);
return target != null ? target.getSecurityToken() : null;
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public TargetInfo updateLastTargetQuery(final TargetInfo target, final URI address) {
return updateTargetStatus(target, null, System.currentTimeMillis(), address);
}
}

View File

@@ -133,7 +133,6 @@ public class JpaDeploymentManagement implements DeploymentManagement {
@Override
@Modifying
@Transactional(isolation = Isolation.READ_COMMITTED)
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String... targetIDs) {
return assignDistributionSet(dsID, ActionType.FORCED, Action.NO_FORCE_TIME, targetIDs);

View File

@@ -18,14 +18,15 @@ import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagAssigmentResultEvent;
import org.eclipse.hawkbit.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.DistributionSetFilter;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityLockedException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
@@ -660,4 +661,26 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
distributionSets.forEach(ds -> ds.getTags().remove(tag));
return distributionSetRepository.save(distributionSets);
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public List<DistributionSetType> createDistributionSetTypes(final Collection<DistributionSetType> types) {
return types.stream().map(this::createDistributionSetType).collect(Collectors.toList());
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public void deleteDistributionSet(final DistributionSet set) {
deleteDistributionSet(set.getId());
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public DistributionSetTagAssignmentResult toggleTagAssignment(final Collection<DistributionSet> sets,
final DistributionSetTag tag) {
return toggleTagAssignment(sets.stream().map(ds -> ds.getId()).collect(Collectors.toList()), tag.getName());
}
}

View File

@@ -17,17 +17,16 @@ import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.ListJoin;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.validation.constraints.NotNull;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule;
@@ -42,7 +41,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule_;
import org.eclipse.hawkbit.repository.model.SwMetadataCompositeKey;
import org.eclipse.hawkbit.repository.specifications.SoftwareModuleSpecification;
import org.eclipse.hawkbit.repository.specifications.SpecificationsBuilder;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.domain.Page;
@@ -61,13 +59,13 @@ import com.google.common.base.Strings;
import com.google.common.collect.Sets;
/**
* Business facade for managing {@link SoftwareModule}s.
* JPA implementation of SoftwareManagement.
*
*/
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
@Validated
@Service
public class SoftwareManagement {
public class JpaSoftwareManagement implements SoftwareManagement {
@Autowired
private EntityManager entityManager;
@@ -96,23 +94,10 @@ public class SoftwareManagement {
@Autowired
private ArtifactManagement artifactManagement;
/**
* Updates existing {@link SoftwareModule}. Update-able values are
* {@link SoftwareModule#getDescription()}
* {@link SoftwareModule#getVendor()}.
*
* @param sm
* to update
*
* @return the saved {@link Entity}.
*
* @throws NullPointerException
* of {@link SoftwareModule#getId()} is <code>null</code>
*/
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
public SoftwareModule updateSoftwareModule(@NotNull final SoftwareModule sm) {
public SoftwareModule updateSoftwareModule(final SoftwareModule sm) {
checkNotNull(sm.getId());
final SoftwareModule module = softwareModuleRepository.findOne(sm.getId());
@@ -130,19 +115,10 @@ public class SoftwareManagement {
return updated ? softwareModuleRepository.save(module) : module;
}
/**
* Updates existing {@link SoftwareModuleType}. Update-able value is
* {@link SoftwareModuleType#getDescription()} and
* {@link SoftwareModuleType#getColour()}.
*
* @param sm
* to update
* @return updated {@link Entity}
*/
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
public SoftwareModuleType updateSoftwareModuleType(@NotNull final SoftwareModuleType sm) {
public SoftwareModuleType updateSoftwareModuleType(final SoftwareModuleType sm) {
checkNotNull(sm.getId());
final SoftwareModuleType type = softwareModuleTypeRepository.findOne(sm.getId());
@@ -159,37 +135,20 @@ public class SoftwareManagement {
return updated ? softwareModuleTypeRepository.save(type) : type;
}
/**
*
* @param swModule
* SoftwareModule to create
* @return SoftwareModule
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@Override
@Modifying
@Transactional
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
public SoftwareModule createSoftwareModule(@NotNull final SoftwareModule swModule) {
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public SoftwareModule createSoftwareModule(final SoftwareModule swModule) {
if (null != swModule.getId()) {
throw new EntityAlreadyExistsException();
}
return softwareModuleRepository.save(swModule);
}
/**
* Create {@link SoftwareModule}s in the repository.
*
* @param swModules
* {@link SoftwareModule}s to create
* @return SoftwareModule
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@Override
@Modifying
@Transactional
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
public List<SoftwareModule> createSoftwareModule(@NotNull final Iterable<SoftwareModule> swModules) {
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public List<SoftwareModule> createSoftwareModule(final Iterable<SoftwareModule> swModules) {
swModules.forEach(swModule -> {
if (null != swModule.getId()) {
throw new EntityAlreadyExistsException();
@@ -200,19 +159,8 @@ public class SoftwareManagement {
}
/**
* retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType}
* .
*
* @param pageable
* page parameters
* @param type
* to be filtered on
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Slice<SoftwareModule> findSoftwareModulesByType(@NotNull final Pageable pageable,
@NotNull final SoftwareModuleType type) {
@Override
public Slice<SoftwareModule> findSoftwareModulesByType(final Pageable pageable, final SoftwareModuleType type) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -225,15 +173,8 @@ public class SoftwareManagement {
return findSwModuleByCriteriaAPI(pageable, specList);
}
/**
* Counts {@link SoftwareModule}s with given {@link SoftwareModuleType}.
*
* @param type
* to count
* @return number of found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Long countSoftwareModulesByType(@NotNull final SoftwareModuleType type) {
@Override
public Long countSoftwareModulesByType(final SoftwareModuleType type) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -246,63 +187,29 @@ public class SoftwareManagement {
return countSwModuleByCriteriaAPI(specList);
}
/**
* Finds {@link SoftwareModule} by given id.
*
* @param id
* to search for
* @return the found {@link SoftwareModule}s or <code>null</code> if not
* found.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
+ SpringEvalExpressions.IS_CONTROLLER)
public SoftwareModule findSoftwareModuleById(@NotNull final Long id) {
@Override
public SoftwareModule findSoftwareModuleById(final Long id) {
return artifactManagement.findSoftwareModuleById(id);
}
/**
* retrieves {@link SoftwareModule} by their name AND version AND type..
*
* @param name
* of the {@link SoftwareModule}
* @param version
* of the {@link SoftwareModule}
* @param type
* of the {@link SoftwareModule}
* @return the found {@link SoftwareModule} or <code>null</code>
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public SoftwareModule findSoftwareModuleByNameAndVersion(@NotEmpty final String name,
@NotEmpty final String version, @NotNull final SoftwareModuleType type) {
@Override
public SoftwareModule findSoftwareModuleByNameAndVersion(final String name, final String version,
final SoftwareModuleType type) {
return softwareModuleRepository.findOneByNameAndVersionAndType(name, version, type);
}
/**
* Deletes the given {@link SoftwareModule} {@link Entity}.
*
* @param bsm
* is the {@link SoftwareModule} to be deleted
*/
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
public void deleteSoftwareModule(@NotNull final SoftwareModule bsm) {
deleteSoftwareModules(Sets.newHashSet(bsm.getId()));
}
private boolean isUnassigned(final SoftwareModule bsmMerged) {
return distributionSetRepository.findByModules(bsmMerged).isEmpty();
}
private Slice<SoftwareModule> findSwModuleByCriteriaAPI(@NotNull final Pageable pageable,
@NotEmpty final List<Specification<SoftwareModule>> specList) {
private Slice<SoftwareModule> findSwModuleByCriteriaAPI(final Pageable pageable,
final List<Specification<SoftwareModule>> specList) {
return criteriaNoCountDao.findAll(SpecificationsBuilder.combineWithAnd(specList), pageable,
SoftwareModule.class);
}
private Long countSwModuleByCriteriaAPI(@NotEmpty final List<Specification<SoftwareModule>> specList) {
private Long countSwModuleByCriteriaAPI(final List<Specification<SoftwareModule>> specList) {
return softwareModuleRepository.count(SpecificationsBuilder.combineWithAnd(specList));
}
@@ -312,16 +219,10 @@ public class SoftwareManagement {
}
}
/**
* Deletes {@link SoftwareModule}s which is any if the given ids.
*
* @param ids
* of the Software Modules to be deleted
*/
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
public void deleteSoftwareModules(@NotNull final Iterable<Long> ids) {
public void deleteSoftwareModules(final Iterable<Long> ids) {
final List<SoftwareModule> swModulesToDelete = softwareModuleRepository.findByIdIn(ids);
final Set<Long> assignedModuleIds = new HashSet<>();
swModulesToDelete.forEach(swModule -> {
@@ -349,15 +250,8 @@ public class SoftwareManagement {
}
}
/**
* Retrieves all software modules. Deleted ones are filtered.
*
* @param pageable
* pagination parameter
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Slice<SoftwareModule> findSoftwareModulesAll(@NotNull final Pageable pageable) {
@Override
public Slice<SoftwareModule> findSoftwareModulesAll(final Pageable pageable) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -376,13 +270,7 @@ public class SoftwareManagement {
return findSwModuleByCriteriaAPI(pageable, specList);
}
/**
* Count all {@link SoftwareModule}s in the repository that are not marked
* as deleted.
*
* @return number of {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@Override
public Long countSoftwareModulesAll() {
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -393,79 +281,31 @@ public class SoftwareManagement {
return countSwModuleByCriteriaAPI(specList);
}
/**
* Retrieves software module including details (
* {@link SoftwareModule#getArtifacts()}).
*
* @param id
* parameter
* @param isDeleted
* parameter
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public SoftwareModule findSoftwareModuleWithDetails(@NotNull final Long id) {
@Override
public SoftwareModule findSoftwareModuleWithDetails(final Long id) {
return artifactManagement.findSoftwareModuleWithDetails(id);
}
/**
* Retrieves all {@link SoftwareModule}s with a given specification.
*
* @param spec
* the specification to filter the software modules
* @param pageable
* pagination parameter
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Page<SoftwareModule> findSoftwareModulesByPredicate(@NotNull final Specification<SoftwareModule> spec,
@NotNull final Pageable pageable) {
@Override
public Page<SoftwareModule> findSoftwareModulesByPredicate(final Specification<SoftwareModule> spec,
final Pageable pageable) {
return softwareModuleRepository.findAll(spec, pageable);
}
/**
* Retrieves all {@link SoftwareModuleType}s with a given specification.
*
* @param spec
* the specification to filter the software modules types
* @param pageable
* pagination parameter
* @return the found {@link SoftwareModuleType}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Page<SoftwareModuleType> findSoftwareModuleTypesByPredicate(
@NotNull final Specification<SoftwareModuleType> spec, @NotNull final Pageable pageable) {
@Override
public Page<SoftwareModuleType> findSoftwareModuleTypesByPredicate(final Specification<SoftwareModuleType> spec,
final Pageable pageable) {
return softwareModuleTypeRepository.findAll(spec, pageable);
}
/**
* Retrieves all software modules with a given list of ids
* {@link SoftwareModule#getId()}.
*
* @param ids
* to search for
* @return {@link List} of found {@link SoftwareModule}s
*/
@Override
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public List<SoftwareModule> findSoftwareModulesById(@NotEmpty final List<Long> ids) {
public List<SoftwareModule> findSoftwareModulesById(final Collection<Long> ids) {
return softwareModuleRepository.findByIdIn(ids);
}
/**
* Filter {@link SoftwareModule}s with given
* {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()}
* and {@link SoftwareModule#getType()} that are not marked as deleted.
*
* @param pageable
* page parameter
* @param searchText
* to be filtered as "like" on {@link SoftwareModule#getName()}
* @param type
* to be filtered as "like" on {@link SoftwareModule#getType()}
* @return the page of found {@link SoftwareModule}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Slice<SoftwareModule> findSoftwareModuleByFilters(@NotNull final Pageable pageable, final String searchText,
@Override
public Slice<SoftwareModule> findSoftwareModuleByFilters(final Pageable pageable, final String searchText,
final SoftwareModuleType type) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -495,29 +335,9 @@ public class SoftwareManagement {
return findSwModuleByCriteriaAPI(pageable, specList);
}
/**
* Filter {@link SoftwareModule}s with given
* {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()}
* search text and {@link SoftwareModule#getType()} that are not marked as
* deleted and sort them by means of given distribution set related modules
* on top of the list.
*
* After that the modules are sorted by {@link SoftwareModule#getName()} and
* {@link SoftwareModule#getVersion()} in ascending order.
*
* @param pageable
* page parameter
* @param orderByDistributionId
* the ID of distribution set to be ordered on top
* @param searchText
* filtered as "like" on {@link SoftwareModule#getName()}
* @param type
* filtered as "equal" on {@link SoftwareModule#getType()}
* @return the page of found {@link SoftwareModule}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@Override
public Slice<CustomSoftwareModule> findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
@NotNull final Pageable pageable, @NotNull final Long orderByDistributionId, final String searchText,
final Pageable pageable, final Long orderByDistributionId, final String searchText,
final SoftwareModuleType type) {
final List<CustomSoftwareModule> resultList = new ArrayList<>();
@@ -594,9 +414,6 @@ public class SoftwareManagement {
return specList;
}
/**
* @param specifications
*/
private Predicate[] specificationsToPredicate(final List<Specification<SoftwareModule>> specifications,
final Root<SoftwareModule> root, final CriteriaQuery<?> query, final CriteriaBuilder cb,
final Predicate... additionalPredicates) {
@@ -608,18 +425,7 @@ public class SoftwareManagement {
return predicates.toArray(new Predicate[predicates.size()]);
}
/**
* Counts {@link SoftwareModule}s with given
* {@link SoftwareModule#getName()} or {@link SoftwareModule#getVersion()}
* and {@link SoftwareModule#getType()} that are not marked as deleted.
*
* @param searchText
* to search for in name and version
* @param type
* to filter the result
* @return number of found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@Override
public Long countSoftwareModuleByFilters(final String searchText, final SoftwareModuleType type) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -640,71 +446,35 @@ public class SoftwareManagement {
return countSwModuleByCriteriaAPI(specList);
}
/**
* @param pageable
* parameter
* @return all {@link SoftwareModuleType}s in the repository.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull final Pageable pageable) {
@Override
public Page<SoftwareModuleType> findSoftwareModuleTypesAll(final Pageable pageable) {
return softwareModuleTypeRepository.findByDeleted(pageable, false);
}
/**
* @return number of {@link SoftwareModuleType}s in the repository.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@Override
public Long countSoftwareModuleTypesAll() {
return softwareModuleTypeRepository.countByDeleted(false);
}
/**
*
* @param key
* to search for
* @return {@link SoftwareModuleType} in the repository with given
* {@link SoftwareModuleType#getKey()}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public SoftwareModuleType findSoftwareModuleTypeByKey(@NotNull final String key) {
@Override
public SoftwareModuleType findSoftwareModuleTypeByKey(final String key) {
return softwareModuleTypeRepository.findByKey(key);
}
/**
*
* @param id
* to search for
* @return {@link SoftwareModuleType} in the repository with given
* {@link SoftwareModuleType#getId()}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public SoftwareModuleType findSoftwareModuleTypeById(@NotNull final Long id) {
@Override
public SoftwareModuleType findSoftwareModuleTypeById(final Long id) {
return softwareModuleTypeRepository.findOne(id);
}
/**
*
* @param name
* to search for
* @return all {@link SoftwareModuleType}s in the repository with given
* {@link SoftwareModuleType#getName()}
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public SoftwareModuleType findSoftwareModuleTypeByName(@NotNull final String name) {
@Override
public SoftwareModuleType findSoftwareModuleTypeByName(final String name) {
return softwareModuleTypeRepository.findByName(name);
}
/**
* Creates new {@link SoftwareModuleType}.
*
* @param type
* to create
* @return created {@link Entity}
*/
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
public SoftwareModuleType createSoftwareModuleType(@NotNull final SoftwareModuleType type) {
public SoftwareModuleType createSoftwareModuleType(final SoftwareModuleType type) {
if (type.getId() != null) {
throw new EntityAlreadyExistsException("Given type contains an Id!");
}
@@ -712,30 +482,10 @@ public class SoftwareManagement {
return softwareModuleTypeRepository.save(type);
}
/**
* Creates multiple {@link SoftwareModuleType}s.
*
* @param types
* to create
* @return created {@link Entity}
*/
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
public List<SoftwareModuleType> createSoftwareModuleType(@NotNull final Collection<SoftwareModuleType> types) {
return types.stream().map(this::createSoftwareModuleType).collect(Collectors.toList());
}
/**
* Deletes or markes as delete in case the type is in use.
*
* @param type
* to delete
*/
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
public void deleteSoftwareModuleType(@NotNull final SoftwareModuleType type) {
public void deleteSoftwareModuleType(final SoftwareModuleType type) {
if (softwareModuleRepository.countByType(type) > 0
|| distributionSetTypeRepository.countByElementsSmType(type) > 0) {
@@ -747,50 +497,21 @@ public class SoftwareManagement {
}
}
/**
* @param pageable
* the page request to page the result set
* @param set
* to search for
* @return all {@link SoftwareModule}s that are assigned to given
* {@link DistributionSet}.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Page<SoftwareModule> findSoftwareModuleByAssignedTo(@NotNull final Pageable pageable,
@NotNull final DistributionSet set) {
@Override
public Page<SoftwareModule> findSoftwareModuleByAssignedTo(final Pageable pageable, final DistributionSet set) {
return softwareModuleRepository.findByAssignedTo(pageable, set);
}
/**
* @param pageable
* the page request to page the result set
* @param set
* to search for
* @param type
* to filter
* @return all {@link SoftwareModule}s that are assigned to given
* {@link DistributionSet} filtered by {@link SoftwareModuleType}.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Page<SoftwareModule> findSoftwareModuleByAssignedToAndType(@NotNull final Pageable pageable,
@NotNull final DistributionSet set, @NotNull final SoftwareModuleType type) {
@Override
public Page<SoftwareModule> findSoftwareModuleByAssignedToAndType(final Pageable pageable,
final DistributionSet set, final SoftwareModuleType type) {
return softwareModuleRepository.findByAssignedToAndType(pageable, set, type);
}
/**
* creates or updates a single software module meta data entry.
*
* @param metadata
* the meta data entry to create or update
* @return the updated or created software module meta data entry
* @throws EntityAlreadyExistsException
* in case the meta data entry already exists for the specific
* key
*/
@Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Modifying
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
public SoftwareModuleMetadata createSoftwareModuleMetadata(@NotNull final SoftwareModuleMetadata metadata) {
public SoftwareModuleMetadata createSoftwareModuleMetadata(final SoftwareModuleMetadata metadata) {
if (softwareModuleMetadataRepository.exists(metadata.getId())) {
throwMetadataKeyAlreadyExists(metadata.getId().getKey());
}
@@ -802,21 +523,11 @@ public class SoftwareManagement {
return softwareModuleMetadataRepository.save(metadata);
}
/**
* creates a list of software module meta data entries.
*
* @param metadata
* the meta data entries to create or update
* @return the updated or created software module meta data entries
* @throws EntityAlreadyExistsException
* in case one of the meta data entry already exists for the
* specific key
*/
@Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Modifying
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
public List<SoftwareModuleMetadata> createSoftwareModuleMetadata(
@NotEmpty final Collection<SoftwareModuleMetadata> metadata) {
final Collection<SoftwareModuleMetadata> metadata) {
for (final SoftwareModuleMetadata softwareModuleMetadata : metadata) {
checkAndThrowAlreadyExistsIfSoftwareModuleMetadataExists(softwareModuleMetadata.getId());
}
@@ -824,20 +535,10 @@ public class SoftwareManagement {
return softwareModuleMetadataRepository.save(metadata);
}
/**
* updates a distribution set meta data value if corresponding entry exists.
*
* @param metadata
* the meta data entry to be updated
* @return the updated meta data entry
* @throws EntityNotFoundException
* in case the meta data entry does not exists and cannot be
* updated
*/
@Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Modifying
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
public SoftwareModuleMetadata updateSoftwareModuleMetadata(@NotNull final SoftwareModuleMetadata metadata) {
public SoftwareModuleMetadata updateSoftwareModuleMetadata(final SoftwareModuleMetadata metadata) {
// check if exists otherwise throw entity not found exception
findSoftwareModuleMetadata(metadata.getId());
// touch it to update the lock revision because we are modifying the
@@ -847,50 +548,22 @@ public class SoftwareManagement {
return softwareModuleMetadataRepository.save(metadata);
}
/**
* deletes a software module meta data entry.
*
* @param id
* the ID of the software module meta data to delete
*/
@Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Modifying
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
public void deleteSoftwareModuleMetadata(@NotNull final SwMetadataCompositeKey id) {
public void deleteSoftwareModuleMetadata(final SwMetadataCompositeKey id) {
softwareModuleMetadataRepository.delete(id);
}
/**
* finds all meta data by the given software module id.
*
* @param swId
* the software module id to retrieve the meta data from
* @param pageable
* the page request to page the result
* @return a paged result of all meta data entries for a given software
* module id
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull final Long swId,
@NotNull final Pageable pageable) {
@Override
public Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(final Long swId,
final Pageable pageable) {
return softwareModuleMetadataRepository.findBySoftwareModuleId(swId, pageable);
}
/**
* finds all meta data by the given software module id.
*
* @param softwareModuleId
* the software module id to retrieve the meta data from
* @param spec
* the specification to filter the result
* @param pageable
* the page request to page the result
* @return a paged result of all meta data entries for a given software
* module id
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
@Override
public Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(final Long softwareModuleId,
@NotNull final Specification<SoftwareModuleMetadata> spec, @NotNull final Pageable pageable) {
final Specification<SoftwareModuleMetadata> spec, final Pageable pageable) {
return softwareModuleMetadataRepository
.findAll(
(Specification<SoftwareModuleMetadata>) (root, query,
@@ -901,18 +574,8 @@ public class SoftwareManagement {
pageable);
}
/**
* finds a single software module meta data by its id.
*
* @param id
* the id of the software module meta data containing the meta
* data key and the ID of the software module
* @return the found SoftwareModuleMetadata or {@code null} if not exits
* @throws EntityNotFoundException
* in case the meta data does not exists for the given key
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public SoftwareModuleMetadata findSoftwareModuleMetadata(@NotNull final SwMetadataCompositeKey id) {
@Override
public SoftwareModuleMetadata findSoftwareModuleMetadata(final SwMetadataCompositeKey id) {
final SoftwareModuleMetadata findOne = softwareModuleMetadataRepository.findOne(id);
if (findOne == null) {
throw new EntityNotFoundException("Metadata with key '" + id.getKey() + "' does not exist");
@@ -931,4 +594,19 @@ public class SoftwareManagement {
throw new EntityAlreadyExistsException("Metadata entry with key '" + metadataKey + "' already exists");
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public void deleteSoftwareModule(final SoftwareModule bsm) {
deleteSoftwareModules(Sets.newHashSet(bsm.getId()));
}
@Override
@Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public List<SoftwareModuleType> createSoftwareModuleType(final Collection<SoftwareModuleType> types) {
return types.stream().map(this::createSoftwareModuleType).collect(Collectors.toList());
}
}

View File

@@ -22,6 +22,7 @@ import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.jpa.ActionRepository;
import org.eclipse.hawkbit.repository.jpa.ActionStatusRepository;
@@ -32,7 +33,6 @@ import org.eclipse.hawkbit.repository.jpa.ExternalArtifactRepository;
import org.eclipse.hawkbit.repository.jpa.LocalArtifactRepository;
import org.eclipse.hawkbit.repository.jpa.RolloutGroupRepository;
import org.eclipse.hawkbit.repository.jpa.RolloutRepository;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.SoftwareModuleMetadataRepository;
import org.eclipse.hawkbit.repository.jpa.SoftwareModuleRepository;
import org.eclipse.hawkbit.repository.jpa.SoftwareModuleTypeRepository;

View File

@@ -18,7 +18,7 @@ import java.util.UUID;
import org.apache.commons.io.IOUtils;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;

View File

@@ -270,7 +270,7 @@ public class SoftwareManagementTest extends AbstractIntegrationTestWithMongoDB {
@Description("Searches for software modules based on a list of IDs.")
public void findSoftwareModulesById() {
final List<Long> modules = new ArrayList<Long>();
final List<Long> modules = new ArrayList<>();
modules.add(softwareManagement.createSoftwareModule(new SoftwareModule(osType, "poky-una", "3.0.2", null, ""))
.getId());

View File

@@ -30,7 +30,7 @@ import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.TagManagement;
import org.eclipse.hawkbit.repository.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.model.Action;

View File

@@ -30,8 +30,8 @@ import org.eclipse.hawkbit.controller.model.DeploymentBase;
import org.eclipse.hawkbit.controller.model.Result.FinalResult;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;

View File

@@ -16,8 +16,8 @@ import java.util.List;
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.DistributionSetType;

View File

@@ -18,9 +18,9 @@ import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.DistributionSetFields;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetMetadataFields;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.TargetFields;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.SystemManagement;
import org.eclipse.hawkbit.repository.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.jpa.TargetWithActionType;

View File

@@ -14,8 +14,8 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi;

View File

@@ -12,8 +12,8 @@ import java.util.List;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeFields;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModule;

View File

@@ -13,8 +13,8 @@ import javax.servlet.http.HttpServletResponse;
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.LocalArtifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.rest.resource.helper.RestResourceConversionHelper;

View File

@@ -14,8 +14,8 @@ import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.LocalArtifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule;

View File

@@ -12,10 +12,10 @@ import java.io.IOException;
import java.util.List;
import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleFields;
import org.eclipse.hawkbit.repository.SoftwareModuleMetadataFields;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;

View File

@@ -10,9 +10,9 @@ package org.eclipse.hawkbit.rest.resource;
import java.util.List;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeFields;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;

View File

@@ -32,9 +32,9 @@ import org.eclipse.hawkbit.TestDataUtil;
import org.eclipse.hawkbit.WithUser;
import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.ActionRepository;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;

View File

@@ -14,7 +14,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;

View File

@@ -12,8 +12,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
import java.io.Serializable;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;

View File

@@ -12,7 +12,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;

View File

@@ -13,8 +13,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum;

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
import java.io.Serializable;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;

View File

@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.common;
import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;

View File

@@ -14,9 +14,9 @@ import java.util.List;
import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.jpa.DistributionSetRepository;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.common.CoordinatesToColor;

View File

@@ -14,7 +14,7 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModule;

View File

@@ -18,8 +18,8 @@ import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;

View File

@@ -17,7 +17,7 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModule;

View File

@@ -12,8 +12,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;

View File

@@ -13,7 +13,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;

View File

@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ui.distributions.smtype;
import java.io.Serializable;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;

View File

@@ -20,7 +20,7 @@ import java.util.Map.Entry;
import java.util.TimeZone;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.AssignmentResult;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.NamedEntity;

View File

@@ -119,7 +119,7 @@
<sonar.links.homepage>https://projects.eclipse.org/projects/iot.hawkbit</sonar.links.homepage>
<sonar.links.ci>https://circleci.com/gh/eclipse/hawkbit</sonar.links.ci>
<!-- Jacoco version to use -->
<jacoco.version>0.7.2.201409121644</jacoco.version>
<jacoco.version>0.7.6.201602180812</jacoco.version>
<!-- The Sonar Jacoco Listener for JUnit to extract coverage details
per test -->
<sonar-jacoco-listeners.version>1.4</sonar-jacoco-listeners.version>