public static ExecStatus fromHttpStatus(final int httpStatus) { ExecStatus status = null; for (ExecStatus value : values()) { if (httpStatus == value.getHttpStatus()) { status = value; } } if (status == null && httpStatus == Response.Status.NO_CONTENT.getStatusCode()) { return ExecStatus.SUCCESS; } return status; } }
protected static String getStatus(final int httpStatus) { ExecStatus execStatus = ExecStatus.fromHttpStatus(httpStatus); return execStatus == null ? Constants.UNKNOWN : execStatus.name(); } }
item.setStatus(status.getStatus().getHttpStatus());
execution.setStatus(ExecStatus.CREATED.name()); ? ExecStatus.SUCCESS.name() : ExecStatus.NOT_ATTEMPTED.name()); execution.setStatus(ExecStatus.FAILURE.name()); } catch (Exception wft) { LOG.error("While executing KO action on {}", execution, wft); ExecStatus.valueOf(execution.getStatus()), failureReason, beforeObj,
@Override public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) { try { Object key = BeanUtils.getPropertyDescriptor(rowModel.getObject().getClass(), keyFieldName). getReadMethod().invoke(rowModel.getObject(), new Object[0]); String status = results.containsKey(key.toString()) ? results.get(key.toString()) : ExecStatus.NOT_ATTEMPTED.name(); item.add(new Label(componentId, new StringResourceModel(status, item, new Model<>(status)))); } catch (BeansException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { LOG.error("Errore retrieving target key value", e); } } }
try { execution = newPropagationTaskCallable(task, reporter).call(); execStatus = ExecStatus.valueOf(execution.getStatus()); } catch (Exception e) { LOG.error("Unexpected exception", e);
item.setStatus(status.getStatus().getHttpStatus());
for (TaskExec execution : executions) { try { ExecStatus.valueOf(execution.getStatus()); } catch (IllegalArgumentException e) { LOG.error("Invalid execution status '" + execution.getStatus() + "'", e);
public static ExecStatus fromHttpStatus(final int httpStatus) { ExecStatus status = null; for (ExecStatus value : values()) { if (httpStatus == value.getHttpStatus()) { status = value; } } if (status == null && httpStatus == Response.Status.NO_CONTENT.getStatusCode()) { return ExecStatus.SUCCESS; } return status; } }
/** * Check whether an execution has to be stored, for a given task. * * @param task propagation task * @param execution to be decide whether to store or not * @return true if execution has to be store, false otherwise */ protected boolean hasToBeregistered(final PropagationTask task, final TaskExec execution) { boolean result; boolean failed = ExecStatus.valueOf(execution.getStatus()) != ExecStatus.SUCCESS; switch (task.getOperation()) { case CREATE: result = (failed && task.getResource().getCreateTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) || task.getResource().getCreateTraceLevel() == TraceLevel.ALL; break; case UPDATE: result = (failed && task.getResource().getUpdateTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) || task.getResource().getUpdateTraceLevel() == TraceLevel.ALL; break; case DELETE: result = (failed && task.getResource().getDeleteTraceLevel().ordinal() >= TraceLevel.FAILURES.ordinal()) || task.getResource().getDeleteTraceLevel() == TraceLevel.ALL; break; default: result = false; } return result; }