Revize 2d245b41
Přidáno uživatelem Ondřej Váně před asi 4 roky(ů)
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/RoadToNowhereDetectorImpl.java | ||
---|---|---|
5 | 5 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Project; |
6 | 6 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.QueryResultItem; |
7 | 7 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.ResultDetail; |
8 |
import cz.zcu.fav.kiv.antipatterndetectionapp.utils.Utils; |
|
9 | 8 |
import org.slf4j.Logger; |
10 | 9 |
import org.slf4j.LoggerFactory; |
11 | 10 |
|
12 | 11 |
import java.sql.ResultSet; |
13 | 12 |
import java.sql.SQLException; |
13 |
import java.util.ArrayList; |
|
14 | 14 |
import java.util.List; |
15 | 15 |
|
16 | 16 |
public class RoadToNowhereDetectorImpl extends AntiPatternDetector { |
... | ... | |
53 | 53 |
*/ |
54 | 54 |
@Override |
55 | 55 |
public QueryResultItem analyze(Project project, DatabaseConnection databaseConnection, List<String> queries) { |
56 |
|
|
57 |
/* Init values */ |
|
58 |
List<ResultDetail> resultDetails = new ArrayList<>(); |
|
56 | 59 |
int numberOfIssuesForProjectPlan = 0; |
57 | 60 |
int numberOfWikiPagesForProjectPlan = 0; |
58 | 61 |
|
... | ... | |
66 | 69 |
} |
67 | 70 |
|
68 | 71 |
} catch (SQLException e) { |
69 |
e.printStackTrace(); |
|
72 |
LOGGER.error("Cannot read results from db"); |
|
73 |
resultDetails.add(new ResultDetail("Problem in reading database", e.toString())); |
|
74 |
return new QueryResultItem(this.antiPattern, true, resultDetails); |
|
70 | 75 |
} |
71 |
List<ResultDetail> resultDetails = Utils.createResultDetailsList( |
|
72 |
new ResultDetail("Project id", project.getId().toString())); |
|
73 | 76 |
|
74 |
if( numberOfIssuesForProjectPlan >= this.MINIMUM_NUMBER_OF_ACTIVITIES || numberOfWikiPagesForProjectPlan >= this.MINIMUM_NUMBER_OF_WIKI_PAGES) { |
|
77 |
resultDetails.add(new ResultDetail("Number of issues for creating project plan", String.valueOf(numberOfIssuesForProjectPlan))); |
|
78 |
resultDetails.add(new ResultDetail("Number of wiki pages for creating project plan", String.valueOf(numberOfWikiPagesForProjectPlan))); |
|
75 | 79 |
|
80 |
if( numberOfIssuesForProjectPlan >= this.MINIMUM_NUMBER_OF_ACTIVITIES || numberOfWikiPagesForProjectPlan >= this.MINIMUM_NUMBER_OF_WIKI_PAGES) { |
|
81 |
resultDetails.add(new ResultDetail("Conclusion", "Found some activities or wiki pages for project plan in first two iterations")); |
|
76 | 82 |
return new QueryResultItem(this.antiPattern, false, resultDetails); |
77 | 83 |
} else { |
84 |
resultDetails.add(new ResultDetail("Conclusion", "No wiki pages and activities for project plan in first two iterations")); |
|
78 | 85 |
return new QueryResultItem(this.antiPattern, true, resultDetails); |
79 | 86 |
} |
80 | 87 |
} |
Také k dispozici: Unified diff
Road to nowhere refactored