public static void validateFence(Action action) { if (action == null) { throw new ValidationException("Action is mandatory but was not provided."); } if (action.getFenceType() == null) { throw new ValidationException("Parameter 'fence_type' is mandatory but was not provided."); } }
@Override public Response fence(Action action) { validateParameters(action, "fenceType"); FenceType fenceType = validateEnum(FenceType.class, action.getFenceType().toUpperCase()); switch (fenceType) { case MANUAL: return fenceManually(action); case RESTART: return fence(action, ActionType.RestartVds); case START: return fence(action, ActionType.StartVds); case STOP: return fence(action, ActionType.StopVds); case STATUS: return getFenceStatus(action); default: return null; } }
to.setFenceType(from.getFenceType());