Revize 9cba4dae
Přidáno uživatelem Václav Hrabík před více než 1 rok
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/controller/ConfigurationController.java | ||
---|---|---|
38 | 38 |
ConfigurationControllerStatusCodes returnCode = configurationService.addConfiguration(userConfiguration); |
39 | 39 |
String message = returnCode.getLabel(); |
40 | 40 |
Map<String,Object> json = new HashMap<>(); |
41 |
json.put("message",message); |
|
41 |
json.put("message", message); |
|
42 |
json.put("id", userConfiguration.getId()); |
|
42 | 43 |
//ResponseEntity<String> response = configurationService.addConfiguration(userConfiguration); |
43 | 44 |
return new ResponseEntity<>(JSONBuilder.buildJSON(json),HttpStatus.valueOf(returnCode.getStatusCode())); |
44 | 45 |
} |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/dials/ConfigurationControllerStatusCodes.java | ||
---|---|---|
19 | 19 |
UPDATE_SUCCESSFUL("Configuration updated",200), |
20 | 20 |
|
21 | 21 |
CONFIGURATION_PAIRING_EXISTS("Configuration already exists in your collection",400), |
22 |
CONFIGURATION_PAIRING_CREATED("configuration added to collection",200);
|
|
22 |
CONFIGURATION_PAIRING_CREATED("Configuration added to collection",200);
|
|
23 | 23 |
|
24 | 24 |
|
25 | 25 |
|
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/model/UserConfiguration.java | ||
---|---|---|
10 | 10 |
private ConfigurationDto configuration; |
11 | 11 |
private String isDefault; |
12 | 12 |
private String configurationName; |
13 |
|
|
14 | 13 |
private String id; |
15 | 14 |
|
16 | 15 |
public UserConfiguration(User user, ConfigurationDto configuration, String isDefault, String configurationName) { |
... | ... | |
30 | 29 |
this.id = id; |
31 | 30 |
} |
32 | 31 |
|
33 |
|
|
34 | 32 |
public User getUser() { |
35 | 33 |
return this.user; |
36 | 34 |
} |
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/v2/service/configuration/ConfigurationServiceImplementation.java | ||
---|---|---|
74 | 74 |
else { |
75 | 75 |
configuration = existingConfiguration; |
76 | 76 |
} |
77 |
|
|
78 |
cfg.setId(String.valueOf(configuration.getId())); |
|
79 |
|
|
77 | 80 |
//pair the configuration to the user |
78 |
pairConfigurationWithUser(user,configuration); |
|
79 |
return ConfigurationControllerStatusCodes.INSERT_SUCCESSFUL; |
|
81 |
return pairConfigurationWithUser(user, configuration); |
|
80 | 82 |
} |
81 | 83 |
|
82 | 84 |
/** |
... | ... | |
189 | 191 |
} |
190 | 192 |
//save the relation between user and configuration |
191 | 193 |
this.userConfigurationJoinRepository.save(new UserConfigurationJoin(key,configuration.getConfigurationName())); |
192 |
return ConfigurationControllerStatusCodes.CONFIGURATION_PAIRING_CREATED;
|
|
194 |
return ConfigurationControllerStatusCodes.INSERT_SUCCESSFUL;
|
|
193 | 195 |
} |
194 | 196 |
|
195 | 197 |
|
Také k dispozici: Unified diff
https://kivprogrammers.atlassian.net/browse/TSP2-45 Dokončení funkcionality SAVE AS