Revize fc20e509
Přidáno uživatelem Ondřej Váně před téměř 4 roky(ů)
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/RoadToNowhereDetectorImpl.java | ||
---|---|---|
1 | 1 |
package cz.zcu.fav.kiv.antipatterndetectionapp.detecting.detectors; |
2 | 2 |
|
3 | 3 |
import cz.zcu.fav.kiv.antipatterndetectionapp.detecting.DatabaseConnection; |
4 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern; |
|
5 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Project; |
|
6 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.QueryResultItem; |
|
7 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.ResultDetail; |
|
4 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.*; |
|
8 | 5 |
import org.slf4j.Logger; |
9 | 6 |
import org.slf4j.LoggerFactory; |
10 | 7 |
|
11 | 8 |
import java.sql.ResultSet; |
12 | 9 |
import java.sql.SQLException; |
13 | 10 |
import java.util.ArrayList; |
11 |
import java.util.HashMap; |
|
14 | 12 |
import java.util.List; |
15 | 13 |
|
16 | 14 |
public class RoadToNowhereDetectorImpl implements AntiPatternDetector { |
... | ... | |
22 | 20 |
"RoadToNowhere", |
23 | 21 |
"The project is not sufficiently planned and therefore " + |
24 | 22 |
"takes place on an ad hoc basis with an uncertain " + |
25 |
"outcome and deadline. There is no project plan in the project."); |
|
23 |
"outcome and deadline. There is no project plan in the project.", |
|
24 |
new HashMap<>() {{ |
|
25 |
put("minNumberOfWikiPagesWithProjectPlan", new Configuration<Integer>("minNumberOfWikiPagesWithProjectPlan", |
|
26 |
"Minimum number of wiki pages with project plan", |
|
27 |
"Number of wiki pages", 1)); |
|
28 |
put("minNumberOfActivitiesWithProjectPlan", new Configuration<Integer>("minNumberOfActivitiesWithProjectPlan", |
|
29 |
"Minimum number of activities with project plan", |
|
30 |
"Number of activities", 1)); |
|
31 |
}}); |
|
26 | 32 |
|
27 | 33 |
private final String sqlFileName = "road_to_nowhere.sql"; |
28 | 34 |
// sql queries loaded from sql file |
29 | 35 |
private List<String> sqlQueries; |
30 | 36 |
|
31 |
/** |
|
32 |
* SETTINGS |
|
33 |
*/ |
|
34 |
private final int MINIMUM_NUMBER_OF_WIKI_PAGES = 1; |
|
35 |
private final int MINIMUM_NUMBER_OF_ACTIVITIES = 1; |
|
37 |
private int getMinNumberOfWikiPagesWithProjectPlan() { |
|
38 |
return (int) antiPattern.getConfigurations().get("minNumberOfWikiPagesWithProjectPlan").getValue(); |
|
39 |
} |
|
40 |
|
|
41 |
private int getMinNumberOfActivitiesWithProjectPlan() { |
|
42 |
return (int) antiPattern.getConfigurations().get("minNumberOfActivitiesWithProjectPlan").getValue(); |
|
43 |
} |
|
36 | 44 |
|
37 | 45 |
@Override |
38 | 46 |
public AntiPattern getAntiPatternModel() { |
... | ... | |
85 | 93 |
resultDetails.add(new ResultDetail("Number of issues for creating project plan", String.valueOf(numberOfIssuesForProjectPlan))); |
86 | 94 |
resultDetails.add(new ResultDetail("Number of wiki pages for creating project plan", String.valueOf(numberOfWikiPagesForProjectPlan))); |
87 | 95 |
|
88 |
if( numberOfIssuesForProjectPlan >= this.MINIMUM_NUMBER_OF_ACTIVITIES || numberOfWikiPagesForProjectPlan >= this.MINIMUM_NUMBER_OF_WIKI_PAGES) {
|
|
96 |
if( numberOfIssuesForProjectPlan >= getMinNumberOfActivitiesWithProjectPlan() || numberOfWikiPagesForProjectPlan >= getMinNumberOfWikiPagesWithProjectPlan()) {
|
|
89 | 97 |
resultDetails.add(new ResultDetail("Conclusion", "Found some activities or wiki pages for project plan in first two iterations")); |
90 | 98 |
return new QueryResultItem(this.antiPattern, false, resultDetails); |
91 | 99 |
} else { |
Také k dispozici: Unified diff
Configuration - Specify Nothing