11package cz .zcu .fav .kiv .antipatterndetectionapp .detecting .detectors ;
22
33import 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 .*;
85import org .slf4j .Logger ;
96import org .slf4j .LoggerFactory ;
107
118import java .sql .ResultSet ;
129import java .sql .SQLException ;
1310import java .util .ArrayList ;
11+ import java .util .HashMap ;
1412import java .util .List ;
1513
1614public class RoadToNowhereDetectorImpl implements AntiPatternDetector {
@@ -22,17 +20,27 @@ public class RoadToNowhereDetectorImpl implements AntiPatternDetector {
2220 "RoadToNowhere" ,
2321 "The project is not sufficiently planned and therefore " +
2422 "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+ }});
2632
2733 private final String sqlFileName = "road_to_nowhere.sql" ;
2834 // sql queries loaded from sql file
2935 private List <String > sqlQueries ;
3036
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+ }
3644
3745 @ Override
3846 public AntiPattern getAntiPatternModel () {
@@ -85,7 +93,7 @@ public QueryResultItem analyze(Project project, DatabaseConnection databaseConne
8593 resultDetails .add (new ResultDetail ("Number of issues for creating project plan" , String .valueOf (numberOfIssuesForProjectPlan )));
8694 resultDetails .add (new ResultDetail ("Number of wiki pages for creating project plan" , String .valueOf (numberOfWikiPagesForProjectPlan )));
8795
88- if ( numberOfIssuesForProjectPlan >= this . MINIMUM_NUMBER_OF_ACTIVITIES || numberOfWikiPagesForProjectPlan >= this . MINIMUM_NUMBER_OF_WIKI_PAGES ) {
96+ if ( numberOfIssuesForProjectPlan >= getMinNumberOfActivitiesWithProjectPlan () || numberOfWikiPagesForProjectPlan >= getMinNumberOfWikiPagesWithProjectPlan () ) {
8997 resultDetails .add (new ResultDetail ("Conclusion" , "Found some activities or wiki pages for project plan in first two iterations" ));
9098 return new QueryResultItem (this .antiPattern , false , resultDetails );
9199 } else {
0 commit comments