• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

edoardof01 / sessionBuilder / 142

23 Jun 2025 03:53PM UTC coverage: 0.0%. Remained the same
142

push

github

edoardof01
modifica al codice per popolare i models della UI coi records del db

0 of 282 branches covered (0.0%)

Branch coverage included in aggregate %.

0 of 45 new or added lines in 7 files covered. (0.0%)

1 existing line in 1 file now uncovered.

0 of 930 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/sessionBuilder/sessionBuilder-core/src/main/java/com/sessionBuilder/core/TopicController.java
1
package com.sessionBuilder.core;
2

3
import java.util.List;
4
import com.google.inject.Inject;
5

6
public class TopicController {
×
7
        
8
        @Inject
9
        private TopicServiceInterface service;
10
        
11
        @Inject
12
        private TopicViewCallback viewCallback;
13
        
14
        private static final String TOPIC_NOT_FOUND = "Topic non trovato: ";
15
        
16
        public void setViewCallback(TopicViewCallback callback) {
17
                this.viewCallback = callback;
×
18
        }
×
19

20
        public Topic handleGetTopicById(long topicId) {
21
                try {
22
                        return service.getTopicById(topicId);
×
23
                } catch(Exception e) {
×
24
                        if(viewCallback != null) {
×
25
                                viewCallback.onTopicError(TOPIC_NOT_FOUND + e.getMessage());
×
26
                        }
27
                        throw e;
×
28
                }
29
        }
30
        
31
        public List<Topic> handleGetAllTopics() {
32
                try {
NEW
33
                        return service.getAllTopics();
×
NEW
34
                } catch(Exception e) {
×
NEW
35
                        if(viewCallback != null) {
×
NEW
36
                                viewCallback.onTopicError("Errore nel caricamento dei topic");
×
37
                        }
NEW
38
                        throw e;
×
39
                }
40
        }
41
        
42
        
43

44
        public Topic handleCreateTopic(String name, String description, int difficulty, List<StudySession> sessionList) {
45
                try {
46
                        Topic topic = service.createTopic(name, description, difficulty, sessionList);
×
47
                        if (viewCallback != null) {
×
48
                                viewCallback.onTopicAdded(topic);
×
49
                        }
50
                        return topic;
×
51
                } catch(Exception e) {
×
52
                        if(viewCallback != null) {
×
53
                                viewCallback.onTopicError(TOPIC_NOT_FOUND + e.getMessage());
×
54
                        }
55
                        throw e;
×
56
                }
57
                
58
        }
59
        
60
        public void handleDeleteTopic(long topicId) {
61
                try {
62
                        Topic topic = service.getTopicById(topicId);
×
63
                        service.deleteTopic(topicId);
×
64
                        if (viewCallback != null) {
×
65
                                viewCallback.onTopicRemoved(topic);
×
66
                        }
67
                } catch(Exception e) {
×
68
                        if(viewCallback != null) {
×
69
                                viewCallback.onTopicError(TOPIC_NOT_FOUND + e.getMessage());
×
70
                        }
71
                }
×
72
                
73
        }
×
74

75
        public void handleAddSessionToTopic(long topicId, long sessionId) {
76
                try {
77
                        service.addSessionToTopic(topicId, sessionId);
×
78
                } catch(Exception e) {
×
79
                        if(viewCallback != null) {
×
80
                                viewCallback.onTopicError(TOPIC_NOT_FOUND + e.getMessage());
×
81
                        }
82
                }
×
83
        }
×
84
        
85
        public void handleRemoveSessionFromTopic(long topicId, long sessionId) {
86
                try {
87
                        service.removeSessionFromTopic(topicId, sessionId);
×
88
                } catch(Exception e) {
×
89
                        if (viewCallback != null) {
×
90
                                viewCallback.onTopicError("Errore nella rimozione della sessione: " + e.getMessage());
×
91
                        }
92
                }
×
93
        }
×
94
        
95
        public int handleTotalTime(long topicId) {
96
                try {
97
                        Integer totalTime = service.calculateTotalTime(topicId);
×
98
                        if (viewCallback != null) {
×
99
                                viewCallback.onTotalTimeCalculated(totalTime);
×
100
                        }
101
                        return totalTime;
×
102
                } catch(Exception e) {
×
103
                        if(viewCallback != null) {
×
104
                                viewCallback.onTopicError(TOPIC_NOT_FOUND + e.getMessage());
×
105
                        }
106
                        throw e;
×
107
                }
108
        }
109
        
110
        public int handlePercentageOfCompletion(long topicId) {
111
                try {
112
                        Integer percentage = service.calculatePercentageOfCompletion(topicId);
×
113
                        if (viewCallback != null) {
×
114
                                viewCallback.onPercentageCalculated(percentage);
×
115
                        }
116
                        return percentage;
×
117
                } catch(Exception e) {
×
118
                        if(viewCallback != null) {
×
119
                                viewCallback.onTopicError(TOPIC_NOT_FOUND + e.getMessage());
×
120
                        }
121
                        throw e;
×
122
                }
123
        }
124

125
        public TopicViewCallback getViewCallback() {
126
                return viewCallback;
×
127
        }
128

129
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc