Skip to content

Commit c034541

Browse files
Merge pull request #260 from phasenraum2010/milestone-1.0.26
Milestone 1.0.26
2 parents 87cb14d + 89f1087 commit c034541

File tree

183 files changed

+5082
-650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+5082
-650
lines changed

pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<groupId>org.springframework.boot</groupId>
1616
<artifactId>spring-boot-starter-parent</artifactId>
1717
<version>1.5.6.RELEASE</version>
18+
<relativePath/> <!-- lookup parent from repository -->
1819
</parent>
1920

2021
<organization>
@@ -102,7 +103,8 @@
102103
</dependency>
103104
<dependency>
104105
<groupId>org.springframework.boot</groupId>
105-
<artifactId>spring-boot-starter-cloud-connectors</artifactId>
106+
<artifactId>spring-boot-devtools</artifactId>
107+
<scope>runtime</scope>
106108
</dependency>
107109
<dependency>
108110
<groupId>org.springframework.boot</groupId>

src/main/java/org/woehlke/twitterwall/ScheduledTasks.java

Lines changed: 76 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,88 @@
1515
@Component
1616
public class ScheduledTasks {
1717

18-
@Scheduled(initialDelay= TEN_SECONDS, fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS)
18+
@Scheduled(initialDelay= TEN_SECONDS, fixedRate = ONE_DAY)
19+
public void createImprintUserAsync(){
20+
String msg = "create Imprint User (Async) ";
21+
if(!schedulerProperties.getSkipFortesting()) {
22+
Task task = asyncStartTask.createImprintUserAsync();
23+
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
24+
}
25+
}
26+
27+
@Scheduled(initialDelay= TEN_SECONDS * 2, fixedRate = FIVE_MINUTES)
1928
public void fetchTweetsFromTwitterSearch() {
2029
String msg = "fetch Tweets From TwitterSearch ";
21-
if((schedulerProperties.getAllowUpdateTweets()) && (!schedulerProperties.getSkipFortesting())) {
30+
if((schedulerProperties.getAllowFetchTweetsFromTwitterSearch()) && (!schedulerProperties.getSkipFortesting())) {
2231
Task task = asyncStartTask.fetchTweetsFromSearch();
2332
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
2433
}
2534
}
2635

27-
@Scheduled(initialDelay= TEN_SECONDS *2, fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_USER_LIST)
36+
@Scheduled(initialDelay= TEN_SECONDS * 3, fixedRate = TWELVE_HOURS)
2837
public void fetchUsersFromDefinedUserList(){
2938
String msg = "fetch Users from Defined User List ";
30-
if((schedulerProperties.getFetchUserListAllow()) && (!schedulerProperties.getSkipFortesting())) {
39+
if((schedulerProperties.getFetchUsersFromDefinedUserListAllow()) && (!schedulerProperties.getSkipFortesting())) {
3140
Task task = asyncStartTask.fetchUsersFromList();
3241
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
3342
}
3443
}
3544

36-
@Scheduled(initialDelay= TEN_SECONDS *3, fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_FOLLOWER)
45+
@Scheduled(initialDelay= TEN_SECONDS * 4, fixedRate = TWELVE_HOURS)
46+
public void getHomeTimeline() {
47+
String msg = "get Home Timeline Tweets ";
48+
if((schedulerProperties.getAllowGetHomeTimeline()) && (!schedulerProperties.getSkipFortesting())) {
49+
Task task = asyncStartTask.getHomeTimeline();
50+
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
51+
}
52+
}
53+
54+
@Scheduled(initialDelay= TEN_SECONDS * 5, fixedRate = TWELVE_HOURS)
55+
public void getUserTimeline() {
56+
String msg = " get User Timeline Tweets ";
57+
if((schedulerProperties.getAllowGetUserTimeline()) && (!schedulerProperties.getSkipFortesting())) {
58+
Task task = asyncStartTask.getUserTimeline();
59+
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
60+
}
61+
}
62+
63+
@Scheduled(initialDelay= TEN_SECONDS * 6, fixedRate = TWELVE_HOURS)
64+
public void getMentions() {
65+
String msg = " get Mentions ";
66+
if((schedulerProperties.getAllowGetMentions()) && (!schedulerProperties.getSkipFortesting())) {
67+
Task task = asyncStartTask.getMentions();
68+
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
69+
}
70+
}
71+
72+
@Scheduled(initialDelay= TEN_SECONDS * 7, fixedRate = TWELVE_HOURS)
73+
public void getFavorites() {
74+
String msg = " get Favorites ";
75+
if((schedulerProperties.getAllowGetFavorites()) && (!schedulerProperties.getSkipFortesting())) {
76+
Task task = asyncStartTask.getFavorites();
77+
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
78+
}
79+
}
80+
81+
@Scheduled(initialDelay= TEN_SECONDS * 8, fixedRate = TWELVE_HOURS)
82+
public void getRetweetsOfMe() {
83+
String msg = " get Retweets Of Me ";
84+
if((schedulerProperties.getAllowGetRetweetsOfMe()) && (!schedulerProperties.getSkipFortesting())) {
85+
Task task = asyncStartTask.getRetweetsOfMe();
86+
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
87+
}
88+
}
89+
90+
@Scheduled(initialDelay= TEN_SECONDS * 9, fixedRate = TWELVE_HOURS)
91+
public void getLists() {
92+
String msg = " get Lists ";
93+
if((schedulerProperties.getAllowGetLists()) && (!schedulerProperties.getSkipFortesting())) {
94+
Task task = asyncStartTask.getLists();
95+
log.info(msg+ "SCHEDULED: task "+task.getUniqueId());
96+
}
97+
}
98+
99+
@Scheduled(initialDelay= TEN_SECONDS * 10, fixedRate = ONE_DAY)
37100
public void fetchFollower(){
38101
String msg = "fetch Follower ";
39102
if((schedulerProperties.getFetchFollowerAllow()) && (!schedulerProperties.getSkipFortesting())) {
@@ -42,7 +105,7 @@ public void fetchFollower(){
42105
}
43106
}
44107

45-
@Scheduled(initialDelay= TEN_SECONDS *4, fixedRate = FIXED_RATE_FOR_SCHEDULAR_FETCH_FRIENDS)
108+
@Scheduled(initialDelay= TEN_SECONDS * 11, fixedRate = ONE_DAY)
46109
public void fetchFriends(){
47110
String msg = "fetch Friends ";
48111
if((schedulerProperties.getFetchFriendsAllow()) && (!schedulerProperties.getSkipFortesting())) {
@@ -51,7 +114,7 @@ public void fetchFriends(){
51114
}
52115
}
53116

54-
@Scheduled(initialDelay= TEN_SECONDS *5, fixedRate = FIXED_RATE_FOR_SCHEDULAR_REMOVE_OLD_DATA_FROM_STORAGE)
117+
@Scheduled(initialDelay= TEN_SECONDS * 12, fixedRate = ONE_HOUR)
55118
public void removeOldDataFromStorage(){
56119
String msg = "remove Old Data From Storage: ";
57120
if((schedulerProperties.getRemoveOldDataFromStorageAllow()) && (!schedulerProperties.getSkipFortesting())) {
@@ -60,7 +123,7 @@ public void removeOldDataFromStorage(){
60123
}
61124
}
62125

63-
@Scheduled(initialDelay= TEN_SECONDS *6, fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER_BY_MENTION)
126+
@Scheduled(initialDelay= TEN_SECONDS * 13, fixedRate = ONE_HOUR)
64127
public void updateUserProfilesFromMentions(){
65128
String msg = "update User Profiles From Mentions";
66129
if((schedulerProperties.getAllowUpdateUserProfilesFromMention()) && (!schedulerProperties.getSkipFortesting())) {
@@ -69,7 +132,7 @@ public void updateUserProfilesFromMentions(){
69132
}
70133
}
71134

72-
@Scheduled(initialDelay= TEN_SECONDS *7, fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_TWEETS)
135+
@Scheduled(initialDelay= TEN_SECONDS * 14, fixedRate = ONE_DAY)
73136
public void updateTweets() {
74137
String msg = "update Tweets ";
75138
if((schedulerProperties.getAllowUpdateTweets()) && (!schedulerProperties.getSkipFortesting())){
@@ -78,7 +141,7 @@ public void updateTweets() {
78141
}
79142
}
80143

81-
@Scheduled(initialDelay= TEN_SECONDS *8, fixedRate = FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER)
144+
@Scheduled(initialDelay= TEN_SECONDS * 15, fixedRate = ONE_DAY)
82145
public void updateUserProfiles() {
83146
String msg = "update User Profiles ";
84147
if((schedulerProperties.getAllowUpdateUserProfiles()) && (!schedulerProperties.getSkipFortesting())) {
@@ -97,25 +160,13 @@ public ScheduledTasks(SchedulerProperties schedulerProperties, AsyncStartTask mq
97160

98161
public final static long ONE_MINUTE = 60 * 1000;
99162

163+
public final static long FIVE_MINUTES = 5 * ONE_MINUTE;
164+
100165
public final static long ONE_HOUR = 60 * ONE_MINUTE;
101166

102167
public final static long TWELVE_HOURS = 12 * ONE_HOUR;
103168

104-
private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_TWEETS = ONE_HOUR;
105-
106-
private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER = TWELVE_HOURS;
107-
108-
private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_FOLLOWER = TWELVE_HOURS;
109-
110-
private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_FRIENDS = TWELVE_HOURS;
111-
112-
private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_TWEETS = TWELVE_HOURS;
113-
114-
private final static long FIXED_RATE_FOR_SCHEDULAR_UPDATE_USER_BY_MENTION = ONE_HOUR;
115-
116-
private final static long FIXED_RATE_FOR_SCHEDULAR_FETCH_USER_LIST = TWELVE_HOURS;
117-
118-
private final static long FIXED_RATE_FOR_SCHEDULAR_REMOVE_OLD_DATA_FROM_STORAGE = ONE_HOUR;
169+
public final static long ONE_DAY = 24 * ONE_HOUR;
119170

120171
private static final Logger log = LoggerFactory.getLogger(ScheduledTasks.class);
121172

src/main/java/org/woehlke/twitterwall/conf/properties/SchedulerProperties.java

Lines changed: 76 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public class SchedulerProperties {
3131
private Boolean skipFortesting;
3232

3333
@NotNull
34-
private Boolean fetchUserListAllow;
34+
private Boolean fetchUsersFromDefinedUserListAllow;
3535

3636
@NotNull
37-
private String fetchUserListName;
37+
private String fetchUsersFromDefinedUserListName;
3838

3939
@NotNull
4040
private Boolean removeOldDataFromStorageAllow;
@@ -45,6 +45,24 @@ public class SchedulerProperties {
4545
@NotNull
4646
private Boolean fetchFriendsAllow;
4747

48+
@NotNull
49+
private Boolean allowGetHomeTimeline;
50+
51+
@NotNull
52+
private Boolean allowGetUserTimeline;
53+
54+
@NotNull
55+
private Boolean allowGetMentions;
56+
57+
@NotNull
58+
private Boolean allowGetFavorites;
59+
60+
@NotNull
61+
private Boolean allowGetRetweetsOfMe;
62+
63+
@NotNull
64+
private Boolean allowGetLists;
65+
4866
public Boolean getAllowFetchTweetsFromTwitterSearch() {
4967
return allowFetchTweetsFromTwitterSearch;
5068
}
@@ -93,20 +111,20 @@ public void setSkipFortesting(Boolean skipFortesting) {
93111
this.skipFortesting = skipFortesting;
94112
}
95113

96-
public Boolean getFetchUserListAllow() {
97-
return fetchUserListAllow;
114+
public Boolean getFetchUsersFromDefinedUserListAllow() {
115+
return fetchUsersFromDefinedUserListAllow;
98116
}
99117

100-
public void setFetchUserListAllow(Boolean fetchUserListAllow) {
101-
this.fetchUserListAllow = fetchUserListAllow;
118+
public void setFetchUsersFromDefinedUserListAllow(Boolean fetchUsersFromDefinedUserListAllow) {
119+
this.fetchUsersFromDefinedUserListAllow = fetchUsersFromDefinedUserListAllow;
102120
}
103121

104-
public String getFetchUserListName() {
105-
return fetchUserListName;
122+
public String getFetchUsersFromDefinedUserListName() {
123+
return fetchUsersFromDefinedUserListName;
106124
}
107125

108-
public void setFetchUserListName(String fetchUserListName) {
109-
this.fetchUserListName = fetchUserListName;
126+
public void setFetchUsersFromDefinedUserListName(String fetchUsersFromDefinedUserListName) {
127+
this.fetchUsersFromDefinedUserListName = fetchUsersFromDefinedUserListName;
110128
}
111129

112130
public Boolean getRemoveOldDataFromStorageAllow() {
@@ -132,4 +150,52 @@ public void setFetchFriendsAllow(Boolean fetchFriendsAllow) {
132150
public Boolean getFetchFriendsAllow() {
133151
return fetchFriendsAllow;
134152
}
153+
154+
public Boolean getAllowGetHomeTimeline() {
155+
return allowGetHomeTimeline;
156+
}
157+
158+
public void setAllowGetHomeTimeline(Boolean allowGetHomeTimeline) {
159+
this.allowGetHomeTimeline = allowGetHomeTimeline;
160+
}
161+
162+
public Boolean getAllowGetUserTimeline() {
163+
return allowGetUserTimeline;
164+
}
165+
166+
public void setAllowGetUserTimeline(Boolean allowGetUserTimeline) {
167+
this.allowGetUserTimeline = allowGetUserTimeline;
168+
}
169+
170+
public Boolean getAllowGetMentions() {
171+
return allowGetMentions;
172+
}
173+
174+
public void setAllowGetMentions(Boolean allowGetMentions) {
175+
this.allowGetMentions = allowGetMentions;
176+
}
177+
178+
public Boolean getAllowGetFavorites() {
179+
return allowGetFavorites;
180+
}
181+
182+
public void setAllowGetFavorites(Boolean allowGetFavorites) {
183+
this.allowGetFavorites = allowGetFavorites;
184+
}
185+
186+
public Boolean getAllowGetRetweetsOfMe() {
187+
return allowGetRetweetsOfMe;
188+
}
189+
190+
public void setAllowGetRetweetsOfMe(Boolean allowGetRetweetsOfMe) {
191+
this.allowGetRetweetsOfMe = allowGetRetweetsOfMe;
192+
}
193+
194+
public Boolean getAllowGetLists() {
195+
return allowGetLists;
196+
}
197+
198+
public void setAllowGetLists(Boolean allowGetLists) {
199+
this.allowGetLists = allowGetLists;
200+
}
135201
}

src/main/java/org/woehlke/twitterwall/frontend/controller/ApplicationController.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import org.woehlke.twitterwall.conf.properties.TwitterProperties;
88
import org.woehlke.twitterwall.frontend.controller.common.Symbols;
99
import org.woehlke.twitterwall.frontend.controller.common.ControllerHelper;
10-
import org.woehlke.twitterwall.oodm.entities.parts.CountedEntities;
11-
import org.woehlke.twitterwall.oodm.service.CountedEntitiesService;
1210

1311
/**
1412
* Created by tw on 03.07.17.
@@ -17,18 +15,6 @@
1715
@RequestMapping(path="/application")
1816
public class ApplicationController {
1917

20-
@RequestMapping(path="/domain/count")
21-
public String domainCount(Model model) {
22-
String msg = "/application/domain/count: ";
23-
String title = "Counted Entities";
24-
String subtitle = twitterProperties.getSearchQuery();
25-
String symbol = Symbols.DATABASE.toString();
26-
model = controllerHelper.setupPage(model,title,subtitle,symbol);
27-
CountedEntities countedEntities =this.countedEntitiesService.countAll();
28-
model.addAttribute("countedEntities", countedEntities);
29-
return "application/domain/count";
30-
}
31-
3218
@RequestMapping(path="/management")
3319
public String managementPage(Model model) {
3420
String msg = "/application/domain/count: ";
@@ -39,30 +25,14 @@ public String managementPage(Model model) {
3925
return "application/management";
4026
}
4127

42-
@RequestMapping(path="/domain/delete/all")
43-
public String domainDeleteAll(Model model) {
44-
String msg = "/application/domain/delete/all: ";
45-
String title = "Counted Entities";
46-
String subtitle = twitterProperties.getSearchQuery();
47-
String symbol = Symbols.DATABASE.toString();
48-
model = controllerHelper.setupPage(model,title,subtitle,symbol);
49-
CountedEntities countedEntities =this.countedEntitiesService.deleteAll();
50-
model.addAttribute("countedEntities", countedEntities);
51-
return "application/domain/count";
52-
}
53-
54-
private final CountedEntitiesService countedEntitiesService;
55-
5628
private final ControllerHelper controllerHelper;
5729

5830
private final TwitterProperties twitterProperties;
5931

6032
@Autowired
6133
public ApplicationController(
62-
CountedEntitiesService countedEntitiesService,
6334
ControllerHelper controllerHelper,
6435
TwitterProperties twitterProperties) {
65-
this.countedEntitiesService = countedEntitiesService;
6636
this.controllerHelper = controllerHelper;
6737
this.twitterProperties = twitterProperties;
6838
}

0 commit comments

Comments
 (0)