Code format hawkbit-repository (#1939)
Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -56,6 +56,25 @@ public class OfflineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
|
||||
quotaManagement, multiAssignmentsConfig, confirmationFlowConfig, repositoryProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
|
||||
final List<JpaTarget> targets, final JpaDistributionSet set) {
|
||||
final JpaAction result = super.createTargetAction(initiatedBy, targetWithActionType, targets, set);
|
||||
if (result != null) {
|
||||
result.setStatus(Status.FINISHED);
|
||||
result.setActive(Boolean.FALSE);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
|
||||
final JpaActionStatus result = super.createActionStatus(action, actionMessage);
|
||||
result.setStatus(Status.FINISHED);
|
||||
result.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Action reported as offline deployment");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JpaTarget> findTargetsForAssignment(final List<String> controllerIDs, final long setId) {
|
||||
final Function<List<String>, List<JpaTarget>> mapper;
|
||||
@@ -126,23 +145,4 @@ public class OfflineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
|
||||
// no need to send deployment events in the offline case
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
|
||||
final List<JpaTarget> targets, final JpaDistributionSet set) {
|
||||
final JpaAction result = super.createTargetAction(initiatedBy, targetWithActionType, targets, set);
|
||||
if (result != null) {
|
||||
result.setStatus(Status.FINISHED);
|
||||
result.setActive(Boolean.FALSE);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
|
||||
final JpaActionStatus result = super.createActionStatus(action, actionMessage);
|
||||
result.setStatus(Status.FINISHED);
|
||||
result.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Action reported as offline deployment");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -72,6 +72,36 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
|
||||
sendTargetAssignDistributionSetEvent(filteredActions.get(0).getTenant(), distributionSetId, filteredActions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
|
||||
final List<JpaTarget> targets, final JpaDistributionSet set) {
|
||||
final JpaAction result = super.createTargetAction(initiatedBy, targetWithActionType, targets, set);
|
||||
if (result != null) {
|
||||
final boolean confirmationRequired = targetWithActionType.isConfirmationRequired()
|
||||
&& result.getTarget().getAutoConfirmationStatus() == null;
|
||||
if (isConfirmationFlowEnabled() && confirmationRequired) {
|
||||
result.setStatus(Status.WAIT_FOR_CONFIRMATION);
|
||||
} else {
|
||||
result.setStatus(Status.RUNNING);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called to create the initial action status for an action
|
||||
*/
|
||||
@Override
|
||||
public JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
|
||||
final JpaActionStatus result = super.createActionStatus(action, actionMessage);
|
||||
if (isConfirmationFlowEnabled()) {
|
||||
result.setStatus(Status.WAIT_FOR_CONFIRMATION);
|
||||
} else {
|
||||
result.setStatus(Status.RUNNING);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JpaTarget> findTargetsForAssignment(final List<String> controllerIDs, final long setId) {
|
||||
final Function<List<String>, List<JpaTarget>> mapper;
|
||||
@@ -149,36 +179,6 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JpaAction createTargetAction(final String initiatedBy, final TargetWithActionType targetWithActionType,
|
||||
final List<JpaTarget> targets, final JpaDistributionSet set) {
|
||||
final JpaAction result = super.createTargetAction(initiatedBy, targetWithActionType, targets, set);
|
||||
if (result != null) {
|
||||
final boolean confirmationRequired = targetWithActionType.isConfirmationRequired()
|
||||
&& result.getTarget().getAutoConfirmationStatus() == null;
|
||||
if (isConfirmationFlowEnabled() && confirmationRequired) {
|
||||
result.setStatus(Status.WAIT_FOR_CONFIRMATION);
|
||||
} else {
|
||||
result.setStatus(Status.RUNNING);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called to create the initial action status for an action
|
||||
*/
|
||||
@Override
|
||||
public JpaActionStatus createActionStatus(final JpaAction action, final String actionMessage) {
|
||||
final JpaActionStatus result = super.createActionStatus(action, actionMessage);
|
||||
if (isConfirmationFlowEnabled()) {
|
||||
result.setStatus(Status.WAIT_FOR_CONFIRMATION);
|
||||
} else {
|
||||
result.setStatus(Status.RUNNING);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void cancelAssignment(final JpaAction action) {
|
||||
if (isMultiAssignmentsEnabled()) {
|
||||
sendMultiActionCancelEvent(action);
|
||||
|
||||
@@ -77,6 +77,14 @@ public class JpaTargetMetadata extends AbstractJpaMetaData implements TargetMeta
|
||||
this.target = (JpaTarget) target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((target == null) ? 0 : target.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
// exception squid:S2259 - obj is checked for null in super
|
||||
@SuppressWarnings("squid:S2259")
|
||||
@@ -94,12 +102,4 @@ public class JpaTargetMetadata extends AbstractJpaMetaData implements TargetMeta
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((target == null) ? 0 : target.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user