Revize 8e87e631
Přidáno uživatelem stepanekp před asi 3 roky(ů)
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/controller/AppController.java | ||
---|---|---|
197 | 197 |
} |
198 | 198 |
|
199 | 199 |
/** |
200 |
* Method of storing new configurations for individual AP.
|
|
200 |
* Method of saving changes of current configuration
|
|
201 | 201 |
* |
202 | 202 |
* @param model object for passing data to the UI |
203 | 203 |
* @param thresholdValues changed configuration values |
... | ... | |
230 | 230 |
} |
231 | 231 |
|
232 | 232 |
/** |
233 |
* Method of storing new configurations for individual AP.
|
|
233 |
* Method for saving full new configuration
|
|
234 | 234 |
* |
235 | 235 |
* @param model object for passing data to the UI |
236 | 236 |
* @param thresholdValues changed configuration values |
... | ... | |
276 | 276 |
} |
277 | 277 |
|
278 | 278 |
/** |
279 |
* Method for storing configuration values for the respective AP.
|
|
279 |
* Method for saving changes of one AP in current configuration
|
|
280 | 280 |
* |
281 | 281 |
* @param model object for passing data to the UI |
282 | 282 |
* @param id id of AP |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/AntiPatternManager.java | ||
---|---|---|
7 | 7 |
import java.util.Map; |
8 | 8 |
|
9 | 9 |
public interface AntiPatternManager { |
10 |
|
|
10 |
/** |
|
11 |
* Method for processing analysis of selected anti-patterns on selected project with certain configuration |
|
12 |
* |
|
13 |
* @param selectedProjects Projects to analyze |
|
14 |
* @param selectedAntiPatterns Anti-patterns to detect |
|
15 |
* @param configuration Current configuration |
|
16 |
* @return Results of analysis stored in a list |
|
17 |
*/ |
|
11 | 18 |
List<QueryResult> analyze(String[] selectedProjects, String[] selectedAntiPatterns, Map<String, Map<String, String>> configuration); |
12 | 19 |
} |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/repository/AntiPatternRepository.java | ||
---|---|---|
4 | 4 |
import cz.zcu.fav.kiv.antipatterndetectionapp.detecting.detectors.AntiPatternDetector; |
5 | 5 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern; |
6 | 6 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Threshold; |
7 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.types.Percentage; |
|
8 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.types.PositiveFloat; |
|
9 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.types.PositiveInteger; |
|
10 | 7 |
import cz.zcu.fav.kiv.antipatterndetectionapp.utils.JsonParser; |
11 | 8 |
import org.reflections.Reflections; |
12 | 9 |
import org.slf4j.Logger; |
... | ... | |
86 | 83 |
} |
87 | 84 |
|
88 | 85 |
/** |
89 |
* |
|
86 |
* Method for reading SQL queries from files
|
|
90 | 87 |
*/ |
91 | 88 |
private void initSqlQueries(){ |
92 | 89 |
LOGGER.info("-------START READING SQL FROM FILES-------"); |
... | ... | |
134 | 131 |
} |
135 | 132 |
|
136 | 133 |
/** |
134 |
* Method for reading anti-pattern information from json files |
|
137 | 135 |
* |
138 |
* @param jsonFileName |
|
139 |
* @return |
|
136 |
* @param jsonFileName Name of the file
|
|
137 |
* @return AntiPattern object
|
|
140 | 138 |
*/ |
141 | 139 |
public AntiPattern getAntiPatternFromJsonFile(String jsonFileName){ |
142 | 140 |
String json = ""; // json configuration file |
... | ... | |
213 | 211 |
} |
214 | 212 |
|
215 | 213 |
/** |
214 |
* Method for creating of the Threshold object from given parameters |
|
216 | 215 |
* |
217 |
* @param thresholdType |
|
218 |
* @param name |
|
219 |
* @param printName |
|
220 |
* @param description |
|
221 |
* @param errorMessage |
|
222 |
* @return |
|
216 |
* @param thresholdType Type of the threshold
|
|
217 |
* @param name Threshold name
|
|
218 |
* @param printName Threshold name for print
|
|
219 |
* @param description Short description of the threshold
|
|
220 |
* @param errorMessage Error message to display if threshold's value is set wrong
|
|
221 |
* @return Threshold object
|
|
223 | 222 |
*/ |
224 | 223 |
private Threshold getThreshold(String thresholdType, String name, String printName, String description, String errorMessage){ |
225 | 224 |
|
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/repository/ConfigurationRepository.java | ||
---|---|---|
40 | 40 |
loadConfigurations(); |
41 | 41 |
} |
42 | 42 |
|
43 |
/** |
|
44 |
* Method for loading all configurations from json files in folder and saving them to map structure |
|
45 |
*/ |
|
43 | 46 |
private void loadConfigurations(){ |
44 | 47 |
LOGGER.info("-------START READING CONFIGURATIONS FROM FILES-------"); |
45 | 48 |
Map<String, Map<String, Map<String, String>>> configurations = new HashMap<>(); |
... | ... | |
120 | 123 |
LOGGER.info("-------FINISHED READING CONFIGURATIONS FROM FILES-------"); |
121 | 124 |
} |
122 | 125 |
|
126 |
/** |
|
127 |
* Method that creates json file from the given configuration |
|
128 |
* @param configurationName Name of the json file |
|
129 |
* @param newConfiguration Map with configuration values |
|
130 |
*/ |
|
123 | 131 |
public void saveConfigurationToFile(String configurationName, Map<String, Map <String, String>> newConfiguration){ |
124 | 132 |
ObjectNode root = JsonParser.getObjectMapper().createObjectNode(); |
125 | 133 |
|
... | ... | |
154 | 162 |
|
155 | 163 |
} |
156 | 164 |
|
165 |
/** |
|
166 |
* Method that saves new configuration from given parameters to the map structure |
|
167 |
* @param antiPatterns List of anti-pattern objects |
|
168 |
* @param configurationName New configuration name |
|
169 |
* @param antiPatternNames Array of anti-pattern names |
|
170 |
* @param thresholdNames Array of threshold names |
|
171 |
* @param thresholdValues Array pf threshold values |
|
172 |
* @param fullNewConfiguration True, if the whole new configuration is created and False, if only some thresholds are updated |
|
173 |
* @return List of the incorrectly set parameters |
|
174 |
*/ |
|
157 | 175 |
public List<String> saveNewConfiguration(List<AntiPattern> antiPatterns, String configurationName, String[] antiPatternNames, String[] thresholdNames, String[] thresholdValues, boolean fullNewConfiguration){ |
158 | 176 |
Map<String, Map<String, String>> newConfiguration = new HashMap<>(); |
159 | 177 |
List<String> incorrectParameters = new ArrayList<>(); |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/service/AntiPatternService.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
AntiPattern setErrorMessages(AntiPattern antiPattern, List<String> wrongParameters); |
38 | 38 |
|
39 |
/** |
|
40 |
* Method for getting description of the anti-pattern from online catalogue on Github |
|
41 |
* |
|
42 |
* @param id ID of the anti-pattern |
|
43 |
* @return Description of the anti-pattern |
|
44 |
*/ |
|
39 | 45 |
String getDescriptionFromCatalogue(long id); |
40 | 46 |
} |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/service/ConfigurationService.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern; |
4 | 4 |
|
5 |
import java.util.HashMap; |
|
6 | 5 |
import java.util.List; |
7 | 6 |
import java.util.Map; |
8 | 7 |
|
9 | 8 |
public interface ConfigurationService { |
10 | 9 |
|
10 |
/** |
|
11 |
* Method for getting all configuration names |
|
12 |
* |
|
13 |
* @return List of the configuration |
|
14 |
*/ |
|
11 | 15 |
List<String> getAllConfigurationNames(); |
12 | 16 |
|
17 |
/** |
|
18 |
* Method for getting default configuration names |
|
19 |
* Default configurations cannot be changed in the app |
|
20 |
* |
|
21 |
* @return List of the default configuration |
|
22 |
*/ |
|
13 | 23 |
List<String> getDefaultConfigurationNames(); |
14 | 24 |
|
15 | 25 |
Map<String, Map<String, String>> getConfigurationByName(String configurationName); |
16 | 26 |
|
27 |
/** |
|
28 |
* Method for saving new configuration to the map structure and json file |
|
29 |
* |
|
30 |
* @param antiPatterns List of all anti-patterns |
|
31 |
* @param configurationName Configuration name |
|
32 |
* @param antiPatternNames List of anti-pattern names |
|
33 |
* @param thresholdNames List of threshold names |
|
34 |
* @param thresholdValues List of threshold values |
|
35 |
* @param fullNewConfiguration True if the whole new configuration is created |
|
36 |
* @return List of incorrectly set values |
|
37 |
*/ |
|
17 | 38 |
List<String> saveNewConfiguration(List<AntiPattern> antiPatterns, String configurationName, String[] antiPatternNames, String[] thresholdNames, String[] thresholdValues, boolean fullNewConfiguration); |
18 | 39 |
} |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/service/UserAccountService.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
public interface UserAccountService { |
4 | 4 |
|
5 |
/** |
|
6 |
* Checks if the given credentials are valid |
|
7 |
* @param username Username |
|
8 |
* @param password Password |
|
9 |
* @return True if user credentials are valid |
|
10 |
*/ |
|
5 | 11 |
boolean checkCredentials(String username, String password); |
6 | 12 |
|
7 | 13 |
} |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/utils/JsonParser.java | ||
---|---|---|
11 | 11 |
|
12 | 12 |
private static ObjectMapper objectMapper = getDefaultObjectMapper(); |
13 | 13 |
|
14 |
/** |
|
15 |
* Method for getting Jackson ObjectMapper object |
|
16 |
* |
|
17 |
* @return ObjectMapper |
|
18 |
*/ |
|
14 | 19 |
public static ObjectMapper getDefaultObjectMapper() { |
15 | 20 |
ObjectMapper defObjectMapper = new ObjectMapper(); |
16 | 21 |
|
... | ... | |
19 | 24 |
return defObjectMapper; |
20 | 25 |
} |
21 | 26 |
|
27 |
/** |
|
28 |
* Method for reading tree model from json |
|
29 |
* |
|
30 |
* @param src |
|
31 |
* @return JsonNode |
|
32 |
* @throws IOException |
|
33 |
*/ |
|
22 | 34 |
public static JsonNode parse(String src) throws IOException { |
23 | 35 |
return objectMapper.readTree(src); |
24 | 36 |
} |
src/main/webapp/resources/js/editor.js | ||
---|---|---|
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
/** |
149 |
* Wraping selected text by h2 tag |
|
149 |
* Wrapping selected text by h2 tag
|
|
150 | 150 |
*/ |
151 | 151 |
function headerH2() { |
152 | 152 |
let S=window.getSelection().toString(); |
... | ... | |
163 | 163 |
} |
164 | 164 |
|
165 | 165 |
/** |
166 |
* Wraping selected text by h3 tag |
|
166 |
* Wrapping selected text by h3 tag
|
|
167 | 167 |
*/ |
168 | 168 |
function headerH3() { |
169 | 169 |
let S=window.getSelection().toString(); |
... | ... | |
179 | 179 |
} |
180 | 180 |
} |
181 | 181 |
|
182 |
/** |
|
183 |
* Wrapping selected text with pre tag |
|
184 |
*/ |
|
182 | 185 |
function codeFormat() { |
183 | 186 |
let S=window.getSelection().toString(); |
184 | 187 |
if(S.length == 0) |
Také k dispozici: Unified diff
Methods commented