Removed deprecated GridFS column from repository (#419)
* Merged artifact sha1 hash and gridfs column. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Renamed exception to get rid of old GridFS name. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Added test description. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix typo. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -19,7 +19,7 @@ import org.eclipse.hawkbit.repository.exception.ArtifactDeleteFailedException;
|
||||
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.GridFSDBFileNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.ArtifactBinaryNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidMD5HashException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidSHA1HashException;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
@@ -186,18 +186,15 @@ public interface ArtifactManagement {
|
||||
/**
|
||||
* Loads {@link DbArtifact} from store for given {@link Artifact}.
|
||||
*
|
||||
* @param artifactId
|
||||
* @param sha1Hash
|
||||
* to search for
|
||||
* @return loaded {@link DbArtifact}
|
||||
*
|
||||
* @throws GridFSDBFileNotFoundException
|
||||
* @throws ArtifactBinaryNotFoundException
|
||||
* if file could not be found in store
|
||||
*
|
||||
* @throws EntityNotFoundException
|
||||
* is artifact with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DOWNLOAD_ARTIFACT + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_CONTROLLER_DOWNLOAD)
|
||||
DbArtifact loadArtifactBinary(@NotNull Long artifactId);
|
||||
DbArtifact loadArtifactBinary(@NotEmpty String sha1Hash);
|
||||
|
||||
}
|
||||
|
||||
@@ -178,15 +178,15 @@ public interface ControllerManagement {
|
||||
*
|
||||
* @param controllerId
|
||||
* the ID of the target to check
|
||||
* @param artifactId
|
||||
* the artifact to verify if the given target had even been
|
||||
* @param sha1Hash
|
||||
* of the artifact to verify if the given target had even been
|
||||
* assigned to
|
||||
* @return {@code true} if the given target has currently or had ever a
|
||||
* relation to the given artifact through the action history,
|
||||
* otherwise {@code false}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
boolean hasTargetArtifactAssigned(@NotNull String controllerId, @NotNull Long artifactId);
|
||||
boolean hasTargetArtifactAssigned(@NotEmpty String controllerId, @NotEmpty String sha1Hash);
|
||||
|
||||
/**
|
||||
* Checks if a given target has currently or has even been assigned to the
|
||||
@@ -197,15 +197,15 @@ public interface ControllerManagement {
|
||||
*
|
||||
* @param targetId
|
||||
* the ID of the target to check
|
||||
* @param artifactId
|
||||
* the artifact to verify if the given target had even been
|
||||
* @param sha1Hash
|
||||
* of the artifact to verify if the given target had even been
|
||||
* assigned to
|
||||
* @return {@code true} if the given target has currently or had ever a
|
||||
* relation to the given artifact through the action history,
|
||||
* otherwise {@code false}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
boolean hasTargetArtifactAssigned(@NotNull Long targetId, @NotNull Long artifactId);
|
||||
boolean hasTargetArtifactAssigned(@NotNull Long targetId, @NotEmpty String sha1Hash);
|
||||
|
||||
/**
|
||||
* Registers retrieved status for given {@link Target} and {@link Action} if
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
||||
*
|
||||
*
|
||||
*/
|
||||
public final class GridFSDBFileNotFoundException extends AbstractServerRtException {
|
||||
public final class ArtifactBinaryNotFoundException extends AbstractServerRtException {
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,7 +27,7 @@ public final class GridFSDBFileNotFoundException extends AbstractServerRtExcepti
|
||||
* Creates a new FileUploadFailedException with
|
||||
* {@link SpServerError#SP_REST_BODY_NOT_READABLE} error.
|
||||
*/
|
||||
public GridFSDBFileNotFoundException() {
|
||||
public ArtifactBinaryNotFoundException() {
|
||||
super(SpServerError.SP_ARTIFACT_LOAD_FAILED);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class GridFSDBFileNotFoundException extends AbstractServerRtExcepti
|
||||
* @param cause
|
||||
* for the exception
|
||||
*/
|
||||
public GridFSDBFileNotFoundException(final Throwable cause) {
|
||||
public ArtifactBinaryNotFoundException(final Throwable cause) {
|
||||
super(SpServerError.SP_ARTIFACT_LOAD_FAILED, cause);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public final class GridFSDBFileNotFoundException extends AbstractServerRtExcepti
|
||||
* @param message
|
||||
* of the error
|
||||
*/
|
||||
public GridFSDBFileNotFoundException(final String message) {
|
||||
public ArtifactBinaryNotFoundException(final String message) {
|
||||
super(message, SpServerError.SP_ARTIFACT_LOAD_FAILED);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.model;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
|
||||
/**
|
||||
@@ -34,7 +36,7 @@ public interface Artifact extends TenantAwareBaseEntity {
|
||||
|
||||
/**
|
||||
* @return SHA-1 hash of the artifact in {@link BaseEncoding#base16()}
|
||||
* format.
|
||||
* format that identifies the {@link DbArtifact} in the system.
|
||||
*/
|
||||
String getSha1Hash();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user