Remove deprecated (#2800)
* ActionFields.DETAILSTATUS removed and replaces with STATUS (so status is with changed semantic - not active but real status) * MgmtAction.detailStatus removed and replaced with status (so status is with changed semantic - not active but real status) * MgmtTargetTagRestApi.assignTargetsPut removed - use POST method * ActionStatusFields.REPORTEDAT deprecation removed - it is a synonym of CREATEDAT but is part of timestamp/reported aspect while createdat is part of creted at/by * MgmtDistributionSetRequestBodyPost.os/runtime/application is removed and * ActionStatusFields.TIMESTAMPT added Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -22,7 +22,6 @@ import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.eclipse.hawkbit.artifact.encryption.ArtifactEncryption;
|
||||
import org.eclipse.hawkbit.artifact.encryption.ArtifactEncryptionSecretsStorage;
|
||||
import org.eclipse.hawkbit.artifact.encryption.ArtifactEncryptionService;
|
||||
import org.eclipse.hawkbit.repository.ActionFields;
|
||||
import org.eclipse.hawkbit.repository.AutoAssignExecutor;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.PropertiesQuotaManagement;
|
||||
@@ -42,7 +41,6 @@ import org.eclipse.hawkbit.repository.event.ApplicationEventFilter;
|
||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManager;
|
||||
import org.eclipse.hawkbit.repository.event.remote.EventEntityManagerHolder;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.jpa.acm.AccessController;
|
||||
import org.eclipse.hawkbit.repository.jpa.aspects.ExceptionMappingAspectHandler;
|
||||
import org.eclipse.hawkbit.repository.jpa.autocleanup.AutoActionCleanup;
|
||||
@@ -478,39 +476,6 @@ public class JpaRepositoryConfiguration {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 0.10.0, will be removed in future releases. Use "active" for querying active status instead of "status".
|
||||
*/
|
||||
@Deprecated(since = "0.10.0", forRemoval = true)
|
||||
@Bean
|
||||
public NodeTransformer actionStatusTransformer() {
|
||||
return new NodeTransformer.Abstract() {
|
||||
|
||||
// just extension points for subclasses
|
||||
@Override
|
||||
protected <T extends Enum<T> & QueryField> Object transformValueElement(
|
||||
final Object value, final Comparison comparison, final Class<T> queryFieldType) {
|
||||
return queryFieldType == (Class<?>) ActionFields.class && "active".equalsIgnoreCase(comparison.getKey())
|
||||
? mapActionStatus(value)
|
||||
: value;
|
||||
}
|
||||
|
||||
private static Object mapActionStatus(final Object value) {
|
||||
final String strValue = String.valueOf(value);
|
||||
if ("true".equalsIgnoreCase(strValue) || "false".equalsIgnoreCase(strValue)) {
|
||||
return value;
|
||||
} else {
|
||||
// handle custom action fields status
|
||||
try {
|
||||
return ActionFields.convertStatusValue(strValue);
|
||||
} catch (final IllegalArgumentException e) {
|
||||
throw new RSQLParameterUnsupportedFieldException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
QueryParser queryParser() {
|
||||
|
||||
@@ -119,7 +119,7 @@ public abstract class AbstractDsAssignmentStrategy {
|
||||
public JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
|
||||
final JpaActionStatus actionStatus = new JpaActionStatus();
|
||||
actionStatus.setAction(action);
|
||||
actionStatus.setOccurredAt(action.getCreatedAt());
|
||||
actionStatus.setTimestamp(action.getCreatedAt());
|
||||
|
||||
if (StringUtils.hasText(actionMessage)) {
|
||||
actionStatus.addMessage(actionMessage);
|
||||
|
||||
@@ -67,7 +67,7 @@ public class JpaActionManagement {
|
||||
protected static JpaActionStatus buildJpaActionStatus(final ActionStatusCreate create) {
|
||||
final JpaActionStatus actionStatus = new JpaActionStatus(
|
||||
create.getStatus(),
|
||||
Optional.ofNullable(create.getOccurredAt()).orElseGet(System::currentTimeMillis));
|
||||
Optional.ofNullable(create.getTimestamp()).orElseGet(System::currentTimeMillis));
|
||||
Optional.ofNullable(create.getMessages()).ifPresent(messages -> messages.forEach(actionStatus::addMessage));
|
||||
actionStatus.setCode(create.getCode());
|
||||
return actionStatus;
|
||||
|
||||
@@ -209,7 +209,7 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
|
||||
@Override
|
||||
protected void onActionStatusUpdate(final JpaActionStatus newActionStatus, final JpaAction action) {
|
||||
final Action.Status updatedActionStatus = newActionStatus.getStatus();
|
||||
final long occurredAt = newActionStatus.getOccurredAt();
|
||||
final long timestamp = newActionStatus.getTimestamp();
|
||||
switch (updatedActionStatus) {
|
||||
case ERROR: {
|
||||
final JpaTarget target = action.getTarget();
|
||||
@@ -218,7 +218,7 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
|
||||
break;
|
||||
}
|
||||
case FINISHED: {
|
||||
requestControllerAttributes(handleFinishedAndStoreInTargetStatus(occurredAt, action));
|
||||
requestControllerAttributes(handleFinishedAndStoreInTargetStatus(timestamp, action));
|
||||
break;
|
||||
}
|
||||
case DOWNLOADED: {
|
||||
@@ -499,7 +499,7 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
|
||||
? RepositoryConstants.MAX_ACTION_HISTORY_MSG_COUNT
|
||||
: messageCount;
|
||||
|
||||
final PageRequest pageable = PageRequest.of(0, limit, Sort.by(Direction.DESC, "occurredAt"));
|
||||
final PageRequest pageable = PageRequest.of(0, limit, Sort.by(Direction.DESC, "timestamp"));
|
||||
final Page<String> messages = actionStatusRepository.findMessagesByActionIdAndMessageNotLike(
|
||||
actionId, RepositoryConstants.SERVER_MESSAGE_PREFIX + "%", pageable);
|
||||
|
||||
@@ -846,15 +846,15 @@ public class JpaControllerManagement extends JpaActionManagement implements Cont
|
||||
* @param action updated action
|
||||
* @return a present controllerId in case the attributes needs to be requested.
|
||||
*/
|
||||
private JpaTarget handleFinishedAndStoreInTargetStatus(final long occurredAt, final JpaAction action) {
|
||||
private JpaTarget handleFinishedAndStoreInTargetStatus(final long timestamp, final JpaAction action) {
|
||||
final JpaTarget target = action.getTarget();
|
||||
action.setActive(false);
|
||||
action.setStatus(Status.FINISHED);
|
||||
if (target.getInstallationDate() == null || target.getInstallationDate() < occurredAt) {
|
||||
if (target.getInstallationDate() == null || target.getInstallationDate() < timestamp) {
|
||||
final JpaDistributionSet ds = entityManager.merge(action.getDistributionSet());
|
||||
|
||||
target.setInstalledDistributionSet(ds);
|
||||
target.setInstallationDate(occurredAt);
|
||||
target.setInstallationDate(timestamp);
|
||||
|
||||
// Target reported an installation of a DOWNLOAD_ONLY assignment, the assigned DS has to be adapted
|
||||
// because the currently assigned DS can be unequal to the currently installed DS (the downloadOnly DS)
|
||||
|
||||
@@ -1048,7 +1048,7 @@ public class JpaDeploymentManagement extends JpaActionManagement implements Depl
|
||||
private void setSkipActionStatus(final JpaAction action) {
|
||||
final JpaActionStatus actionStatus = new JpaActionStatus();
|
||||
actionStatus.setAction(action);
|
||||
actionStatus.setOccurredAt(action.getCreatedAt());
|
||||
actionStatus.setTimestamp(action.getCreatedAt());
|
||||
actionStatus.setStatus(Status.RUNNING);
|
||||
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Distribution Set is already assigned. Skipping this action.");
|
||||
actionStatusRepository.save(actionStatus);
|
||||
|
||||
@@ -142,7 +142,7 @@ public class JpaDistributionSetManagement
|
||||
DistributionSetFields.class));
|
||||
}
|
||||
if (completedComparison.get() != null) { // really a comparison
|
||||
log.warn("Usage of 'complete' in RSQL is deprecated and will be removed in future: {}", node);
|
||||
log.warn("Usage of 'complete' is limited and may be removed: {}", node);
|
||||
final boolean completed = completeComparison(completedComparison);
|
||||
return filter(JpaManagementHelper.findAllWithCountBySpec(jpaRepository, specList, pageable), completed);
|
||||
}
|
||||
|
||||
@@ -568,7 +568,7 @@ public class JpaRolloutManagement implements RolloutManagement {
|
||||
JpaActionStatus actionStatus = new JpaActionStatus();
|
||||
actionStatus.setAction(action);
|
||||
actionStatus.setStatus(status);
|
||||
actionStatus.setOccurredAt(currentTimestamp);
|
||||
actionStatus.setTimestamp(currentTimestamp);
|
||||
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "A " + typeOfCancellation + " has been performed by server.");
|
||||
cancellingStatuses.add(actionStatus);
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
|
||||
@Setter
|
||||
@Getter
|
||||
@Column(name = "target_occurred_at", nullable = false, updatable = false)
|
||||
private long occurredAt;
|
||||
private long timestamp;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(
|
||||
@@ -97,12 +97,12 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
|
||||
*
|
||||
* @param action the action for this action status
|
||||
* @param status the status for this action status
|
||||
* @param occurredAt the occurred timestamp
|
||||
* @param timestamp the occurred timestamp
|
||||
*/
|
||||
public JpaActionStatus(final Action action, final Status status, final long occurredAt) {
|
||||
public JpaActionStatus(final Action action, final Status status, final long timestamp) {
|
||||
this.action = (JpaAction) action;
|
||||
this.status = status;
|
||||
this.occurredAt = occurredAt;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,13 +110,13 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
|
||||
*
|
||||
* @param action the action for this action status
|
||||
* @param status the status for this action status
|
||||
* @param occurredAt the occurred timestamp
|
||||
* @param timestamp the occurred timestamp
|
||||
* @param message the message which should be added to this action status
|
||||
*/
|
||||
public JpaActionStatus(final JpaAction action, final Status status, final long occurredAt, final String message) {
|
||||
public JpaActionStatus(final JpaAction action, final Status status, final long timestamp, final String message) {
|
||||
this.action = action;
|
||||
this.status = status;
|
||||
this.occurredAt = occurredAt;
|
||||
this.timestamp = timestamp;
|
||||
addMessage(message);
|
||||
}
|
||||
|
||||
@@ -124,11 +124,11 @@ public class JpaActionStatus extends AbstractJpaTenantAwareBaseEntity implements
|
||||
* Creates a new {@link ActionStatus} object.
|
||||
*
|
||||
* @param status the status for this action status
|
||||
* @param occurredAt the occurred timestamp
|
||||
* @param timestamp the occurred timestamp
|
||||
*/
|
||||
public JpaActionStatus(final Status status, final long occurredAt) {
|
||||
public JpaActionStatus(final Status status, final long timestamp) {
|
||||
this.status = status;
|
||||
this.occurredAt = occurredAt;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user