// Path: app/src/main/java/fr/guddy/androidstarter/rest/queries/AbstractQuery.java
// public abstract class AbstractQuery extends Job {
//     private static final String TAG = AbstractQuery.class.getSimpleName();
//     private static final boolean DEBUG = true;
// 
//     protected enum Priority {
//         LOW(0),
//         MEDIUM(500),
//         HIGH(1000);
//         private final int value;
// 
//         Priority(final int piValue) {
//             value = piValue;
//         }
//     }
// 
//     protected boolean mSuccess;
//     protected Throwable mThrowable;
//     protected AbstractEventQueryDidFinish.ErrorType mErrorType;
// 
//     //region Protected constructor
//     protected AbstractQuery(final Priority poPriority) {
//         super(new Params(poPriority.value).requireNetwork());
//     }
// 
//     protected AbstractQuery(final Priority poPriority, final boolean pbPersistent, final String psGroupId, final long plDelayMs) {
//         super(new Params(poPriority.value).requireNetwork().setPersistent(pbPersistent).setGroupId(psGroupId).setDelayMs(plDelayMs));
//     }
//     //endregion
// 
//     //region Overridden methods
//     @DebugLog
//     @Override
//     public void onAdded() {
//         if (BuildConfig.DEBUG && DEBUG) {
//             Logger.t(TAG).d("");
//         }
//     }
// 
//     @DebugLog
//     @Override
//     public void onRun() throws Throwable {
//         if (BuildConfig.DEBUG && DEBUG) {
//             Logger.t(TAG).d("");
//         }
// 
//         inject();
// 
//         try {
//             execute();
//             mSuccess = true;
//         } catch (Throwable loThrowable) {
//             if (BuildConfig.DEBUG && DEBUG) {
//                 Logger.t(TAG).e(loThrowable, "");
//             }
//             mErrorType = AbstractEventQueryDidFinish.ErrorType.UNKNOWN;
//             mThrowable = loThrowable;
//             mSuccess = false;
//         }
// 
//         postEventQueryFinished();
//     }
// 
//     @Override
//     protected void onCancel(final int cancelReason, @Nullable final Throwable poThrowable) {
//     }
// 
//     @Override
//     protected RetryConstraint shouldReRunOnThrowable(@NonNull final Throwable poThrowable, final int piRunCount, final int piMaxRunCount) {
//         return null;
//     }
// 
//     @DebugLog
//     @Override
//     protected int getRetryLimit() {
//         return 1;
//     }
//     //endregion
// 
//     //region Protected helper method
//     protected <T> boolean isCached(@NonNull final Response<T> poResponse) {
//         if (poResponse.isSuccessful() &&
//                 (
//                         (poResponse.raw().networkResponse() != null && poResponse.raw().networkResponse().code() == HttpURLConnection.HTTP_NOT_MODIFIED)
//                                 ||
//                                 (poResponse.raw().networkResponse() == null && poResponse.raw().cacheResponse() != null))
//                 ) {
//             return true;
//         }
//         return false;
//     }
//     //endregion
// 
//     //region Protected abstract method for specific job
//     public abstract void inject();
// 
//     protected abstract void execute() throws Exception;
// 
//     protected abstract void postEventQueryFinished();
// 
//     public abstract void postEventQueryFinishedNoNetwork();
//     //endregion
// }


import fr.guddy.androidstarter.rest.queries.AbstractQuery;
package fr.guddy.androidstarter.bus.event;


public abstract class AbstractEventQueryDidFinish<QueryType extends AbstractQuery> extends AbstractEvent {
    public enum ErrorType {
        UNKNOWN,
        NETWORK_UNREACHABLE
    }

    public final QueryType query;

    public final boolean success;
    public final ErrorType errorType;
    public final Throwable throwable;

