Introduce action status scoped custom code (#1277)
* Allow providing a custom code with an action status feedback to give more fine grained device specific details. * Add ddi rest docs for new optional status code value. * Provide new code value via mgmt api. Fix review findings. * Fix failing tests Signed-off-by: Michael Herdt <Michael.Herdt@bosch.io> Co-authored-by: Stefan Behl <stefan.behl@bosch.io>
This commit is contained in:
@@ -29,6 +29,9 @@ public class JpaActionStatusCreate extends AbstractActionStatusCreate<ActionStat
|
||||
if (messages != null) {
|
||||
messages.forEach(result::addMessage);
|
||||
}
|
||||
if (code != null) {
|
||||
result.setCode(code);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository.jpa.model;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.persistence.CollectionTable;
|
||||
import javax.persistence.Column;
|
||||
@@ -85,6 +86,9 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
|
||||
@Column(name = "detail_message", length = MESSAGE_ENTRY_LENGTH, nullable = false, updatable = false)
|
||||
private List<String> messages;
|
||||
|
||||
@Column(name = "code", nullable = true, updatable = false)
|
||||
private Integer code;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ActionStatus} object.
|
||||
*
|
||||
@@ -184,4 +188,11 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Optional<Integer> getCode() {
|
||||
return Optional.ofNullable(code);
|
||||
}
|
||||
|
||||
public void setCode(final Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE sp_action_status ADD COLUMN code INTEGER;
|
||||
CREATE INDEX sp_idx_action_status_03 ON sp_action_status (tenant, code);
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE sp_action_status ADD column code integer;
|
||||
CREATE INDEX sp_idx_action_status_03 ON sp_action_status (tenant, code);
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE sp_action_status ADD COLUMN code integer;
|
||||
CREATE INDEX sp_idx_action_status_03 ON sp_action_status (tenant, code);
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE sp_action_status ADD code INT;
|
||||
CREATE INDEX sp_idx_action_status_03 ON sp_action_status (tenant, code);
|
||||
@@ -47,7 +47,6 @@ import org.eclipse.hawkbit.repository.exception.IncompatibleTargetTypeException;
|
||||
import org.eclipse.hawkbit.repository.exception.IncompleteDistributionSetException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidDistributionSetException;
|
||||
import org.eclipse.hawkbit.repository.exception.MultiAssignmentIsNotEnabledException;
|
||||
import org.eclipse.hawkbit.repository.jpa.configuration.Constants;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||
|
||||
Reference in New Issue
Block a user