Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -10,12 +10,20 @@
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Update implementation.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Accessors(fluent = true)
|
||||
public class GenericDistributionSetUpdate extends AbstractDistributionSetUpdateCreate<DistributionSetUpdate>
|
||||
implements DistributionSetUpdate {
|
||||
|
||||
@@ -25,17 +33,4 @@ public class GenericDistributionSetUpdate extends AbstractDistributionSetUpdateC
|
||||
public GenericDistributionSetUpdate(final Long id) {
|
||||
super.id = id;
|
||||
}
|
||||
|
||||
public DistributionSetUpdate locked(@Nullable final Boolean locked) {
|
||||
if (Boolean.FALSE.equals(locked)) {
|
||||
this.locked = null;
|
||||
} else {
|
||||
this.locked = locked;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getLocked() {
|
||||
return locked;
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,20 @@
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Update implementation.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString
|
||||
@Accessors(fluent = true)
|
||||
public class GenericSoftwareModuleUpdate extends AbstractSoftwareModuleUpdateCreate<SoftwareModuleUpdate>
|
||||
implements SoftwareModuleUpdate {
|
||||
|
||||
@@ -25,17 +33,4 @@ public class GenericSoftwareModuleUpdate extends AbstractSoftwareModuleUpdateCre
|
||||
public GenericSoftwareModuleUpdate(final Long id) {
|
||||
super.id = id;
|
||||
}
|
||||
|
||||
public SoftwareModuleUpdate locked(@Nullable final Boolean locked) {
|
||||
if (Boolean.FALSE.equals(locked)) {
|
||||
this.locked = null;
|
||||
} else {
|
||||
this.locked = locked;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Boolean getLocked() {
|
||||
return locked;
|
||||
}
|
||||
}
|
||||
@@ -286,8 +286,11 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
update.getDescription().ifPresent(set::setDescription);
|
||||
update.getVersion().ifPresent(set::setVersion);
|
||||
|
||||
if (Boolean.TRUE.equals(update.getLocked()) && !set.isLocked()) {
|
||||
// lock/unlock ONLY if locked flag is present!
|
||||
if (Boolean.TRUE.equals(update.locked())) {
|
||||
set.lock();
|
||||
} else if (Boolean.FALSE.equals(update.locked())) {
|
||||
set.unlock();
|
||||
}
|
||||
|
||||
if (update.isRequiredMigrationStep() != null
|
||||
|
||||
@@ -142,8 +142,12 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
|
||||
update.getDescription().ifPresent(module::setDescription);
|
||||
update.getVendor().ifPresent(module::setVendor);
|
||||
if (Boolean.TRUE.equals(update.getLocked()) && !module.isLocked()) {
|
||||
|
||||
// lock/unlock ONLY if locked flag is present!
|
||||
if (Boolean.TRUE.equals(update.locked())) {
|
||||
module.lock();
|
||||
} else if (Boolean.FALSE.equals(update.locked())) {
|
||||
module.unlock();
|
||||
}
|
||||
|
||||
return softwareModuleRepository.save(module);
|
||||
|
||||
Reference in New Issue
Block a user