Clean Code Refactoring
Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -298,20 +298,7 @@ public class AmqpMessageHandlerService {
|
|||||||
*/
|
*/
|
||||||
private void updateActionStatus(final Message message) {
|
private void updateActionStatus(final Message message) {
|
||||||
final ActionUpdateStatus actionUpdateStatus = convertMessage(message, ActionUpdateStatus.class);
|
final ActionUpdateStatus actionUpdateStatus = convertMessage(message, ActionUpdateStatus.class);
|
||||||
final Long actionId = actionUpdateStatus.getActionId();
|
final Action action = checkActionExist(message, actionUpdateStatus);
|
||||||
LOG.debug("Target notifies intermediate about action {} with status {}.", actionId, actionUpdateStatus
|
|
||||||
.getActionStatus().name());
|
|
||||||
|
|
||||||
if (actionId == null) {
|
|
||||||
logAndThrowMessageError(message, "Invalid message no action id");
|
|
||||||
}
|
|
||||||
|
|
||||||
final Action action = controllerManagement.findActionWithDetails(actionId);
|
|
||||||
|
|
||||||
if (action == null) {
|
|
||||||
logAndThrowMessageError(message, "Got intermediate notification about action " + actionId
|
|
||||||
+ " but action does not exist");
|
|
||||||
}
|
|
||||||
|
|
||||||
final ActionStatus actionStatus = new ActionStatus();
|
final ActionStatus actionStatus = new ActionStatus();
|
||||||
final List<String> messageText = actionUpdateStatus.getMessage();
|
final List<String> messageText = actionUpdateStatus.getMessage();
|
||||||
@@ -362,6 +349,29 @@ public class AmqpMessageHandlerService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message
|
||||||
|
* @param actionUpdateStatus
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Action checkActionExist(final Message message, final ActionUpdateStatus actionUpdateStatus) {
|
||||||
|
final Long actionId = actionUpdateStatus.getActionId();
|
||||||
|
LOG.debug("Target notifies intermediate about action {} with status {}.", actionId, actionUpdateStatus
|
||||||
|
.getActionStatus().name());
|
||||||
|
|
||||||
|
if (actionId == null) {
|
||||||
|
logAndThrowMessageError(message, "Invalid message no action id");
|
||||||
|
}
|
||||||
|
|
||||||
|
final Action action = controllerManagement.findActionWithDetails(actionId);
|
||||||
|
|
||||||
|
if (action == null) {
|
||||||
|
logAndThrowMessageError(message, "Got intermediate notification about action " + actionId
|
||||||
|
+ " but action does not exist");
|
||||||
|
}
|
||||||
|
return action;
|
||||||
|
}
|
||||||
|
|
||||||
private void handleCancelRejected(final Message message, final Action action, final ActionStatus actionStatus) {
|
private void handleCancelRejected(final Message message, final Action action, final ActionStatus actionStatus) {
|
||||||
if (action.isCancelingOrCanceled()) {
|
if (action.isCancelingOrCanceled()) {
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
|||||||
@Override
|
@Override
|
||||||
protected Map<String, Object> getVendorProperties() {
|
protected Map<String, Object> getVendorProperties() {
|
||||||
|
|
||||||
final Map<String, Object> properties = new HashMap<String, Object>();
|
final Map<String, Object> properties = new HashMap<>();
|
||||||
// Turn off dynamic weaving to disable LTW lookup in static weaving mode
|
// Turn off dynamic weaving to disable LTW lookup in static weaving mode
|
||||||
properties.put("eclipselink.weaving", "false");
|
properties.put("eclipselink.weaving", "false");
|
||||||
// needed for reports
|
// needed for reports
|
||||||
|
|||||||
Reference in New Issue
Block a user