| 1 | /******************************************************************************* | |
| 2 | * Copyhacked (H) 2012-2025. | |
| 3 | * This program and the accompanying materials | |
| 4 | * are made available under no term at all, use it like | |
| 5 | * you want, but share and discuss it | |
| 6 | * every time possible with every body. | |
| 7 | * | |
| 8 | * Contributors: | |
| 9 | * ron190 at ymail dot com - initial implementation | |
| 10 | ******************************************************************************/ | |
| 11 | package com.jsql.model; | |
| 12 | ||
| 13 | import com.jsql.model.bean.util.Request; | |
| 14 | import com.jsql.model.injection.strategy.blind.callable.AbstractCallableBit; | |
| 15 | ||
| 16 | import java.util.concurrent.SubmissionPublisher; | |
| 17 | ||
| 18 | /** | |
| 19 | * Define the features of the injection model :<br> | |
| 20 | * - stop the preparation of injection,<br> | |
| 21 | * - Callable for parallelize HTTP tasks,<br> | |
| 22 | * - communication with view, via Observable. | |
| 23 | */ | |
| 24 | public abstract class AbstractModelObservable extends SubmissionPublisher<Request> { | |
| 25 | | |
| 26 | /** | |
| 27 | * True if user wants to stop preparation.<br> | |
| 28 | * During the preparation, several methods will | |
| 29 | * check if the execution must be stopped. | |
| 30 | */ | |
| 31 | protected boolean isStoppedByUser = false; | |
| 32 | ||
| 33 | /** | |
| 34 | * Function header for the inject() methods, definition needed by call(), | |
| 35 | * dataInjection: SQL query, | |
| 36 | * responseHeader unused, | |
| 37 | * useVisibleIndex false if injection indexes aren't needed, | |
| 38 | * return source page after the HTTP call. | |
| 39 | */ | |
| 40 | public abstract String inject( | |
| 41 | String dataInjection, | |
| 42 | boolean isUsingIndex, | |
| 43 | String metadataInjectionProcess, | |
| 44 | AbstractCallableBit<?> callableBoolean, | |
| 45 | boolean isReport | |
| 46 | ); | |
| 47 | | |
| 48 | /** | |
| 49 | * Inject without the need of index like in "select 1,2,...".<br> | |
| 50 | * Used for example by: first index test (getVisibleIndex), Error test, and Error, Blind, Time strategies. | |
| 51 | * @return source code of current page | |
| 52 | */ | |
| 53 | public String injectWithoutIndex(String dataInjection, String metadataInjectionProcess) { | |
| 54 |
1
1. injectWithoutIndex : replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithoutIndex → NO_COVERAGE |
return this.inject(dataInjection, false, metadataInjectionProcess, null, false); |
| 55 | } | |
| 56 | ||
| 57 | public String injectWithoutIndex(String dataInjection, String metadataInjectionProcess, AbstractCallableBit<?> callableBoolean) { | |
| 58 |
1
1. injectWithoutIndex : replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithoutIndex → NO_COVERAGE |
return this.inject(dataInjection, false, metadataInjectionProcess, callableBoolean, false); |
| 59 | } | |
| 60 | ||
| 61 | public String injectWithIndexes(String dataInjection, String metadataInjectionProcess) { | |
| 62 |
1
1. injectWithIndexes : replaced return value with "" for com/jsql/model/AbstractModelObservable::injectWithIndexes → NO_COVERAGE |
return this.inject(dataInjection, true, metadataInjectionProcess, null, false); |
| 63 | } | |
| 64 | ||
| 65 | public String getReportWithoutIndex(String dataInjection, String metadataInjectionProcess) { | |
| 66 |
1
1. getReportWithoutIndex : replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithoutIndex → NO_COVERAGE |
return this.inject(dataInjection, false, metadataInjectionProcess, null, true); |
| 67 | } | |
| 68 | ||
| 69 | public String getReportWithoutIndex(String dataInjection, String metadataInjectionProcess, AbstractCallableBit<?> callableBoolean) { | |
| 70 |
1
1. getReportWithoutIndex : replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithoutIndex → NO_COVERAGE |
return this.inject(dataInjection, false, metadataInjectionProcess, callableBoolean, true); |
| 71 | } | |
| 72 | ||
| 73 | public String getReportWithIndexes(String dataInjection, String metadataInjectionProcess) { | |
| 74 |
1
1. getReportWithIndexes : replaced return value with "" for com/jsql/model/AbstractModelObservable::getReportWithIndexes → NO_COVERAGE |
return this.inject(dataInjection, true, metadataInjectionProcess, null, true); |
| 75 | } | |
| 76 | ||
| 77 | /** | |
| 78 | * Send an interaction message to registered views. | |
| 79 | * @param request The event bean corresponding to the interaction | |
| 80 | */ | |
| 81 | public void sendToViews(final Request request) { | |
| 82 | this.submit(request); | |
| 83 | } | |
| 84 | ||
| 85 | | |
| 86 | // Getters and setters | |
| 87 | | |
| 88 | public boolean isStoppedByUser() { | |
| 89 |
2
1. isStoppedByUser : replaced boolean return with true for com/jsql/model/AbstractModelObservable::isStoppedByUser → NO_COVERAGE 2. isStoppedByUser : replaced boolean return with false for com/jsql/model/AbstractModelObservable::isStoppedByUser → NO_COVERAGE |
return this.isStoppedByUser; |
| 90 | } | |
| 91 | ||
| 92 | public void setIsStoppedByUser(boolean processStopped) { | |
| 93 | this.isStoppedByUser = processStopped; | |
| 94 | } | |
| 95 | } | |
Mutations | ||
| 54 |
1.1 |
|
| 58 |
1.1 |
|
| 62 |
1.1 |
|
| 66 |
1.1 |
|
| 70 |
1.1 |
|
| 74 |
1.1 |
|
| 89 |
1.1 2.2 |