    public AbstractEventQueryDidFinish(final QueryType poQuery, final boolean pbSuccess, final ErrorType poErrorType, final Throwable poThrowable) {
// Path: app/src/main/java/fr/guddy/androidstarter/rest/queries/AbstractQuery.java
// public abstract class AbstractQuery extends Job {
//     private static final String TAG = AbstractQuery.class.getSimpleName();
//     private static final boolean DEBUG = true;
// 
//     protected enum Priority {
//         LOW(0),
//         MEDIUM(500),
//         HIGH(1000);
//         private final int value;
// 
//         Priority(final int piValue) {
//             value = piValue;
//         }
//     }
// 
//     protected boolean mSuccess;
//     protected Throwable mThrowable;
//     protected AbstractEventQueryDidFinish.ErrorType mErrorType;
// 
//     //region Protected constructor
//     protected AbstractQuery(final Priority poPriority) {
//         super(new Params(poPriority.value).requireNetwork());
//     }
// 
//     protected AbstractQuery(final Priority poPriority, final boolean pbPersistent, final String psGroupId, final long plDelayMs) {
//         super(new Params(poPriority.value).requireNetwork().setPersistent(pbPersistent).setGroupId(psGroupId).setDelayMs(plDelayMs));
//     }
//     //endregion
// 
//     //region Overridden methods
//     @DebugLog
//     @Override
//     public void onAdded() {
//         if (BuildConfig.DEBUG && DEBUG) {
//             Logger.t(TAG).d("");
//         }
//     }
// 
//     @DebugLog
//     @Override
//     public void onRun() throws Throwable {
//         if (BuildConfig.DEBUG && DEBUG) {
//             Logger.t(TAG).d("");
//         }
// 
//         inject();
// 
//         try {
//             execute();
//             mSuccess = true;
//         } catch (Throwable loThrowable) {
//             if (BuildConfig.DEBUG && DEBUG) {
//                 Logger.t(TAG).e(loThrowable, "");
//             }
//             mErrorType = AbstractEventQueryDidFinish.ErrorType.UNKNOWN;
//             mThrowable = loThrowable;
//             mSuccess = false;
//         }
// 
//         postEventQueryFinished();
//     }
// 
//     @Override
//     protected void onCancel(final int cancelReason, @Nullable final Throwable poThrowable) {
//     }
// 
//     @Override
//     protected RetryConstraint shouldReRunOnThrowable(@NonNull final Throwable poThrowable, final int piRunCount, final int piMaxRunCount) {
//         return null;
//     }
// 
//     @DebugLog
//     @Override
//     protected int getRetryLimit() {
//         return 1;
//     }
//     //endregion
// 
//     //region Protected helper method
//     protected <T> boolean isCached(@NonNull final Response<T> poResponse) {
//         if (poResponse.isSuccessful() &&
//                 (
//                         (poResponse.raw().networkResponse() != null && poResponse.raw().networkResponse().code() == HttpURLConnection.HTTP_NOT_MODIFIED)
//                                 ||
//                                 (poResponse.raw().networkResponse() == null && poResponse.raw().cacheResponse() != null))
//                 ) {
//             return true;
//         }
//         return false;
//     }
//     //endregion
// 
//     //region Protected abstract method for specific job
//     public abstract void inject();
// 
//     protected abstract void execute() throws Exception;
// 
//     protected abstract void postEventQueryFinished();
// 
//     public abstract void postEventQueryFinishedNoNetwork();
//     //endregion
// }


// Path: app/src/main/java/fr/guddy/androidstarter/bus/event/AbstractEventQueryDidFinish.java
import fr.guddy.androidstarter.rest.queries.AbstractQuery;

package fr.guddy.androidstarter.bus.event;


public abstract class AbstractEventQueryDidFinish<QueryType extends AbstractQuery> extends AbstractEvent {
    public enum ErrorType {
        UNKNOWN,
        NETWORK_UNREACHABLE
    }

    public final QueryType query;

    public final boolean success;
    public final ErrorType errorType;
    public final Throwable throwable;

    public AbstractEventQueryDidFinish(final QueryType poQuery, final boolean pbSuccess, final ErrorType poErrorType, final Throwable poThrowable) {
        query = poQuery;