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.cache.CacheConstants;
import org.eclipse.hawkbit.im.authentication.SpPermission; import org.eclipse.hawkbit.im.authentication.SpPermission;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; 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.TenantUserPasswordAuthenticationToken;
import org.eclipse.hawkbit.im.authentication.UserAuthenticationFilter; 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.rest.resource.RestConstants;
import org.eclipse.hawkbit.security.ControllerTenantAwareAuthenticationDetailsSource; import org.eclipse.hawkbit.security.ControllerTenantAwareAuthenticationDetailsSource;
import org.eclipse.hawkbit.security.DdiSecurityProperties; 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."); logAndThrowMessageError(message, "Status for action does not exisit.");
} }
final Action addUpdateActionStatus = getUpdateActionStatus(action, actionStatus); final Action addUpdateActionStatus = getUpdateActionStatus(actionStatus);
if (!addUpdateActionStatus.isActive()) { if (!addUpdateActionStatus.isActive()) {
lookIfUpdateAvailable(action.getTarget()); lookIfUpdateAvailable(action.getTarget());
} }
} }
private Action getUpdateActionStatus(final Action action, final ActionStatus actionStatus) { private Action getUpdateActionStatus(final ActionStatus actionStatus) {
if (actionStatus.getStatus().equals(Status.CANCELED)) { 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) { private Action checkActionExist(final Message message, final ActionUpdateStatus actionUpdateStatus) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,7 +32,7 @@ import org.springframework.stereotype.Component;
@Profile("!test") @Profile("!test")
public class RolloutScheduler { public class RolloutScheduler {
private static final Logger logger = LoggerFactory.getLogger(RolloutScheduler.class); private static final Logger LOGGER = LoggerFactory.getLogger(RolloutScheduler.class);
@Autowired @Autowired
private TenantAware tenantAware; 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) @Scheduled(initialDelayString = RolloutProperties.Scheduler.PROP_SCHEDULER_DELAY_PLACEHOLDER, fixedDelayString = RolloutProperties.Scheduler.PROP_SCHEDULER_DELAY_PLACEHOLDER)
public void rolloutScheduler() { 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 // run this code in system code privileged to have the necessary
// permission to query and create entities. // permission to query and create entities.
systemSecurityContext.runAsSystem(() -> { systemSecurityContext.runAsSystem(() -> {
@@ -68,7 +68,7 @@ public class RolloutScheduler {
// iterate through all tenants and execute the rollout check for // iterate through all tenants and execute the rollout check for
// each tenant seperately. // each tenant seperately.
final List<String> tenants = systemManagement.findTenants(); 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) { for (final String tenant : tenants) {
tenantAware.runAsTenant(tenant, () -> { tenantAware.runAsTenant(tenant, () -> {
rolloutManagement.checkRunningRollouts(rolloutProperties.getScheduler().getFixedDelay()); 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; package org.eclipse.hawkbit.repository;
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions; 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.core.env.Environment;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
/**
* Management service for tenant configurations.
*
*/
public interface TenantConfigurationManagement { public interface TenantConfigurationManagement {
/** /**
@@ -131,4 +143,4 @@ public interface TenantConfigurationManagement {
@PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION) @PreAuthorize(value = SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
void deleteConfiguration(TenantConfigurationKey configurationKey); 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); LOG.debug("storing new artifact into repository {}", artifact);
return localArtifactRepository.save(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 @Override
@Transactional(isolation = Isolation.READ_UNCOMMITTED)
public String getSecurityTokenByControllerId(final String controllerId) { public String getSecurityTokenByControllerId(final String controllerId) {
final Target target = targetRepository.findByControllerId(controllerId); final Target target = targetRepository.findByControllerId(controllerId);
return target != null ? target.getSecurityToken() : null; 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 @Override
@Modifying @Modifying
@Transactional(isolation = Isolation.READ_COMMITTED) @Transactional(isolation = Isolation.READ_COMMITTED)
@CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true) @CacheEvict(value = { "distributionUsageAssigned" }, allEntries = true)
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String... targetIDs) { public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final String... targetIDs) {
return assignDistributionSet(dsID, ActionType.FORCED, Action.NO_FORCE_TIME, 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.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import org.eclipse.hawkbit.eventbus.event.DistributionSetTagAssigmentResultEvent; import org.eclipse.hawkbit.eventbus.event.DistributionSetTagAssigmentResultEvent;
import org.eclipse.hawkbit.executor.AfterTransactionCommitExecutor; import org.eclipse.hawkbit.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.DistributionSetFilter; import org.eclipse.hawkbit.repository.DistributionSetFilter;
import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetFilter.DistributionSetFilterBuilder; 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.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityLockedException; import org.eclipse.hawkbit.repository.exception.EntityLockedException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
@@ -660,4 +661,26 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
distributionSets.forEach(ds -> ds.getTags().remove(tag)); distributionSets.forEach(ds -> ds.getTags().remove(tag));
return distributionSetRepository.save(distributionSets); 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.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.persistence.Entity;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.ListJoin; import javax.persistence.criteria.ListJoin;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
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.ArtifactManagement; 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.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.CustomSoftwareModule; 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.model.SwMetadataCompositeKey;
import org.eclipse.hawkbit.repository.specifications.SoftwareModuleSpecification; import org.eclipse.hawkbit.repository.specifications.SoftwareModuleSpecification;
import org.eclipse.hawkbit.repository.specifications.SpecificationsBuilder; import org.eclipse.hawkbit.repository.specifications.SpecificationsBuilder;
import org.hibernate.validator.constraints.NotEmpty;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.AuditorAware; import org.springframework.data.domain.AuditorAware;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
@@ -61,13 +59,13 @@ import com.google.common.base.Strings;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
/** /**
* Business facade for managing {@link SoftwareModule}s. * JPA implementation of SoftwareManagement.
* *
*/ */
@Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED) @Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED)
@Validated @Validated
@Service @Service
public class SoftwareManagement { public class JpaSoftwareManagement implements SoftwareManagement {
@Autowired @Autowired
private EntityManager entityManager; private EntityManager entityManager;
@@ -96,23 +94,10 @@ public class SoftwareManagement {
@Autowired @Autowired
private ArtifactManagement artifactManagement; private ArtifactManagement artifactManagement;
/** @Override
* 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>
*/
@Modifying @Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) public SoftwareModule updateSoftwareModule(final SoftwareModule sm) {
public SoftwareModule updateSoftwareModule(@NotNull final SoftwareModule sm) {
checkNotNull(sm.getId()); checkNotNull(sm.getId());
final SoftwareModule module = softwareModuleRepository.findOne(sm.getId()); final SoftwareModule module = softwareModuleRepository.findOne(sm.getId());
@@ -130,19 +115,10 @@ public class SoftwareManagement {
return updated ? softwareModuleRepository.save(module) : module; return updated ? softwareModuleRepository.save(module) : module;
} }
/** @Override
* Updates existing {@link SoftwareModuleType}. Update-able value is
* {@link SoftwareModuleType#getDescription()} and
* {@link SoftwareModuleType#getColour()}.
*
* @param sm
* to update
* @return updated {@link Entity}
*/
@Modifying @Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) public SoftwareModuleType updateSoftwareModuleType(final SoftwareModuleType sm) {
public SoftwareModuleType updateSoftwareModuleType(@NotNull final SoftwareModuleType sm) {
checkNotNull(sm.getId()); checkNotNull(sm.getId());
final SoftwareModuleType type = softwareModuleTypeRepository.findOne(sm.getId()); final SoftwareModuleType type = softwareModuleTypeRepository.findOne(sm.getId());
@@ -159,37 +135,20 @@ public class SoftwareManagement {
return updated ? softwareModuleTypeRepository.save(type) : type; return updated ? softwareModuleTypeRepository.save(type) : type;
} }
/** @Override
*
* @param swModule
* SoftwareModule to create
* @return SoftwareModule
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@Modifying @Modifying
@Transactional @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) public SoftwareModule createSoftwareModule(final SoftwareModule swModule) {
public SoftwareModule createSoftwareModule(@NotNull final SoftwareModule swModule) {
if (null != swModule.getId()) { if (null != swModule.getId()) {
throw new EntityAlreadyExistsException(); throw new EntityAlreadyExistsException();
} }
return softwareModuleRepository.save(swModule); return softwareModuleRepository.save(swModule);
} }
/** @Override
* Create {@link SoftwareModule}s in the repository.
*
* @param swModules
* {@link SoftwareModule}s to create
* @return SoftwareModule
* @throws EntityAlreadyExistsException
* if a given entity already exists
*/
@Modifying @Modifying
@Transactional @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) public List<SoftwareModule> createSoftwareModule(final Iterable<SoftwareModule> swModules) {
public List<SoftwareModule> createSoftwareModule(@NotNull final Iterable<SoftwareModule> swModules) {
swModules.forEach(swModule -> { swModules.forEach(swModule -> {
if (null != swModule.getId()) { if (null != swModule.getId()) {
throw new EntityAlreadyExistsException(); throw new EntityAlreadyExistsException();
@@ -200,19 +159,8 @@ public class SoftwareManagement {
} }
/** @Override
* retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType} public Slice<SoftwareModule> findSoftwareModulesByType(final Pageable pageable, final SoftwareModuleType type) {
* .
*
* @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) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>(); final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -225,15 +173,8 @@ public class SoftwareManagement {
return findSwModuleByCriteriaAPI(pageable, specList); return findSwModuleByCriteriaAPI(pageable, specList);
} }
/** @Override
* Counts {@link SoftwareModule}s with given {@link SoftwareModuleType}. public Long countSoftwareModulesByType(final SoftwareModuleType type) {
*
* @param type
* to count
* @return number of found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Long countSoftwareModulesByType(@NotNull final SoftwareModuleType type) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>(); final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -246,63 +187,29 @@ public class SoftwareManagement {
return countSwModuleByCriteriaAPI(specList); return countSwModuleByCriteriaAPI(specList);
} }
/** @Override
* Finds {@link SoftwareModule} by given id. public SoftwareModule findSoftwareModuleById(final Long 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) {
return artifactManagement.findSoftwareModuleById(id); return artifactManagement.findSoftwareModuleById(id);
} }
/** @Override
* retrieves {@link SoftwareModule} by their name AND version AND type.. public SoftwareModule findSoftwareModuleByNameAndVersion(final String name, final String version,
* final SoftwareModuleType 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) {
return softwareModuleRepository.findOneByNameAndVersionAndType(name, version, 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) { private boolean isUnassigned(final SoftwareModule bsmMerged) {
return distributionSetRepository.findByModules(bsmMerged).isEmpty(); return distributionSetRepository.findByModules(bsmMerged).isEmpty();
} }
private Slice<SoftwareModule> findSwModuleByCriteriaAPI(@NotNull final Pageable pageable, private Slice<SoftwareModule> findSwModuleByCriteriaAPI(final Pageable pageable,
@NotEmpty final List<Specification<SoftwareModule>> specList) { final List<Specification<SoftwareModule>> specList) {
return criteriaNoCountDao.findAll(SpecificationsBuilder.combineWithAnd(specList), pageable, return criteriaNoCountDao.findAll(SpecificationsBuilder.combineWithAnd(specList), pageable,
SoftwareModule.class); 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)); return softwareModuleRepository.count(SpecificationsBuilder.combineWithAnd(specList));
} }
@@ -312,16 +219,10 @@ public class SoftwareManagement {
} }
} }
/** @Override
* Deletes {@link SoftwareModule}s which is any if the given ids.
*
* @param ids
* of the Software Modules to be deleted
*/
@Modifying @Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY) public void deleteSoftwareModules(final Iterable<Long> ids) {
public void deleteSoftwareModules(@NotNull final Iterable<Long> ids) {
final List<SoftwareModule> swModulesToDelete = softwareModuleRepository.findByIdIn(ids); final List<SoftwareModule> swModulesToDelete = softwareModuleRepository.findByIdIn(ids);
final Set<Long> assignedModuleIds = new HashSet<>(); final Set<Long> assignedModuleIds = new HashSet<>();
swModulesToDelete.forEach(swModule -> { swModulesToDelete.forEach(swModule -> {
@@ -349,15 +250,8 @@ public class SoftwareManagement {
} }
} }
/** @Override
* Retrieves all software modules. Deleted ones are filtered. public Slice<SoftwareModule> findSoftwareModulesAll(final Pageable pageable) {
*
* @param pageable
* pagination parameter
* @return the found {@link SoftwareModule}s
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Slice<SoftwareModule> findSoftwareModulesAll(@NotNull final Pageable pageable) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>(); final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -376,13 +270,7 @@ public class SoftwareManagement {
return findSwModuleByCriteriaAPI(pageable, specList); return findSwModuleByCriteriaAPI(pageable, specList);
} }
/** @Override
* 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)
public Long countSoftwareModulesAll() { public Long countSoftwareModulesAll() {
final List<Specification<SoftwareModule>> specList = new ArrayList<>(); final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -393,79 +281,31 @@ public class SoftwareManagement {
return countSwModuleByCriteriaAPI(specList); return countSwModuleByCriteriaAPI(specList);
} }
/** @Override
* Retrieves software module including details ( public SoftwareModule findSoftwareModuleWithDetails(final Long id) {
* {@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) {
return artifactManagement.findSoftwareModuleWithDetails(id); return artifactManagement.findSoftwareModuleWithDetails(id);
} }
/** @Override
* Retrieves all {@link SoftwareModule}s with a given specification. public Page<SoftwareModule> findSoftwareModulesByPredicate(final Specification<SoftwareModule> spec,
* final Pageable pageable) {
* @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) {
return softwareModuleRepository.findAll(spec, pageable); return softwareModuleRepository.findAll(spec, pageable);
} }
/** @Override
* Retrieves all {@link SoftwareModuleType}s with a given specification. public Page<SoftwareModuleType> findSoftwareModuleTypesByPredicate(final Specification<SoftwareModuleType> spec,
* final Pageable pageable) {
* @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) {
return softwareModuleTypeRepository.findAll(spec, pageable); return softwareModuleTypeRepository.findAll(spec, pageable);
} }
/** @Override
* 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
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) @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); return softwareModuleRepository.findByIdIn(ids);
} }
/** @Override
* Filter {@link SoftwareModule}s with given public Slice<SoftwareModule> findSoftwareModuleByFilters(final Pageable pageable, final String searchText,
* {@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,
final SoftwareModuleType type) { final SoftwareModuleType type) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>(); final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -495,29 +335,9 @@ public class SoftwareManagement {
return findSwModuleByCriteriaAPI(pageable, specList); return findSwModuleByCriteriaAPI(pageable, specList);
} }
/** @Override
* 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)
public Slice<CustomSoftwareModule> findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc( 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 SoftwareModuleType type) {
final List<CustomSoftwareModule> resultList = new ArrayList<>(); final List<CustomSoftwareModule> resultList = new ArrayList<>();
@@ -594,9 +414,6 @@ public class SoftwareManagement {
return specList; return specList;
} }
/**
* @param specifications
*/
private Predicate[] specificationsToPredicate(final List<Specification<SoftwareModule>> specifications, private Predicate[] specificationsToPredicate(final List<Specification<SoftwareModule>> specifications,
final Root<SoftwareModule> root, final CriteriaQuery<?> query, final CriteriaBuilder cb, final Root<SoftwareModule> root, final CriteriaQuery<?> query, final CriteriaBuilder cb,
final Predicate... additionalPredicates) { final Predicate... additionalPredicates) {
@@ -608,18 +425,7 @@ public class SoftwareManagement {
return predicates.toArray(new Predicate[predicates.size()]); return predicates.toArray(new Predicate[predicates.size()]);
} }
/** @Override
* 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)
public Long countSoftwareModuleByFilters(final String searchText, final SoftwareModuleType type) { public Long countSoftwareModuleByFilters(final String searchText, final SoftwareModuleType type) {
final List<Specification<SoftwareModule>> specList = new ArrayList<>(); final List<Specification<SoftwareModule>> specList = new ArrayList<>();
@@ -640,71 +446,35 @@ public class SoftwareManagement {
return countSwModuleByCriteriaAPI(specList); return countSwModuleByCriteriaAPI(specList);
} }
/** @Override
* @param pageable public Page<SoftwareModuleType> findSoftwareModuleTypesAll(final Pageable pageable) {
* parameter
* @return all {@link SoftwareModuleType}s in the repository.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Page<SoftwareModuleType> findSoftwareModuleTypesAll(@NotNull final Pageable pageable) {
return softwareModuleTypeRepository.findByDeleted(pageable, false); return softwareModuleTypeRepository.findByDeleted(pageable, false);
} }
/** @Override
* @return number of {@link SoftwareModuleType}s in the repository.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
public Long countSoftwareModuleTypesAll() { public Long countSoftwareModuleTypesAll() {
return softwareModuleTypeRepository.countByDeleted(false); return softwareModuleTypeRepository.countByDeleted(false);
} }
/** @Override
* public SoftwareModuleType findSoftwareModuleTypeByKey(final String key) {
* @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) {
return softwareModuleTypeRepository.findByKey(key); return softwareModuleTypeRepository.findByKey(key);
} }
/** @Override
* public SoftwareModuleType findSoftwareModuleTypeById(final Long id) {
* @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) {
return softwareModuleTypeRepository.findOne(id); return softwareModuleTypeRepository.findOne(id);
} }
/** @Override
* public SoftwareModuleType findSoftwareModuleTypeByName(final String name) {
* @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) {
return softwareModuleTypeRepository.findByName(name); return softwareModuleTypeRepository.findByName(name);
} }
/** @Override
* Creates new {@link SoftwareModuleType}.
*
* @param type
* to create
* @return created {@link Entity}
*/
@Modifying @Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) public SoftwareModuleType createSoftwareModuleType(final SoftwareModuleType type) {
public SoftwareModuleType createSoftwareModuleType(@NotNull final SoftwareModuleType type) {
if (type.getId() != null) { if (type.getId() != null) {
throw new EntityAlreadyExistsException("Given type contains an Id!"); throw new EntityAlreadyExistsException("Given type contains an Id!");
} }
@@ -712,30 +482,10 @@ public class SoftwareManagement {
return softwareModuleTypeRepository.save(type); return softwareModuleTypeRepository.save(type);
} }
/** @Override
* Creates multiple {@link SoftwareModuleType}s.
*
* @param types
* to create
* @return created {@link Entity}
*/
@Modifying @Modifying
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY) public void deleteSoftwareModuleType(final SoftwareModuleType type) {
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) {
if (softwareModuleRepository.countByType(type) > 0 if (softwareModuleRepository.countByType(type) > 0
|| distributionSetTypeRepository.countByElementsSmType(type) > 0) { || distributionSetTypeRepository.countByElementsSmType(type) > 0) {
@@ -747,50 +497,21 @@ public class SoftwareManagement {
} }
} }
/** @Override
* @param pageable public Page<SoftwareModule> findSoftwareModuleByAssignedTo(final Pageable pageable, final DistributionSet set) {
* 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) {
return softwareModuleRepository.findByAssignedTo(pageable, set); return softwareModuleRepository.findByAssignedTo(pageable, set);
} }
/** @Override
* @param pageable public Page<SoftwareModule> findSoftwareModuleByAssignedToAndType(final Pageable pageable,
* the page request to page the result set final DistributionSet set, final SoftwareModuleType type) {
* @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) {
return softwareModuleRepository.findByAssignedToAndType(pageable, set, type); return softwareModuleRepository.findByAssignedToAndType(pageable, set, type);
} }
/** @Override
* 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
*/
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Modifying @Modifying
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) public SoftwareModuleMetadata createSoftwareModuleMetadata(final SoftwareModuleMetadata metadata) {
public SoftwareModuleMetadata createSoftwareModuleMetadata(@NotNull final SoftwareModuleMetadata metadata) {
if (softwareModuleMetadataRepository.exists(metadata.getId())) { if (softwareModuleMetadataRepository.exists(metadata.getId())) {
throwMetadataKeyAlreadyExists(metadata.getId().getKey()); throwMetadataKeyAlreadyExists(metadata.getId().getKey());
} }
@@ -802,21 +523,11 @@ public class SoftwareManagement {
return softwareModuleMetadataRepository.save(metadata); return softwareModuleMetadataRepository.save(metadata);
} }
/** @Override
* 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
*/
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Modifying @Modifying
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
public List<SoftwareModuleMetadata> createSoftwareModuleMetadata( public List<SoftwareModuleMetadata> createSoftwareModuleMetadata(
@NotEmpty final Collection<SoftwareModuleMetadata> metadata) { final Collection<SoftwareModuleMetadata> metadata) {
for (final SoftwareModuleMetadata softwareModuleMetadata : metadata) { for (final SoftwareModuleMetadata softwareModuleMetadata : metadata) {
checkAndThrowAlreadyExistsIfSoftwareModuleMetadataExists(softwareModuleMetadata.getId()); checkAndThrowAlreadyExistsIfSoftwareModuleMetadataExists(softwareModuleMetadata.getId());
} }
@@ -824,20 +535,10 @@ public class SoftwareManagement {
return softwareModuleMetadataRepository.save(metadata); return softwareModuleMetadataRepository.save(metadata);
} }
/** @Override
* 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
*/
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Modifying @Modifying
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) public SoftwareModuleMetadata updateSoftwareModuleMetadata(final SoftwareModuleMetadata metadata) {
public SoftwareModuleMetadata updateSoftwareModuleMetadata(@NotNull final SoftwareModuleMetadata metadata) {
// check if exists otherwise throw entity not found exception // check if exists otherwise throw entity not found exception
findSoftwareModuleMetadata(metadata.getId()); findSoftwareModuleMetadata(metadata.getId());
// touch it to update the lock revision because we are modifying the // touch it to update the lock revision because we are modifying the
@@ -847,50 +548,22 @@ public class SoftwareManagement {
return softwareModuleMetadataRepository.save(metadata); return softwareModuleMetadataRepository.save(metadata);
} }
/** @Override
* deletes a software module meta data entry.
*
* @param id
* the ID of the software module meta data to delete
*/
@Transactional(isolation = Isolation.READ_UNCOMMITTED) @Transactional(isolation = Isolation.READ_UNCOMMITTED)
@Modifying @Modifying
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY) public void deleteSoftwareModuleMetadata(final SwMetadataCompositeKey id) {
public void deleteSoftwareModuleMetadata(@NotNull final SwMetadataCompositeKey id) {
softwareModuleMetadataRepository.delete(id); softwareModuleMetadataRepository.delete(id);
} }
/** @Override
* finds all meta data by the given software module id. public Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(final Long swId,
* final Pageable pageable) {
* @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) {
return softwareModuleMetadataRepository.findBySoftwareModuleId(swId, pageable); return softwareModuleMetadataRepository.findBySoftwareModuleId(swId, pageable);
} }
/** @Override
* 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)
public Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(final Long softwareModuleId, 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 return softwareModuleMetadataRepository
.findAll( .findAll(
(Specification<SoftwareModuleMetadata>) (root, query, (Specification<SoftwareModuleMetadata>) (root, query,
@@ -901,18 +574,8 @@ public class SoftwareManagement {
pageable); pageable);
} }
/** @Override
* finds a single software module meta data by its id. public SoftwareModuleMetadata findSoftwareModuleMetadata(final SwMetadataCompositeKey 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) {
final SoftwareModuleMetadata findOne = softwareModuleMetadataRepository.findOne(id); final SoftwareModuleMetadata findOne = softwareModuleMetadataRepository.findOne(id);
if (findOne == null) { if (findOne == null) {
throw new EntityNotFoundException("Metadata with key '" + id.getKey() + "' does not exist"); 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"); 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.DistributionSetManagement;
import org.eclipse.hawkbit.repository.RolloutGroupManagement; import org.eclipse.hawkbit.repository.RolloutGroupManagement;
import org.eclipse.hawkbit.repository.RolloutManagement; import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement; import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.jpa.ActionRepository; import org.eclipse.hawkbit.repository.jpa.ActionRepository;
import org.eclipse.hawkbit.repository.jpa.ActionStatusRepository; 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.LocalArtifactRepository;
import org.eclipse.hawkbit.repository.jpa.RolloutGroupRepository; import org.eclipse.hawkbit.repository.jpa.RolloutGroupRepository;
import org.eclipse.hawkbit.repository.jpa.RolloutRepository; 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.SoftwareModuleMetadataRepository;
import org.eclipse.hawkbit.repository.jpa.SoftwareModuleRepository; import org.eclipse.hawkbit.repository.jpa.SoftwareModuleRepository;
import org.eclipse.hawkbit.repository.jpa.SoftwareModuleTypeRepository; 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.apache.commons.io.IOUtils;
import org.eclipse.hawkbit.repository.ArtifactManagement; import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement; 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.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTag; 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.") @Description("Searches for software modules based on a list of IDs.")
public void findSoftwareModulesById() { 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, "")) modules.add(softwareManagement.createSoftwareModule(new SoftwareModule(osType, "poky-una", "3.0.2", null, ""))
.getId()); .getId());

View File

@@ -30,7 +30,7 @@ import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.DeploymentManagement; import org.eclipse.hawkbit.repository.DeploymentManagement;
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult; import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.DistributionSetManagement; 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.TagManagement;
import org.eclipse.hawkbit.repository.jpa.TargetManagement; import org.eclipse.hawkbit.repository.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.model.Action; 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.controller.model.Result.FinalResult;
import org.eclipse.hawkbit.repository.ArtifactManagement; import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.ControllerManagement; import org.eclipse.hawkbit.repository.ControllerManagement;
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.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status; import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus; import org.eclipse.hawkbit.repository.model.ActionStatus;

View File

@@ -16,8 +16,8 @@ import java.util.List;
import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult; import org.eclipse.hawkbit.repository.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
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.SoftwareManagement;
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.DistributionSetType; 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.DistributionSetFields;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetMetadataFields; import org.eclipse.hawkbit.repository.DistributionSetMetadataFields;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.TargetFields; import org.eclipse.hawkbit.repository.TargetFields;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; 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.SystemManagement;
import org.eclipse.hawkbit.repository.jpa.TargetManagement; import org.eclipse.hawkbit.repository.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.jpa.TargetWithActionType; 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.ArrayList;
import java.util.List; import java.util.List;
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.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType; import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.rest.resource.api.DistributionSetTypeRestApi; 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.DistributionSetManagement;
import org.eclipse.hawkbit.repository.DistributionSetTypeFields; import org.eclipse.hawkbit.repository.DistributionSetTypeFields;
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.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.Artifact; import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.DistributionSetType; import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModule; 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.artifact.repository.model.DbArtifact;
import org.eclipse.hawkbit.repository.ArtifactManagement; import org.eclipse.hawkbit.repository.ArtifactManagement;
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.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.LocalArtifact; import org.eclipse.hawkbit.repository.model.LocalArtifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.rest.resource.helper.RestResourceConversionHelper; 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.ArrayList;
import java.util.List; import java.util.List;
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.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.Artifact; import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.LocalArtifact; import org.eclipse.hawkbit.repository.model.LocalArtifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;

View File

@@ -12,10 +12,10 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.repository.ArtifactManagement; import org.eclipse.hawkbit.repository.ArtifactManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleFields; import org.eclipse.hawkbit.repository.SoftwareModuleFields;
import org.eclipse.hawkbit.repository.SoftwareModuleMetadataFields; import org.eclipse.hawkbit.repository.SoftwareModuleMetadataFields;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; 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.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;

View File

@@ -10,9 +10,9 @@ package org.eclipse.hawkbit.rest.resource;
import java.util.List; import java.util.List;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeFields; import org.eclipse.hawkbit.repository.SoftwareModuleTypeFields;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException; 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.Artifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; 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.WithUser;
import org.eclipse.hawkbit.repository.ControllerManagement; import org.eclipse.hawkbit.repository.ControllerManagement;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
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.ActionRepository; 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.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.model.Action; import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status; import org.eclipse.hawkbit.repository.model.Action.Status;

View File

@@ -14,7 +14,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; 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.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState; import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile; 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.List;
import java.util.Map; import java.util.Map;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest; 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.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter; 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 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.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery; import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;

View File

@@ -12,7 +12,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; 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.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent; import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleEvent; 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.List;
import java.util.Set; import java.util.Set;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker; import org.eclipse.hawkbit.repository.SpPermissionChecker;
import org.eclipse.hawkbit.repository.jpa.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent; import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum; 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 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.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent; import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState; 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.List;
import java.util.Map; import java.util.Map;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest; 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.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions; import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SpringContextHelper; import org.eclipse.hawkbit.ui.utils.SpringContextHelper;

View File

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

View File

@@ -14,7 +14,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement; 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.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;

View File

@@ -18,8 +18,8 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import org.eclipse.hawkbit.repository.DistributionSetManagement; import org.eclipse.hawkbit.repository.DistributionSetManagement;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SpPermissionChecker; 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.jpa.TargetManagement;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.repository.model.DistributionSetIdName;

View File

@@ -17,7 +17,7 @@ import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.eclipse.hawkbit.repository.DistributionSetManagement; 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.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetIdName; import org.eclipse.hawkbit.repository.model.DistributionSetIdName;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;

View File

@@ -12,8 +12,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.jpa.OffsetBasedPageRequest; 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.CustomSoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModule; import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType; import org.eclipse.hawkbit.repository.model.SoftwareModuleType;

View File

@@ -13,7 +13,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; 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.repository.model.SoftwareModule;
import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout; import org.eclipse.hawkbit.ui.artifacts.details.ArtifactDetailsLayout;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent; 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 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.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent; import org.eclipse.hawkbit.ui.artifacts.event.SMFilterEvent;
import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick; import org.eclipse.hawkbit.ui.common.filterlayout.AbstractFilterSingleButtonClick;

View File

@@ -20,7 +20,7 @@ import java.util.Map.Entry;
import java.util.TimeZone; import java.util.TimeZone;
import org.apache.commons.lang3.StringUtils; 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.AssignmentResult;
import org.eclipse.hawkbit.repository.model.DistributionSet; import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.NamedEntity; 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.homepage>https://projects.eclipse.org/projects/iot.hawkbit</sonar.links.homepage>
<sonar.links.ci>https://circleci.com/gh/eclipse/hawkbit</sonar.links.ci> <sonar.links.ci>https://circleci.com/gh/eclipse/hawkbit</sonar.links.ci>
<!-- Jacoco version to use --> <!-- 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 <!-- The Sonar Jacoco Listener for JUnit to extract coverage details
per test --> per test -->
<sonar-jacoco-listeners.version>1.4</sonar-jacoco-listeners.version> <sonar-jacoco-listeners.version>1.4</sonar-jacoco-listeners.version>